@sproutsocial/seeds-react-indicator 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +6 -0
- package/.eslintrc.js +4 -0
- package/.turbo/turbo-build.log +21 -0
- package/CHANGELOG.md +7 -0
- package/dist/esm/index.js +57 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +94 -0
- package/dist/index.js.map +1 -0
- package/jest.config.js +9 -0
- package/package.json +44 -0
- package/src/Indicator.tsx +19 -0
- package/src/IndicatorTypes.ts +12 -0
- package/src/__tests__/features.test.tsx +10 -0
- package/src/__tests__/types.typetest.tsx +16 -0
- package/src/index.stories.tsx +22 -0
- package/src/index.ts +5 -0
- package/src/styles.ts +24 -0
- package/tsconfig.json +9 -0
- package/tsup.config.ts +12 -0
package/.eslintignore
ADDED
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
yarn run v1.22.22
|
|
2
|
+
$ tsup --dts
|
|
3
|
+
CLI Building entry: src/index.ts
|
|
4
|
+
CLI Using tsconfig: tsconfig.json
|
|
5
|
+
CLI tsup v8.0.2
|
|
6
|
+
CLI Using tsup config: /home/runner/work/seeds/seeds/seeds-react/seeds-react-indicator/tsup.config.ts
|
|
7
|
+
CLI Target: es2022
|
|
8
|
+
CLI Cleaning output folder
|
|
9
|
+
CJS Build start
|
|
10
|
+
ESM Build start
|
|
11
|
+
ESM dist/esm/index.js 1.33 KB
|
|
12
|
+
ESM dist/esm/index.js.map 2.50 KB
|
|
13
|
+
ESM ⚡️ Build success in 149ms
|
|
14
|
+
CJS dist/index.js 3.22 KB
|
|
15
|
+
CJS dist/index.js.map 2.58 KB
|
|
16
|
+
CJS ⚡️ Build success in 155ms
|
|
17
|
+
DTS Build start
|
|
18
|
+
DTS ⚡️ Build success in 44614ms
|
|
19
|
+
DTS dist/index.d.ts 548.00 B
|
|
20
|
+
DTS dist/index.d.mts 548.00 B
|
|
21
|
+
Done in 50.22s.
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// src/Indicator.tsx
|
|
2
|
+
import "react";
|
|
3
|
+
import Icon from "@sproutsocial/seeds-react-icon";
|
|
4
|
+
|
|
5
|
+
// src/styles.ts
|
|
6
|
+
import styled from "styled-components";
|
|
7
|
+
import { COMMON } from "@sproutsocial/seeds-react-system-props";
|
|
8
|
+
import { visuallyHidden } from "@sproutsocial/seeds-react-mixins";
|
|
9
|
+
var Container = styled.span.attrs({
|
|
10
|
+
className: "Indicator"
|
|
11
|
+
})`
|
|
12
|
+
position: relative;
|
|
13
|
+
display: block;
|
|
14
|
+
width: ${(props) => props.theme.space[400]};
|
|
15
|
+
height: ${(props) => props.theme.space[400]};
|
|
16
|
+
font-size: 10px;
|
|
17
|
+
line-height: 0;
|
|
18
|
+
color: ${(props) => props.color ?? props.theme.colors.icon.info};
|
|
19
|
+
text-align: center;
|
|
20
|
+
|
|
21
|
+
> div {
|
|
22
|
+
${visuallyHidden}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
${COMMON}
|
|
26
|
+
`;
|
|
27
|
+
var styles_default = Container;
|
|
28
|
+
|
|
29
|
+
// src/Indicator.tsx
|
|
30
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
31
|
+
var Indicator = ({ tooltip = "", ...rest }) => {
|
|
32
|
+
return /* @__PURE__ */ jsxs(
|
|
33
|
+
styles_default,
|
|
34
|
+
{
|
|
35
|
+
"data-tip": tooltip,
|
|
36
|
+
"data-qa-indicator": "",
|
|
37
|
+
"aria-label": tooltip,
|
|
38
|
+
tabIndex: 0,
|
|
39
|
+
...rest,
|
|
40
|
+
children: [
|
|
41
|
+
tooltip && /* @__PURE__ */ jsx("div", { children: tooltip }),
|
|
42
|
+
/* @__PURE__ */ jsx(Icon, { name: "circle-fill-solid", size: "mini", "aria-hidden": true })
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// src/IndicatorTypes.ts
|
|
49
|
+
import "react";
|
|
50
|
+
|
|
51
|
+
// src/index.ts
|
|
52
|
+
var src_default = Indicator;
|
|
53
|
+
export {
|
|
54
|
+
Indicator,
|
|
55
|
+
src_default as default
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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 Indicator = ({ tooltip = \"\", ...rest }: TypeIndicatorProps) => {\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","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: block;\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","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;AACvB,OAAO,UAAU;;;ACDjB,OAAO,YAAY;AACnB,SAAS,cAAc;AACvB,SAAS,sBAAsB;AAE/B,IAAM,YAAY,OAAO,KAAK,MAAM;AAAA,EAClC,WAAW;AACb,CAAC;AAAA;AAAA;AAAA,WAGU,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;;;ADhBX,SAOc,KAPd;AAFG,IAAM,YAAY,CAAC,EAAE,UAAU,IAAI,GAAG,KAAK,MAA0B;AAC1E,SACE;AAAA,IAAC;AAAA;AAAA,MACC,YAAU;AAAA,MACV,qBAAkB;AAAA,MAClB,cAAY;AAAA,MACZ,UAAU;AAAA,MACT,GAAG;AAAA,MAEH;AAAA,mBAAW,oBAAC,SAAK,mBAAQ;AAAA,QAC1B,oBAAC,QAAK,MAAK,qBAAoB,MAAK,QAAO,eAAW,MAAC;AAAA;AAAA;AAAA,EACzD;AAEJ;;;AElBA,OAAuB;;;ACEvB,IAAO,cAAQ;","names":[]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { TypeStyledComponentsCommonProps, TypeSystemCommonProps } from '@sproutsocial/seeds-react-system-props';
|
|
4
|
+
|
|
5
|
+
interface TypeIndicatorProps extends TypeStyledComponentsCommonProps, TypeSystemCommonProps, Omit<React.ComponentPropsWithoutRef<"span">, "color"> {
|
|
6
|
+
tooltip?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare const Indicator: ({ tooltip, ...rest }: TypeIndicatorProps) => react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { Indicator, type TypeIndicatorProps, Indicator as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { TypeStyledComponentsCommonProps, TypeSystemCommonProps } from '@sproutsocial/seeds-react-system-props';
|
|
4
|
+
|
|
5
|
+
interface TypeIndicatorProps extends TypeStyledComponentsCommonProps, TypeSystemCommonProps, Omit<React.ComponentPropsWithoutRef<"span">, "color"> {
|
|
6
|
+
tooltip?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare const Indicator: ({ tooltip, ...rest }: TypeIndicatorProps) => react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { Indicator, type TypeIndicatorProps, Indicator as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
Indicator: () => Indicator,
|
|
34
|
+
default: () => src_default
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(src_exports);
|
|
37
|
+
|
|
38
|
+
// src/Indicator.tsx
|
|
39
|
+
var React = require("react");
|
|
40
|
+
var import_seeds_react_icon = __toESM(require("@sproutsocial/seeds-react-icon"));
|
|
41
|
+
|
|
42
|
+
// src/styles.ts
|
|
43
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
44
|
+
var import_seeds_react_system_props = require("@sproutsocial/seeds-react-system-props");
|
|
45
|
+
var import_seeds_react_mixins = require("@sproutsocial/seeds-react-mixins");
|
|
46
|
+
var Container = import_styled_components.default.span.attrs({
|
|
47
|
+
className: "Indicator"
|
|
48
|
+
})`
|
|
49
|
+
position: relative;
|
|
50
|
+
display: block;
|
|
51
|
+
width: ${(props) => props.theme.space[400]};
|
|
52
|
+
height: ${(props) => props.theme.space[400]};
|
|
53
|
+
font-size: 10px;
|
|
54
|
+
line-height: 0;
|
|
55
|
+
color: ${(props) => props.color ?? props.theme.colors.icon.info};
|
|
56
|
+
text-align: center;
|
|
57
|
+
|
|
58
|
+
> div {
|
|
59
|
+
${import_seeds_react_mixins.visuallyHidden}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
${import_seeds_react_system_props.COMMON}
|
|
63
|
+
`;
|
|
64
|
+
var styles_default = Container;
|
|
65
|
+
|
|
66
|
+
// src/Indicator.tsx
|
|
67
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
68
|
+
var Indicator = ({ tooltip = "", ...rest }) => {
|
|
69
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
70
|
+
styles_default,
|
|
71
|
+
{
|
|
72
|
+
"data-tip": tooltip,
|
|
73
|
+
"data-qa-indicator": "",
|
|
74
|
+
"aria-label": tooltip,
|
|
75
|
+
tabIndex: 0,
|
|
76
|
+
...rest,
|
|
77
|
+
children: [
|
|
78
|
+
tooltip && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: tooltip }),
|
|
79
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_seeds_react_icon.default, { name: "circle-fill-solid", size: "mini", "aria-hidden": true })
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// src/IndicatorTypes.ts
|
|
86
|
+
var React2 = require("react");
|
|
87
|
+
|
|
88
|
+
// src/index.ts
|
|
89
|
+
var src_default = Indicator;
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
Indicator
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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 Indicator = ({ tooltip = \"\", ...rest }: TypeIndicatorProps) => {\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","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: block;\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","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,YAAuB;AACvB,8BAAiB;;;ACDjB,+BAAmB;AACnB,sCAAuB;AACvB,gCAA+B;AAE/B,IAAM,YAAY,yBAAAA,QAAO,KAAK,MAAM;AAAA,EAClC,WAAW;AACb,CAAC;AAAA;AAAA;AAAA,WAGU,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;;;ADhBX;AAFG,IAAM,YAAY,CAAC,EAAE,UAAU,IAAI,GAAG,KAAK,MAA0B;AAC1E,SACE;AAAA,IAAC;AAAA;AAAA,MACC,YAAU;AAAA,MACV,qBAAkB;AAAA,MAClB,cAAY;AAAA,MACZ,UAAU;AAAA,MACT,GAAG;AAAA,MAEH;AAAA,mBAAW,4CAAC,SAAK,mBAAQ;AAAA,QAC1B,4CAAC,wBAAAC,SAAA,EAAK,MAAK,qBAAoB,MAAK,QAAO,eAAW,MAAC;AAAA;AAAA;AAAA,EACzD;AAEJ;;;AElBA,IAAAC,SAAuB;;;AHEvB,IAAO,cAAQ;","names":["styled","Icon","React"]}
|
package/jest.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sproutsocial/seeds-react-indicator",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Seeds React Indicator",
|
|
5
|
+
"author": "Sprout Social, Inc.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/esm/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsup --dts",
|
|
12
|
+
"build:debug": "tsup --dts --metafile",
|
|
13
|
+
"dev": "tsup --watch --dts",
|
|
14
|
+
"clean": "rm -rf .turbo dist",
|
|
15
|
+
"clean:modules": "rm -rf node_modules",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"test": "jest",
|
|
18
|
+
"test:watch": "jest --watch --coverage=false"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@sproutsocial/seeds-react-theme": "*",
|
|
22
|
+
"@sproutsocial/seeds-react-system-props": "*",
|
|
23
|
+
"@sproutsocial/seeds-react-icon": "*",
|
|
24
|
+
"@sproutsocial/seeds-react-mixins": "*"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/react": "^18.0.0",
|
|
28
|
+
"@types/styled-components": "^5.1.26",
|
|
29
|
+
"@sproutsocial/eslint-config-seeds": "*",
|
|
30
|
+
"react": "^18.0.0",
|
|
31
|
+
"styled-components": "^5.2.3",
|
|
32
|
+
"tsup": "^8.0.2",
|
|
33
|
+
"typescript": "^5.6.2",
|
|
34
|
+
"@sproutsocial/seeds-tsconfig": "*",
|
|
35
|
+
"@sproutsocial/seeds-testing": "*",
|
|
36
|
+
"@sproutsocial/seeds-react-testing-library": "*"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"styled-components": "^5.2.3"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=18"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import Icon from "@sproutsocial/seeds-react-icon";
|
|
3
|
+
import Container from "./styles";
|
|
4
|
+
import type { TypeIndicatorProps } from "./IndicatorTypes";
|
|
5
|
+
|
|
6
|
+
export const Indicator = ({ tooltip = "", ...rest }: TypeIndicatorProps) => {
|
|
7
|
+
return (
|
|
8
|
+
<Container
|
|
9
|
+
data-tip={tooltip}
|
|
10
|
+
data-qa-indicator=""
|
|
11
|
+
aria-label={tooltip}
|
|
12
|
+
tabIndex={0}
|
|
13
|
+
{...rest}
|
|
14
|
+
>
|
|
15
|
+
{tooltip && <div>{tooltip}</div>}
|
|
16
|
+
<Icon name="circle-fill-solid" size="mini" aria-hidden />
|
|
17
|
+
</Container>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type {
|
|
3
|
+
TypeStyledComponentsCommonProps,
|
|
4
|
+
TypeSystemCommonProps,
|
|
5
|
+
} from "@sproutsocial/seeds-react-system-props";
|
|
6
|
+
|
|
7
|
+
export interface TypeIndicatorProps
|
|
8
|
+
extends TypeStyledComponentsCommonProps,
|
|
9
|
+
TypeSystemCommonProps,
|
|
10
|
+
Omit<React.ComponentPropsWithoutRef<"span">, "color"> {
|
|
11
|
+
tooltip?: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@sproutsocial/seeds-react-testing-library";
|
|
3
|
+
import { Indicator } from "../";
|
|
4
|
+
|
|
5
|
+
describe("Indicator", () => {
|
|
6
|
+
it("should render properly", () => {
|
|
7
|
+
const { container } = render(<Indicator />);
|
|
8
|
+
expect(container).toBeTruthy();
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { render } from "@sproutsocial/seeds-react-testing-library";
|
|
3
|
+
import { Indicator } from "../";
|
|
4
|
+
|
|
5
|
+
describe.skip("Indicator/types", () => {
|
|
6
|
+
it("should render valid props", () => {
|
|
7
|
+
render(
|
|
8
|
+
<>
|
|
9
|
+
<Indicator />
|
|
10
|
+
<Indicator tooltip="test tooltip text" />
|
|
11
|
+
{/* @ts-expect-error - test invalid tooltip is rejected */}
|
|
12
|
+
<Indicator tooltip={5} />
|
|
13
|
+
</>
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Indicator, type TypeIndicatorProps } from "./";
|
|
3
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Indicator> = {
|
|
6
|
+
title: "Components/Indicator",
|
|
7
|
+
component: Indicator,
|
|
8
|
+
args: {
|
|
9
|
+
tooltip:
|
|
10
|
+
"I explain this Indicator, I should always be used for clarity and accessibility purposes.",
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
|
|
16
|
+
type Story = StoryObj<typeof Indicator>;
|
|
17
|
+
|
|
18
|
+
export const DefaultStory: Story = {
|
|
19
|
+
render: (args: TypeIndicatorProps) => <Indicator {...args} />,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
DefaultStory.storyName = "Default";
|
package/src/index.ts
ADDED
package/src/styles.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { COMMON } from "@sproutsocial/seeds-react-system-props";
|
|
3
|
+
import { visuallyHidden } from "@sproutsocial/seeds-react-mixins";
|
|
4
|
+
|
|
5
|
+
const Container = styled.span.attrs({
|
|
6
|
+
className: "Indicator",
|
|
7
|
+
})`
|
|
8
|
+
position: relative;
|
|
9
|
+
display: block;
|
|
10
|
+
width: ${(props) => props.theme.space[400]};
|
|
11
|
+
height: ${(props) => props.theme.space[400]};
|
|
12
|
+
font-size: 10px;
|
|
13
|
+
line-height: 0;
|
|
14
|
+
color: ${(props) => props.color ?? props.theme.colors.icon.info};
|
|
15
|
+
text-align: center;
|
|
16
|
+
|
|
17
|
+
> div {
|
|
18
|
+
${visuallyHidden}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
${COMMON}
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
export default Container;
|
package/tsconfig.json
ADDED
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineConfig } from "tsup";
|
|
2
|
+
|
|
3
|
+
export default defineConfig((options) => ({
|
|
4
|
+
entry: ["src/index.ts"],
|
|
5
|
+
format: ["cjs", "esm"],
|
|
6
|
+
clean: true,
|
|
7
|
+
legacyOutput: true,
|
|
8
|
+
dts: options.dts,
|
|
9
|
+
external: ["react"],
|
|
10
|
+
sourcemap: true,
|
|
11
|
+
metafile: options.metafile,
|
|
12
|
+
}));
|