@sproutsocial/seeds-react-indicator 1.0.42 → 1.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +67 -11
- package/CHANGELOG.md +18 -0
- package/dist/esm/index.js +62 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +64 -6
- package/dist/index.js.map +1 -1
- package/dist/indicator.css +36 -0
- package/package.json +15 -7
- package/src/Indicator.tsx +9 -16
- package/src/IndicatorHybrid.tsx +36 -0
- package/src/IndicatorTailwind.tsx +53 -0
- package/src/__tests__/features.test.tsx +24 -1
- package/src/indicator.css +36 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
yarn run v1.22.22
|
|
2
|
-
$ tsup --dts
|
|
2
|
+
$ tsup --dts && cp src/indicator.css dist/indicator.css
|
|
3
|
+
▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json]
|
|
4
|
+
|
|
5
|
+
package.json:14:6:
|
|
6
|
+
14 │ "types": "./dist/index.d.ts"
|
|
7
|
+
╵ ~~~~~~~
|
|
8
|
+
|
|
9
|
+
The "import" condition comes earlier and will be used for all "import" statements:
|
|
10
|
+
|
|
11
|
+
package.json:12:6:
|
|
12
|
+
12 │ "import": "./dist/esm/index.js",
|
|
13
|
+
╵ ~~~~~~~~
|
|
14
|
+
|
|
15
|
+
The "require" condition comes earlier and will be used for all "require" calls:
|
|
16
|
+
|
|
17
|
+
package.json:13:6:
|
|
18
|
+
13 │ "require": "./dist/index.js",
|
|
19
|
+
╵ ~~~~~~~~~
|
|
20
|
+
|
|
3
21
|
[34mCLI[39m Building entry: src/index.ts
|
|
4
22
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
5
23
|
[34mCLI[39m tsup v8.5.0
|
|
@@ -8,14 +26,52 @@ $ tsup --dts
|
|
|
8
26
|
[34mCLI[39m Cleaning output folder
|
|
9
27
|
[34mCJS[39m Build start
|
|
10
28
|
[34mESM[39m Build start
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
|
|
29
|
+
[warn] [33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mThe condition "types" here will never be used as it comes after both "import" and "require"[0m [package.json]
|
|
30
|
+
|
|
31
|
+
package.json:14:6:
|
|
32
|
+
[37m 14 │ [32m"types"[37m: "./dist/index.d.ts"
|
|
33
|
+
╵ [32m~~~~~~~[0m
|
|
34
|
+
|
|
35
|
+
The "import" condition comes earlier and will be used for all "import" statements:
|
|
36
|
+
|
|
37
|
+
package.json:12:6:
|
|
38
|
+
[37m 12 │ [32m"import"[37m: "./dist/esm/index.js",
|
|
39
|
+
╵ [32m~~~~~~~~[0m
|
|
40
|
+
|
|
41
|
+
The "require" condition comes earlier and will be used for all "require" calls:
|
|
42
|
+
|
|
43
|
+
package.json:13:6:
|
|
44
|
+
[37m 13 │ [32m"require"[37m: "./dist/index.js",
|
|
45
|
+
╵ [32m~~~~~~~~~[0m
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
[warn] [33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mThe condition "types" here will never be used as it comes after both "import" and "require"[0m [package.json]
|
|
49
|
+
|
|
50
|
+
package.json:14:6:
|
|
51
|
+
[37m 14 │ [32m"types"[37m: "./dist/index.d.ts"
|
|
52
|
+
╵ [32m~~~~~~~[0m
|
|
53
|
+
|
|
54
|
+
The "import" condition comes earlier and will be used for all "import" statements:
|
|
55
|
+
|
|
56
|
+
package.json:12:6:
|
|
57
|
+
[37m 12 │ [32m"import"[37m: "./dist/esm/index.js",
|
|
58
|
+
╵ [32m~~~~~~~~[0m
|
|
59
|
+
|
|
60
|
+
The "require" condition comes earlier and will be used for all "require" calls:
|
|
61
|
+
|
|
62
|
+
package.json:13:6:
|
|
63
|
+
[37m 13 │ [32m"require"[37m: "./dist/index.js",
|
|
64
|
+
╵ [32m~~~~~~~~~[0m
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
[32mCJS[39m [1mdist/index.js [22m[32m5.08 KB[39m
|
|
68
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m6.11 KB[39m
|
|
69
|
+
[32mCJS[39m ⚡️ Build success in 18ms
|
|
70
|
+
[32mESM[39m [1mdist/esm/index.js [22m[32m2.93 KB[39m
|
|
71
|
+
[32mESM[39m [1mdist/esm/index.js.map [22m[32m5.98 KB[39m
|
|
72
|
+
[32mESM[39m ⚡️ Build success in 19ms
|
|
17
73
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
21
|
-
Done in
|
|
74
|
+
[32mDTS[39m ⚡️ Build success in 6693ms
|
|
75
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m739.00 B[39m
|
|
76
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m739.00 B[39m
|
|
77
|
+
Done in 8.18s.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @sproutsocial/seeds-react-indicator
|
|
2
2
|
|
|
3
|
+
## 1.0.44
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [d21ae54]
|
|
8
|
+
- @sproutsocial/seeds-react-theme@4.2.1
|
|
9
|
+
- @sproutsocial/seeds-react-icon@2.4.4
|
|
10
|
+
- @sproutsocial/seeds-react-mixins@4.3.10
|
|
11
|
+
|
|
12
|
+
## 1.0.43
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [917a951]
|
|
17
|
+
- Updated dependencies [6611f6a]
|
|
18
|
+
- @sproutsocial/seeds-react-icon@2.4.3
|
|
19
|
+
- @sproutsocial/seeds-react-system-props@3.1.2
|
|
20
|
+
|
|
3
21
|
## 1.0.42
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// src/Indicator.tsx
|
|
2
2
|
import "react";
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
// src/IndicatorHybrid.tsx
|
|
5
|
+
import "react";
|
|
6
|
+
import Icon2 from "@sproutsocial/seeds-react-icon";
|
|
4
7
|
|
|
5
8
|
// src/styles.ts
|
|
6
9
|
import styled from "styled-components";
|
|
@@ -28,12 +31,35 @@ var Container = styled.span.attrs({
|
|
|
28
31
|
`;
|
|
29
32
|
var styles_default = Container;
|
|
30
33
|
|
|
31
|
-
// src/
|
|
34
|
+
// src/IndicatorTailwind.tsx
|
|
35
|
+
import "react";
|
|
36
|
+
import Icon from "@sproutsocial/seeds-react-icon";
|
|
32
37
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
33
|
-
|
|
38
|
+
function cn(...inputs) {
|
|
39
|
+
const classes = [];
|
|
40
|
+
for (const input of inputs) {
|
|
41
|
+
if (!input) continue;
|
|
42
|
+
if (typeof input === "string") {
|
|
43
|
+
classes.push(input);
|
|
44
|
+
} else if (typeof input === "object") {
|
|
45
|
+
for (const [key, value] of Object.entries(input)) {
|
|
46
|
+
if (value) {
|
|
47
|
+
classes.push(key);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return classes.join(" ");
|
|
53
|
+
}
|
|
54
|
+
var IndicatorTailwind = ({
|
|
55
|
+
tooltip = "",
|
|
56
|
+
className,
|
|
57
|
+
...rest
|
|
58
|
+
}) => {
|
|
34
59
|
return /* @__PURE__ */ jsxs(
|
|
35
|
-
|
|
60
|
+
"span",
|
|
36
61
|
{
|
|
62
|
+
className: cn("Indicator", "seeds-indicator", className),
|
|
37
63
|
"data-tip": tooltip,
|
|
38
64
|
"data-qa-indicator": "",
|
|
39
65
|
"aria-label": tooltip,
|
|
@@ -46,6 +72,38 @@ var Indicator = ({ tooltip = "", ...rest }) => {
|
|
|
46
72
|
}
|
|
47
73
|
);
|
|
48
74
|
};
|
|
75
|
+
IndicatorTailwind.displayName = "IndicatorTailwind";
|
|
76
|
+
|
|
77
|
+
// src/IndicatorHybrid.tsx
|
|
78
|
+
import { hasStyledProps } from "@sproutsocial/seeds-react-system-props";
|
|
79
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
80
|
+
var IndicatorHybrid = ({
|
|
81
|
+
tooltip = "",
|
|
82
|
+
...rest
|
|
83
|
+
}) => {
|
|
84
|
+
if (hasStyledProps(rest)) {
|
|
85
|
+
return /* @__PURE__ */ jsxs2(
|
|
86
|
+
styles_default,
|
|
87
|
+
{
|
|
88
|
+
"data-tip": tooltip,
|
|
89
|
+
"data-qa-indicator": "",
|
|
90
|
+
"aria-label": tooltip,
|
|
91
|
+
tabIndex: 0,
|
|
92
|
+
...rest,
|
|
93
|
+
children: [
|
|
94
|
+
tooltip && /* @__PURE__ */ jsx2("div", { children: tooltip }),
|
|
95
|
+
/* @__PURE__ */ jsx2(Icon2, { name: "circle-fill-solid", size: "mini", "aria-hidden": true })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
return /* @__PURE__ */ jsx2(IndicatorTailwind, { tooltip, ...rest });
|
|
101
|
+
};
|
|
102
|
+
IndicatorHybrid.displayName = "Indicator";
|
|
103
|
+
|
|
104
|
+
// src/Indicator.tsx
|
|
105
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
106
|
+
var Indicator = (props) => /* @__PURE__ */ jsx3(IndicatorHybrid, { ...props });
|
|
49
107
|
|
|
50
108
|
// src/IndicatorTypes.ts
|
|
51
109
|
import "react";
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Indicator.tsx","../../src/styles.ts","../../src/IndicatorTypes.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Container from \"./styles\";\nimport type { TypeIndicatorProps } from \"./IndicatorTypes\";\n\nexport const
|
|
1
|
+
{"version":3,"sources":["../../src/Indicator.tsx","../../src/IndicatorHybrid.tsx","../../src/styles.ts","../../src/IndicatorTailwind.tsx","../../src/IndicatorTypes.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport { IndicatorHybrid } from \"./IndicatorHybrid\";\nimport type { TypeIndicatorProps } from \"./IndicatorTypes\";\n\n/**\n * Indicator component. Automatically routes between the Tailwind\n * implementation (preferred) and the styled-components implementation (for\n * consumers using system props or styled() extension).\n */\nexport const Indicator = (props: TypeIndicatorProps) => (\n <IndicatorHybrid {...props} />\n);\n","/**\n * Hybrid Indicator Component\n * Automatically chooses between Tailwind and styled-components based on props\n */\n\nimport * as React from \"react\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Container from \"./styles\"; // Styled-components version\nimport { IndicatorTailwind } from \"./IndicatorTailwind\"; // Tailwind version\nimport { hasStyledProps } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeIndicatorProps } from \"./IndicatorTypes\";\n\nexport const IndicatorHybrid = ({\n tooltip = \"\",\n ...rest\n}: TypeIndicatorProps) => {\n if (hasStyledProps(rest)) {\n return (\n <Container\n data-tip={tooltip}\n data-qa-indicator=\"\"\n aria-label={tooltip}\n tabIndex={0}\n {...rest}\n >\n {tooltip && <div>{tooltip}</div>}\n <Icon name=\"circle-fill-solid\" size=\"mini\" aria-hidden />\n </Container>\n );\n }\n\n // Use Tailwind version (preferred - better performance)\n return <IndicatorTailwind tooltip={tooltip} {...rest} />;\n};\n\nIndicatorHybrid.displayName = \"Indicator\";\n","import styled from \"styled-components\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport { visuallyHidden } from \"@sproutsocial/seeds-react-mixins\";\n\nconst Container = styled.span.attrs({\n className: \"Indicator\",\n})`\n position: relative;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n width: ${(props) => props.theme.space[400]};\n height: ${(props) => props.theme.space[400]};\n font-size: 10px;\n line-height: 0;\n color: ${(props) => props.color ?? props.theme.colors.icon.info};\n text-align: center;\n\n > div {\n ${visuallyHidden}\n }\n\n ${COMMON}\n`;\n\nexport default Container;\n","/**\n * Tailwind CSS implementation of Indicator component\n * Uses Seeds indicator CSS classes from indicator.css\n */\n\nimport * as React from \"react\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport type { TypeIndicatorProps } from \"./IndicatorTypes\";\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 IndicatorTailwind = ({\n tooltip = \"\",\n className,\n ...rest\n}: TypeIndicatorProps) => {\n return (\n <span\n className={cn(\"Indicator\", \"seeds-indicator\", className)}\n data-tip={tooltip}\n data-qa-indicator=\"\"\n aria-label={tooltip}\n tabIndex={0}\n {...(rest as React.ComponentPropsWithoutRef<\"span\">)}\n >\n {tooltip && <div>{tooltip}</div>}\n <Icon name=\"circle-fill-solid\" size=\"mini\" aria-hidden />\n </span>\n );\n};\n\nIndicatorTailwind.displayName = \"IndicatorTailwind\";\n","import * as React from \"react\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\nexport interface TypeIndicatorProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<React.ComponentPropsWithoutRef<\"span\">, \"color\"> {\n tooltip?: string;\n}\n","import { Indicator } from \"./Indicator\";\n\nexport default Indicator;\nexport { Indicator };\nexport * from \"./IndicatorTypes\";\n"],"mappings":";AAAA,OAAuB;;;ACKvB,OAAuB;AACvB,OAAOA,WAAU;;;ACNjB,OAAO,YAAY;AACnB,SAAS,cAAc;AACvB,SAAS,sBAAsB;AAE/B,IAAM,YAAY,OAAO,KAAK,MAAM;AAAA,EAClC,WAAW;AACb,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,WAKU,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA,YAChC,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA;AAAA;AAAA,WAGlC,CAAC,UAAU,MAAM,SAAS,MAAM,MAAM,OAAO,KAAK,IAAI;AAAA;AAAA;AAAA;AAAA,MAI3D,cAAc;AAAA;AAAA;AAAA,IAGhB,MAAM;AAAA;AAGV,IAAO,iBAAQ;;;ACpBf,OAAuB;AACvB,OAAO,UAAU;AAgCb,SAQc,KARd;AA5BJ,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,GAAG;AAChD,YAAI,OAAO;AACT,kBAAQ,KAAK,GAAG;AAAA,QAClB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,QAAQ,KAAK,GAAG;AACzB;AAEO,IAAM,oBAAoB,CAAC;AAAA,EAChC,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,MAA0B;AACxB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,aAAa,mBAAmB,SAAS;AAAA,MACvD,YAAU;AAAA,MACV,qBAAkB;AAAA,MAClB,cAAY;AAAA,MACZ,UAAU;AAAA,MACT,GAAI;AAAA,MAEJ;AAAA,mBAAW,oBAAC,SAAK,mBAAQ;AAAA,QAC1B,oBAAC,QAAK,MAAK,qBAAoB,MAAK,QAAO,eAAW,MAAC;AAAA;AAAA;AAAA,EACzD;AAEJ;AAEA,kBAAkB,cAAc;;;AF3ChC,SAAS,sBAAsB;AASzB,SAOc,OAAAC,MAPd,QAAAC,aAAA;AANC,IAAM,kBAAkB,CAAC;AAAA,EAC9B,UAAU;AAAA,EACV,GAAG;AACL,MAA0B;AACxB,MAAI,eAAe,IAAI,GAAG;AACxB,WACE,gBAAAA;AAAA,MAAC;AAAA;AAAA,QACC,YAAU;AAAA,QACV,qBAAkB;AAAA,QAClB,cAAY;AAAA,QACZ,UAAU;AAAA,QACT,GAAG;AAAA,QAEH;AAAA,qBAAW,gBAAAD,KAAC,SAAK,mBAAQ;AAAA,UAC1B,gBAAAA,KAACE,OAAA,EAAK,MAAK,qBAAoB,MAAK,QAAO,eAAW,MAAC;AAAA;AAAA;AAAA,IACzD;AAAA,EAEJ;AAGA,SAAO,gBAAAF,KAAC,qBAAkB,SAAmB,GAAG,MAAM;AACxD;AAEA,gBAAgB,cAAc;;;ADzB5B,gBAAAG,YAAA;AADK,IAAM,YAAY,CAAC,UACxB,gBAAAA,KAAC,mBAAiB,GAAG,OAAO;;;AIV9B,OAAuB;;;ACEvB,IAAO,gBAAQ;","names":["Icon","jsx","jsxs","Icon","jsx"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -6,6 +6,11 @@ interface TypeIndicatorProps extends TypeStyledComponentsCommonProps, TypeSystem
|
|
|
6
6
|
tooltip?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Indicator component. Automatically routes between the Tailwind
|
|
11
|
+
* implementation (preferred) and the styled-components implementation (for
|
|
12
|
+
* consumers using system props or styled() extension).
|
|
13
|
+
*/
|
|
14
|
+
declare const Indicator: (props: TypeIndicatorProps) => react_jsx_runtime.JSX.Element;
|
|
10
15
|
|
|
11
16
|
export { Indicator, type TypeIndicatorProps, Indicator as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ interface TypeIndicatorProps extends TypeStyledComponentsCommonProps, TypeSystem
|
|
|
6
6
|
tooltip?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Indicator component. Automatically routes between the Tailwind
|
|
11
|
+
* implementation (preferred) and the styled-components implementation (for
|
|
12
|
+
* consumers using system props or styled() extension).
|
|
13
|
+
*/
|
|
14
|
+
declare const Indicator: (props: TypeIndicatorProps) => react_jsx_runtime.JSX.Element;
|
|
10
15
|
|
|
11
16
|
export { Indicator, type TypeIndicatorProps, Indicator as default };
|
package/dist/index.js
CHANGED
|
@@ -36,8 +36,11 @@ __export(index_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(index_exports);
|
|
37
37
|
|
|
38
38
|
// src/Indicator.tsx
|
|
39
|
-
var
|
|
40
|
-
|
|
39
|
+
var React3 = require("react");
|
|
40
|
+
|
|
41
|
+
// src/IndicatorHybrid.tsx
|
|
42
|
+
var React2 = require("react");
|
|
43
|
+
var import_seeds_react_icon2 = __toESM(require("@sproutsocial/seeds-react-icon"));
|
|
41
44
|
|
|
42
45
|
// src/styles.ts
|
|
43
46
|
var import_styled_components = __toESM(require("styled-components"));
|
|
@@ -65,12 +68,35 @@ var Container = import_styled_components.default.span.attrs({
|
|
|
65
68
|
`;
|
|
66
69
|
var styles_default = Container;
|
|
67
70
|
|
|
68
|
-
// src/
|
|
71
|
+
// src/IndicatorTailwind.tsx
|
|
72
|
+
var React = require("react");
|
|
73
|
+
var import_seeds_react_icon = __toESM(require("@sproutsocial/seeds-react-icon"));
|
|
69
74
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
70
|
-
|
|
75
|
+
function cn(...inputs) {
|
|
76
|
+
const classes = [];
|
|
77
|
+
for (const input of inputs) {
|
|
78
|
+
if (!input) continue;
|
|
79
|
+
if (typeof input === "string") {
|
|
80
|
+
classes.push(input);
|
|
81
|
+
} else if (typeof input === "object") {
|
|
82
|
+
for (const [key, value] of Object.entries(input)) {
|
|
83
|
+
if (value) {
|
|
84
|
+
classes.push(key);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return classes.join(" ");
|
|
90
|
+
}
|
|
91
|
+
var IndicatorTailwind = ({
|
|
92
|
+
tooltip = "",
|
|
93
|
+
className,
|
|
94
|
+
...rest
|
|
95
|
+
}) => {
|
|
71
96
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
72
|
-
|
|
97
|
+
"span",
|
|
73
98
|
{
|
|
99
|
+
className: cn("Indicator", "seeds-indicator", className),
|
|
74
100
|
"data-tip": tooltip,
|
|
75
101
|
"data-qa-indicator": "",
|
|
76
102
|
"aria-label": tooltip,
|
|
@@ -83,9 +109,41 @@ var Indicator = ({ tooltip = "", ...rest }) => {
|
|
|
83
109
|
}
|
|
84
110
|
);
|
|
85
111
|
};
|
|
112
|
+
IndicatorTailwind.displayName = "IndicatorTailwind";
|
|
113
|
+
|
|
114
|
+
// src/IndicatorHybrid.tsx
|
|
115
|
+
var import_seeds_react_system_props2 = require("@sproutsocial/seeds-react-system-props");
|
|
116
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
117
|
+
var IndicatorHybrid = ({
|
|
118
|
+
tooltip = "",
|
|
119
|
+
...rest
|
|
120
|
+
}) => {
|
|
121
|
+
if ((0, import_seeds_react_system_props2.hasStyledProps)(rest)) {
|
|
122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
123
|
+
styles_default,
|
|
124
|
+
{
|
|
125
|
+
"data-tip": tooltip,
|
|
126
|
+
"data-qa-indicator": "",
|
|
127
|
+
"aria-label": tooltip,
|
|
128
|
+
tabIndex: 0,
|
|
129
|
+
...rest,
|
|
130
|
+
children: [
|
|
131
|
+
tooltip && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: tooltip }),
|
|
132
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_seeds_react_icon2.default, { name: "circle-fill-solid", size: "mini", "aria-hidden": true })
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IndicatorTailwind, { tooltip, ...rest });
|
|
138
|
+
};
|
|
139
|
+
IndicatorHybrid.displayName = "Indicator";
|
|
140
|
+
|
|
141
|
+
// src/Indicator.tsx
|
|
142
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
143
|
+
var Indicator = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(IndicatorHybrid, { ...props });
|
|
86
144
|
|
|
87
145
|
// src/IndicatorTypes.ts
|
|
88
|
-
var
|
|
146
|
+
var React4 = require("react");
|
|
89
147
|
|
|
90
148
|
// src/index.ts
|
|
91
149
|
var index_default = Indicator;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/Indicator.tsx","../src/styles.ts","../src/IndicatorTypes.ts"],"sourcesContent":["import { Indicator } from \"./Indicator\";\n\nexport default Indicator;\nexport { Indicator };\nexport * from \"./IndicatorTypes\";\n","import * as React from \"react\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Container from \"./styles\";\nimport type { TypeIndicatorProps } from \"./IndicatorTypes\";\n\nexport const
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/Indicator.tsx","../src/IndicatorHybrid.tsx","../src/styles.ts","../src/IndicatorTailwind.tsx","../src/IndicatorTypes.ts"],"sourcesContent":["import { Indicator } from \"./Indicator\";\n\nexport default Indicator;\nexport { Indicator };\nexport * from \"./IndicatorTypes\";\n","import * as React from \"react\";\nimport { IndicatorHybrid } from \"./IndicatorHybrid\";\nimport type { TypeIndicatorProps } from \"./IndicatorTypes\";\n\n/**\n * Indicator component. Automatically routes between the Tailwind\n * implementation (preferred) and the styled-components implementation (for\n * consumers using system props or styled() extension).\n */\nexport const Indicator = (props: TypeIndicatorProps) => (\n <IndicatorHybrid {...props} />\n);\n","/**\n * Hybrid Indicator Component\n * Automatically chooses between Tailwind and styled-components based on props\n */\n\nimport * as React from \"react\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Container from \"./styles\"; // Styled-components version\nimport { IndicatorTailwind } from \"./IndicatorTailwind\"; // Tailwind version\nimport { hasStyledProps } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeIndicatorProps } from \"./IndicatorTypes\";\n\nexport const IndicatorHybrid = ({\n tooltip = \"\",\n ...rest\n}: TypeIndicatorProps) => {\n if (hasStyledProps(rest)) {\n return (\n <Container\n data-tip={tooltip}\n data-qa-indicator=\"\"\n aria-label={tooltip}\n tabIndex={0}\n {...rest}\n >\n {tooltip && <div>{tooltip}</div>}\n <Icon name=\"circle-fill-solid\" size=\"mini\" aria-hidden />\n </Container>\n );\n }\n\n // Use Tailwind version (preferred - better performance)\n return <IndicatorTailwind tooltip={tooltip} {...rest} />;\n};\n\nIndicatorHybrid.displayName = \"Indicator\";\n","import styled from \"styled-components\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport { visuallyHidden } from \"@sproutsocial/seeds-react-mixins\";\n\nconst Container = styled.span.attrs({\n className: \"Indicator\",\n})`\n position: relative;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n width: ${(props) => props.theme.space[400]};\n height: ${(props) => props.theme.space[400]};\n font-size: 10px;\n line-height: 0;\n color: ${(props) => props.color ?? props.theme.colors.icon.info};\n text-align: center;\n\n > div {\n ${visuallyHidden}\n }\n\n ${COMMON}\n`;\n\nexport default Container;\n","/**\n * Tailwind CSS implementation of Indicator component\n * Uses Seeds indicator CSS classes from indicator.css\n */\n\nimport * as React from \"react\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport type { TypeIndicatorProps } from \"./IndicatorTypes\";\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 IndicatorTailwind = ({\n tooltip = \"\",\n className,\n ...rest\n}: TypeIndicatorProps) => {\n return (\n <span\n className={cn(\"Indicator\", \"seeds-indicator\", className)}\n data-tip={tooltip}\n data-qa-indicator=\"\"\n aria-label={tooltip}\n tabIndex={0}\n {...(rest as React.ComponentPropsWithoutRef<\"span\">)}\n >\n {tooltip && <div>{tooltip}</div>}\n <Icon name=\"circle-fill-solid\" size=\"mini\" aria-hidden />\n </span>\n );\n};\n\nIndicatorTailwind.displayName = \"IndicatorTailwind\";\n","import * as React from \"react\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\nexport interface TypeIndicatorProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<React.ComponentPropsWithoutRef<\"span\">, \"color\"> {\n tooltip?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,SAAuB;;;ACKvB,IAAAC,SAAuB;AACvB,IAAAC,2BAAiB;;;ACNjB,+BAAmB;AACnB,sCAAuB;AACvB,gCAA+B;AAE/B,IAAM,YAAY,yBAAAC,QAAO,KAAK,MAAM;AAAA,EAClC,WAAW;AACb,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,WAKU,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA,YAChC,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA;AAAA;AAAA,WAGlC,CAAC,UAAU,MAAM,SAAS,MAAM,MAAM,OAAO,KAAK,IAAI;AAAA;AAAA;AAAA;AAAA,MAI3D,wCAAc;AAAA;AAAA;AAAA,IAGhB,sCAAM;AAAA;AAGV,IAAO,iBAAQ;;;ACpBf,YAAuB;AACvB,8BAAiB;AAgCb;AA5BJ,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,GAAG;AAChD,YAAI,OAAO;AACT,kBAAQ,KAAK,GAAG;AAAA,QAClB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,QAAQ,KAAK,GAAG;AACzB;AAEO,IAAM,oBAAoB,CAAC;AAAA,EAChC,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,MAA0B;AACxB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,aAAa,mBAAmB,SAAS;AAAA,MACvD,YAAU;AAAA,MACV,qBAAkB;AAAA,MAClB,cAAY;AAAA,MACZ,UAAU;AAAA,MACT,GAAI;AAAA,MAEJ;AAAA,mBAAW,4CAAC,SAAK,mBAAQ;AAAA,QAC1B,4CAAC,wBAAAC,SAAA,EAAK,MAAK,qBAAoB,MAAK,QAAO,eAAW,MAAC;AAAA;AAAA;AAAA,EACzD;AAEJ;AAEA,kBAAkB,cAAc;;;AF3ChC,IAAAC,mCAA+B;AASzB,IAAAC,sBAAA;AANC,IAAM,kBAAkB,CAAC;AAAA,EAC9B,UAAU;AAAA,EACV,GAAG;AACL,MAA0B;AACxB,UAAI,iDAAe,IAAI,GAAG;AACxB,WACE;AAAA,MAAC;AAAA;AAAA,QACC,YAAU;AAAA,QACV,qBAAkB;AAAA,QAClB,cAAY;AAAA,QACZ,UAAU;AAAA,QACT,GAAG;AAAA,QAEH;AAAA,qBAAW,6CAAC,SAAK,mBAAQ;AAAA,UAC1B,6CAAC,yBAAAC,SAAA,EAAK,MAAK,qBAAoB,MAAK,QAAO,eAAW,MAAC;AAAA;AAAA;AAAA,IACzD;AAAA,EAEJ;AAGA,SAAO,6CAAC,qBAAkB,SAAmB,GAAG,MAAM;AACxD;AAEA,gBAAgB,cAAc;;;ADzB5B,IAAAC,sBAAA;AADK,IAAM,YAAY,CAAC,UACxB,6CAAC,mBAAiB,GAAG,OAAO;;;AIV9B,IAAAC,SAAuB;;;ALEvB,IAAO,gBAAQ;","names":["React","React","import_seeds_react_icon","styled","Icon","import_seeds_react_system_props","import_jsx_runtime","Icon","import_jsx_runtime","React"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeds Indicator 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
|
+
* All rules are wrapped in `@layer components` so that consumer Tailwind
|
|
9
|
+
* utilities (unlayered) win the cascade over these styles.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
@layer components {
|
|
13
|
+
.seeds-indicator {
|
|
14
|
+
position: relative;
|
|
15
|
+
display: inline-flex;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
align-items: center;
|
|
18
|
+
width: var(--space-400);
|
|
19
|
+
height: var(--space-400);
|
|
20
|
+
font-size: 10px;
|
|
21
|
+
line-height: 0;
|
|
22
|
+
color: var(--color-icon-info);
|
|
23
|
+
text-align: center;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.seeds-indicator > div {
|
|
27
|
+
position: absolute;
|
|
28
|
+
width: 1px;
|
|
29
|
+
height: 1px;
|
|
30
|
+
padding: 0;
|
|
31
|
+
margin: -1px;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
clip: rect(0 0 0 0);
|
|
34
|
+
border: 0;
|
|
35
|
+
}
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sproutsocial/seeds-react-indicator",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
4
4
|
"description": "Seeds React Indicator",
|
|
5
5
|
"author": "Sprout Social, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/esm/index.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/esm/index.js",
|
|
13
|
+
"require": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
15
|
+
},
|
|
16
|
+
"./dist/indicator.css": "./dist/indicator.css"
|
|
17
|
+
},
|
|
10
18
|
"scripts": {
|
|
11
|
-
"build": "tsup --dts",
|
|
12
|
-
"build:debug": "tsup --dts --metafile",
|
|
19
|
+
"build": "tsup --dts && cp src/indicator.css dist/indicator.css",
|
|
20
|
+
"build:debug": "tsup --dts --metafile && cp src/indicator.css dist/indicator.css",
|
|
13
21
|
"dev": "tsup --watch --dts",
|
|
14
22
|
"clean": "rm -rf .turbo dist",
|
|
15
23
|
"clean:modules": "rm -rf node_modules",
|
|
@@ -18,10 +26,10 @@
|
|
|
18
26
|
"test:watch": "jest --watch --coverage=false"
|
|
19
27
|
},
|
|
20
28
|
"dependencies": {
|
|
21
|
-
"@sproutsocial/seeds-react-theme": "^4.2.
|
|
22
|
-
"@sproutsocial/seeds-react-system-props": "^3.1.
|
|
23
|
-
"@sproutsocial/seeds-react-icon": "^2.4.
|
|
24
|
-
"@sproutsocial/seeds-react-mixins": "^4.3.
|
|
29
|
+
"@sproutsocial/seeds-react-theme": "^4.2.1",
|
|
30
|
+
"@sproutsocial/seeds-react-system-props": "^3.1.2",
|
|
31
|
+
"@sproutsocial/seeds-react-icon": "^2.4.4",
|
|
32
|
+
"@sproutsocial/seeds-react-mixins": "^4.3.10"
|
|
25
33
|
},
|
|
26
34
|
"devDependencies": {
|
|
27
35
|
"@types/react": "^18.0.0",
|
package/src/Indicator.tsx
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
3
|
-
import Container from "./styles";
|
|
2
|
+
import { IndicatorHybrid } from "./IndicatorHybrid";
|
|
4
3
|
import type { TypeIndicatorProps } from "./IndicatorTypes";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
>
|
|
15
|
-
{tooltip && <div>{tooltip}</div>}
|
|
16
|
-
<Icon name="circle-fill-solid" size="mini" aria-hidden />
|
|
17
|
-
</Container>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
5
|
+
/**
|
|
6
|
+
* Indicator component. Automatically routes between the Tailwind
|
|
7
|
+
* implementation (preferred) and the styled-components implementation (for
|
|
8
|
+
* consumers using system props or styled() extension).
|
|
9
|
+
*/
|
|
10
|
+
export const Indicator = (props: TypeIndicatorProps) => (
|
|
11
|
+
<IndicatorHybrid {...props} />
|
|
12
|
+
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hybrid Indicator Component
|
|
3
|
+
* Automatically chooses between Tailwind and styled-components based on props
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import Icon from "@sproutsocial/seeds-react-icon";
|
|
8
|
+
import Container from "./styles"; // Styled-components version
|
|
9
|
+
import { IndicatorTailwind } from "./IndicatorTailwind"; // Tailwind version
|
|
10
|
+
import { hasStyledProps } from "@sproutsocial/seeds-react-system-props";
|
|
11
|
+
import type { TypeIndicatorProps } from "./IndicatorTypes";
|
|
12
|
+
|
|
13
|
+
export const IndicatorHybrid = ({
|
|
14
|
+
tooltip = "",
|
|
15
|
+
...rest
|
|
16
|
+
}: TypeIndicatorProps) => {
|
|
17
|
+
if (hasStyledProps(rest)) {
|
|
18
|
+
return (
|
|
19
|
+
<Container
|
|
20
|
+
data-tip={tooltip}
|
|
21
|
+
data-qa-indicator=""
|
|
22
|
+
aria-label={tooltip}
|
|
23
|
+
tabIndex={0}
|
|
24
|
+
{...rest}
|
|
25
|
+
>
|
|
26
|
+
{tooltip && <div>{tooltip}</div>}
|
|
27
|
+
<Icon name="circle-fill-solid" size="mini" aria-hidden />
|
|
28
|
+
</Container>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Use Tailwind version (preferred - better performance)
|
|
33
|
+
return <IndicatorTailwind tooltip={tooltip} {...rest} />;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
IndicatorHybrid.displayName = "Indicator";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tailwind CSS implementation of Indicator component
|
|
3
|
+
* Uses Seeds indicator CSS classes from indicator.css
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import Icon from "@sproutsocial/seeds-react-icon";
|
|
8
|
+
import type { TypeIndicatorProps } from "./IndicatorTypes";
|
|
9
|
+
|
|
10
|
+
// Utility for merging class names properly
|
|
11
|
+
function cn(
|
|
12
|
+
...inputs: (string | undefined | null | false | Record<string, boolean>)[]
|
|
13
|
+
): string {
|
|
14
|
+
const classes: string[] = [];
|
|
15
|
+
|
|
16
|
+
for (const input of inputs) {
|
|
17
|
+
if (!input) continue;
|
|
18
|
+
|
|
19
|
+
if (typeof input === "string") {
|
|
20
|
+
classes.push(input);
|
|
21
|
+
} else if (typeof input === "object") {
|
|
22
|
+
for (const [key, value] of Object.entries(input)) {
|
|
23
|
+
if (value) {
|
|
24
|
+
classes.push(key);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return classes.join(" ");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const IndicatorTailwind = ({
|
|
34
|
+
tooltip = "",
|
|
35
|
+
className,
|
|
36
|
+
...rest
|
|
37
|
+
}: TypeIndicatorProps) => {
|
|
38
|
+
return (
|
|
39
|
+
<span
|
|
40
|
+
className={cn("Indicator", "seeds-indicator", className)}
|
|
41
|
+
data-tip={tooltip}
|
|
42
|
+
data-qa-indicator=""
|
|
43
|
+
aria-label={tooltip}
|
|
44
|
+
tabIndex={0}
|
|
45
|
+
{...(rest as React.ComponentPropsWithoutRef<"span">)}
|
|
46
|
+
>
|
|
47
|
+
{tooltip && <div>{tooltip}</div>}
|
|
48
|
+
<Icon name="circle-fill-solid" size="mini" aria-hidden />
|
|
49
|
+
</span>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
IndicatorTailwind.displayName = "IndicatorTailwind";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { render } from "@sproutsocial/seeds-react-testing-library";
|
|
2
|
+
import { render, screen } from "@sproutsocial/seeds-react-testing-library";
|
|
3
3
|
import { Indicator } from "../";
|
|
4
4
|
|
|
5
5
|
describe("Indicator", () => {
|
|
@@ -7,4 +7,27 @@ describe("Indicator", () => {
|
|
|
7
7
|
const { container } = render(<Indicator />);
|
|
8
8
|
expect(container).toBeTruthy();
|
|
9
9
|
});
|
|
10
|
+
|
|
11
|
+
it("renders the Tailwind path with the Indicator and seeds-indicator classes", () => {
|
|
12
|
+
const { container } = render(<Indicator tooltip="online" />);
|
|
13
|
+
const el = container.querySelector("[data-qa-indicator]");
|
|
14
|
+
expect(el).toHaveClass("Indicator");
|
|
15
|
+
expect(el).toHaveClass("seeds-indicator");
|
|
16
|
+
expect(el).toHaveAttribute("aria-label", "online");
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("merges a consumer className on the Tailwind path (styled() contract)", () => {
|
|
20
|
+
const { container } = render(<Indicator className="custom" />);
|
|
21
|
+
const el = container.querySelector("[data-qa-indicator]");
|
|
22
|
+
expect(el).toHaveClass("seeds-indicator");
|
|
23
|
+
expect(el).toHaveClass("custom");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("routes through the styled-components path when a system prop is present", () => {
|
|
27
|
+
// mt is a system prop, which routes Indicator through the styled-components path
|
|
28
|
+
const { container } = render(<Indicator mt={200} />);
|
|
29
|
+
const el = container.querySelector("[data-qa-indicator]");
|
|
30
|
+
expect(el).toBeInTheDocument();
|
|
31
|
+
expect(el).toHaveClass("Indicator");
|
|
32
|
+
});
|
|
10
33
|
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeds Indicator 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
|
+
* All rules are wrapped in `@layer components` so that consumer Tailwind
|
|
9
|
+
* utilities (unlayered) win the cascade over these styles.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
@layer components {
|
|
13
|
+
.seeds-indicator {
|
|
14
|
+
position: relative;
|
|
15
|
+
display: inline-flex;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
align-items: center;
|
|
18
|
+
width: var(--space-400);
|
|
19
|
+
height: var(--space-400);
|
|
20
|
+
font-size: 10px;
|
|
21
|
+
line-height: 0;
|
|
22
|
+
color: var(--color-icon-info);
|
|
23
|
+
text-align: center;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.seeds-indicator > div {
|
|
27
|
+
position: absolute;
|
|
28
|
+
width: 1px;
|
|
29
|
+
height: 1px;
|
|
30
|
+
padding: 0;
|
|
31
|
+
margin: -1px;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
clip: rect(0 0 0 0);
|
|
34
|
+
border: 0;
|
|
35
|
+
}
|
|
36
|
+
}
|