@sproutsocial/seeds-react-container 0.3.19 → 0.3.20

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.
@@ -1,5 +1,5 @@
1
1
  yarn run v1.22.22
2
- $ tsup --dts
2
+ $ tsup --dts && cp src/container.css dist/container.css
3
3
  CLI Building entry: src/index.ts
4
4
  CLI Using tsconfig: tsconfig.json
5
5
  CLI tsup v8.5.0
@@ -8,14 +8,14 @@ $ tsup --dts
8
8
  CLI Cleaning output folder
9
9
  CJS Build start
10
10
  ESM Build start
11
- CJS dist/index.js 2.40 KB
12
- CJS dist/index.js.map 1.22 KB
13
- CJS ⚡️ Build success in 79ms
14
- ESM dist/esm/index.js 659.00 B
15
- ESM dist/esm/index.js.map 1.08 KB
16
- ESM ⚡️ Build success in 79ms
11
+ CJS dist/index.js 3.90 KB
12
+ CJS dist/index.js.map 4.69 KB
13
+ CJS ⚡️ Build success in 16ms
14
+ ESM dist/esm/index.js 2.00 KB
15
+ ESM dist/esm/index.js.map 4.55 KB
16
+ ESM ⚡️ Build success in 16ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 4762ms
19
- DTS dist/index.d.ts 241.00 B
20
- DTS dist/index.d.mts 241.00 B
21
- Done in 6.09s.
18
+ DTS ⚡️ Build success in 4600ms
19
+ DTS dist/index.d.ts 449.00 B
20
+ DTS dist/index.d.mts 449.00 B
21
+ Done in 5.94s.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @sproutsocial/seeds-react-container
2
2
 
3
+ ## 0.3.20
4
+
5
+ ### Patch Changes
6
+
7
+ - b77aca0: Migrate Container to the Tailwind hybrid pattern. By default Container now renders
8
+ a plain div with the `seeds-container` CSS class (background, border, and radius via
9
+ `var(--color-container-*)` / `var(--radius-outer)` tokens). Consumers passing
10
+ styled-system props (`p`, `m`, `color`, `width`, position props, …) or extending via
11
+ `styled()` continue to route through the styled-components path for full backward
12
+ compatibility. Component CSS is wrapped in `@layer components` so consumer Tailwind
13
+ utilities can override it.
14
+
15
+ Also adds position props (`position`, `zIndex`, `top`, `right`, `bottom`, `left`) to
16
+ the shared styled-system prop allowlist in `seeds-react-system-props` so hybrid
17
+ components correctly route Box-style positioning through the styled-components path.
18
+
19
+ - Updated dependencies [b77aca0]
20
+ - Updated dependencies [2e72599]
21
+ - @sproutsocial/seeds-react-system-props@3.1.3
22
+ - @sproutsocial/seeds-react-theme@4.3.0
23
+ - @sproutsocial/seeds-react-box@1.1.26
24
+ - @sproutsocial/seeds-react-mixins@4.3.11
25
+
3
26
  ## 0.3.19
4
27
 
5
28
  ### Patch Changes
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Seeds Container component class. Mirrors the container mixin from
3
+ * @sproutsocial/seeds-react-mixins.
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-container {
14
+ background: var(--color-container-bg-base);
15
+ border: 1px solid var(--color-container-border-base);
16
+ border-radius: var(--radius-outer);
17
+ }
18
+ }
package/dist/esm/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  // src/Container.tsx
2
- import * as React from "react";
2
+ import * as React3 from "react";
3
+
4
+ // src/ContainerHybrid.tsx
5
+ import * as React2 from "react";
3
6
 
4
7
  // src/styles.tsx
5
8
  import styled from "styled-components";
@@ -10,11 +13,59 @@ var StyledContainer = styled(Box)`
10
13
  `;
11
14
  var styles_default = StyledContainer;
12
15
 
13
- // src/Container.tsx
16
+ // src/ContainerTailwind.tsx
17
+ import * as React from "react";
14
18
  import { jsx } from "react/jsx-runtime";
15
- var Container = React.forwardRef(
19
+ function cn(...inputs) {
20
+ const classes = [];
21
+ for (const input of inputs) {
22
+ if (!input) continue;
23
+ if (typeof input === "string") {
24
+ classes.push(input);
25
+ } else if (typeof input === "object") {
26
+ for (const [key, value] of Object.entries(input)) {
27
+ if (value) {
28
+ classes.push(key);
29
+ }
30
+ }
31
+ }
32
+ }
33
+ return classes.join(" ");
34
+ }
35
+ var ContainerTailwind = React.forwardRef(
36
+ ({ className, children, ...rest }, ref) => {
37
+ return /* @__PURE__ */ jsx(
38
+ "div",
39
+ {
40
+ ref,
41
+ className: cn("seeds-container", className),
42
+ ...rest,
43
+ children
44
+ }
45
+ );
46
+ }
47
+ );
48
+ ContainerTailwind.displayName = "ContainerTailwind";
49
+
50
+ // src/ContainerHybrid.tsx
51
+ import { needsStyledComponents } from "@sproutsocial/seeds-react-system-props";
52
+ import { jsx as jsx2 } from "react/jsx-runtime";
53
+ var ContainerHybrid = React2.forwardRef(
54
+ (props, ref) => {
55
+ if (needsStyledComponents(props)) {
56
+ return /* @__PURE__ */ jsx2(styles_default, { ...props, ref });
57
+ }
58
+ return /* @__PURE__ */ jsx2(ContainerTailwind, { ...props, ref });
59
+ }
60
+ );
61
+ ContainerHybrid.displayName = "ContainerHybrid";
62
+ var ContainerHybrid_default = ContainerHybrid;
63
+
64
+ // src/Container.tsx
65
+ import { jsx as jsx3 } from "react/jsx-runtime";
66
+ var Container = React3.forwardRef(
16
67
  (props, ref) => {
17
- return /* @__PURE__ */ jsx(styles_default, { ...props, ref });
68
+ return /* @__PURE__ */ jsx3(ContainerHybrid_default, { ...props, ref });
18
69
  }
19
70
  );
20
71
  Container.displayName = "Container";
@@ -1 +1 @@
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\";\nimport { container } from \"@sproutsocial/seeds-react-mixins\";\n\nconst StyledContainer = styled(Box)<TypeBoxProps>`\n ${container}\n`;\n\nexport default StyledContainer;\n"],"mappings":";AAAA,YAAY,WAAW;;;ACAvB,OAAO,YAAY;AACnB,SAAS,WAAW;AAEpB,SAAS,iBAAiB;AAE1B,IAAM,kBAAkB,OAAO,GAAG;AAAA,IAC9B,SAAS;AAAA;AAGb,IAAO,iBAAQ;;;ADHJ;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":[]}
1
+ {"version":3,"sources":["../../src/Container.tsx","../../src/ContainerHybrid.tsx","../../src/styles.tsx","../../src/ContainerTailwind.tsx"],"sourcesContent":["import * as React from \"react\";\nimport ContainerHybrid from \"./ContainerHybrid\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\n\n/**\n * Container component. Automatically routes between the Tailwind implementation\n * (preferred) and the styled-components implementation (for consumers using\n * system props or a styled() extension).\n */\nconst Container = React.forwardRef<HTMLDivElement, TypeBoxProps>(\n (props, ref) => {\n return <ContainerHybrid {...props} ref={ref} />;\n }\n);\n\nContainer.displayName = \"Container\";\n\nexport default Container;\n","/**\n * Hybrid Container component.\n * Automatically chooses between Tailwind and styled-components based on props.\n */\n\nimport * as React from \"react\";\nimport StyledContainer from \"./styles\"; // Styled-components version\nimport { ContainerTailwind } from \"./ContainerTailwind\"; // Tailwind version\nimport { needsStyledComponents } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\n\nconst ContainerHybrid = React.forwardRef<HTMLDivElement, TypeBoxProps>(\n (props, ref) => {\n // Styled-system props (p, m, color, width, position, …) and styled()\n // extensions route through the styled-components path for backward\n // compatibility. needsStyledComponents reliably hits the SC path for\n // styled(Container) extensions, which hasStyledProps alone would miss.\n if (needsStyledComponents(props)) {\n return <StyledContainer {...props} ref={ref} />;\n }\n\n // Use Tailwind version (preferred - better performance)\n return <ContainerTailwind {...props} ref={ref} />;\n }\n);\n\nContainerHybrid.displayName = \"ContainerHybrid\";\n\nexport default ContainerHybrid;\n","import styled from \"styled-components\";\nimport { Box } from \"@sproutsocial/seeds-react-box\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\nimport { container } from \"@sproutsocial/seeds-react-mixins\";\n\nconst StyledContainer = styled(Box)<TypeBoxProps>`\n ${container}\n`;\n\nexport default StyledContainer;\n","/**\n * Tailwind CSS implementation of the Container component.\n * Uses the Seeds container CSS class from container.css.\n */\n\nimport * as React from \"react\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\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 ContainerTailwind = React.forwardRef<HTMLDivElement, TypeBoxProps>(\n ({ className, children, ...rest }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"seeds-container\", className)}\n {...(rest as React.ComponentPropsWithoutRef<\"div\">)}\n >\n {children}\n </div>\n );\n }\n);\n\nContainerTailwind.displayName = \"ContainerTailwind\";\n"],"mappings":";AAAA,YAAYA,YAAW;;;ACKvB,YAAYC,YAAW;;;ACLvB,OAAO,YAAY;AACnB,SAAS,WAAW;AAEpB,SAAS,iBAAiB;AAE1B,IAAM,kBAAkB,OAAO,GAAG;AAAA,IAC9B,SAAS;AAAA;AAGb,IAAO,iBAAQ;;;ACJf,YAAY,WAAW;AA6BjB;AAzBN,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,oBAA0B;AAAA,EACrC,CAAC,EAAE,WAAW,UAAU,GAAG,KAAK,GAAG,QAAQ;AACzC,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,mBAAmB,SAAS;AAAA,QACzC,GAAI;AAAA,QAEJ;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,kBAAkB,cAAc;;;AFrChC,SAAS,6BAA6B;AAUzB,gBAAAC,YAAA;AAPb,IAAM,kBAAwB;AAAA,EAC5B,CAAC,OAAO,QAAQ;AAKd,QAAI,sBAAsB,KAAK,GAAG;AAChC,aAAO,gBAAAA,KAAC,kBAAiB,GAAG,OAAO,KAAU;AAAA,IAC/C;AAGA,WAAO,gBAAAA,KAAC,qBAAmB,GAAG,OAAO,KAAU;AAAA,EACjD;AACF;AAEA,gBAAgB,cAAc;AAE9B,IAAO,0BAAQ;;;ADjBJ,gBAAAC,YAAA;AAFX,IAAM,YAAkB;AAAA,EACtB,CAAC,OAAO,QAAQ;AACd,WAAO,gBAAAA,KAAC,2BAAiB,GAAG,OAAO,KAAU;AAAA,EAC/C;AACF;AAEA,UAAU,cAAc;AAExB,IAAO,oBAAQ;","names":["React","React","jsx","jsx"]}
package/dist/index.d.mts CHANGED
@@ -1,6 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { TypeBoxProps } from '@sproutsocial/seeds-react-box';
3
3
 
4
+ /**
5
+ * Container component. Automatically routes between the Tailwind implementation
6
+ * (preferred) and the styled-components implementation (for consumers using
7
+ * system props or a styled() extension).
8
+ */
4
9
  declare const Container: React.ForwardRefExoticComponent<Omit<TypeBoxProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
10
 
6
11
  export { Container };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { TypeBoxProps } from '@sproutsocial/seeds-react-box';
3
3
 
4
+ /**
5
+ * Container component. Automatically routes between the Tailwind implementation
6
+ * (preferred) and the styled-components implementation (for consumers using
7
+ * system props or a styled() extension).
8
+ */
4
9
  declare const Container: React.ForwardRefExoticComponent<Omit<TypeBoxProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
10
 
6
11
  export { Container };
package/dist/index.js CHANGED
@@ -35,7 +35,10 @@ __export(index_exports, {
35
35
  module.exports = __toCommonJS(index_exports);
36
36
 
37
37
  // src/Container.tsx
38
- var React = __toESM(require("react"));
38
+ var React3 = __toESM(require("react"));
39
+
40
+ // src/ContainerHybrid.tsx
41
+ var React2 = __toESM(require("react"));
39
42
 
40
43
  // src/styles.tsx
41
44
  var import_styled_components = __toESM(require("styled-components"));
@@ -46,11 +49,59 @@ var StyledContainer = (0, import_styled_components.default)(import_seeds_react_b
46
49
  `;
47
50
  var styles_default = StyledContainer;
48
51
 
49
- // src/Container.tsx
52
+ // src/ContainerTailwind.tsx
53
+ var React = __toESM(require("react"));
50
54
  var import_jsx_runtime = require("react/jsx-runtime");
51
- var Container = React.forwardRef(
55
+ function cn(...inputs) {
56
+ const classes = [];
57
+ for (const input of inputs) {
58
+ if (!input) continue;
59
+ if (typeof input === "string") {
60
+ classes.push(input);
61
+ } else if (typeof input === "object") {
62
+ for (const [key, value] of Object.entries(input)) {
63
+ if (value) {
64
+ classes.push(key);
65
+ }
66
+ }
67
+ }
68
+ }
69
+ return classes.join(" ");
70
+ }
71
+ var ContainerTailwind = React.forwardRef(
72
+ ({ className, children, ...rest }, ref) => {
73
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
+ "div",
75
+ {
76
+ ref,
77
+ className: cn("seeds-container", className),
78
+ ...rest,
79
+ children
80
+ }
81
+ );
82
+ }
83
+ );
84
+ ContainerTailwind.displayName = "ContainerTailwind";
85
+
86
+ // src/ContainerHybrid.tsx
87
+ var import_seeds_react_system_props = require("@sproutsocial/seeds-react-system-props");
88
+ var import_jsx_runtime2 = require("react/jsx-runtime");
89
+ var ContainerHybrid = React2.forwardRef(
90
+ (props, ref) => {
91
+ if ((0, import_seeds_react_system_props.needsStyledComponents)(props)) {
92
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(styles_default, { ...props, ref });
93
+ }
94
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ContainerTailwind, { ...props, ref });
95
+ }
96
+ );
97
+ ContainerHybrid.displayName = "ContainerHybrid";
98
+ var ContainerHybrid_default = ContainerHybrid;
99
+
100
+ // src/Container.tsx
101
+ var import_jsx_runtime3 = require("react/jsx-runtime");
102
+ var Container = React3.forwardRef(
52
103
  (props, ref) => {
53
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(styles_default, { ...props, ref });
104
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ContainerHybrid_default, { ...props, ref });
54
105
  }
55
106
  );
56
107
  Container.displayName = "Container";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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\";\nimport { container } from \"@sproutsocial/seeds-react-mixins\";\n\nconst StyledContainer = styled(Box)<TypeBoxProps>`\n ${container}\n`;\n\nexport default StyledContainer;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;;;ACAvB,+BAAmB;AACnB,6BAAoB;AAEpB,gCAA0B;AAE1B,IAAM,sBAAkB,yBAAAA,SAAO,0BAAG;AAAA,IAC9B,mCAAS;AAAA;AAGb,IAAO,iBAAQ;;;ADHJ;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"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/Container.tsx","../src/ContainerHybrid.tsx","../src/styles.tsx","../src/ContainerTailwind.tsx"],"sourcesContent":["import Container from \"./Container\";\n\nexport { Container };\n","import * as React from \"react\";\nimport ContainerHybrid from \"./ContainerHybrid\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\n\n/**\n * Container component. Automatically routes between the Tailwind implementation\n * (preferred) and the styled-components implementation (for consumers using\n * system props or a styled() extension).\n */\nconst Container = React.forwardRef<HTMLDivElement, TypeBoxProps>(\n (props, ref) => {\n return <ContainerHybrid {...props} ref={ref} />;\n }\n);\n\nContainer.displayName = \"Container\";\n\nexport default Container;\n","/**\n * Hybrid Container component.\n * Automatically chooses between Tailwind and styled-components based on props.\n */\n\nimport * as React from \"react\";\nimport StyledContainer from \"./styles\"; // Styled-components version\nimport { ContainerTailwind } from \"./ContainerTailwind\"; // Tailwind version\nimport { needsStyledComponents } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\n\nconst ContainerHybrid = React.forwardRef<HTMLDivElement, TypeBoxProps>(\n (props, ref) => {\n // Styled-system props (p, m, color, width, position, …) and styled()\n // extensions route through the styled-components path for backward\n // compatibility. needsStyledComponents reliably hits the SC path for\n // styled(Container) extensions, which hasStyledProps alone would miss.\n if (needsStyledComponents(props)) {\n return <StyledContainer {...props} ref={ref} />;\n }\n\n // Use Tailwind version (preferred - better performance)\n return <ContainerTailwind {...props} ref={ref} />;\n }\n);\n\nContainerHybrid.displayName = \"ContainerHybrid\";\n\nexport default ContainerHybrid;\n","import styled from \"styled-components\";\nimport { Box } from \"@sproutsocial/seeds-react-box\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\nimport { container } from \"@sproutsocial/seeds-react-mixins\";\n\nconst StyledContainer = styled(Box)<TypeBoxProps>`\n ${container}\n`;\n\nexport default StyledContainer;\n","/**\n * Tailwind CSS implementation of the Container component.\n * Uses the Seeds container CSS class from container.css.\n */\n\nimport * as React from \"react\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\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 ContainerTailwind = React.forwardRef<HTMLDivElement, TypeBoxProps>(\n ({ className, children, ...rest }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"seeds-container\", className)}\n {...(rest as React.ComponentPropsWithoutRef<\"div\">)}\n >\n {children}\n </div>\n );\n }\n);\n\nContainerTailwind.displayName = \"ContainerTailwind\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,SAAuB;;;ACKvB,IAAAC,SAAuB;;;ACLvB,+BAAmB;AACnB,6BAAoB;AAEpB,gCAA0B;AAE1B,IAAM,sBAAkB,yBAAAC,SAAO,0BAAG;AAAA,IAC9B,mCAAS;AAAA;AAGb,IAAO,iBAAQ;;;ACJf,YAAuB;AA6BjB;AAzBN,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,oBAA0B;AAAA,EACrC,CAAC,EAAE,WAAW,UAAU,GAAG,KAAK,GAAG,QAAQ;AACzC,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,mBAAmB,SAAS;AAAA,QACzC,GAAI;AAAA,QAEJ;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,kBAAkB,cAAc;;;AFrChC,sCAAsC;AAUzB,IAAAC,sBAAA;AAPb,IAAM,kBAAwB;AAAA,EAC5B,CAAC,OAAO,QAAQ;AAKd,YAAI,uDAAsB,KAAK,GAAG;AAChC,aAAO,6CAAC,kBAAiB,GAAG,OAAO,KAAU;AAAA,IAC/C;AAGA,WAAO,6CAAC,qBAAmB,GAAG,OAAO,KAAU;AAAA,EACjD;AACF;AAEA,gBAAgB,cAAc;AAE9B,IAAO,0BAAQ;;;ADjBJ,IAAAC,sBAAA;AAFX,IAAM,YAAkB;AAAA,EACtB,CAAC,OAAO,QAAQ;AACd,WAAO,6CAAC,2BAAiB,GAAG,OAAO,KAAU;AAAA,EAC/C;AACF;AAEA,UAAU,cAAc;AAExB,IAAO,oBAAQ;","names":["React","React","styled","import_jsx_runtime","import_jsx_runtime"]}
package/package.json CHANGED
@@ -1,15 +1,23 @@
1
1
  {
2
2
  "name": "@sproutsocial/seeds-react-container",
3
- "version": "0.3.19",
3
+ "version": "0.3.20",
4
4
  "description": "Seeds React Container",
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
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/esm/index.js",
14
+ "require": "./dist/index.js"
15
+ },
16
+ "./dist/container.css": "./dist/container.css"
17
+ },
10
18
  "scripts": {
11
- "build": "tsup --dts",
12
- "build:debug": "tsup --dts --metafile",
19
+ "build": "tsup --dts && cp src/container.css dist/container.css",
20
+ "build:debug": "tsup --dts --metafile && cp src/container.css dist/container.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-box": "^1.1.25",
22
- "@sproutsocial/seeds-react-mixins": "^4.3.10",
23
- "@sproutsocial/seeds-react-theme": "^4.2.1",
24
- "@sproutsocial/seeds-react-system-props": "^3.1.2"
29
+ "@sproutsocial/seeds-react-box": "^1.1.26",
30
+ "@sproutsocial/seeds-react-mixins": "^4.3.11",
31
+ "@sproutsocial/seeds-react-theme": "^4.3.0",
32
+ "@sproutsocial/seeds-react-system-props": "^3.1.3"
25
33
  },
26
34
  "devDependencies": {
27
35
  "@types/react": "^18.0.0",
@@ -15,3 +15,12 @@ export const Default: Story = {
15
15
  },
16
16
  render: (args) => <Container p={400} {...args} />,
17
17
  };
18
+
19
+ // No system props → renders the Tailwind path. Customize via className using
20
+ // Seeds Tailwind utilities instead of styled-system props.
21
+ export const Tailwind: Story = {
22
+ args: {
23
+ children: "This is a Tailwind container.",
24
+ },
25
+ render: (args) => <Container className="p-400" {...args} />,
26
+ };
package/src/Container.tsx CHANGED
@@ -1,10 +1,15 @@
1
1
  import * as React from "react";
2
- import StyledContainer from "./styles";
2
+ import ContainerHybrid from "./ContainerHybrid";
3
3
  import type { TypeBoxProps } from "@sproutsocial/seeds-react-box";
4
4
 
5
+ /**
6
+ * Container component. Automatically routes between the Tailwind implementation
7
+ * (preferred) and the styled-components implementation (for consumers using
8
+ * system props or a styled() extension).
9
+ */
5
10
  const Container = React.forwardRef<HTMLDivElement, TypeBoxProps>(
6
11
  (props, ref) => {
7
- return <StyledContainer {...props} ref={ref} />;
12
+ return <ContainerHybrid {...props} ref={ref} />;
8
13
  }
9
14
  );
10
15
 
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Hybrid Container component.
3
+ * Automatically chooses between Tailwind and styled-components based on props.
4
+ */
5
+
6
+ import * as React from "react";
7
+ import StyledContainer from "./styles"; // Styled-components version
8
+ import { ContainerTailwind } from "./ContainerTailwind"; // Tailwind version
9
+ import { needsStyledComponents } from "@sproutsocial/seeds-react-system-props";
10
+ import type { TypeBoxProps } from "@sproutsocial/seeds-react-box";
11
+
12
+ const ContainerHybrid = React.forwardRef<HTMLDivElement, TypeBoxProps>(
13
+ (props, ref) => {
14
+ // Styled-system props (p, m, color, width, position, …) and styled()
15
+ // extensions route through the styled-components path for backward
16
+ // compatibility. needsStyledComponents reliably hits the SC path for
17
+ // styled(Container) extensions, which hasStyledProps alone would miss.
18
+ if (needsStyledComponents(props)) {
19
+ return <StyledContainer {...props} ref={ref} />;
20
+ }
21
+
22
+ // Use Tailwind version (preferred - better performance)
23
+ return <ContainerTailwind {...props} ref={ref} />;
24
+ }
25
+ );
26
+
27
+ ContainerHybrid.displayName = "ContainerHybrid";
28
+
29
+ export default ContainerHybrid;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Tailwind CSS implementation of the Container component.
3
+ * Uses the Seeds container CSS class from container.css.
4
+ */
5
+
6
+ import * as React from "react";
7
+ import type { TypeBoxProps } from "@sproutsocial/seeds-react-box";
8
+
9
+ // Utility for merging class names properly
10
+ function cn(
11
+ ...inputs: (string | undefined | null | false | Record<string, boolean>)[]
12
+ ): string {
13
+ const classes: string[] = [];
14
+
15
+ for (const input of inputs) {
16
+ if (!input) continue;
17
+
18
+ if (typeof input === "string") {
19
+ classes.push(input);
20
+ } else if (typeof input === "object") {
21
+ for (const [key, value] of Object.entries(input)) {
22
+ if (value) {
23
+ classes.push(key);
24
+ }
25
+ }
26
+ }
27
+ }
28
+
29
+ return classes.join(" ");
30
+ }
31
+
32
+ export const ContainerTailwind = React.forwardRef<HTMLDivElement, TypeBoxProps>(
33
+ ({ className, children, ...rest }, ref) => {
34
+ return (
35
+ <div
36
+ ref={ref}
37
+ className={cn("seeds-container", className)}
38
+ {...(rest as React.ComponentPropsWithoutRef<"div">)}
39
+ >
40
+ {children}
41
+ </div>
42
+ );
43
+ }
44
+ );
45
+
46
+ ContainerTailwind.displayName = "ContainerTailwind";
@@ -7,4 +7,41 @@ describe("Container", () => {
7
7
 
8
8
  expect(screen.getByText("Test...")).toBeInTheDocument();
9
9
  });
10
+
11
+ describe("Tailwind path (no system props)", () => {
12
+ it("renders with the seeds-container class", () => {
13
+ render(<Container>Test...</Container>);
14
+
15
+ expect(screen.getByText("Test...")).toHaveClass("seeds-container");
16
+ });
17
+
18
+ it("merges consumer className", () => {
19
+ render(<Container className="custom">Test...</Container>);
20
+
21
+ const container = screen.getByText("Test...");
22
+ expect(container).toHaveClass("seeds-container");
23
+ expect(container).toHaveClass("custom");
24
+ });
25
+ });
26
+
27
+ describe("styled-components path (system props)", () => {
28
+ it("renders the styled-components path with padding", () => {
29
+ render(<Container p={400}>Test...</Container>);
30
+
31
+ expect(screen.getByText("Test...")).toHaveStyleRule("padding", "16px");
32
+ });
33
+
34
+ it("routes position props through the styled-components path", () => {
35
+ render(
36
+ <Container position="absolute" top={0} zIndex={2}>
37
+ Test...
38
+ </Container>
39
+ );
40
+
41
+ const container = screen.getByText("Test...");
42
+ expect(container).not.toHaveClass("seeds-container");
43
+ expect(container).toHaveStyleRule("position", "absolute");
44
+ expect(container).toHaveStyleRule("z-index", "2");
45
+ });
46
+ });
10
47
  });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Seeds Container component class. Mirrors the container mixin from
3
+ * @sproutsocial/seeds-react-mixins.
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-container {
14
+ background: var(--color-container-bg-base);
15
+ border: 1px solid var(--color-container-border-base);
16
+ border-radius: var(--radius-outer);
17
+ }
18
+ }