@sproutsocial/seeds-react-icon 2.4.2 → 2.4.4
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 +154 -44
- package/dist/esm/index.js.map +1 -1
- package/dist/icon.css +36 -0
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +166 -56
- package/dist/index.js.map +1 -1
- package/package.json +9 -8
package/dist/esm/index.js
CHANGED
|
@@ -6,9 +6,13 @@ import {
|
|
|
6
6
|
import "react";
|
|
7
7
|
import styled2, { css as css2 } from "styled-components";
|
|
8
8
|
import Box from "@sproutsocial/seeds-react-box";
|
|
9
|
+
|
|
10
|
+
// src/IconHybrid.tsx
|
|
11
|
+
import "react";
|
|
9
12
|
import PartnerLogo from "@sproutsocial/seeds-react-partner-logo";
|
|
10
|
-
import { includes } from "@sproutsocial/seeds-react-utilities";
|
|
13
|
+
import { includes as includes2 } from "@sproutsocial/seeds-react-utilities";
|
|
11
14
|
import { LogoNamesWithoutVariants as PartnerLogoNames } from "@sproutsocial/seeds-partner-logos";
|
|
15
|
+
import { needsStyledComponents } from "@sproutsocial/seeds-react-system-props";
|
|
12
16
|
|
|
13
17
|
// src/styles.ts
|
|
14
18
|
import styled, { css } from "styled-components";
|
|
@@ -53,7 +57,65 @@ var Container = styled.span.attrs({
|
|
|
53
57
|
`;
|
|
54
58
|
var styles_default = Container;
|
|
55
59
|
|
|
56
|
-
// src/
|
|
60
|
+
// src/IconTailwind.tsx
|
|
61
|
+
import "react";
|
|
62
|
+
import { jsx } from "react/jsx-runtime";
|
|
63
|
+
function cn(...inputs) {
|
|
64
|
+
const classes = [];
|
|
65
|
+
for (const input of inputs) {
|
|
66
|
+
if (!input) continue;
|
|
67
|
+
if (typeof input === "string") {
|
|
68
|
+
classes.push(input);
|
|
69
|
+
} else if (typeof input === "object") {
|
|
70
|
+
for (const [key, value] of Object.entries(input)) {
|
|
71
|
+
if (value) {
|
|
72
|
+
classes.push(key);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return classes.join(" ");
|
|
78
|
+
}
|
|
79
|
+
var sizeMap = {
|
|
80
|
+
mini: "12px",
|
|
81
|
+
/** TODO: deprecate default in favor of small in future release */
|
|
82
|
+
default: "16px",
|
|
83
|
+
small: "16px",
|
|
84
|
+
medium: "24px",
|
|
85
|
+
large: "32px",
|
|
86
|
+
jumbo: "64px"
|
|
87
|
+
};
|
|
88
|
+
var IconTailwind = ({
|
|
89
|
+
size,
|
|
90
|
+
fixedWidth,
|
|
91
|
+
className,
|
|
92
|
+
children,
|
|
93
|
+
...rest
|
|
94
|
+
}) => {
|
|
95
|
+
const classes = cn(
|
|
96
|
+
"Icon",
|
|
97
|
+
"seeds-icon",
|
|
98
|
+
{ "seeds-icon-fixed-width": fixedWidth },
|
|
99
|
+
className
|
|
100
|
+
);
|
|
101
|
+
return /* @__PURE__ */ jsx(
|
|
102
|
+
"span",
|
|
103
|
+
{
|
|
104
|
+
...rest,
|
|
105
|
+
className: classes,
|
|
106
|
+
style: {
|
|
107
|
+
...rest.style,
|
|
108
|
+
"--icon-size": sizeMap[size]
|
|
109
|
+
},
|
|
110
|
+
children
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
IconTailwind.displayName = "IconTailwind";
|
|
115
|
+
|
|
116
|
+
// src/iconShared.tsx
|
|
117
|
+
import "react";
|
|
118
|
+
import { includes } from "@sproutsocial/seeds-react-utilities";
|
|
57
119
|
import {
|
|
58
120
|
AiViewBoxes,
|
|
59
121
|
ExternalViewBoxes,
|
|
@@ -61,14 +123,57 @@ import {
|
|
|
61
123
|
SproutViewBoxes,
|
|
62
124
|
ExternalIconNames
|
|
63
125
|
} from "@sproutsocial/seeds-icons";
|
|
64
|
-
import { jsx
|
|
126
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
65
127
|
var AllViewboxes = {
|
|
66
128
|
...AiViewBoxes,
|
|
67
129
|
...ExternalViewBoxes,
|
|
68
130
|
...GeneralViewBoxes,
|
|
69
131
|
...SproutViewBoxes
|
|
70
132
|
};
|
|
71
|
-
|
|
133
|
+
function resolveIconName(name, size) {
|
|
134
|
+
const defaultVariant = size === "mini" ? "solid" : "outline";
|
|
135
|
+
return !name?.endsWith("-outline") && !name?.endsWith("-solid") && !includes(ExternalIconNames, name) ? (
|
|
136
|
+
// then add default variant
|
|
137
|
+
`${name}-${defaultVariant}`
|
|
138
|
+
) : (
|
|
139
|
+
// else use name as is
|
|
140
|
+
name
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
function getAriaProps(ariaLabel, ariaLabelFromRest) {
|
|
144
|
+
const hasAriaLabel = !!ariaLabel || !!ariaLabelFromRest;
|
|
145
|
+
const containerAriaProps = hasAriaLabel ? {} : { "aria-hidden": "true" };
|
|
146
|
+
const svgAriaProps = hasAriaLabel ? { role: "img", "aria-label": ariaLabel ?? ariaLabelFromRest } : {};
|
|
147
|
+
return { containerAriaProps, svgAriaProps };
|
|
148
|
+
}
|
|
149
|
+
var IconSvg = ({
|
|
150
|
+
iconName,
|
|
151
|
+
iconViewBox,
|
|
152
|
+
svgProps,
|
|
153
|
+
svgAriaProps
|
|
154
|
+
}) => /* @__PURE__ */ jsx2(
|
|
155
|
+
"svg",
|
|
156
|
+
{
|
|
157
|
+
className: "Icon-svg",
|
|
158
|
+
viewBox: iconViewBox,
|
|
159
|
+
focusable: false,
|
|
160
|
+
"data-qa-icon-svg": `${iconName}-svg`,
|
|
161
|
+
...svgProps,
|
|
162
|
+
...svgAriaProps,
|
|
163
|
+
children: /* @__PURE__ */ jsx2(
|
|
164
|
+
"use",
|
|
165
|
+
{
|
|
166
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
167
|
+
xlinkHref: `#seeds-svgs_${iconName}`
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
// src/IconHybrid.tsx
|
|
174
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
175
|
+
var SC_CLASS_PATTERN = /\bsc-[a-zA-Z0-9]+\b/;
|
|
176
|
+
var IconHybrid = ({
|
|
72
177
|
name,
|
|
73
178
|
size = "small",
|
|
74
179
|
fixedWidth = false,
|
|
@@ -77,7 +182,7 @@ var Icon = ({
|
|
|
77
182
|
svgProps,
|
|
78
183
|
...rest
|
|
79
184
|
}) => {
|
|
80
|
-
if (
|
|
185
|
+
if (includes2(PartnerLogoNames, name)) {
|
|
81
186
|
const logoSize = size === "default" ? "small" : size;
|
|
82
187
|
const logoProps = {
|
|
83
188
|
partnerName: name,
|
|
@@ -85,7 +190,7 @@ var Icon = ({
|
|
|
85
190
|
logoType: "symbol",
|
|
86
191
|
svgProps
|
|
87
192
|
};
|
|
88
|
-
return /* @__PURE__ */
|
|
193
|
+
return /* @__PURE__ */ jsx3(
|
|
89
194
|
PartnerLogo,
|
|
90
195
|
{
|
|
91
196
|
"aria-label": ariaLabel,
|
|
@@ -94,53 +199,58 @@ var Icon = ({
|
|
|
94
199
|
}
|
|
95
200
|
);
|
|
96
201
|
}
|
|
97
|
-
const
|
|
98
|
-
const iconName = (
|
|
99
|
-
// if not external and has no variant
|
|
100
|
-
!name?.endsWith("-outline") && !name?.endsWith("-solid") && !includes(ExternalIconNames, name) ? (
|
|
101
|
-
// then add default variant
|
|
102
|
-
`${name}-${defaultVariant}`
|
|
103
|
-
) : (
|
|
104
|
-
// else use name as is
|
|
105
|
-
name
|
|
106
|
-
)
|
|
107
|
-
);
|
|
202
|
+
const iconName = resolveIconName(name, size);
|
|
108
203
|
const iconViewBox = AllViewboxes[iconName];
|
|
109
204
|
const { "aria-label": ariaLabelFromRest, ...restWithoutAriaLabel } = rest;
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
205
|
+
const { containerAriaProps, svgAriaProps } = getAriaProps(
|
|
206
|
+
ariaLabel,
|
|
207
|
+
ariaLabelFromRest
|
|
208
|
+
);
|
|
209
|
+
const svg = /* @__PURE__ */ jsx3(
|
|
210
|
+
IconSvg,
|
|
115
211
|
{
|
|
116
|
-
|
|
212
|
+
iconName,
|
|
213
|
+
iconViewBox,
|
|
214
|
+
svgProps,
|
|
215
|
+
svgAriaProps
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
const className = restWithoutAriaLabel.className;
|
|
219
|
+
const needsSC = color !== void 0 || restWithoutAriaLabel.cursor !== void 0 || needsStyledComponents(restWithoutAriaLabel) || typeof className === "string" && SC_CLASS_PATTERN.test(className);
|
|
220
|
+
if (needsSC) {
|
|
221
|
+
return /* @__PURE__ */ jsx3(
|
|
222
|
+
styles_default,
|
|
223
|
+
{
|
|
224
|
+
iconSize: size,
|
|
225
|
+
fixedWidth: !!fixedWidth,
|
|
226
|
+
"data-qa-icon": iconName,
|
|
227
|
+
color,
|
|
228
|
+
...restWithoutAriaLabel,
|
|
229
|
+
...containerAriaProps,
|
|
230
|
+
children: svg
|
|
231
|
+
},
|
|
232
|
+
iconName
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
return /* @__PURE__ */ jsx3(
|
|
236
|
+
IconTailwind,
|
|
237
|
+
{
|
|
238
|
+
size,
|
|
117
239
|
fixedWidth: !!fixedWidth,
|
|
118
240
|
"data-qa-icon": iconName,
|
|
119
|
-
color,
|
|
120
241
|
...restWithoutAriaLabel,
|
|
121
242
|
...containerAriaProps,
|
|
122
|
-
children:
|
|
123
|
-
"svg",
|
|
124
|
-
{
|
|
125
|
-
className: "Icon-svg",
|
|
126
|
-
viewBox: iconViewBox,
|
|
127
|
-
focusable: false,
|
|
128
|
-
"data-qa-icon-svg": `${iconName}-svg`,
|
|
129
|
-
...svgProps,
|
|
130
|
-
...svgAriaProps,
|
|
131
|
-
children: /* @__PURE__ */ jsx(
|
|
132
|
-
"use",
|
|
133
|
-
{
|
|
134
|
-
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
135
|
-
xlinkHref: `#seeds-svgs_${iconName}`
|
|
136
|
-
}
|
|
137
|
-
)
|
|
138
|
-
}
|
|
139
|
-
)
|
|
243
|
+
children: svg
|
|
140
244
|
},
|
|
141
245
|
iconName
|
|
142
246
|
);
|
|
143
247
|
};
|
|
248
|
+
IconHybrid.displayName = "Icon";
|
|
249
|
+
var IconHybrid_default = IconHybrid;
|
|
250
|
+
|
|
251
|
+
// src/Icon.tsx
|
|
252
|
+
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
253
|
+
var Icon = (props) => /* @__PURE__ */ jsx4(IconHybrid_default, { ...props });
|
|
144
254
|
var ToggleableIcon = styled2(Icon)`
|
|
145
255
|
transition: all ${(p) => p.theme.duration.fast} linear;
|
|
146
256
|
|
|
@@ -165,7 +275,7 @@ var IconToggle = ({
|
|
|
165
275
|
...rest
|
|
166
276
|
}) => {
|
|
167
277
|
return /* @__PURE__ */ jsxs(Box, { as: "span", position: "relative", display: "inline-flex", ...rest, children: [
|
|
168
|
-
/* @__PURE__ */
|
|
278
|
+
/* @__PURE__ */ jsx4(
|
|
169
279
|
ToggleableIcon,
|
|
170
280
|
{
|
|
171
281
|
active: isActive,
|
|
@@ -176,7 +286,7 @@ var IconToggle = ({
|
|
|
176
286
|
"aria-label": !isActive ? void 0 : ariaLabel
|
|
177
287
|
}
|
|
178
288
|
),
|
|
179
|
-
/* @__PURE__ */
|
|
289
|
+
/* @__PURE__ */ jsx4(
|
|
180
290
|
ToggleableIcon,
|
|
181
291
|
{
|
|
182
292
|
active: !isActive,
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Icon.tsx","../../src/styles.ts","../../src/IconTypes.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport styled, { css } from \"styled-components\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport PartnerLogo from \"@sproutsocial/seeds-react-partner-logo\";\nimport { includes } from \"@sproutsocial/seeds-react-utilities\";\nimport { LogoNamesWithoutVariants as PartnerLogoNames } from \"@sproutsocial/seeds-partner-logos\";\n\nimport type { TypeIconProps, TypeToggleProps } from \"./IconTypes\";\nimport Container from \"./styles\";\nimport {\n AiViewBoxes,\n ExternalViewBoxes,\n GeneralViewBoxes,\n SproutViewBoxes,\n ExternalIconNames,\n type EnumIconSvgNames,\n type EnumIconNamesWithoutVariants,\n} from \"@sproutsocial/seeds-icons\";\n\nconst AllViewboxes = {\n ...AiViewBoxes,\n ...ExternalViewBoxes,\n ...GeneralViewBoxes,\n ...SproutViewBoxes,\n};\n\nconst Icon = ({\n name,\n size = \"small\",\n fixedWidth = false,\n ariaLabel,\n color,\n svgProps,\n ...rest\n}: TypeIconProps) => {\n if (includes(PartnerLogoNames, name)) {\n // Icon's \"default\" size is equivalent to PartnerLogo's \"small\" size\n const logoSize = size === \"default\" ? \"small\" : size;\n const logoProps = {\n partnerName: name,\n size: logoSize,\n logoType: \"symbol\" as const,\n svgProps,\n };\n return (\n <PartnerLogo\n // ariaLabel needs to be overridable by aria-label prop in ...rest\n aria-label={ariaLabel}\n {...rest}\n {...logoProps}\n />\n );\n }\n\n const defaultVariant = size === \"mini\" ? \"solid\" : \"outline\";\n\n const iconName: EnumIconSvgNames =\n // if not external and has no variant\n !name?.endsWith(\"-outline\") &&\n !name?.endsWith(\"-solid\") &&\n !includes(ExternalIconNames, name)\n ? // then add default variant\n `${name as EnumIconNamesWithoutVariants}-${defaultVariant}`\n : // else use name as is\n (name as EnumIconSvgNames);\n\n const iconViewBox = AllViewboxes[iconName];\n\n const { \"aria-label\": ariaLabelFromRest, ...restWithoutAriaLabel } = rest;\n const hasAriaLabel = !!ariaLabel || !!ariaLabelFromRest;\n const containerAriaProps = hasAriaLabel ? {} : { \"aria-hidden\": \"true\" };\n const svgAriaProps = hasAriaLabel\n ? { role: \"img\", \"aria-label\": ariaLabel ?? ariaLabelFromRest }\n : {};\n\n return (\n <Container\n iconSize={size}\n fixedWidth={!!fixedWidth}\n key={iconName}\n data-qa-icon={iconName}\n color={color}\n {...restWithoutAriaLabel}\n {...containerAriaProps}\n >\n <svg\n className=\"Icon-svg\"\n viewBox={iconViewBox}\n focusable={false}\n data-qa-icon-svg={`${iconName}-svg`}\n {...svgProps}\n {...svgAriaProps}\n >\n <use\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n xlinkHref={`#seeds-svgs_${iconName}`}\n />\n </svg>\n </Container>\n );\n};\n\nconst ToggleableIcon = styled(Icon)<{ active: boolean }>`\n transition: all ${(p) => p.theme.duration.fast} linear;\n\n ${(p) =>\n p.active &&\n css`\n opacity: 1;\n transform: scale(1);\n `}\n\n ${(p) =>\n !p.active &&\n css`\n position: absolute;\n opacity: 0;\n transform: scale(0);\n `}\n`;\n\nconst IconToggle = ({\n activeName,\n inactiveName,\n isActive,\n size = \"small\",\n fixedWidth = false,\n ariaLabel,\n ...rest\n}: TypeToggleProps) => {\n return (\n <Box as=\"span\" position=\"relative\" display=\"inline-flex\" {...rest}>\n <ToggleableIcon\n active={isActive}\n name={activeName}\n size={size}\n fixedWidth={fixedWidth}\n aria-hidden={!isActive}\n aria-label={!isActive ? undefined : ariaLabel}\n />\n <ToggleableIcon\n active={!isActive}\n name={inactiveName}\n size={size}\n fixedWidth={fixedWidth}\n aria-hidden={isActive}\n aria-label={isActive ? ariaLabel : undefined}\n />\n </Box>\n );\n};\n\nIconToggle.displayName = \"Icon.Toggle\";\n/**\n * **Accessibility note:** It is best practice to wrap `<Icon.Toggle />` in a button. The button must include `aria-label` and `aria-pressed` in order for a screen reader to properly communicate the icon's state. See example below.\n *\n * @link https://www.w3.org/TR/wai-aria-practices-1.1/#button\n * @example\n * const [toggleState, setToggleState] = useState(false);\n * <Button // Wrap Icon.Toggle with Button\n * appearance='pill'\n * aria-label='like' // required for accessibility\n * aria-pressed={toggleState} // required for accessibility\n * onClick={() => setToggleState(!toggleState)}\n * >\n * <Icon.Toggle\n * activeName=\"heart-solid\"\n * inactiveName=\"heart-outline\"\n * isActive={toggleState}\n * />\n * </Button>\n */\nIcon.Toggle = IconToggle;\n\nexport default Icon;\n","import styled, { css } from \"styled-components\";\nimport { verticalAlign } from \"styled-system\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeIconSize } from \"./IconTypes\";\n\nconst sizes: { [key in TypeIconSize]: string } = {\n mini: \"12px\",\n\n /** TODO: deprecate default in favor of small in future release */\n default: \"16px\",\n small: \"16px\",\n medium: \"24px\",\n large: \"32px\",\n jumbo: \"64px\",\n};\n\nconst stylesForSize = (iconActualSize: string, fixedWidth: boolean) => css`\n line-height: ${iconActualSize};\n\n &,\n .Icon-svg {\n height: ${iconActualSize};\n fill: currentColor;\n }\n\n ${fixedWidth &&\n `\n &,\n & .Icon-svg {\n width: ${iconActualSize}\n }\n `}\n`;\n\nconst Container = styled.span.attrs({\n className: \"Icon\",\n})<{\n iconSize: TypeIconSize;\n fixedWidth: boolean;\n}>`\n display: inline-block;\n color: inherit;\n vertical-align: middle;\n\n ${(props) => stylesForSize(sizes[props.iconSize], props.fixedWidth)}\n\n ${COMMON}\n ${verticalAlign}\n`;\nexport default Container;\n","import * as React from \"react\";\nimport type { EnumIconNames } from \"@sproutsocial/seeds-icons\";\nimport type { EnumLogoNamesWithoutVariants } from \"@sproutsocial/seeds-partner-logos\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\n\nexport type TypeIconName = EnumIconNames | EnumLogoNamesWithoutVariants;\n\nexport type TypeIconSize =\n | \"mini\" // 12x12\n // TODO: deprecate default in favor of small in future release\n | \"default\" // 16x16\n | \"small\" // 16x16\n | \"medium\" // 24x24\n | \"large\" // 32x32\n | \"jumbo\"; // 64x64\n\nexport interface TypeIconProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<React.ComponentPropsWithoutRef<\"span\">, \"color\"> {\n /** Name of the icon in the svg sprite */\n name: TypeIconName;\n size?: TypeIconSize;\n /** Whether the icon should have a fixed width or not. Use this when you need to align icons/text vertically in a list. */\n fixedWidth?: boolean;\n /** Label used to describe the icon if not used with an accompanying visual label */\n ariaLabel?: string;\n svgProps?: React.ComponentPropsWithoutRef<\"svg\">;\n}\n\nexport interface TypeToggleProps extends TypeBoxProps {\n /** Name of the icon to be shown in the active state */\n activeName: TypeIconName;\n /** Name of the icon to be shown in the inactive state */\n inactiveName: TypeIconName;\n /** Whether the active icon should be shown or not */\n isActive: boolean;\n /** The size of the icon. `small` is the default */\n size?: TypeIconSize;\n fixedWidth?: boolean;\n ariaLabel?: string;\n}\n","import Icon from \"./Icon\";\n\nexport default Icon;\nexport { Icon };\nexport { default as IconContainer } from \"./styles\";\nexport * from \"./IconTypes\";\n\n// Icon v2 exports (structural SVG wrapper; distinct API from v1)\nexport { default as IconV2 } from \"./v2\";\nexport type { TypeIconV2Props, TypeIconV2Size } from \"./v2\";\n"],"mappings":";;;;;AAAA,OAAuB;AACvB,OAAOA,WAAU,OAAAC,YAAW;AAC5B,OAAO,SAAS;AAChB,OAAO,iBAAiB;AACxB,SAAS,gBAAgB;AACzB,SAAS,4BAA4B,wBAAwB;;;ACL7D,OAAO,UAAU,WAAW;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AAGvB,IAAM,QAA2C;AAAA,EAC/C,MAAM;AAAA;AAAA,EAGN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AACT;AAEA,IAAM,gBAAgB,CAAC,gBAAwB,eAAwB;AAAA,iBACtD,cAAc;AAAA;AAAA;AAAA;AAAA,cAIjB,cAAc;AAAA;AAAA;AAAA;AAAA,IAIxB,cACF;AAAA;AAAA;AAAA,eAGa,cAAc;AAAA;AAAA,GAE1B;AAAA;AAGH,IAAM,YAAY,OAAO,KAAK,MAAM;AAAA,EAClC,W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AAAA,IACrC;AAAA,KACF;AAEJ;AAEA,WAAW,cAAc;AAoBzB,KAAK,SAAS;AAEd,IAAOC,gBAAQ;;;AE9Kf,OAAuB;;;ACEvB,IAAO,cAAQC;","names":["styled","css","styled","css","Icon_default","Icon_default"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Icon.tsx","../../src/IconHybrid.tsx","../../src/styles.ts","../../src/IconTailwind.tsx","../../src/iconShared.tsx","../../src/IconTypes.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport styled, { css } from \"styled-components\";\nimport Box from \"@sproutsocial/seeds-react-box\";\n\nimport type { TypeIconProps, TypeToggleProps } from \"./IconTypes\";\nimport IconHybrid from \"./IconHybrid\";\n\n/**\n * Icon. Automatically routes between the Tailwind implementation (preferred, for\n * bare icons) and the styled-components implementation (for consumers using\n * `color` tokens, system props, or a styled() extension). The routing logic and\n * shared name/variant/aria/svg handling live in IconHybrid / iconShared.\n */\nconst Icon = (props: TypeIconProps) => <IconHybrid {...props} />;\n\nconst ToggleableIcon = styled(Icon)<{ active: boolean }>`\n transition: all ${(p) => p.theme.duration.fast} linear;\n\n ${(p) =>\n p.active &&\n css`\n opacity: 1;\n transform: scale(1);\n `}\n\n ${(p) =>\n !p.active &&\n css`\n position: absolute;\n opacity: 0;\n transform: scale(0);\n `}\n`;\n\nconst IconToggle = ({\n activeName,\n inactiveName,\n isActive,\n size = \"small\",\n fixedWidth = false,\n ariaLabel,\n ...rest\n}: TypeToggleProps) => {\n return (\n <Box as=\"span\" position=\"relative\" display=\"inline-flex\" {...rest}>\n <ToggleableIcon\n active={isActive}\n name={activeName}\n size={size}\n fixedWidth={fixedWidth}\n aria-hidden={!isActive}\n aria-label={!isActive ? undefined : ariaLabel}\n />\n <ToggleableIcon\n active={!isActive}\n name={inactiveName}\n size={size}\n fixedWidth={fixedWidth}\n aria-hidden={isActive}\n aria-label={isActive ? ariaLabel : undefined}\n />\n </Box>\n );\n};\n\nIconToggle.displayName = \"Icon.Toggle\";\n/**\n * **Accessibility note:** It is best practice to wrap `<Icon.Toggle />` in a button. The button must include `aria-label` and `aria-pressed` in order for a screen reader to properly communicate the icon's state. See example below.\n *\n * @link https://www.w3.org/TR/wai-aria-practices-1.1/#button\n * @example\n * const [toggleState, setToggleState] = useState(false);\n * <Button // Wrap Icon.Toggle with Button\n * appearance='pill'\n * aria-label='like' // required for accessibility\n * aria-pressed={toggleState} // required for accessibility\n * onClick={() => setToggleState(!toggleState)}\n * >\n * <Icon.Toggle\n * activeName=\"heart-solid\"\n * inactiveName=\"heart-outline\"\n * isActive={toggleState}\n * />\n * </Button>\n */\nIcon.Toggle = IconToggle;\n\nexport default Icon;\n","/**\n * Hybrid Icon component.\n * Automatically chooses between the Tailwind (pure CSS-class) render path and the\n * styled-components path based on props, preserving 100% backward compatibility:\n *\n * - `color` tokens (e.g. \"icon.base\"), styled-system props (margins, layout),\n * a styled() extension (theme/forwardedComponent), or an injected `sc-*`\n * className all route to the styled-components Container.\n * - bare icons (name + size + fixedWidth, no system props) render via the\n * lighter Tailwind <span>.\n *\n * Name/variant resolution, viewBox lookup, aria handling, and the <svg> markup\n * are shared with the styled-components path via iconShared.tsx.\n */\nimport * as React from \"react\";\nimport PartnerLogo from \"@sproutsocial/seeds-react-partner-logo\";\nimport { includes } from \"@sproutsocial/seeds-react-utilities\";\nimport { LogoNamesWithoutVariants as PartnerLogoNames } from \"@sproutsocial/seeds-partner-logos\";\nimport { needsStyledComponents } from \"@sproutsocial/seeds-react-system-props\";\n\nimport type { TypeIconProps } from \"./IconTypes\";\nimport Container from \"./styles\";\nimport { IconTailwind } from \"./IconTailwind\";\nimport {\n AllViewboxes,\n resolveIconName,\n getAriaProps,\n IconSvg,\n} from \"./iconShared\";\n\n// Matches the generated styled-components class (e.g. \"sc-bdVaJa\"). A styled(Icon)\n// extension injects such a class; routing it to the styled path keeps its\n// generated styles (and avoids leaking `theme`/custom props onto the DOM span).\nconst SC_CLASS_PATTERN = /\\bsc-[a-zA-Z0-9]+\\b/;\n\nconst IconHybrid = ({\n name,\n size = \"small\",\n fixedWidth = false,\n ariaLabel,\n color,\n svgProps,\n ...rest\n}: TypeIconProps) => {\n if (includes(PartnerLogoNames, name)) {\n // Icon's \"default\" size is equivalent to PartnerLogo's \"small\" size\n const logoSize = size === \"default\" ? \"small\" : size;\n const logoProps = {\n partnerName: name,\n size: logoSize,\n logoType: \"symbol\" as const,\n svgProps,\n };\n return (\n <PartnerLogo\n // ariaLabel needs to be overridable by aria-label prop in ...rest\n aria-label={ariaLabel}\n {...rest}\n {...logoProps}\n />\n );\n }\n\n const iconName = resolveIconName(name, size);\n const iconViewBox = AllViewboxes[iconName];\n\n const { \"aria-label\": ariaLabelFromRest, ...restWithoutAriaLabel } =\n rest as Record<string, any>;\n const { containerAriaProps, svgAriaProps } = getAriaProps(\n ariaLabel,\n ariaLabelFromRest\n );\n\n const svg = (\n <IconSvg\n iconName={iconName}\n iconViewBox={iconViewBox}\n svgProps={svgProps}\n svgAriaProps={svgAriaProps}\n />\n );\n\n // Route to styled-components whenever backward compatibility requires it.\n // `color` is destructured out of `rest`, so it must be checked explicitly —\n // the Tailwind path only does `fill: currentColor` and cannot resolve a token\n // like \"icon.base\".\n // `cursor` is a public Icon prop applied by the legacy Container via the\n // COMMON mixin, but is not in STYLED_SYSTEM_PROPS, so `needsStyledComponents`\n // does not catch it. Gate it explicitly (like `color`) so it keeps routing to\n // SC instead of leaking onto the Tailwind span as an invalid DOM attribute.\n // It is read (not destructured) off `restWithoutAriaLabel` so it still spreads\n // onto Container below.\n const className = restWithoutAriaLabel.className;\n const needsSC =\n color !== undefined ||\n restWithoutAriaLabel.cursor !== undefined ||\n needsStyledComponents(restWithoutAriaLabel) ||\n (typeof className === \"string\" && SC_CLASS_PATTERN.test(className));\n\n if (needsSC) {\n return (\n <Container\n iconSize={size}\n fixedWidth={!!fixedWidth}\n key={iconName}\n data-qa-icon={iconName}\n color={color as React.ComponentProps<typeof Container>[\"color\"]}\n {...restWithoutAriaLabel}\n {...containerAriaProps}\n >\n {svg}\n </Container>\n );\n }\n\n return (\n <IconTailwind\n size={size}\n fixedWidth={!!fixedWidth}\n key={iconName}\n data-qa-icon={iconName}\n {...restWithoutAriaLabel}\n {...containerAriaProps}\n >\n {svg}\n </IconTailwind>\n );\n};\n\nIconHybrid.displayName = \"Icon\";\nexport default IconHybrid;\n","import styled, { css } from \"styled-components\";\nimport { verticalAlign } from \"styled-system\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeIconSize } from \"./IconTypes\";\n\nconst sizes: { [key in TypeIconSize]: string } = {\n mini: \"12px\",\n\n /** TODO: deprecate default in favor of small in future release */\n default: \"16px\",\n small: \"16px\",\n medium: \"24px\",\n large: \"32px\",\n jumbo: \"64px\",\n};\n\nconst stylesForSize = (iconActualSize: string, fixedWidth: boolean) => css`\n line-height: ${iconActualSize};\n\n &,\n .Icon-svg {\n height: ${iconActualSize};\n fill: currentColor;\n }\n\n ${fixedWidth &&\n `\n &,\n & .Icon-svg {\n width: ${iconActualSize}\n }\n `}\n`;\n\nconst Container = styled.span.attrs({\n className: \"Icon\",\n})<{\n iconSize: TypeIconSize;\n fixedWidth: boolean;\n}>`\n display: inline-block;\n color: inherit;\n vertical-align: middle;\n\n ${(props) => stylesForSize(sizes[props.iconSize], props.fixedWidth)}\n\n ${COMMON}\n ${verticalAlign}\n`;\nexport default Container;\n","/**\n * Tailwind/CSS-class implementation of the Icon container.\n * Uses the Seeds icon CSS classes from icon.css. Presentational only: it applies\n * the `.Icon`/`.seeds-icon` classes and the `--icon-size` custom property, then\n * renders the precomputed <svg> (passed as children). All name/variant/aria\n * logic lives in iconShared.tsx and IconHybrid.tsx.\n */\nimport React from \"react\";\nimport type { TypeIconSize } from \"./IconTypes\";\n\n// Utility for merging class names properly.\n// Mirror of the local helper in ButtonTailwind.tsx — `cn` is NOT exported from\n// @sproutsocial/seeds-react-utilities, so it is duplicated here intentionally.\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\n// Pixel lookup driving --icon-size. Mirrors `sizes` in styles.ts (kept local so\n// styles.ts stays untouched for the legacy styled-components path).\nconst sizeMap: { [key in TypeIconSize]: string } = {\n mini: \"12px\",\n\n /** TODO: deprecate default in favor of small in future release */\n default: \"16px\",\n small: \"16px\",\n medium: \"24px\",\n large: \"32px\",\n jumbo: \"64px\",\n};\n\ntype TypeIconTailwindProps = {\n size: TypeIconSize;\n fixedWidth: boolean;\n className?: string;\n children: React.ReactNode;\n} & Omit<React.ComponentPropsWithoutRef<\"span\">, \"color\">;\n\nexport const IconTailwind = ({\n size,\n fixedWidth,\n className,\n children,\n ...rest\n}: TypeIconTailwindProps) => {\n // \"Icon\" preserves downstream descendant selectors (e.g. `.Icon` in\n // seeds-react-switch / seeds-react-data-viz) that the styled-components\n // Container added via .attrs({ className: \"Icon\" }).\n const classes = cn(\n \"Icon\",\n \"seeds-icon\",\n { \"seeds-icon-fixed-width\": fixedWidth },\n className\n );\n\n return (\n <span\n {...rest}\n className={classes}\n style={\n {\n ...rest.style,\n \"--icon-size\": sizeMap[size],\n } as React.CSSProperties\n }\n >\n {children}\n </span>\n );\n};\n\nIconTailwind.displayName = \"IconTailwind\";\n","/**\n * Shared, non-styling Icon logic used by BOTH render paths (the styled-components\n * Container path and the Tailwind <span> path). Factoring this out keeps the two\n * paths from diverging: name/variant resolution, viewBox lookup, aria handling,\n * and the <svg> markup live here once.\n *\n * Not part of the public export surface (not re-exported from index.ts).\n */\nimport * as React from \"react\";\nimport { includes } from \"@sproutsocial/seeds-react-utilities\";\nimport {\n AiViewBoxes,\n ExternalViewBoxes,\n GeneralViewBoxes,\n SproutViewBoxes,\n ExternalIconNames,\n type EnumIconSvgNames,\n type EnumIconNamesWithoutVariants,\n} from \"@sproutsocial/seeds-icons\";\nimport type { TypeIconName, TypeIconSize } from \"./IconTypes\";\n\nexport const AllViewboxes = {\n ...AiViewBoxes,\n ...ExternalViewBoxes,\n ...GeneralViewBoxes,\n ...SproutViewBoxes,\n};\n\n/**\n * Resolve a bare icon name to its concrete svg-sprite name by applying the\n * default variant (`solid` for `mini`, `outline` otherwise) unless the name is\n * already variant-suffixed or is an external icon. Matches the original\n * Icon.tsx resolution exactly.\n */\nexport function resolveIconName(\n name: TypeIconName,\n size: TypeIconSize\n): EnumIconSvgNames {\n const defaultVariant = size === \"mini\" ? \"solid\" : \"outline\";\n return !name?.endsWith(\"-outline\") &&\n !name?.endsWith(\"-solid\") &&\n !includes(ExternalIconNames, name)\n ? // then add default variant\n (`${\n name as EnumIconNamesWithoutVariants\n }-${defaultVariant}` as EnumIconSvgNames)\n : // else use name as is\n (name as EnumIconSvgNames);\n}\n\n/**\n * Compute the aria attributes for the container and the svg. When an aria-label\n * is present (via the `ariaLabel` prop or a spread `aria-label`), the svg gets\n * role=\"img\" + aria-label and the container is left visible; otherwise the\n * container is marked aria-hidden. Matches the original Icon.tsx behavior.\n */\nexport function getAriaProps(ariaLabel?: string, ariaLabelFromRest?: string) {\n const hasAriaLabel = !!ariaLabel || !!ariaLabelFromRest;\n const containerAriaProps = hasAriaLabel\n ? {}\n : { \"aria-hidden\": \"true\" as const };\n const svgAriaProps = hasAriaLabel\n ? { role: \"img\" as const, \"aria-label\": ariaLabel ?? ariaLabelFromRest }\n : {};\n return { containerAriaProps, svgAriaProps };\n}\n\n/**\n * The icon <svg> markup, identical for both render paths. `svgAriaProps` is\n * spread last so aria attributes win over any `svgProps` (matching the original\n * Icon.tsx spread order).\n */\nexport const IconSvg = ({\n iconName,\n iconViewBox,\n svgProps,\n svgAriaProps,\n}: {\n iconName: string;\n iconViewBox?: string;\n svgProps?: React.ComponentPropsWithoutRef<\"svg\">;\n svgAriaProps: React.ComponentPropsWithoutRef<\"svg\">;\n}) => (\n <svg\n className=\"Icon-svg\"\n viewBox={iconViewBox}\n focusable={false}\n data-qa-icon-svg={`${iconName}-svg`}\n {...svgProps}\n {...svgAriaProps}\n >\n <use\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n xlinkHref={`#seeds-svgs_${iconName}`}\n />\n </svg>\n);\n","import * as React from \"react\";\nimport type { EnumIconNames } from \"@sproutsocial/seeds-icons\";\nimport type { EnumLogoNamesWithoutVariants } from \"@sproutsocial/seeds-partner-logos\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\n\nexport type TypeIconName = EnumIconNames | EnumLogoNamesWithoutVariants;\n\nexport type TypeIconSize =\n | \"mini\" // 12x12\n // TODO: deprecate default in favor of small in future release\n | \"default\" // 16x16\n | \"small\" // 16x16\n | \"medium\" // 24x24\n | \"large\" // 32x32\n | \"jumbo\"; // 64x64\n\nexport interface TypeIconProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<React.ComponentPropsWithoutRef<\"span\">, \"color\"> {\n /** Name of the icon in the svg sprite */\n name: TypeIconName;\n size?: TypeIconSize;\n /** Whether the icon should have a fixed width or not. Use this when you need to align icons/text vertically in a list. */\n fixedWidth?: boolean;\n /** Label used to describe the icon if not used with an accompanying visual label */\n ariaLabel?: string;\n svgProps?: React.ComponentPropsWithoutRef<\"svg\">;\n}\n\nexport interface TypeToggleProps extends TypeBoxProps {\n /** Name of the icon to be shown in the active state */\n activeName: TypeIconName;\n /** Name of the icon to be shown in the inactive state */\n inactiveName: TypeIconName;\n /** Whether the active icon should be shown or not */\n isActive: boolean;\n /** The size of the icon. `small` is the default */\n size?: TypeIconSize;\n fixedWidth?: boolean;\n ariaLabel?: string;\n}\n","import Icon from \"./Icon\";\n\nexport default Icon;\nexport { Icon };\nexport { default as IconContainer } from \"./styles\";\nexport * from \"./IconTypes\";\n\n// Icon v2 exports (structural SVG wrapper; distinct API from v1)\nexport { default as IconV2 } from \"./v2\";\nexport type { TypeIconV2Props, TypeIconV2Size } from \"./v2\";\n"],"mappings":";;;;;AAAA,OAAuB;AACvB,OAAOA,WAAU,OAAAC,YAAW;AAC5B,OAAO,SAAS;;;ACYhB,OAAuB;AACvB,OAAO,iBAAiB;AACxB,SAAS,YAAAC,iBAAgB;AACzB,SAAS,4BAA4B,wBAAwB;AAC7D,SAAS,6BAA6B;;;AClBtC,OAAO,UAAU,WAAW;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AAGvB,IAAM,QAA2C;AAAA,EAC/C,MAAM;AAAA;AAAA,EAGN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AACT;AAEA,IAAM,gBAAgB,CAAC,gBAAwB,eAAwB;AAAA,iBACtD,cAAc;AAAA;AAAA;AAAA;AAAA,cAIjB,cAAc;AAAA;AAAA;AAAA;AAAA,IAIxB,cACF;AAAA;AAAA;AAAA,eAGa,cAAc;AAAA;AAAA,GAE1B;AAAA;AAGH,IAAM,YAAY,OAAO,KAAK,MAAM;AAAA,EAClC,WAAW;AACb,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAQG,CAAC,UAAU,cAAc,MAAM,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC;AAAA;AAAA,IAEjE,MAAM;AAAA,IACN,aAAa;AAAA;AAEjB,IAAO,iBAAQ;;;AC1Cf,OAAkB;AAkEd;AA5DJ,SAAS,MACJ,QACK;AACR,QAAM,UAAoB,CAAC;AAE3B,aAAW,SAAS,QAAQ;AAC1B,QAAI,CAAC,MAAO;AAEZ,QAAI,OAAO,UAAU,UAAU;AAC7B,cAAQ,KAAK,KAAK;AAAA,IACpB,WAAW,OAAO,UAAU,UAAU;AACpC,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,G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A,eAAa,CAAC;AAAA,QACd,cAAY,CAAC,WAAW,SAAY;AAAA;AAAA,IACtC;AAAA,IACA,gBAAAA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ,CAAC;AAAA,QACT,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,eAAa;AAAA,QACb,cAAY,WAAW,YAAY;AAAA;AAAA,IACrC;AAAA,KACF;AAEJ;AAEA,WAAW,cAAc;AAoBzB,KAAK,SAAS;AAEd,IAAOG,gBAAQ;;;AKvFf,OAAuB;;;ACEvB,IAAO,cAAQC;","names":["styled","css","includes","jsx","jsx","includes","jsx","styled","css","Icon_default","Icon_default"]}
|
package/dist/icon.css
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeds Icon component classes
|
|
3
|
+
* Use these instead of writing out individual Tailwind utility classes.
|
|
4
|
+
*
|
|
5
|
+
* Requires @sproutsocial/seeds-react-theme/dist/theme-all.css imported for
|
|
6
|
+
* CSS variable definitions and dark mode support.
|
|
7
|
+
*
|
|
8
|
+
* The dynamic `size` prop is applied through the `--icon-size` custom property,
|
|
9
|
+
* set inline by IconTailwind (e.g. style={{ "--icon-size": "16px" }}).
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* <span class="Icon seeds-icon" style="--icon-size: 16px">
|
|
13
|
+
* <svg class="Icon-svg" />
|
|
14
|
+
* </span>
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
@layer components {
|
|
18
|
+
.seeds-icon {
|
|
19
|
+
display: inline-block;
|
|
20
|
+
color: inherit;
|
|
21
|
+
vertical-align: middle;
|
|
22
|
+
line-height: var(--icon-size);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.seeds-icon,
|
|
26
|
+
.seeds-icon .Icon-svg {
|
|
27
|
+
height: var(--icon-size);
|
|
28
|
+
fill: currentColor;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* width only applied when fixedWidth */
|
|
32
|
+
.seeds-icon-fixed-width,
|
|
33
|
+
.seeds-icon-fixed-width .Icon-svg {
|
|
34
|
+
width: var(--icon-size);
|
|
35
|
+
}
|
|
36
|
+
}
|
package/dist/index.d.mts
CHANGED
|
@@ -32,8 +32,14 @@ interface TypeToggleProps extends TypeBoxProps {
|
|
|
32
32
|
ariaLabel?: string;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Icon. Automatically routes between the Tailwind implementation (preferred, for
|
|
37
|
+
* bare icons) and the styled-components implementation (for consumers using
|
|
38
|
+
* `color` tokens, system props, or a styled() extension). The routing logic and
|
|
39
|
+
* shared name/variant/aria/svg handling live in IconHybrid / iconShared.
|
|
40
|
+
*/
|
|
35
41
|
declare const Icon: {
|
|
36
|
-
(
|
|
42
|
+
(props: TypeIconProps): react_jsx_runtime.JSX.Element;
|
|
37
43
|
/**
|
|
38
44
|
* **Accessibility note:** It is best practice to wrap `<Icon.Toggle />` in a button. The button must include `aria-label` and `aria-pressed` in order for a screen reader to properly communicate the icon's state. See example below.
|
|
39
45
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -32,8 +32,14 @@ interface TypeToggleProps extends TypeBoxProps {
|
|
|
32
32
|
ariaLabel?: string;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Icon. Automatically routes between the Tailwind implementation (preferred, for
|
|
37
|
+
* bare icons) and the styled-components implementation (for consumers using
|
|
38
|
+
* `color` tokens, system props, or a styled() extension). The routing logic and
|
|
39
|
+
* shared name/variant/aria/svg handling live in IconHybrid / iconShared.
|
|
40
|
+
*/
|
|
35
41
|
declare const Icon: {
|
|
36
|
-
(
|
|
42
|
+
(props: TypeIconProps): react_jsx_runtime.JSX.Element;
|
|
37
43
|
/**
|
|
38
44
|
* **Accessibility note:** It is best practice to wrap `<Icon.Toggle />` in a button. The button must include `aria-label` and `aria-pressed` in order for a screen reader to properly communicate the icon's state. See example below.
|
|
39
45
|
*
|
package/dist/index.js
CHANGED
|
@@ -38,12 +38,16 @@ __export(src_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(src_exports);
|
|
39
39
|
|
|
40
40
|
// src/Icon.tsx
|
|
41
|
-
var
|
|
41
|
+
var React4 = require("react");
|
|
42
42
|
var import_styled_components2 = __toESM(require("styled-components"));
|
|
43
43
|
var import_seeds_react_box = __toESM(require("@sproutsocial/seeds-react-box"));
|
|
44
|
+
|
|
45
|
+
// src/IconHybrid.tsx
|
|
46
|
+
var React3 = require("react");
|
|
44
47
|
var import_seeds_react_partner_logo = __toESM(require("@sproutsocial/seeds-react-partner-logo"));
|
|
45
|
-
var
|
|
48
|
+
var import_seeds_react_utilities2 = require("@sproutsocial/seeds-react-utilities");
|
|
46
49
|
var import_seeds_partner_logos = require("@sproutsocial/seeds-partner-logos");
|
|
50
|
+
var import_seeds_react_system_props2 = require("@sproutsocial/seeds-react-system-props");
|
|
47
51
|
|
|
48
52
|
// src/styles.ts
|
|
49
53
|
var import_styled_components = __toESM(require("styled-components"));
|
|
@@ -88,16 +92,117 @@ var Container = import_styled_components.default.span.attrs({
|
|
|
88
92
|
`;
|
|
89
93
|
var styles_default = Container;
|
|
90
94
|
|
|
91
|
-
// src/
|
|
92
|
-
var
|
|
95
|
+
// src/IconTailwind.tsx
|
|
96
|
+
var import_react = require("react");
|
|
93
97
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
98
|
+
function cn(...inputs) {
|
|
99
|
+
const classes = [];
|
|
100
|
+
for (const input of inputs) {
|
|
101
|
+
if (!input) continue;
|
|
102
|
+
if (typeof input === "string") {
|
|
103
|
+
classes.push(input);
|
|
104
|
+
} else if (typeof input === "object") {
|
|
105
|
+
for (const [key, value] of Object.entries(input)) {
|
|
106
|
+
if (value) {
|
|
107
|
+
classes.push(key);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return classes.join(" ");
|
|
113
|
+
}
|
|
114
|
+
var sizeMap = {
|
|
115
|
+
mini: "12px",
|
|
116
|
+
/** TODO: deprecate default in favor of small in future release */
|
|
117
|
+
default: "16px",
|
|
118
|
+
small: "16px",
|
|
119
|
+
medium: "24px",
|
|
120
|
+
large: "32px",
|
|
121
|
+
jumbo: "64px"
|
|
122
|
+
};
|
|
123
|
+
var IconTailwind = ({
|
|
124
|
+
size,
|
|
125
|
+
fixedWidth,
|
|
126
|
+
className,
|
|
127
|
+
children,
|
|
128
|
+
...rest
|
|
129
|
+
}) => {
|
|
130
|
+
const classes = cn(
|
|
131
|
+
"Icon",
|
|
132
|
+
"seeds-icon",
|
|
133
|
+
{ "seeds-icon-fixed-width": fixedWidth },
|
|
134
|
+
className
|
|
135
|
+
);
|
|
136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
137
|
+
"span",
|
|
138
|
+
{
|
|
139
|
+
...rest,
|
|
140
|
+
className: classes,
|
|
141
|
+
style: {
|
|
142
|
+
...rest.style,
|
|
143
|
+
"--icon-size": sizeMap[size]
|
|
144
|
+
},
|
|
145
|
+
children
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
IconTailwind.displayName = "IconTailwind";
|
|
150
|
+
|
|
151
|
+
// src/iconShared.tsx
|
|
152
|
+
var React2 = require("react");
|
|
153
|
+
var import_seeds_react_utilities = require("@sproutsocial/seeds-react-utilities");
|
|
154
|
+
var import_seeds_icons = require("@sproutsocial/seeds-icons");
|
|
155
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
94
156
|
var AllViewboxes = {
|
|
95
157
|
...import_seeds_icons.AiViewBoxes,
|
|
96
158
|
...import_seeds_icons.ExternalViewBoxes,
|
|
97
159
|
...import_seeds_icons.GeneralViewBoxes,
|
|
98
160
|
...import_seeds_icons.SproutViewBoxes
|
|
99
161
|
};
|
|
100
|
-
|
|
162
|
+
function resolveIconName(name, size) {
|
|
163
|
+
const defaultVariant = size === "mini" ? "solid" : "outline";
|
|
164
|
+
return !name?.endsWith("-outline") && !name?.endsWith("-solid") && !(0, import_seeds_react_utilities.includes)(import_seeds_icons.ExternalIconNames, name) ? (
|
|
165
|
+
// then add default variant
|
|
166
|
+
`${name}-${defaultVariant}`
|
|
167
|
+
) : (
|
|
168
|
+
// else use name as is
|
|
169
|
+
name
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
function getAriaProps(ariaLabel, ariaLabelFromRest) {
|
|
173
|
+
const hasAriaLabel = !!ariaLabel || !!ariaLabelFromRest;
|
|
174
|
+
const containerAriaProps = hasAriaLabel ? {} : { "aria-hidden": "true" };
|
|
175
|
+
const svgAriaProps = hasAriaLabel ? { role: "img", "aria-label": ariaLabel ?? ariaLabelFromRest } : {};
|
|
176
|
+
return { containerAriaProps, svgAriaProps };
|
|
177
|
+
}
|
|
178
|
+
var IconSvg = ({
|
|
179
|
+
iconName,
|
|
180
|
+
iconViewBox,
|
|
181
|
+
svgProps,
|
|
182
|
+
svgAriaProps
|
|
183
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
184
|
+
"svg",
|
|
185
|
+
{
|
|
186
|
+
className: "Icon-svg",
|
|
187
|
+
viewBox: iconViewBox,
|
|
188
|
+
focusable: false,
|
|
189
|
+
"data-qa-icon-svg": `${iconName}-svg`,
|
|
190
|
+
...svgProps,
|
|
191
|
+
...svgAriaProps,
|
|
192
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
193
|
+
"use",
|
|
194
|
+
{
|
|
195
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
196
|
+
xlinkHref: `#seeds-svgs_${iconName}`
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
// src/IconHybrid.tsx
|
|
203
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
204
|
+
var SC_CLASS_PATTERN = /\bsc-[a-zA-Z0-9]+\b/;
|
|
205
|
+
var IconHybrid = ({
|
|
101
206
|
name,
|
|
102
207
|
size = "small",
|
|
103
208
|
fixedWidth = false,
|
|
@@ -106,7 +211,7 @@ var Icon = ({
|
|
|
106
211
|
svgProps,
|
|
107
212
|
...rest
|
|
108
213
|
}) => {
|
|
109
|
-
if ((0,
|
|
214
|
+
if ((0, import_seeds_react_utilities2.includes)(import_seeds_partner_logos.LogoNamesWithoutVariants, name)) {
|
|
110
215
|
const logoSize = size === "default" ? "small" : size;
|
|
111
216
|
const logoProps = {
|
|
112
217
|
partnerName: name,
|
|
@@ -114,7 +219,7 @@ var Icon = ({
|
|
|
114
219
|
logoType: "symbol",
|
|
115
220
|
svgProps
|
|
116
221
|
};
|
|
117
|
-
return /* @__PURE__ */ (0,
|
|
222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
118
223
|
import_seeds_react_partner_logo.default,
|
|
119
224
|
{
|
|
120
225
|
"aria-label": ariaLabel,
|
|
@@ -123,53 +228,58 @@ var Icon = ({
|
|
|
123
228
|
}
|
|
124
229
|
);
|
|
125
230
|
}
|
|
126
|
-
const
|
|
127
|
-
const iconName = (
|
|
128
|
-
// if not external and has no variant
|
|
129
|
-
!name?.endsWith("-outline") && !name?.endsWith("-solid") && !(0, import_seeds_react_utilities.includes)(import_seeds_icons.ExternalIconNames, name) ? (
|
|
130
|
-
// then add default variant
|
|
131
|
-
`${name}-${defaultVariant}`
|
|
132
|
-
) : (
|
|
133
|
-
// else use name as is
|
|
134
|
-
name
|
|
135
|
-
)
|
|
136
|
-
);
|
|
231
|
+
const iconName = resolveIconName(name, size);
|
|
137
232
|
const iconViewBox = AllViewboxes[iconName];
|
|
138
233
|
const { "aria-label": ariaLabelFromRest, ...restWithoutAriaLabel } = rest;
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
234
|
+
const { containerAriaProps, svgAriaProps } = getAriaProps(
|
|
235
|
+
ariaLabel,
|
|
236
|
+
ariaLabelFromRest
|
|
237
|
+
);
|
|
238
|
+
const svg = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
239
|
+
IconSvg,
|
|
240
|
+
{
|
|
241
|
+
iconName,
|
|
242
|
+
iconViewBox,
|
|
243
|
+
svgProps,
|
|
244
|
+
svgAriaProps
|
|
245
|
+
}
|
|
246
|
+
);
|
|
247
|
+
const className = restWithoutAriaLabel.className;
|
|
248
|
+
const needsSC = color !== void 0 || restWithoutAriaLabel.cursor !== void 0 || (0, import_seeds_react_system_props2.needsStyledComponents)(restWithoutAriaLabel) || typeof className === "string" && SC_CLASS_PATTERN.test(className);
|
|
249
|
+
if (needsSC) {
|
|
250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
251
|
+
styles_default,
|
|
252
|
+
{
|
|
253
|
+
iconSize: size,
|
|
254
|
+
fixedWidth: !!fixedWidth,
|
|
255
|
+
"data-qa-icon": iconName,
|
|
256
|
+
color,
|
|
257
|
+
...restWithoutAriaLabel,
|
|
258
|
+
...containerAriaProps,
|
|
259
|
+
children: svg
|
|
260
|
+
},
|
|
261
|
+
iconName
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
265
|
+
IconTailwind,
|
|
144
266
|
{
|
|
145
|
-
|
|
267
|
+
size,
|
|
146
268
|
fixedWidth: !!fixedWidth,
|
|
147
269
|
"data-qa-icon": iconName,
|
|
148
|
-
color,
|
|
149
270
|
...restWithoutAriaLabel,
|
|
150
271
|
...containerAriaProps,
|
|
151
|
-
children:
|
|
152
|
-
"svg",
|
|
153
|
-
{
|
|
154
|
-
className: "Icon-svg",
|
|
155
|
-
viewBox: iconViewBox,
|
|
156
|
-
focusable: false,
|
|
157
|
-
"data-qa-icon-svg": `${iconName}-svg`,
|
|
158
|
-
...svgProps,
|
|
159
|
-
...svgAriaProps,
|
|
160
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
161
|
-
"use",
|
|
162
|
-
{
|
|
163
|
-
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
164
|
-
xlinkHref: `#seeds-svgs_${iconName}`
|
|
165
|
-
}
|
|
166
|
-
)
|
|
167
|
-
}
|
|
168
|
-
)
|
|
272
|
+
children: svg
|
|
169
273
|
},
|
|
170
274
|
iconName
|
|
171
275
|
);
|
|
172
276
|
};
|
|
277
|
+
IconHybrid.displayName = "Icon";
|
|
278
|
+
var IconHybrid_default = IconHybrid;
|
|
279
|
+
|
|
280
|
+
// src/Icon.tsx
|
|
281
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
282
|
+
var Icon = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconHybrid_default, { ...props });
|
|
173
283
|
var ToggleableIcon = (0, import_styled_components2.default)(Icon)`
|
|
174
284
|
transition: all ${(p) => p.theme.duration.fast} linear;
|
|
175
285
|
|
|
@@ -193,8 +303,8 @@ var IconToggle = ({
|
|
|
193
303
|
ariaLabel,
|
|
194
304
|
...rest
|
|
195
305
|
}) => {
|
|
196
|
-
return /* @__PURE__ */ (0,
|
|
197
|
-
/* @__PURE__ */ (0,
|
|
306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_seeds_react_box.default, { as: "span", position: "relative", display: "inline-flex", ...rest, children: [
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
198
308
|
ToggleableIcon,
|
|
199
309
|
{
|
|
200
310
|
active: isActive,
|
|
@@ -205,7 +315,7 @@ var IconToggle = ({
|
|
|
205
315
|
"aria-label": !isActive ? void 0 : ariaLabel
|
|
206
316
|
}
|
|
207
317
|
),
|
|
208
|
-
/* @__PURE__ */ (0,
|
|
318
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
209
319
|
ToggleableIcon,
|
|
210
320
|
{
|
|
211
321
|
active: !isActive,
|
|
@@ -223,14 +333,14 @@ Icon.Toggle = IconToggle;
|
|
|
223
333
|
var Icon_default = Icon;
|
|
224
334
|
|
|
225
335
|
// src/IconTypes.ts
|
|
226
|
-
var
|
|
336
|
+
var React5 = require("react");
|
|
227
337
|
|
|
228
338
|
// src/v2/Icon.tsx
|
|
229
|
-
var
|
|
339
|
+
var React6 = __toESM(require("react"));
|
|
230
340
|
|
|
231
341
|
// src/v2/styles.ts
|
|
232
342
|
var import_styled_components3 = __toESM(require("styled-components"));
|
|
233
|
-
var
|
|
343
|
+
var import_seeds_react_system_props3 = require("@sproutsocial/seeds-react-system-props");
|
|
234
344
|
var dimensions = {
|
|
235
345
|
default: { container: "24px", icon: "18px" },
|
|
236
346
|
small: { container: "20px", icon: "15px" }
|
|
@@ -251,19 +361,19 @@ var Container2 = import_styled_components3.default.span`
|
|
|
251
361
|
fill: currentColor;
|
|
252
362
|
}
|
|
253
363
|
|
|
254
|
-
${
|
|
255
|
-
${
|
|
256
|
-
${
|
|
364
|
+
${import_seeds_react_system_props3.COMMON}
|
|
365
|
+
${import_seeds_react_system_props3.FLEXBOX}
|
|
366
|
+
${import_seeds_react_system_props3.LAYOUT}
|
|
257
367
|
`;
|
|
258
368
|
var styles_default2 = Container2;
|
|
259
369
|
|
|
260
370
|
// src/v2/Icon.tsx
|
|
261
|
-
var
|
|
262
|
-
var Icon2 =
|
|
371
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
372
|
+
var Icon2 = React6.forwardRef(
|
|
263
373
|
({ size = "default", children, icon, "aria-label": ariaLabel, ...rest }, ref) => {
|
|
264
374
|
const content = children ?? icon;
|
|
265
375
|
const ariaProps = ariaLabel ? { role: "img", "aria-label": ariaLabel } : { "aria-hidden": true };
|
|
266
|
-
return /* @__PURE__ */ (0,
|
|
376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
267
377
|
styles_default2,
|
|
268
378
|
{
|
|
269
379
|
ref,
|
|
@@ -280,7 +390,7 @@ Icon2.displayName = "IconV2";
|
|
|
280
390
|
var Icon_default2 = Icon2;
|
|
281
391
|
|
|
282
392
|
// src/v2/IconTypes.ts
|
|
283
|
-
var
|
|
393
|
+
var React7 = require("react");
|
|
284
394
|
|
|
285
395
|
// src/index.ts
|
|
286
396
|
var src_default = Icon_default;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/Icon.tsx","../src/styles.ts","../src/IconTypes.ts","../src/v2/Icon.tsx","../src/v2/styles.ts","../src/v2/IconTypes.ts"],"sourcesContent":["import Icon from \"./Icon\";\n\nexport default Icon;\nexport { Icon };\nexport { default as IconContainer } from \"./styles\";\nexport * from \"./IconTypes\";\n\n// Icon v2 exports (structural SVG wrapper; distinct API from v1)\nexport { default as IconV2 } from \"./v2\";\nexport type { TypeIconV2Props, TypeIconV2Size } from \"./v2\";\n","import * as React from \"react\";\nimport styled, { css } from \"styled-components\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport PartnerLogo from \"@sproutsocial/seeds-react-partner-logo\";\nimport { includes } from \"@sproutsocial/seeds-react-utilities\";\nimport { LogoNamesWithoutVariants as PartnerLogoNames } from \"@sproutsocial/seeds-partner-logos\";\n\nimport type { TypeIconProps, TypeToggleProps } from \"./IconTypes\";\nimport Container from \"./styles\";\nimport {\n AiViewBoxes,\n ExternalViewBoxes,\n GeneralViewBoxes,\n SproutViewBoxes,\n ExternalIconNames,\n type EnumIconSvgNames,\n type EnumIconNamesWithoutVariants,\n} from \"@sproutsocial/seeds-icons\";\n\nconst AllViewboxes = {\n ...AiViewBoxes,\n ...ExternalViewBoxes,\n ...GeneralViewBoxes,\n ...SproutViewBoxes,\n};\n\nconst Icon = ({\n name,\n size = \"small\",\n fixedWidth = false,\n ariaLabel,\n color,\n svgProps,\n ...rest\n}: TypeIconProps) => {\n if (includes(PartnerLogoNames, name)) {\n // Icon's \"default\" size is equivalent to PartnerLogo's \"small\" size\n const logoSize = size === \"default\" ? \"small\" : size;\n const logoProps = {\n partnerName: name,\n size: logoSize,\n logoType: \"symbol\" as const,\n svgProps,\n };\n return (\n <PartnerLogo\n // ariaLabel needs to be overridable by aria-label prop in ...rest\n aria-label={ariaLabel}\n {...rest}\n {...logoProps}\n />\n );\n }\n\n const defaultVariant = size === \"mini\" ? \"solid\" : \"outline\";\n\n const iconName: EnumIconSvgNames =\n // if not external and has no variant\n !name?.endsWith(\"-outline\") &&\n !name?.endsWith(\"-solid\") &&\n !includes(ExternalIconNames, name)\n ? // then add default variant\n `${name as EnumIconNamesWithoutVariants}-${defaultVariant}`\n : // else use name as is\n (name as EnumIconSvgNames);\n\n const iconViewBox = AllViewboxes[iconName];\n\n const { \"aria-label\": ariaLabelFromRest, ...restWithoutAriaLabel } = rest;\n const hasAriaLabel = !!ariaLabel || !!ariaLabelFromRest;\n const containerAriaProps = hasAriaLabel ? {} : { \"aria-hidden\": \"true\" };\n const svgAriaProps = hasAriaLabel\n ? { role: \"img\", \"aria-label\": ariaLabel ?? ariaLabelFromRest }\n : {};\n\n return (\n <Container\n iconSize={size}\n fixedWidth={!!fixedWidth}\n key={iconName}\n data-qa-icon={iconName}\n color={color}\n {...restWithoutAriaLabel}\n {...containerAriaProps}\n >\n <svg\n className=\"Icon-svg\"\n viewBox={iconViewBox}\n focusable={false}\n data-qa-icon-svg={`${iconName}-svg`}\n {...svgProps}\n {...svgAriaProps}\n >\n <use\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n xlinkHref={`#seeds-svgs_${iconName}`}\n />\n </svg>\n </Container>\n );\n};\n\nconst ToggleableIcon = styled(Icon)<{ active: boolean }>`\n transition: all ${(p) => p.theme.duration.fast} linear;\n\n ${(p) =>\n p.active &&\n css`\n opacity: 1;\n transform: scale(1);\n `}\n\n ${(p) =>\n !p.active &&\n css`\n position: absolute;\n opacity: 0;\n transform: scale(0);\n `}\n`;\n\nconst IconToggle = ({\n activeName,\n inactiveName,\n isActive,\n size = \"small\",\n fixedWidth = false,\n ariaLabel,\n ...rest\n}: TypeToggleProps) => {\n return (\n <Box as=\"span\" position=\"relative\" display=\"inline-flex\" {...rest}>\n <ToggleableIcon\n active={isActive}\n name={activeName}\n size={size}\n fixedWidth={fixedWidth}\n aria-hidden={!isActive}\n aria-label={!isActive ? undefined : ariaLabel}\n />\n <ToggleableIcon\n active={!isActive}\n name={inactiveName}\n size={size}\n fixedWidth={fixedWidth}\n aria-hidden={isActive}\n aria-label={isActive ? ariaLabel : undefined}\n />\n </Box>\n );\n};\n\nIconToggle.displayName = \"Icon.Toggle\";\n/**\n * **Accessibility note:** It is best practice to wrap `<Icon.Toggle />` in a button. The button must include `aria-label` and `aria-pressed` in order for a screen reader to properly communicate the icon's state. See example below.\n *\n * @link https://www.w3.org/TR/wai-aria-practices-1.1/#button\n * @example\n * const [toggleState, setToggleState] = useState(false);\n * <Button // Wrap Icon.Toggle with Button\n * appearance='pill'\n * aria-label='like' // required for accessibility\n * aria-pressed={toggleState} // required for accessibility\n * onClick={() => setToggleState(!toggleState)}\n * >\n * <Icon.Toggle\n * activeName=\"heart-solid\"\n * inactiveName=\"heart-outline\"\n * isActive={toggleState}\n * />\n * </Button>\n */\nIcon.Toggle = IconToggle;\n\nexport default Icon;\n","import styled, { css } from \"styled-components\";\nimport { verticalAlign } from \"styled-system\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeIconSize } from \"./IconTypes\";\n\nconst sizes: { [key in TypeIconSize]: string } = {\n mini: \"12px\",\n\n /** TODO: deprecate default in favor of small in future release */\n default: \"16px\",\n small: \"16px\",\n medium: \"24px\",\n large: \"32px\",\n jumbo: \"64px\",\n};\n\nconst stylesForSize = (iconActualSize: string, fixedWidth: boolean) => css`\n line-height: ${iconActualSize};\n\n &,\n .Icon-svg {\n height: ${iconActualSize};\n fill: currentColor;\n }\n\n ${fixedWidth &&\n `\n &,\n & .Icon-svg {\n width: ${iconActualSize}\n }\n `}\n`;\n\nconst Container = styled.span.attrs({\n className: \"Icon\",\n})<{\n iconSize: TypeIconSize;\n fixedWidth: boolean;\n}>`\n display: inline-block;\n color: inherit;\n vertical-align: middle;\n\n ${(props) => stylesForSize(sizes[props.iconSize], props.fixedWidth)}\n\n ${COMMON}\n ${verticalAlign}\n`;\nexport default Container;\n","import * as React from \"react\";\nimport type { EnumIconNames } from \"@sproutsocial/seeds-icons\";\nimport type { EnumLogoNamesWithoutVariants } from \"@sproutsocial/seeds-partner-logos\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\n\nexport type TypeIconName = EnumIconNames | EnumLogoNamesWithoutVariants;\n\nexport type TypeIconSize =\n | \"mini\" // 12x12\n // TODO: deprecate default in favor of small in future release\n | \"default\" // 16x16\n | \"small\" // 16x16\n | \"medium\" // 24x24\n | \"large\" // 32x32\n | \"jumbo\"; // 64x64\n\nexport interface TypeIconProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<React.ComponentPropsWithoutRef<\"span\">, \"color\"> {\n /** Name of the icon in the svg sprite */\n name: TypeIconName;\n size?: TypeIconSize;\n /** Whether the icon should have a fixed width or not. Use this when you need to align icons/text vertically in a list. */\n fixedWidth?: boolean;\n /** Label used to describe the icon if not used with an accompanying visual label */\n ariaLabel?: string;\n svgProps?: React.ComponentPropsWithoutRef<\"svg\">;\n}\n\nexport interface TypeToggleProps extends TypeBoxProps {\n /** Name of the icon to be shown in the active state */\n activeName: TypeIconName;\n /** Name of the icon to be shown in the inactive state */\n inactiveName: TypeIconName;\n /** Whether the active icon should be shown or not */\n isActive: boolean;\n /** The size of the icon. `small` is the default */\n size?: TypeIconSize;\n fixedWidth?: boolean;\n ariaLabel?: string;\n}\n","import * as React from \"react\";\nimport Container from \"./styles\";\nimport type { TypeIconV2Props } from \"./IconTypes\";\n\n/**\n * **Icon (v2)** — a structural wrapper that centers a caller-supplied SVG inside a\n * fixed-size container, slightly larger than the icon to give it breathing room\n * (a buffer against focus rings, hover backgrounds, and button padding).\n *\n * The caller passes the SVG directly via `children` (or the `icon` alias). The SVG\n * should use `viewBox=\"0 0 24 24\"` and `currentColor` fills — the component controls\n * only the rendered width/height and centering, never the viewBox or path-level fills.\n *\n * Sizes:\n * - `default` — 24×24px container, icon renders at 18×18px\n * - `small` — 20×20px container, icon renders at 15×15px\n *\n * Accessibility: decorative by default (`aria-hidden`). Pass `aria-label` to expose a\n * standalone icon — the container then gets `role=\"img\"` and the label.\n *\n * @example\n * <Icon aria-label=\"Settings\"><MySvg /></Icon>\n */\nconst Icon = React.forwardRef<HTMLSpanElement, TypeIconV2Props>(\n (\n { size = \"default\", children, icon, \"aria-label\": ariaLabel, ...rest },\n ref\n ) => {\n const content = children ?? icon;\n const ariaProps = ariaLabel\n ? { role: \"img\" as const, \"aria-label\": ariaLabel }\n : { \"aria-hidden\": true };\n\n return (\n <Container\n ref={ref}\n iconSize={size}\n data-qa-icon-v2={size}\n {...ariaProps}\n {...rest}\n >\n {content}\n </Container>\n );\n }\n);\n\nIcon.displayName = \"IconV2\";\n\nexport default Icon;\n","import styled from \"styled-components\";\nimport {\n COMMON,\n FLEXBOX,\n LAYOUT,\n} from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeIconV2Size } from \"./IconTypes\";\n\nconst dimensions: {\n [key in TypeIconV2Size]: { container: string; icon: string };\n} = {\n default: { container: \"24px\", icon: \"18px\" },\n small: { container: \"20px\", icon: \"15px\" },\n};\n\n/**\n * Structural, non-semantic container that centers a caller-supplied SVG inside a\n * fixed-size box (slightly larger than the icon, for breathing room). The child\n * `svg` is sized via CSS to the icon dimensions and inherits color through\n * `currentColor` — no background or border.\n */\nconst Container = styled.span<{\n iconSize: TypeIconV2Size;\n}>`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n color: inherit;\n width: ${(props) => dimensions[props.iconSize].container};\n height: ${(props) => dimensions[props.iconSize].container};\n\n & > svg {\n width: ${(props) => dimensions[props.iconSize].icon};\n height: ${(props) => dimensions[props.iconSize].icon};\n flex-shrink: 0;\n fill: currentColor;\n }\n\n ${COMMON}\n ${FLEXBOX}\n ${LAYOUT}\n`;\n\nexport default Container;\n","import * as React from \"react\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\nexport type TypeIconV2Size =\n | \"default\" // 24x24 container, 18x18 icon\n | \"small\"; // 20x20 container, 15x15 icon\n\nexport interface TypeIconV2Props\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<React.ComponentPropsWithoutRef<\"span\">, \"color\"> {\n /** Container/icon size variant. Defaults to `\"default\"` (24px container, 18px icon). */\n size?: TypeIconV2Size;\n /** The SVG element to render inside the container. Should use `viewBox=\"0 0 24 24\"` and `currentColor` fills. */\n children?: React.ReactNode;\n /** Alias for `children`. When both are provided, `children` wins. */\n icon?: React.ReactNode;\n /** When provided, the container gets `role=\"img\"` and this label, making a standalone icon accessible. Omit for decorative icons (the container is `aria-hidden` automatically). */\n \"aria-label\"?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,IAAAC,4BAA4B;AAC5B,6BAAgB;AAChB,sCAAwB;AACxB,mCAAyB;AACzB,iCAA6D;;;ACL7D,+BAA4B;AAC5B,2BAA8B;AAC9B,sCAAuB;AAGvB,IAAM,QAA2C;AAAA,EAC/C,MAAM;AAAA;AAAA,EAGN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AACT;AAEA,IAAM,gBAAgB,CAAC,gBAAwB,eAAwB;AAAA,iBACtD,cAAc;AAAA;AAAA;AAAA;AAAA,cAIjB,cAAc;AAAA;AAAA;AAAA;AAAA,IAIxB,cACF;AAAA;AAAA;AAAA,eAGa,cAAc;AAAA;AAAA,GAE1B;AA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":["Icon_default","import_styled_components","styled","PartnerLogoNames","PartnerLogo","styled","Box","React","React","import_styled_components","import_seeds_react_system_props","Container","styled","styles_default","import_jsx_runtime","Icon","styles_default","Icon_default","React"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/Icon.tsx","../src/IconHybrid.tsx","../src/styles.ts","../src/IconTailwind.tsx","../src/iconShared.tsx","../src/IconTypes.ts","../src/v2/Icon.tsx","../src/v2/styles.ts","../src/v2/IconTypes.ts"],"sourcesContent":["import Icon from \"./Icon\";\n\nexport default Icon;\nexport { Icon };\nexport { default as IconContainer } from \"./styles\";\nexport * from \"./IconTypes\";\n\n// Icon v2 exports (structural SVG wrapper; distinct API from v1)\nexport { default as IconV2 } from \"./v2\";\nexport type { TypeIconV2Props, TypeIconV2Size } from \"./v2\";\n","import * as React from \"react\";\nimport styled, { css } from \"styled-components\";\nimport Box from \"@sproutsocial/seeds-react-box\";\n\nimport type { TypeIconProps, TypeToggleProps } from \"./IconTypes\";\nimport IconHybrid from \"./IconHybrid\";\n\n/**\n * Icon. Automatically routes between the Tailwind implementation (preferred, for\n * bare icons) and the styled-components implementation (for consumers using\n * `color` tokens, system props, or a styled() extension). The routing logic and\n * shared name/variant/aria/svg handling live in IconHybrid / iconShared.\n */\nconst Icon = (props: TypeIconProps) => <IconHybrid {...props} />;\n\nconst ToggleableIcon = styled(Icon)<{ active: boolean }>`\n transition: all ${(p) => p.theme.duration.fast} linear;\n\n ${(p) =>\n p.active &&\n css`\n opacity: 1;\n transform: scale(1);\n `}\n\n ${(p) =>\n !p.active &&\n css`\n position: absolute;\n opacity: 0;\n transform: scale(0);\n `}\n`;\n\nconst IconToggle = ({\n activeName,\n inactiveName,\n isActive,\n size = \"small\",\n fixedWidth = false,\n ariaLabel,\n ...rest\n}: TypeToggleProps) => {\n return (\n <Box as=\"span\" position=\"relative\" display=\"inline-flex\" {...rest}>\n <ToggleableIcon\n active={isActive}\n name={activeName}\n size={size}\n fixedWidth={fixedWidth}\n aria-hidden={!isActive}\n aria-label={!isActive ? undefined : ariaLabel}\n />\n <ToggleableIcon\n active={!isActive}\n name={inactiveName}\n size={size}\n fixedWidth={fixedWidth}\n aria-hidden={isActive}\n aria-label={isActive ? ariaLabel : undefined}\n />\n </Box>\n );\n};\n\nIconToggle.displayName = \"Icon.Toggle\";\n/**\n * **Accessibility note:** It is best practice to wrap `<Icon.Toggle />` in a button. The button must include `aria-label` and `aria-pressed` in order for a screen reader to properly communicate the icon's state. See example below.\n *\n * @link https://www.w3.org/TR/wai-aria-practices-1.1/#button\n * @example\n * const [toggleState, setToggleState] = useState(false);\n * <Button // Wrap Icon.Toggle with Button\n * appearance='pill'\n * aria-label='like' // required for accessibility\n * aria-pressed={toggleState} // required for accessibility\n * onClick={() => setToggleState(!toggleState)}\n * >\n * <Icon.Toggle\n * activeName=\"heart-solid\"\n * inactiveName=\"heart-outline\"\n * isActive={toggleState}\n * />\n * </Button>\n */\nIcon.Toggle = IconToggle;\n\nexport default Icon;\n","/**\n * Hybrid Icon component.\n * Automatically chooses between the Tailwind (pure CSS-class) render path and the\n * styled-components path based on props, preserving 100% backward compatibility:\n *\n * - `color` tokens (e.g. \"icon.base\"), styled-system props (margins, layout),\n * a styled() extension (theme/forwardedComponent), or an injected `sc-*`\n * className all route to the styled-components Container.\n * - bare icons (name + size + fixedWidth, no system props) render via the\n * lighter Tailwind <span>.\n *\n * Name/variant resolution, viewBox lookup, aria handling, and the <svg> markup\n * are shared with the styled-components path via iconShared.tsx.\n */\nimport * as React from \"react\";\nimport PartnerLogo from \"@sproutsocial/seeds-react-partner-logo\";\nimport { includes } from \"@sproutsocial/seeds-react-utilities\";\nimport { LogoNamesWithoutVariants as PartnerLogoNames } from \"@sproutsocial/seeds-partner-logos\";\nimport { needsStyledComponents } from \"@sproutsocial/seeds-react-system-props\";\n\nimport type { TypeIconProps } from \"./IconTypes\";\nimport Container from \"./styles\";\nimport { IconTailwind } from \"./IconTailwind\";\nimport {\n AllViewboxes,\n resolveIconName,\n getAriaProps,\n IconSvg,\n} from \"./iconShared\";\n\n// Matches the generated styled-components class (e.g. \"sc-bdVaJa\"). A styled(Icon)\n// extension injects such a class; routing it to the styled path keeps its\n// generated styles (and avoids leaking `theme`/custom props onto the DOM span).\nconst SC_CLASS_PATTERN = /\\bsc-[a-zA-Z0-9]+\\b/;\n\nconst IconHybrid = ({\n name,\n size = \"small\",\n fixedWidth = false,\n ariaLabel,\n color,\n svgProps,\n ...rest\n}: TypeIconProps) => {\n if (includes(PartnerLogoNames, name)) {\n // Icon's \"default\" size is equivalent to PartnerLogo's \"small\" size\n const logoSize = size === \"default\" ? \"small\" : size;\n const logoProps = {\n partnerName: name,\n size: logoSize,\n logoType: \"symbol\" as const,\n svgProps,\n };\n return (\n <PartnerLogo\n // ariaLabel needs to be overridable by aria-label prop in ...rest\n aria-label={ariaLabel}\n {...rest}\n {...logoProps}\n />\n );\n }\n\n const iconName = resolveIconName(name, size);\n const iconViewBox = AllViewboxes[iconName];\n\n const { \"aria-label\": ariaLabelFromRest, ...restWithoutAriaLabel } =\n rest as Record<string, any>;\n const { containerAriaProps, svgAriaProps } = getAriaProps(\n ariaLabel,\n ariaLabelFromRest\n );\n\n const svg = (\n <IconSvg\n iconName={iconName}\n iconViewBox={iconViewBox}\n svgProps={svgProps}\n svgAriaProps={svgAriaProps}\n />\n );\n\n // Route to styled-components whenever backward compatibility requires it.\n // `color` is destructured out of `rest`, so it must be checked explicitly —\n // the Tailwind path only does `fill: currentColor` and cannot resolve a token\n // like \"icon.base\".\n // `cursor` is a public Icon prop applied by the legacy Container via the\n // COMMON mixin, but is not in STYLED_SYSTEM_PROPS, so `needsStyledComponents`\n // does not catch it. Gate it explicitly (like `color`) so it keeps routing to\n // SC instead of leaking onto the Tailwind span as an invalid DOM attribute.\n // It is read (not destructured) off `restWithoutAriaLabel` so it still spreads\n // onto Container below.\n const className = restWithoutAriaLabel.className;\n const needsSC =\n color !== undefined ||\n restWithoutAriaLabel.cursor !== undefined ||\n needsStyledComponents(restWithoutAriaLabel) ||\n (typeof className === \"string\" && SC_CLASS_PATTERN.test(className));\n\n if (needsSC) {\n return (\n <Container\n iconSize={size}\n fixedWidth={!!fixedWidth}\n key={iconName}\n data-qa-icon={iconName}\n color={color as React.ComponentProps<typeof Container>[\"color\"]}\n {...restWithoutAriaLabel}\n {...containerAriaProps}\n >\n {svg}\n </Container>\n );\n }\n\n return (\n <IconTailwind\n size={size}\n fixedWidth={!!fixedWidth}\n key={iconName}\n data-qa-icon={iconName}\n {...restWithoutAriaLabel}\n {...containerAriaProps}\n >\n {svg}\n </IconTailwind>\n );\n};\n\nIconHybrid.displayName = \"Icon\";\nexport default IconHybrid;\n","import styled, { css } from \"styled-components\";\nimport { verticalAlign } from \"styled-system\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeIconSize } from \"./IconTypes\";\n\nconst sizes: { [key in TypeIconSize]: string } = {\n mini: \"12px\",\n\n /** TODO: deprecate default in favor of small in future release */\n default: \"16px\",\n small: \"16px\",\n medium: \"24px\",\n large: \"32px\",\n jumbo: \"64px\",\n};\n\nconst stylesForSize = (iconActualSize: string, fixedWidth: boolean) => css`\n line-height: ${iconActualSize};\n\n &,\n .Icon-svg {\n height: ${iconActualSize};\n fill: currentColor;\n }\n\n ${fixedWidth &&\n `\n &,\n & .Icon-svg {\n width: ${iconActualSize}\n }\n `}\n`;\n\nconst Container = styled.span.attrs({\n className: \"Icon\",\n})<{\n iconSize: TypeIconSize;\n fixedWidth: boolean;\n}>`\n display: inline-block;\n color: inherit;\n vertical-align: middle;\n\n ${(props) => stylesForSize(sizes[props.iconSize], props.fixedWidth)}\n\n ${COMMON}\n ${verticalAlign}\n`;\nexport default Container;\n","/**\n * Tailwind/CSS-class implementation of the Icon container.\n * Uses the Seeds icon CSS classes from icon.css. Presentational only: it applies\n * the `.Icon`/`.seeds-icon` classes and the `--icon-size` custom property, then\n * renders the precomputed <svg> (passed as children). All name/variant/aria\n * logic lives in iconShared.tsx and IconHybrid.tsx.\n */\nimport React from \"react\";\nimport type { TypeIconSize } from \"./IconTypes\";\n\n// Utility for merging class names properly.\n// Mirror of the local helper in ButtonTailwind.tsx — `cn` is NOT exported from\n// @sproutsocial/seeds-react-utilities, so it is duplicated here intentionally.\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\n// Pixel lookup driving --icon-size. Mirrors `sizes` in styles.ts (kept local so\n// styles.ts stays untouched for the legacy styled-components path).\nconst sizeMap: { [key in TypeIconSize]: string } = {\n mini: \"12px\",\n\n /** TODO: deprecate default in favor of small in future release */\n default: \"16px\",\n small: \"16px\",\n medium: \"24px\",\n large: \"32px\",\n jumbo: \"64px\",\n};\n\ntype TypeIconTailwindProps = {\n size: TypeIconSize;\n fixedWidth: boolean;\n className?: string;\n children: React.ReactNode;\n} & Omit<React.ComponentPropsWithoutRef<\"span\">, \"color\">;\n\nexport const IconTailwind = ({\n size,\n fixedWidth,\n className,\n children,\n ...rest\n}: TypeIconTailwindProps) => {\n // \"Icon\" preserves downstream descendant selectors (e.g. `.Icon` in\n // seeds-react-switch / seeds-react-data-viz) that the styled-components\n // Container added via .attrs({ className: \"Icon\" }).\n const classes = cn(\n \"Icon\",\n \"seeds-icon\",\n { \"seeds-icon-fixed-width\": fixedWidth },\n className\n );\n\n return (\n <span\n {...rest}\n className={classes}\n style={\n {\n ...rest.style,\n \"--icon-size\": sizeMap[size],\n } as React.CSSProperties\n }\n >\n {children}\n </span>\n );\n};\n\nIconTailwind.displayName = \"IconTailwind\";\n","/**\n * Shared, non-styling Icon logic used by BOTH render paths (the styled-components\n * Container path and the Tailwind <span> path). Factoring this out keeps the two\n * paths from diverging: name/variant resolution, viewBox lookup, aria handling,\n * and the <svg> markup live here once.\n *\n * Not part of the public export surface (not re-exported from index.ts).\n */\nimport * as React from \"react\";\nimport { includes } from \"@sproutsocial/seeds-react-utilities\";\nimport {\n AiViewBoxes,\n ExternalViewBoxes,\n GeneralViewBoxes,\n SproutViewBoxes,\n ExternalIconNames,\n type EnumIconSvgNames,\n type EnumIconNamesWithoutVariants,\n} from \"@sproutsocial/seeds-icons\";\nimport type { TypeIconName, TypeIconSize } from \"./IconTypes\";\n\nexport const AllViewboxes = {\n ...AiViewBoxes,\n ...ExternalViewBoxes,\n ...GeneralViewBoxes,\n ...SproutViewBoxes,\n};\n\n/**\n * Resolve a bare icon name to its concrete svg-sprite name by applying the\n * default variant (`solid` for `mini`, `outline` otherwise) unless the name is\n * already variant-suffixed or is an external icon. Matches the original\n * Icon.tsx resolution exactly.\n */\nexport function resolveIconName(\n name: TypeIconName,\n size: TypeIconSize\n): EnumIconSvgNames {\n const defaultVariant = size === \"mini\" ? \"solid\" : \"outline\";\n return !name?.endsWith(\"-outline\") &&\n !name?.endsWith(\"-solid\") &&\n !includes(ExternalIconNames, name)\n ? // then add default variant\n (`${\n name as EnumIconNamesWithoutVariants\n }-${defaultVariant}` as EnumIconSvgNames)\n : // else use name as is\n (name as EnumIconSvgNames);\n}\n\n/**\n * Compute the aria attributes for the container and the svg. When an aria-label\n * is present (via the `ariaLabel` prop or a spread `aria-label`), the svg gets\n * role=\"img\" + aria-label and the container is left visible; otherwise the\n * container is marked aria-hidden. Matches the original Icon.tsx behavior.\n */\nexport function getAriaProps(ariaLabel?: string, ariaLabelFromRest?: string) {\n const hasAriaLabel = !!ariaLabel || !!ariaLabelFromRest;\n const containerAriaProps = hasAriaLabel\n ? {}\n : { \"aria-hidden\": \"true\" as const };\n const svgAriaProps = hasAriaLabel\n ? { role: \"img\" as const, \"aria-label\": ariaLabel ?? ariaLabelFromRest }\n : {};\n return { containerAriaProps, svgAriaProps };\n}\n\n/**\n * The icon <svg> markup, identical for both render paths. `svgAriaProps` is\n * spread last so aria attributes win over any `svgProps` (matching the original\n * Icon.tsx spread order).\n */\nexport const IconSvg = ({\n iconName,\n iconViewBox,\n svgProps,\n svgAriaProps,\n}: {\n iconName: string;\n iconViewBox?: string;\n svgProps?: React.ComponentPropsWithoutRef<\"svg\">;\n svgAriaProps: React.ComponentPropsWithoutRef<\"svg\">;\n}) => (\n <svg\n className=\"Icon-svg\"\n viewBox={iconViewBox}\n focusable={false}\n data-qa-icon-svg={`${iconName}-svg`}\n {...svgProps}\n {...svgAriaProps}\n >\n <use\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n xlinkHref={`#seeds-svgs_${iconName}`}\n />\n </svg>\n);\n","import * as React from \"react\";\nimport type { EnumIconNames } from \"@sproutsocial/seeds-icons\";\nimport type { EnumLogoNamesWithoutVariants } from \"@sproutsocial/seeds-partner-logos\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\n\nexport type TypeIconName = EnumIconNames | EnumLogoNamesWithoutVariants;\n\nexport type TypeIconSize =\n | \"mini\" // 12x12\n // TODO: deprecate default in favor of small in future release\n | \"default\" // 16x16\n | \"small\" // 16x16\n | \"medium\" // 24x24\n | \"large\" // 32x32\n | \"jumbo\"; // 64x64\n\nexport interface TypeIconProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<React.ComponentPropsWithoutRef<\"span\">, \"color\"> {\n /** Name of the icon in the svg sprite */\n name: TypeIconName;\n size?: TypeIconSize;\n /** Whether the icon should have a fixed width or not. Use this when you need to align icons/text vertically in a list. */\n fixedWidth?: boolean;\n /** Label used to describe the icon if not used with an accompanying visual label */\n ariaLabel?: string;\n svgProps?: React.ComponentPropsWithoutRef<\"svg\">;\n}\n\nexport interface TypeToggleProps extends TypeBoxProps {\n /** Name of the icon to be shown in the active state */\n activeName: TypeIconName;\n /** Name of the icon to be shown in the inactive state */\n inactiveName: TypeIconName;\n /** Whether the active icon should be shown or not */\n isActive: boolean;\n /** The size of the icon. `small` is the default */\n size?: TypeIconSize;\n fixedWidth?: boolean;\n ariaLabel?: string;\n}\n","import * as React from \"react\";\nimport Container from \"./styles\";\nimport type { TypeIconV2Props } from \"./IconTypes\";\n\n/**\n * **Icon (v2)** — a structural wrapper that centers a caller-supplied SVG inside a\n * fixed-size container, slightly larger than the icon to give it breathing room\n * (a buffer against focus rings, hover backgrounds, and button padding).\n *\n * The caller passes the SVG directly via `children` (or the `icon` alias). The SVG\n * should use `viewBox=\"0 0 24 24\"` and `currentColor` fills — the component controls\n * only the rendered width/height and centering, never the viewBox or path-level fills.\n *\n * Sizes:\n * - `default` — 24×24px container, icon renders at 18×18px\n * - `small` — 20×20px container, icon renders at 15×15px\n *\n * Accessibility: decorative by default (`aria-hidden`). Pass `aria-label` to expose a\n * standalone icon — the container then gets `role=\"img\"` and the label.\n *\n * @example\n * <Icon aria-label=\"Settings\"><MySvg /></Icon>\n */\nconst Icon = React.forwardRef<HTMLSpanElement, TypeIconV2Props>(\n (\n { size = \"default\", children, icon, \"aria-label\": ariaLabel, ...rest },\n ref\n ) => {\n const content = children ?? icon;\n const ariaProps = ariaLabel\n ? { role: \"img\" as const, \"aria-label\": ariaLabel }\n : { \"aria-hidden\": true };\n\n return (\n <Container\n ref={ref}\n iconSize={size}\n data-qa-icon-v2={size}\n {...ariaProps}\n {...rest}\n >\n {content}\n </Container>\n );\n }\n);\n\nIcon.displayName = \"IconV2\";\n\nexport default Icon;\n","import styled from \"styled-components\";\nimport {\n COMMON,\n FLEXBOX,\n LAYOUT,\n} from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeIconV2Size } from \"./IconTypes\";\n\nconst dimensions: {\n [key in TypeIconV2Size]: { container: string; icon: string };\n} = {\n default: { container: \"24px\", icon: \"18px\" },\n small: { container: \"20px\", icon: \"15px\" },\n};\n\n/**\n * Structural, non-semantic container that centers a caller-supplied SVG inside a\n * fixed-size box (slightly larger than the icon, for breathing room). The child\n * `svg` is sized via CSS to the icon dimensions and inherits color through\n * `currentColor` — no background or border.\n */\nconst Container = styled.span<{\n iconSize: TypeIconV2Size;\n}>`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n color: inherit;\n width: ${(props) => dimensions[props.iconSize].container};\n height: ${(props) => dimensions[props.iconSize].container};\n\n & > svg {\n width: ${(props) => dimensions[props.iconSize].icon};\n height: ${(props) => dimensions[props.iconSize].icon};\n flex-shrink: 0;\n fill: currentColor;\n }\n\n ${COMMON}\n ${FLEXBOX}\n ${LAYOUT}\n`;\n\nexport default Container;\n","import * as React from \"react\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\nexport type TypeIconV2Size =\n | \"default\" // 24x24 container, 18x18 icon\n | \"small\"; // 20x20 container, 15x15 icon\n\nexport interface TypeIconV2Props\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<React.ComponentPropsWithoutRef<\"span\">, \"color\"> {\n /** Container/icon size variant. Defaults to `\"default\"` (24px container, 18px icon). */\n size?: TypeIconV2Size;\n /** The SVG element to render inside the container. Should use `viewBox=\"0 0 24 24\"` and `currentColor` fills. */\n children?: React.ReactNode;\n /** Alias for `children`. When both are provided, `children` wins. */\n icon?: React.ReactNode;\n /** When provided, the container gets `role=\"img\"` and this label, making a standalone icon accessible. Omit for decorative icons (the container is `aria-hidden` automatically). */\n \"aria-label\"?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA,IAAAC,SAAuB;AACvB,IAAAC,4BAA4B;AAC5B,6BAAgB;;;ACYhB,IAAAC,SAAuB;AACvB,sCAAwB;AACxB,IAAAC,gCAAyB;AACzB,iCAA6D;AAC7D,IAAAC,mCAAsC;;;AClBtC,+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AW,QAAQ,MAAM,OAAO;AAAA,EAC3C,OAAO,EAAE,WAAW,QAAQ,MAAM,OAAO;AAC3C;AAQA,IAAMC,aAAY,0BAAAC,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAQd,CAAC,UAAU,WAAW,MAAM,QAAQ,EAAE,SAAS;AAAA,YAC9C,CAAC,UAAU,WAAW,MAAM,QAAQ,EAAE,SAAS;AAAA;AAAA;AAAA,aAG9C,CAAC,UAAU,WAAW,MAAM,QAAQ,EAAE,IAAI;AAAA,cACzC,CAAC,UAAU,WAAW,MAAM,QAAQ,EAAE,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,IAKpD,uCAAM;AAAA,IACN,wCAAO;AAAA,IACP,uCAAM;AAAA;AAGV,IAAOC,kBAAQF;;;ADVT,IAAAG,sBAAA;AAXN,IAAMC,QAAa;AAAA,EACjB,CACE,EAAE,OAAO,WAAW,UAAU,MAAM,cAAc,WAAW,GAAG,KAAK,GACrE,QACG;AACH,UAAM,UAAU,YAAY;AAC5B,UAAM,YAAY,YACd,EAAE,MAAM,OAAgB,cAAc,UAAU,IAChD,EAAE,eAAe,KAAK;AAE1B,WACE;AAAA,MAACC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,UAAU;AAAA,QACV,mBAAiB;AAAA,QAChB,GAAG;AAAA,QACH,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEAD,MAAK,cAAc;AAEnB,IAAOE,gBAAQF;;;AEjDf,IAAAG,SAAuB;;;ATEvB,IAAO,cAAQ;","names":["Icon_default","React","import_styled_components","React","import_seeds_react_utilities","import_seeds_react_system_props","styled","React","import_jsx_runtime","import_jsx_runtime","PartnerLogoNames","PartnerLogo","import_jsx_runtime","styled","Box","React","React","import_styled_components","import_seeds_react_system_props","Container","styled","styles_default","import_jsx_runtime","Icon","styles_default","Icon_default","React"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sproutsocial/seeds-react-icon",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.4",
|
|
4
4
|
"description": "Seeds React Icon component",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"types": "./dist/v2/index.d.ts",
|
|
16
16
|
"import": "./dist/esm/v2/index.js",
|
|
17
17
|
"require": "./dist/v2/index.js"
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
|
+
"./dist/icon.css": "./dist/icon.css"
|
|
19
20
|
},
|
|
20
21
|
"author": "Sprout Social, Inc.",
|
|
21
22
|
"license": "MIT",
|
|
@@ -23,8 +24,8 @@
|
|
|
23
24
|
"dist"
|
|
24
25
|
],
|
|
25
26
|
"scripts": {
|
|
26
|
-
"build": "tsup --dts",
|
|
27
|
-
"build:debug": "tsup --dts --metafile",
|
|
27
|
+
"build": "tsup --dts && cp src/icon.css dist/icon.css",
|
|
28
|
+
"build:debug": "tsup --dts --metafile && cp src/icon.css dist/icon.css",
|
|
28
29
|
"dev": "tsup --watch --dts",
|
|
29
30
|
"clean": "rm -rf .turbo dist",
|
|
30
31
|
"clean:modules": "rm -rf node_modules",
|
|
@@ -33,10 +34,10 @@
|
|
|
33
34
|
"test:watch": "jest --watch --coverage=false"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@sproutsocial/seeds-react-box": "^1.1.
|
|
37
|
-
"@sproutsocial/seeds-react-partner-logo": "^1.7.
|
|
38
|
-
"@sproutsocial/seeds-react-system-props": "^3.1.
|
|
39
|
-
"@sproutsocial/seeds-react-theme": "^4.2.
|
|
37
|
+
"@sproutsocial/seeds-react-box": "^1.1.25",
|
|
38
|
+
"@sproutsocial/seeds-react-partner-logo": "^1.7.17",
|
|
39
|
+
"@sproutsocial/seeds-react-system-props": "^3.1.2",
|
|
40
|
+
"@sproutsocial/seeds-react-theme": "^4.2.1",
|
|
40
41
|
"@sproutsocial/seeds-react-utilities": "^4.0.1",
|
|
41
42
|
"styled-system": "^5.1.5"
|
|
42
43
|
},
|