@sproutsocial/seeds-react-container 0.1.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +1 -1
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +16 -31
- package/dist/esm/index.js +13 -56
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +4 -14
- package/dist/index.d.ts +4 -14
- package/dist/index.js +12 -55
- package/dist/index.js.map +1 -1
- package/package.json +3 -7
- package/src/Container.stories.tsx +8 -43
- package/src/Container.tsx +9 -54
- package/src/__tests__/container.test.tsx +4 -47
- package/src/index.ts +0 -3
- package/src/styles.tsx +12 -0
- package/tsconfig.json +1 -1
- package/src/styled.d.ts +0 -7
- package/src/styles.ts +0 -23
package/.eslintrc.js
CHANGED
package/.turbo/turbo-build.log
CHANGED
|
@@ -8,14 +8,14 @@ $ tsup --dts
|
|
|
8
8
|
[34mCLI[39m Cleaning output folder
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
12
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
-
[32mESM[39m [1mdist/esm/index.js [22m[
|
|
15
|
-
[32mESM[39m [1mdist/esm/index.js.map [22m[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m2.51 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m1.54 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 153ms
|
|
14
|
+
[32mESM[39m [1mdist/esm/index.js [22m[32m813.00 B[39m
|
|
15
|
+
[32mESM[39m [1mdist/esm/index.js.map [22m[32m1.41 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 153ms
|
|
17
17
|
[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
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 21895ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m241.00 B[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m241.00 B[39m
|
|
21
|
+
Done in 29.45s.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,44 +1,29 @@
|
|
|
1
1
|
# @sproutsocial/seeds-react-container
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.3.0
|
|
4
4
|
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
- @sproutsocial/seeds-react-icon@2.0.2
|
|
8
|
-
- @sproutsocial/seeds-react-button@1.3.7
|
|
9
|
-
|
|
10
|
-
## 0.1.3
|
|
11
|
-
|
|
12
|
-
### Patch Changes
|
|
5
|
+
### Minor Changes
|
|
13
6
|
|
|
14
|
-
-
|
|
15
|
-
- @sproutsocial/seeds-react-theme@3.2.1
|
|
16
|
-
- @sproutsocial/seeds-react-box@1.1.7
|
|
17
|
-
- @sproutsocial/seeds-react-icon@2.0.1
|
|
18
|
-
- @sproutsocial/seeds-react-loader@1.0.6
|
|
19
|
-
- @sproutsocial/seeds-react-button@1.3.6
|
|
7
|
+
- e2f6976: Refactor ContentBlock to use the shared Container component from seeds-react-container instead of custom styles. This improves consistency across components and simplifies the codebase. Also removes unused type exports from seeds-react-container.
|
|
20
8
|
|
|
21
|
-
## 0.
|
|
9
|
+
## 0.2.0
|
|
22
10
|
|
|
23
|
-
###
|
|
11
|
+
### Minor Changes
|
|
24
12
|
|
|
25
|
-
-
|
|
26
|
-
- @sproutsocial/seeds-react-icon@2.0.0
|
|
27
|
-
- @sproutsocial/seeds-react-button@1.3.5
|
|
13
|
+
- 1de0863: **Breaking Changes**
|
|
28
14
|
|
|
29
|
-
|
|
15
|
+
`@sproutsocial/seeds-react-container` has been simplified to a basic styled container component. It now only provides border, background, and border-radius styling as a wrapper around Box, accepting all Box props.
|
|
30
16
|
|
|
31
|
-
|
|
17
|
+
The previous Container component functionality (with title, subtitle, loading states, and header actions) has been moved to a new package: `@sproutsocial/seeds-react-content-block`.
|
|
32
18
|
|
|
33
|
-
|
|
34
|
-
- @sproutsocial/seeds-react-theme@3.2.0
|
|
35
|
-
- @sproutsocial/seeds-react-box@1.1.6
|
|
36
|
-
- @sproutsocial/seeds-react-icon@1.1.8
|
|
37
|
-
- @sproutsocial/seeds-react-loader@1.0.5
|
|
38
|
-
- @sproutsocial/seeds-react-button@1.3.4
|
|
19
|
+
**Migration**
|
|
39
20
|
|
|
40
|
-
|
|
21
|
+
If you were using the old Container component with `title`, `subtitle`, `isLoading`, or `headerActions` props, switch to `@sproutsocial/seeds-react-content-block`:
|
|
41
22
|
|
|
42
|
-
|
|
23
|
+
```tsx
|
|
24
|
+
// Before
|
|
25
|
+
import { Container } from "@sproutsocial/seeds-react-container";
|
|
43
26
|
|
|
44
|
-
|
|
27
|
+
// After
|
|
28
|
+
import { ContentBlock } from "@sproutsocial/seeds-react-content-block";
|
|
29
|
+
```
|
package/dist/esm/index.js
CHANGED
|
@@ -1,70 +1,27 @@
|
|
|
1
1
|
// src/Container.tsx
|
|
2
|
-
import "react";
|
|
3
|
-
import { Box as Box2 } from "@sproutsocial/seeds-react-box";
|
|
4
|
-
import { Text } from "@sproutsocial/seeds-react-text";
|
|
5
|
-
import { Loader } from "@sproutsocial/seeds-react-loader";
|
|
2
|
+
import * as React from "react";
|
|
6
3
|
|
|
7
|
-
// src/styles.
|
|
4
|
+
// src/styles.tsx
|
|
8
5
|
import styled from "styled-components";
|
|
9
6
|
import { Box } from "@sproutsocial/seeds-react-box";
|
|
10
|
-
var
|
|
7
|
+
var StyledContainer = styled(Box)`
|
|
11
8
|
background: ${({ theme }) => theme.colors.container.background.base};
|
|
12
|
-
border: ${({ theme }) => theme.borderWidths[500]} solid
|
|
13
|
-
${({ theme }) => theme.colors.container.border.base};
|
|
14
9
|
border-radius: ${({ theme }) => theme.radii.outer};
|
|
15
|
-
|
|
16
|
-
var ContainerHeader = styled(Box)`
|
|
17
|
-
display: flex;
|
|
18
|
-
justify-content: space-between;
|
|
19
|
-
align-items: center;
|
|
20
|
-
border-bottom: ${({ theme }) => theme.borderWidths[500]} solid
|
|
10
|
+
border: ${({ theme }) => theme.borders[500]}
|
|
21
11
|
${({ theme }) => theme.colors.container.border.base};
|
|
22
|
-
color: ${({ theme }) => theme.colors.text.headline};
|
|
23
|
-
padding: ${({ theme }) => theme.space[400]};
|
|
24
|
-
`;
|
|
25
|
-
var ContainerContent = styled(Box)`
|
|
26
|
-
padding: ${({ theme }) => theme.space[400]};
|
|
27
12
|
`;
|
|
13
|
+
var styles_default = StyledContainer;
|
|
28
14
|
|
|
29
15
|
// src/Container.tsx
|
|
30
|
-
import { jsx
|
|
31
|
-
var Container = (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
isLoading,
|
|
38
|
-
headerActions,
|
|
39
|
-
contentProps,
|
|
40
|
-
...boxProps
|
|
41
|
-
}) => {
|
|
42
|
-
return /* @__PURE__ */ jsxs(ContainerStyles, { as: "section", ...boxProps, children: [
|
|
43
|
-
/* @__PURE__ */ jsxs(ContainerHeader, { children: [
|
|
44
|
-
/* @__PURE__ */ jsxs(Box2, { children: [
|
|
45
|
-
/* @__PURE__ */ jsx(Text.Headline, { as: titleAs, children: title }),
|
|
46
|
-
/* @__PURE__ */ jsx(Text.Byline, { as: subtitleAs, fontWeight: "normal", children: subtitle })
|
|
47
|
-
] }),
|
|
48
|
-
headerActions && /* @__PURE__ */ jsx(Box2, { children: headerActions })
|
|
49
|
-
] }),
|
|
50
|
-
/* @__PURE__ */ jsx(
|
|
51
|
-
Box2,
|
|
52
|
-
{
|
|
53
|
-
p: 400,
|
|
54
|
-
...contentProps,
|
|
55
|
-
borderBottomLeftRadius: "outer",
|
|
56
|
-
borderBottomRightRadius: "outer",
|
|
57
|
-
children: isLoading ? /* @__PURE__ */ jsx(Box2, { my: 400, children: /* @__PURE__ */ jsx(Loader, { delay: false }) }) : content
|
|
58
|
-
}
|
|
59
|
-
)
|
|
60
|
-
] });
|
|
61
|
-
};
|
|
16
|
+
import { jsx } from "react/jsx-runtime";
|
|
17
|
+
var Container = React.forwardRef(
|
|
18
|
+
(props, ref) => {
|
|
19
|
+
return /* @__PURE__ */ jsx(styles_default, { ...props, ref });
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
Container.displayName = "Container";
|
|
62
23
|
var Container_default = Container;
|
|
63
|
-
|
|
64
|
-
// src/index.ts
|
|
65
|
-
var index_default = Container_default;
|
|
66
24
|
export {
|
|
67
|
-
Container_default as Container
|
|
68
|
-
index_default as default
|
|
25
|
+
Container_default as Container
|
|
69
26
|
};
|
|
70
27
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Container.tsx","../../src/styles.
|
|
1
|
+
{"version":3,"sources":["../../src/Container.tsx","../../src/styles.tsx"],"sourcesContent":["import * as React from \"react\";\nimport StyledContainer from \"./styles\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\n\nconst Container = React.forwardRef<HTMLDivElement, TypeBoxProps>(\n (props, ref) => {\n return <StyledContainer {...props} ref={ref} />;\n }\n);\n\nContainer.displayName = \"Container\";\n\nexport default Container;\n","import styled from \"styled-components\";\nimport { Box } from \"@sproutsocial/seeds-react-box\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\n\nconst StyledContainer = styled(Box)<TypeBoxProps>`\n background: ${({ theme }) => theme.colors.container.background.base};\n border-radius: ${({ theme }) => theme.radii.outer};\n border: ${({ theme }) => theme.borders[500]}\n ${({ theme }) => theme.colors.container.border.base};\n`;\n\nexport default StyledContainer;\n"],"mappings":";AAAA,YAAY,WAAW;;;ACAvB,OAAO,YAAY;AACnB,SAAS,WAAW;AAGpB,IAAM,kBAAkB,OAAO,GAAG;AAAA,gBAClB,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,UAAU,WAAW,IAAI;AAAA,mBAClD,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM,KAAK;AAAA,YACvC,CAAC,EAAE,MAAM,MAAM,MAAM,QAAQ,GAAG,CAAC;AAAA,MACvC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,UAAU,OAAO,IAAI;AAAA;AAGvD,IAAO,iBAAQ;;;ADLJ;AAFX,IAAM,YAAkB;AAAA,EACtB,CAAC,OAAO,QAAQ;AACd,WAAO,oBAAC,kBAAiB,GAAG,OAAO,KAAU;AAAA,EAC/C;AACF;AAEA,UAAU,cAAc;AAExB,IAAO,oBAAQ;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TypeBoxProps } from '@sproutsocial/seeds-react-box';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
title: string;
|
|
6
|
-
subtitle: string;
|
|
7
|
-
titleAs: "h1" | "h2" | "h3" | "h4";
|
|
8
|
-
subtitleAs: "h2" | "h3" | "h4" | "h5" | "p";
|
|
9
|
-
isLoading?: boolean;
|
|
10
|
-
content?: React.ReactNode;
|
|
11
|
-
headerActions?: React.ReactNode;
|
|
12
|
-
contentProps?: React.ComponentProps<typeof Box>;
|
|
13
|
-
}
|
|
14
|
-
declare const Container: React.FC<ContainerProps>;
|
|
4
|
+
declare const Container: React.ForwardRefExoticComponent<Omit<TypeBoxProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
5
|
|
|
16
|
-
export { Container
|
|
6
|
+
export { Container };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TypeBoxProps } from '@sproutsocial/seeds-react-box';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
title: string;
|
|
6
|
-
subtitle: string;
|
|
7
|
-
titleAs: "h1" | "h2" | "h3" | "h4";
|
|
8
|
-
subtitleAs: "h2" | "h3" | "h4" | "h5" | "p";
|
|
9
|
-
isLoading?: boolean;
|
|
10
|
-
content?: React.ReactNode;
|
|
11
|
-
headerActions?: React.ReactNode;
|
|
12
|
-
contentProps?: React.ComponentProps<typeof Box>;
|
|
13
|
-
}
|
|
14
|
-
declare const Container: React.FC<ContainerProps>;
|
|
4
|
+
declare const Container: React.ForwardRefExoticComponent<Omit<TypeBoxProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
5
|
|
|
16
|
-
export { Container
|
|
6
|
+
export { Container };
|
package/dist/index.js
CHANGED
|
@@ -30,76 +30,33 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
Container: () => Container_default
|
|
34
|
-
default: () => index_default
|
|
33
|
+
Container: () => Container_default
|
|
35
34
|
});
|
|
36
35
|
module.exports = __toCommonJS(index_exports);
|
|
37
36
|
|
|
38
37
|
// src/Container.tsx
|
|
39
|
-
var
|
|
40
|
-
var import_seeds_react_box2 = require("@sproutsocial/seeds-react-box");
|
|
41
|
-
var import_seeds_react_text = require("@sproutsocial/seeds-react-text");
|
|
42
|
-
var import_seeds_react_loader = require("@sproutsocial/seeds-react-loader");
|
|
38
|
+
var React = __toESM(require("react"));
|
|
43
39
|
|
|
44
|
-
// src/styles.
|
|
40
|
+
// src/styles.tsx
|
|
45
41
|
var import_styled_components = __toESM(require("styled-components"));
|
|
46
42
|
var import_seeds_react_box = require("@sproutsocial/seeds-react-box");
|
|
47
|
-
var
|
|
43
|
+
var StyledContainer = (0, import_styled_components.default)(import_seeds_react_box.Box)`
|
|
48
44
|
background: ${({ theme }) => theme.colors.container.background.base};
|
|
49
|
-
border: ${({ theme }) => theme.borderWidths[500]} solid
|
|
50
|
-
${({ theme }) => theme.colors.container.border.base};
|
|
51
45
|
border-radius: ${({ theme }) => theme.radii.outer};
|
|
52
|
-
|
|
53
|
-
var ContainerHeader = (0, import_styled_components.default)(import_seeds_react_box.Box)`
|
|
54
|
-
display: flex;
|
|
55
|
-
justify-content: space-between;
|
|
56
|
-
align-items: center;
|
|
57
|
-
border-bottom: ${({ theme }) => theme.borderWidths[500]} solid
|
|
46
|
+
border: ${({ theme }) => theme.borders[500]}
|
|
58
47
|
${({ theme }) => theme.colors.container.border.base};
|
|
59
|
-
color: ${({ theme }) => theme.colors.text.headline};
|
|
60
|
-
padding: ${({ theme }) => theme.space[400]};
|
|
61
|
-
`;
|
|
62
|
-
var ContainerContent = (0, import_styled_components.default)(import_seeds_react_box.Box)`
|
|
63
|
-
padding: ${({ theme }) => theme.space[400]};
|
|
64
48
|
`;
|
|
49
|
+
var styles_default = StyledContainer;
|
|
65
50
|
|
|
66
51
|
// src/Container.tsx
|
|
67
52
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
68
|
-
var Container = (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
isLoading,
|
|
75
|
-
headerActions,
|
|
76
|
-
contentProps,
|
|
77
|
-
...boxProps
|
|
78
|
-
}) => {
|
|
79
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ContainerStyles, { as: "section", ...boxProps, children: [
|
|
80
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ContainerHeader, { children: [
|
|
81
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_seeds_react_box2.Box, { children: [
|
|
82
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_seeds_react_text.Text.Headline, { as: titleAs, children: title }),
|
|
83
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_seeds_react_text.Text.Byline, { as: subtitleAs, fontWeight: "normal", children: subtitle })
|
|
84
|
-
] }),
|
|
85
|
-
headerActions && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_seeds_react_box2.Box, { children: headerActions })
|
|
86
|
-
] }),
|
|
87
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
88
|
-
import_seeds_react_box2.Box,
|
|
89
|
-
{
|
|
90
|
-
p: 400,
|
|
91
|
-
...contentProps,
|
|
92
|
-
borderBottomLeftRadius: "outer",
|
|
93
|
-
borderBottomRightRadius: "outer",
|
|
94
|
-
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_seeds_react_box2.Box, { my: 400, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_seeds_react_loader.Loader, { delay: false }) }) : content
|
|
95
|
-
}
|
|
96
|
-
)
|
|
97
|
-
] });
|
|
98
|
-
};
|
|
53
|
+
var Container = React.forwardRef(
|
|
54
|
+
(props, ref) => {
|
|
55
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(styles_default, { ...props, ref });
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
Container.displayName = "Container";
|
|
99
59
|
var Container_default = Container;
|
|
100
|
-
|
|
101
|
-
// src/index.ts
|
|
102
|
-
var index_default = Container_default;
|
|
103
60
|
// Annotate the CommonJS export names for ESM import in node:
|
|
104
61
|
0 && (module.exports = {
|
|
105
62
|
Container
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/Container.tsx","../src/styles.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/Container.tsx","../src/styles.tsx"],"sourcesContent":["import Container from \"./Container\";\n\nexport { Container };\n","import * as React from \"react\";\nimport StyledContainer from \"./styles\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\n\nconst Container = React.forwardRef<HTMLDivElement, TypeBoxProps>(\n (props, ref) => {\n return <StyledContainer {...props} ref={ref} />;\n }\n);\n\nContainer.displayName = \"Container\";\n\nexport default Container;\n","import styled from \"styled-components\";\nimport { Box } from \"@sproutsocial/seeds-react-box\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\n\nconst StyledContainer = styled(Box)<TypeBoxProps>`\n background: ${({ theme }) => theme.colors.container.background.base};\n border-radius: ${({ theme }) => theme.radii.outer};\n border: ${({ theme }) => theme.borders[500]}\n ${({ theme }) => theme.colors.container.border.base};\n`;\n\nexport default StyledContainer;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;;;ACAvB,+BAAmB;AACnB,6BAAoB;AAGpB,IAAM,sBAAkB,yBAAAA,SAAO,0BAAG;AAAA,gBAClB,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,UAAU,WAAW,IAAI;AAAA,mBAClD,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM,KAAK;AAAA,YACvC,CAAC,EAAE,MAAM,MAAM,MAAM,QAAQ,GAAG,CAAC;AAAA,MACvC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,UAAU,OAAO,IAAI;AAAA;AAGvD,IAAO,iBAAQ;;;ADLJ;AAFX,IAAM,YAAkB;AAAA,EACtB,CAAC,OAAO,QAAQ;AACd,WAAO,4CAAC,kBAAiB,GAAG,OAAO,KAAU;AAAA,EAC/C;AACF;AAEA,UAAU,cAAc;AAExB,IAAO,oBAAQ;","names":["styled"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sproutsocial/seeds-react-container",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Seeds React Container",
|
|
5
5
|
"author": "Sprout Social, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,12 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@sproutsocial/seeds-react-box": "^1.1.7",
|
|
22
|
-
"@sproutsocial/seeds-react-
|
|
23
|
-
"@sproutsocial/seeds-react-
|
|
24
|
-
"@sproutsocial/seeds-react-loader": "^1.0.6",
|
|
25
|
-
"@sproutsocial/seeds-react-system-props": "^3.0.2",
|
|
26
|
-
"@sproutsocial/seeds-react-text": "^1.3.2",
|
|
27
|
-
"@sproutsocial/seeds-react-theme": "^3.2.1"
|
|
22
|
+
"@sproutsocial/seeds-react-theme": "^3.2.1",
|
|
23
|
+
"@sproutsocial/seeds-react-system-props": "^3.0.1"
|
|
28
24
|
},
|
|
29
25
|
"devDependencies": {
|
|
30
26
|
"@types/react": "^18.0.0",
|
|
@@ -1,52 +1,17 @@
|
|
|
1
|
-
import Container from "./Container";
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import
|
|
4
|
-
import { Button } from "@sproutsocial/seeds-react-button";
|
|
5
|
-
import { Icon } from "@sproutsocial/seeds-react-icon";
|
|
2
|
+
import Container from "./Container";
|
|
6
3
|
|
|
7
|
-
const meta
|
|
4
|
+
const meta = {
|
|
8
5
|
title: "Components/Container",
|
|
9
6
|
component: Container,
|
|
10
|
-
|
|
11
|
-
title: "Volume Breakdown - Outbound",
|
|
12
|
-
subtitle: "View a breakdown of your outbound volume.",
|
|
13
|
-
content: (
|
|
14
|
-
<Text.SmallBodyCopy>
|
|
15
|
-
Here is some content inside the container.
|
|
16
|
-
</Text.SmallBodyCopy>
|
|
17
|
-
),
|
|
18
|
-
isLoading: false,
|
|
19
|
-
headerActions: null,
|
|
20
|
-
},
|
|
21
|
-
};
|
|
7
|
+
} satisfies Meta<typeof Container>;
|
|
22
8
|
|
|
23
9
|
export default meta;
|
|
24
|
-
|
|
25
|
-
type Story = StoryObj<typeof Container>;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
26
11
|
|
|
27
12
|
export const Default: Story = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
render: (args) => (
|
|
33
|
-
<Container
|
|
34
|
-
{...args}
|
|
35
|
-
headerActions={
|
|
36
|
-
<Button size="small">
|
|
37
|
-
<Icon name="face-frown-open-solid" />
|
|
38
|
-
</Button>
|
|
39
|
-
}
|
|
40
|
-
/>
|
|
41
|
-
),
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const LoadingState: Story = {
|
|
45
|
-
render: (args) => <Container {...args} isLoading={true} />,
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const WithContentStyles: Story = {
|
|
49
|
-
render: (args) => (
|
|
50
|
-
<Container {...args} contentProps={{ p: 0, py: 400, bg: "blue.300" }} />
|
|
51
|
-
),
|
|
13
|
+
args: {
|
|
14
|
+
children: "This is a container.",
|
|
15
|
+
},
|
|
16
|
+
render: (args) => <Container p={400} {...args} />,
|
|
52
17
|
};
|
package/src/Container.tsx
CHANGED
|
@@ -1,58 +1,13 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { Loader } from "@sproutsocial/seeds-react-loader";
|
|
5
|
-
import { ContainerHeader, ContainerStyles } from "./styles";
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import StyledContainer from "./styles";
|
|
3
|
+
import type { TypeBoxProps } from "@sproutsocial/seeds-react-box";
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
isLoading?: boolean;
|
|
13
|
-
content?: React.ReactNode;
|
|
14
|
-
headerActions?: React.ReactNode;
|
|
15
|
-
contentProps?: React.ComponentProps<typeof Box>;
|
|
16
|
-
}
|
|
5
|
+
const Container = React.forwardRef<HTMLDivElement, TypeBoxProps>(
|
|
6
|
+
(props, ref) => {
|
|
7
|
+
return <StyledContainer {...props} ref={ref} />;
|
|
8
|
+
}
|
|
9
|
+
);
|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
title,
|
|
20
|
-
subtitle,
|
|
21
|
-
titleAs = "h2",
|
|
22
|
-
subtitleAs = "h3",
|
|
23
|
-
content,
|
|
24
|
-
isLoading,
|
|
25
|
-
headerActions,
|
|
26
|
-
contentProps,
|
|
27
|
-
...boxProps
|
|
28
|
-
}) => {
|
|
29
|
-
return (
|
|
30
|
-
<ContainerStyles as="section" {...boxProps}>
|
|
31
|
-
<ContainerHeader>
|
|
32
|
-
<Box>
|
|
33
|
-
<Text.Headline as={titleAs}>{title}</Text.Headline>
|
|
34
|
-
<Text.Byline as={subtitleAs} fontWeight="normal">
|
|
35
|
-
{subtitle}
|
|
36
|
-
</Text.Byline>
|
|
37
|
-
</Box>
|
|
38
|
-
{headerActions && <Box>{headerActions}</Box>}
|
|
39
|
-
</ContainerHeader>
|
|
40
|
-
<Box
|
|
41
|
-
p={400}
|
|
42
|
-
{...contentProps}
|
|
43
|
-
borderBottomLeftRadius="outer"
|
|
44
|
-
borderBottomRightRadius="outer"
|
|
45
|
-
>
|
|
46
|
-
{isLoading ? (
|
|
47
|
-
<Box my={400}>
|
|
48
|
-
<Loader delay={false} />
|
|
49
|
-
</Box>
|
|
50
|
-
) : (
|
|
51
|
-
content
|
|
52
|
-
)}
|
|
53
|
-
</Box>
|
|
54
|
-
</ContainerStyles>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
11
|
+
Container.displayName = "Container";
|
|
57
12
|
|
|
58
13
|
export default Container;
|
|
@@ -1,53 +1,10 @@
|
|
|
1
1
|
import { render, screen } from "@sproutsocial/seeds-react-testing-library";
|
|
2
2
|
import Container from "../Container";
|
|
3
3
|
|
|
4
|
-
describe("Container
|
|
5
|
-
|
|
6
|
-
render(
|
|
7
|
-
<Container
|
|
8
|
-
title="Test Title"
|
|
9
|
-
subtitle="Test Subtitle"
|
|
10
|
-
titleAs="h1"
|
|
11
|
-
subtitleAs="h2"
|
|
12
|
-
/>
|
|
13
|
-
);
|
|
4
|
+
describe("Container", () => {
|
|
5
|
+
it("should render properly", () => {
|
|
6
|
+
render(<Container>Test...</Container>);
|
|
14
7
|
|
|
15
|
-
|
|
16
|
-
const subtitleElement = screen.getByText("Test Subtitle");
|
|
17
|
-
|
|
18
|
-
expect(titleElement.tagName).toBe("H1");
|
|
19
|
-
expect(subtitleElement.tagName).toBe("H2");
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
test("renders content when not loading", () => {
|
|
23
|
-
render(
|
|
24
|
-
<Container
|
|
25
|
-
title="Test Title"
|
|
26
|
-
subtitle="Test Subtitle"
|
|
27
|
-
titleAs="h2"
|
|
28
|
-
subtitleAs="h3"
|
|
29
|
-
isLoading={false}
|
|
30
|
-
content={<div>Loaded Content</div>}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
expect(screen.getByText("Loaded Content")).toBeInTheDocument();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test("renders loader when loading", () => {
|
|
37
|
-
render(
|
|
38
|
-
<Container
|
|
39
|
-
title="Test Title"
|
|
40
|
-
subtitle="Test Subtitle"
|
|
41
|
-
titleAs="h2"
|
|
42
|
-
subtitleAs="h3"
|
|
43
|
-
isLoading={true}
|
|
44
|
-
/>
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
expect(
|
|
48
|
-
screen.getByDataQaLabel({
|
|
49
|
-
loader: "",
|
|
50
|
-
})
|
|
51
|
-
).toBeInTheDocument();
|
|
8
|
+
expect(screen.getByText("Test...")).toBeInTheDocument();
|
|
52
9
|
});
|
|
53
10
|
});
|
package/src/index.ts
CHANGED
package/src/styles.tsx
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { Box } from "@sproutsocial/seeds-react-box";
|
|
3
|
+
import type { TypeBoxProps } from "@sproutsocial/seeds-react-box";
|
|
4
|
+
|
|
5
|
+
const StyledContainer = styled(Box)<TypeBoxProps>`
|
|
6
|
+
background: ${({ theme }) => theme.colors.container.background.base};
|
|
7
|
+
border-radius: ${({ theme }) => theme.radii.outer};
|
|
8
|
+
border: ${({ theme }) => theme.borders[500]}
|
|
9
|
+
${({ theme }) => theme.colors.container.border.base};
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
export default StyledContainer;
|
package/tsconfig.json
CHANGED
package/src/styled.d.ts
DELETED
package/src/styles.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
import { Box } from "@sproutsocial/seeds-react-box";
|
|
3
|
-
|
|
4
|
-
export const ContainerStyles = styled.section`
|
|
5
|
-
background: ${({ theme }) => theme.colors.container.background.base};
|
|
6
|
-
border: ${({ theme }) => theme.borderWidths[500]} solid
|
|
7
|
-
${({ theme }) => theme.colors.container.border.base};
|
|
8
|
-
border-radius: ${({ theme }) => theme.radii.outer};
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
export const ContainerHeader = styled(Box)`
|
|
12
|
-
display: flex;
|
|
13
|
-
justify-content: space-between;
|
|
14
|
-
align-items: center;
|
|
15
|
-
border-bottom: ${({ theme }) => theme.borderWidths[500]} solid
|
|
16
|
-
${({ theme }) => theme.colors.container.border.base};
|
|
17
|
-
color: ${({ theme }) => theme.colors.text.headline};
|
|
18
|
-
padding: ${({ theme }) => theme.space[400]};
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
export const ContainerContent = styled(Box)`
|
|
22
|
-
padding: ${({ theme }) => theme.space[400]};
|
|
23
|
-
`;
|