@sproutsocial/seeds-react-stack 1.0.23 → 1.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,5 +1,11 @@
1
1
  // src/Stack.tsx
2
- import "react";
2
+ import React4 from "react";
3
+
4
+ // src/StackHybrid.tsx
5
+ import React3 from "react";
6
+
7
+ // src/StackStyledComponents.tsx
8
+ import * as React from "react";
3
9
  import { Children } from "react";
4
10
 
5
11
  // src/utils.ts
@@ -37,7 +43,7 @@ var normalizeResponsiveProp = (value) => {
37
43
  }
38
44
  };
39
45
 
40
- // src/Stack.tsx
46
+ // src/StackStyledComponents.tsx
41
47
  import Box from "@sproutsocial/seeds-react-box";
42
48
  import { jsx } from "react/jsx-runtime";
43
49
  import { createElement } from "react";
@@ -77,55 +83,124 @@ var stackStyles = {
77
83
  }
78
84
  }
79
85
  };
80
- var Stack = ({
81
- children,
82
- space = 300,
83
- align = "left",
84
- direction = "vertical",
85
- ...rest
86
- }) => {
87
- const stackItems = Children.toArray(children);
88
- const responsiveAlignment = normalizeResponsiveProp(align);
89
- const responsiveDirection = normalizeResponsiveProp(direction);
90
- const responsiveSpace = normalizeResponsiveProp(space);
91
- const initialValue = ["initial", "initial", "initial", "initial", "initial"];
92
- const styleProps = {
93
- alignItems: [...initialValue],
94
- flexDirection: [...initialValue],
95
- justifyContent: [...initialValue]
96
- };
97
- const childFlexBasis = [...initialValue];
98
- const childMarginProps = {
99
- marginLeft: [...initialValue],
100
- marginTop: [...initialValue]
101
- };
102
- initialValue.forEach((_, i) => {
103
- const currentDirection = responsiveDirection[i];
104
- const currentAlignment = responsiveAlignment[i];
105
- const currentSpace = responsiveSpace[i];
106
- if (currentDirection && currentAlignment) {
107
- const styles = stackStyles[currentDirection][currentAlignment];
108
- Object.keys(styleProps).forEach((key) => {
109
- styleProps[key][i] = styles[key] || "initial";
110
- });
86
+ var StackStyledComponents = React.forwardRef(
87
+ ({ children, space = 300, align = "left", direction = "vertical", ...rest }, ref) => {
88
+ const stackItems = Children.toArray(children);
89
+ const responsiveAlignment = normalizeResponsiveProp(align);
90
+ const responsiveDirection = normalizeResponsiveProp(direction);
91
+ const responsiveSpace = normalizeResponsiveProp(space);
92
+ const initialValue = [
93
+ "initial",
94
+ "initial",
95
+ "initial",
96
+ "initial",
97
+ "initial"
98
+ ];
99
+ const styleProps = {
100
+ alignItems: [...initialValue],
101
+ flexDirection: [...initialValue],
102
+ justifyContent: [...initialValue]
103
+ };
104
+ const childFlexBasis = [...initialValue];
105
+ const childMarginProps = {
106
+ marginLeft: [...initialValue],
107
+ marginTop: [...initialValue]
108
+ };
109
+ initialValue.forEach((_, i) => {
110
+ const currentDirection = responsiveDirection[i];
111
+ const currentAlignment = responsiveAlignment[i];
112
+ const currentSpace = responsiveSpace[i];
113
+ if (currentDirection && currentAlignment) {
114
+ const styles = stackStyles[currentDirection][currentAlignment];
115
+ Object.keys(styleProps).forEach((key) => {
116
+ styleProps[key][i] = styles[key] || "initial";
117
+ });
118
+ }
119
+ const flexBasis = currentAlignment === "stretch" && currentDirection === "horizontal" ? "100%" : null;
120
+ childFlexBasis[i] = flexBasis;
121
+ const margin = currentDirection === "horizontal" ? "marginLeft" : "marginTop";
122
+ const opposite = currentDirection === "horizontal" ? "marginTop" : "marginLeft";
123
+ childMarginProps[margin][i] = currentSpace;
124
+ childMarginProps[opposite][i] = 0;
125
+ });
126
+ return /* @__PURE__ */ jsx(Box, { display: "flex", ref, ...styleProps, ...rest, children: stackItems.map((item, i) => /* @__PURE__ */ createElement(
127
+ Box,
128
+ {
129
+ flexBasis: childFlexBasis,
130
+ ...i !== 0 ? childMarginProps : {},
131
+ key: i
132
+ },
133
+ item
134
+ )) });
135
+ }
136
+ );
137
+ StackStyledComponents.displayName = "StackStyledComponents";
138
+ var StackStyledComponents_default = StackStyledComponents;
139
+
140
+ // src/StackTailwind.tsx
141
+ import React2 from "react";
142
+ import { jsx as jsx2 } from "react/jsx-runtime";
143
+ function cn(...inputs) {
144
+ const classes = [];
145
+ for (const input of inputs) {
146
+ if (!input) continue;
147
+ if (typeof input === "string") {
148
+ classes.push(input);
149
+ } else if (typeof input === "object") {
150
+ for (const [key, value] of Object.entries(input)) {
151
+ if (value) {
152
+ classes.push(key);
153
+ }
154
+ }
111
155
  }
112
- const flexBasis = currentAlignment === "stretch" && currentDirection === "horizontal" ? "100%" : null;
113
- childFlexBasis[i] = flexBasis;
114
- const margin = currentDirection === "horizontal" ? "marginLeft" : "marginTop";
115
- const opposite = currentDirection === "horizontal" ? "marginTop" : "marginLeft";
116
- childMarginProps[margin][i] = currentSpace;
117
- childMarginProps[opposite][i] = 0;
118
- });
119
- return /* @__PURE__ */ jsx(Box, { display: "flex", ...styleProps, ...rest, children: stackItems.map((item, i) => /* @__PURE__ */ createElement(
120
- Box,
121
- {
122
- flexBasis: childFlexBasis,
123
- ...i !== 0 ? childMarginProps : {},
124
- key: i
125
- },
126
- item
127
- )) });
128
- };
156
+ }
157
+ return classes.join(" ");
158
+ }
159
+ var StackTailwind = React2.forwardRef(
160
+ ({
161
+ children,
162
+ space = 300,
163
+ align = "left",
164
+ direction = "vertical",
165
+ as,
166
+ className,
167
+ ...rest
168
+ }, ref) => {
169
+ const Component = as || "div";
170
+ const classes = cn(
171
+ "seeds-stack",
172
+ `seeds-stack-${direction}`,
173
+ `seeds-stack-align-${align}`,
174
+ `seeds-stack-space-${space}`,
175
+ className
176
+ );
177
+ return /* @__PURE__ */ jsx2(Component, { className: classes, ref, ...rest, children });
178
+ }
179
+ );
180
+ StackTailwind.displayName = "StackTailwind";
181
+
182
+ // src/StackHybrid.tsx
183
+ import { hasStyledProps } from "@sproutsocial/seeds-react-system-props";
184
+ import { jsx as jsx3 } from "react/jsx-runtime";
185
+ var isResponsive = (value) => Array.isArray(value);
186
+ var StackHybrid = React3.forwardRef(
187
+ (props, ref) => {
188
+ const { space, align, direction, children, ...rest } = props;
189
+ const needsStyledComponents = hasStyledProps(rest) || isResponsive(space) || isResponsive(align) || isResponsive(direction) || // arbitrary string spacing (e.g. "20px") can't map to a variant class
190
+ typeof space === "string";
191
+ if (needsStyledComponents) {
192
+ return /* @__PURE__ */ jsx3(StackStyledComponents_default, { ref, ...props });
193
+ }
194
+ return /* @__PURE__ */ jsx3(StackTailwind, { ref, ...props });
195
+ }
196
+ );
197
+ StackHybrid.displayName = "Stack";
198
+ var StackHybrid_default = StackHybrid;
199
+
200
+ // src/Stack.tsx
201
+ import { jsx as jsx4 } from "react/jsx-runtime";
202
+ var Stack = React4.forwardRef((props, ref) => /* @__PURE__ */ jsx4(StackHybrid_default, { ...props, ref }));
203
+ Stack.displayName = "Stack";
129
204
  var Stack_default = Stack;
130
205
 
131
206
  // src/StackTypes.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Stack.tsx","../../src/utils.ts","../../src/StackTypes.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport { Children } from \"react\";\nimport { normalizeResponsiveProp } from \"./utils\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport type { TypeStackProps } from \"./StackTypes\";\n\nconst stackStyles = {\n horizontal: {\n left: {\n alignItems: \"center\",\n },\n center: {\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n right: {\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n },\n stretch: {\n alignItems: \"center\",\n },\n },\n vertical: {\n left: {\n flexDirection: \"column\",\n alignItems: \"flex-start\",\n },\n center: {\n flexDirection: \"column\",\n alignItems: \"center\",\n },\n right: {\n flexDirection: \"column\",\n alignItems: \"flex-end\",\n },\n stretch: {\n flexDirection: \"column\",\n alignItems: \"stretch\",\n },\n },\n};\n\nconst Stack = ({\n children,\n space = 300,\n align = \"left\",\n direction = \"vertical\",\n ...rest\n}: TypeStackProps) => {\n const stackItems = Children.toArray(children);\n const responsiveAlignment = normalizeResponsiveProp(align);\n const responsiveDirection = normalizeResponsiveProp(direction);\n const responsiveSpace = normalizeResponsiveProp(space);\n const initialValue = [\"initial\", \"initial\", \"initial\", \"initial\", \"initial\"];\n\n // TODO: rely on styled system to solve this during the refactor\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const styleProps: any = {\n alignItems: [...initialValue],\n flexDirection: [...initialValue],\n justifyContent: [...initialValue],\n };\n const childFlexBasis: (string | null)[] = [...initialValue];\n const childMarginProps = {\n marginLeft: [...initialValue],\n marginTop: [...initialValue],\n };\n\n initialValue.forEach((_, i) => {\n const currentDirection = responsiveDirection[i] as keyof typeof stackStyles;\n const currentAlignment = responsiveAlignment[\n i\n ] as keyof (typeof stackStyles)[\"horizontal\"];\n const currentSpace = responsiveSpace[i];\n\n if (currentDirection && currentAlignment) {\n const styles: { [key: string]: string } =\n stackStyles[currentDirection][currentAlignment];\n Object.keys(styleProps).forEach((key: string) => {\n styleProps[key][i] = styles[key] || \"initial\";\n });\n }\n\n const flexBasis =\n currentAlignment === \"stretch\" && currentDirection === \"horizontal\"\n ? \"100%\"\n : null;\n childFlexBasis[i] = flexBasis;\n\n const margin =\n currentDirection === \"horizontal\" ? \"marginLeft\" : \"marginTop\";\n\n const opposite =\n currentDirection === \"horizontal\" ? \"marginTop\" : \"marginLeft\";\n childMarginProps[margin][i] = currentSpace;\n // styled system can pass numbers that map to theme values and TS doesn't like it\n childMarginProps[opposite][i] = 0 as unknown as string;\n });\n\n return (\n <Box display=\"flex\" {...styleProps} {...rest}>\n {stackItems.map((item, i) => (\n <Box\n flexBasis={childFlexBasis}\n {...(i !== 0 ? childMarginProps : {})}\n key={i}\n >\n {item}\n </Box>\n ))}\n </Box>\n );\n};\n\nexport default Stack;\n","import { theme } from \"@sproutsocial/seeds-react-theme\";\n\nimport type { TypeResponsive } from \"@sproutsocial/seeds-react-system-props\";\n\nconst breakpoints = theme.breakpoints;\nconst LENGTH = breakpoints.length + 1;\n\nexport const normalizeResponsiveProp = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: TypeResponsive<any>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TypeResponsive<any> => {\n if ([\"string\", \"number\"].includes(typeof value)) {\n return Array(LENGTH).fill(value);\n }\n\n if (value.length) {\n switch (value.length) {\n case 1:\n return Array(LENGTH).fill(value[0]);\n case 2:\n return [value[0], ...Array(LENGTH - 1).fill(value[1])];\n case 3:\n return [value[0], value[1], ...Array(LENGTH - 2).fill(value[2])];\n case 4:\n return [\n value[0],\n value[1],\n value[2],\n ...Array(LENGTH - 3).fill(value[3]),\n ];\n case 5:\n return value;\n default:\n throw new Error(\n `Invalid responsive prop length: ${JSON.stringify(value)}`\n );\n }\n } else {\n throw new Error(`Invalid responsive prop type: ${JSON.stringify(value)}`);\n }\n};\n","import * as React from \"react\";\n\nimport type { TypeResponsive } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\n\nexport type TypeSpaceLiterals =\n | 0\n | 100\n | 200\n | 300\n | 350\n | 400\n | 450\n | 500\n | 600\n | string;\n\ntype TypeDirection = \"vertical\" | \"horizontal\";\n\ntype TypeAlignment = \"left\" | \"center\" | \"right\" | \"stretch\";\n\nexport interface TypeStackProps extends TypeBoxProps {\n /** Amount of space between items in the stack */\n space?: TypeResponsive<TypeSpaceLiterals>;\n\n /** Alignment of the items in the stack (horizontal or vertical) */\n align?: TypeResponsive<TypeAlignment>;\n\n /** Axis upon which the stack is laid out (left, center, right, or stretch) */\n direction?: TypeResponsive<TypeDirection>;\n children: React.ReactNode;\n}\n","import Stack from \"./Stack\";\n\nexport default Stack;\nexport { Stack };\nexport * from \"./StackTypes\";\n"],"mappings":";AAAA,OAAuB;AACvB,SAAS,gBAAgB;;;ACDzB,SAAS,aAAa;AAItB,IAAM,cAAc,MAAM;AAC1B,IAAM,SAAS,YAAY,SAAS;AAE7B,IAAM,0BAA0B,CAErC,UAEwB;AACxB,MAAI,CAAC,UAAU,QAAQ,EAAE,SAAS,OAAO,KAAK,GAAG;AAC/C,WAAO,MAAM,MAAM,EAAE,KAA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,qBAAqB,eAAe,cAAc;AACpD,qBAAiB,MAAM,EAAE,CAAC,IAAI;AAE9B,qBAAiB,QAAQ,EAAE,CAAC,IAAI;AAAA,EAClC,CAAC;AAED,SACE,oBAAC,OAAI,SAAQ,QAAQ,GAAG,YAAa,GAAG,MACrC,qBAAW,IAAI,CAAC,MAAM,MACrB;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,MACV,GAAI,MAAM,IAAI,mBAAmB,CAAC;AAAA,MACnC,KAAK;AAAA;AAAA,IAEJ;AAAA,EACH,CACD,GACH;AAEJ;AAEA,IAAO,gBAAQ;;;AEnHf,OAAuB;;;ACEvB,IAAO,gBAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/Stack.tsx","../../src/StackHybrid.tsx","../../src/StackStyledComponents.tsx","../../src/utils.ts","../../src/StackTailwind.tsx","../../src/StackTypes.ts","../../src/index.ts"],"sourcesContent":["import React from \"react\";\nimport type { TypeStackProps } from \"./StackTypes\";\nimport StackHybrid from \"./StackHybrid\";\n\n/**\n * Stack component. Automatically routes between the Tailwind implementation\n * (preferred) and the styled-components implementation (for consumers using\n * system props, a styled() extension, or responsive/arbitrary-string props).\n */\nconst Stack = React.forwardRef<HTMLDivElement, TypeStackProps>((props, ref) => (\n <StackHybrid {...props} ref={ref} />\n));\n\nStack.displayName = \"Stack\";\nexport default Stack;\n","/**\n * Hybrid Stack Component\n * Automatically chooses between Tailwind and styled-components based on props.\n *\n * Routes to the styled-components path when a consumer passes styled-system\n * props (e.g. p, bg, color), a styled() extension, or responsive (array) /\n * arbitrary-string values for space/align/direction — none of which can be\n * expressed as a static CSS class. Otherwise renders the Tailwind path.\n */\n\nimport React from \"react\";\nimport type { TypeStackProps } from \"./StackTypes\";\nimport StackStyledComponents from \"./StackStyledComponents\"; // Styled-components version\nimport { StackTailwind } from \"./StackTailwind\"; // Tailwind version\nimport { hasStyledProps } from \"@sproutsocial/seeds-react-system-props\";\n\nconst isResponsive = (value: unknown): boolean => Array.isArray(value);\n\nconst StackHybrid = React.forwardRef<HTMLDivElement, TypeStackProps>(\n (props, ref) => {\n const { space, align, direction, children, ...rest } = props;\n\n const needsStyledComponents =\n hasStyledProps(rest) ||\n isResponsive(space) ||\n isResponsive(align) ||\n isResponsive(direction) ||\n // arbitrary string spacing (e.g. \"20px\") can't map to a variant class\n typeof space === \"string\";\n\n if (needsStyledComponents) {\n return <StackStyledComponents ref={ref} {...props} />;\n }\n\n // Use Tailwind version (preferred - better performance)\n return <StackTailwind ref={ref} {...props} />;\n }\n);\n\nStackHybrid.displayName = \"Stack\";\nexport default StackHybrid;\n","/**\n * Styled-components (Box-based) implementation of Stack.\n * This is the legacy path used whenever a consumer passes styled-system props,\n * a styled() extension, or responsive (array) / arbitrary-string values for\n * space/align/direction. Relocated verbatim from the original Stack.tsx.\n */\n\nimport * as React from \"react\";\nimport { Children } from \"react\";\nimport { normalizeResponsiveProp } from \"./utils\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport type { TypeStackProps } from \"./StackTypes\";\n\nconst stackStyles = {\n horizontal: {\n left: {\n alignItems: \"center\",\n },\n center: {\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n right: {\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n },\n stretch: {\n alignItems: \"center\",\n },\n },\n vertical: {\n left: {\n flexDirection: \"column\",\n alignItems: \"flex-start\",\n },\n center: {\n flexDirection: \"column\",\n alignItems: \"center\",\n },\n right: {\n flexDirection: \"column\",\n alignItems: \"flex-end\",\n },\n stretch: {\n flexDirection: \"column\",\n alignItems: \"stretch\",\n },\n },\n};\n\nconst StackStyledComponents = React.forwardRef<HTMLDivElement, TypeStackProps>(\n (\n { children, space = 300, align = \"left\", direction = \"vertical\", ...rest },\n ref\n ) => {\n const stackItems = Children.toArray(children);\n const responsiveAlignment = normalizeResponsiveProp(align);\n const responsiveDirection = normalizeResponsiveProp(direction);\n const responsiveSpace = normalizeResponsiveProp(space);\n const initialValue = [\n \"initial\",\n \"initial\",\n \"initial\",\n \"initial\",\n \"initial\",\n ];\n\n // TODO: rely on styled system to solve this during the refactor\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const styleProps: any = {\n alignItems: [...initialValue],\n flexDirection: [...initialValue],\n justifyContent: [...initialValue],\n };\n const childFlexBasis: (string | null)[] = [...initialValue];\n const childMarginProps = {\n marginLeft: [...initialValue],\n marginTop: [...initialValue],\n };\n\n initialValue.forEach((_, i) => {\n const currentDirection = responsiveDirection[i] as keyof typeof stackStyles;\n const currentAlignment = responsiveAlignment[\n i\n ] as keyof (typeof stackStyles)[\"horizontal\"];\n const currentSpace = responsiveSpace[i];\n\n if (currentDirection && currentAlignment) {\n const styles: { [key: string]: string } =\n stackStyles[currentDirection][currentAlignment];\n Object.keys(styleProps).forEach((key: string) => {\n styleProps[key][i] = styles[key] || \"initial\";\n });\n }\n\n const flexBasis =\n currentAlignment === \"stretch\" && currentDirection === \"horizontal\"\n ? \"100%\"\n : null;\n childFlexBasis[i] = flexBasis;\n\n const margin =\n currentDirection === \"horizontal\" ? \"marginLeft\" : \"marginTop\";\n\n const opposite =\n currentDirection === \"horizontal\" ? \"marginTop\" : \"marginLeft\";\n childMarginProps[margin][i] = currentSpace;\n // styled system can pass numbers that map to theme values and TS doesn't like it\n childMarginProps[opposite][i] = 0 as unknown as string;\n });\n\n return (\n <Box display=\"flex\" ref={ref} {...styleProps} {...rest}>\n {stackItems.map((item, i) => (\n <Box\n flexBasis={childFlexBasis}\n {...(i !== 0 ? childMarginProps : {})}\n key={i}\n >\n {item}\n </Box>\n ))}\n </Box>\n );\n }\n);\n\nStackStyledComponents.displayName = \"StackStyledComponents\";\nexport default StackStyledComponents;\n","import { theme } from \"@sproutsocial/seeds-react-theme\";\n\nimport type { TypeResponsive } from \"@sproutsocial/seeds-react-system-props\";\n\nconst breakpoints = theme.breakpoints;\nconst LENGTH = breakpoints.length + 1;\n\nexport const normalizeResponsiveProp = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: TypeResponsive<any>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TypeResponsive<any> => {\n if ([\"string\", \"number\"].includes(typeof value)) {\n return Array(LENGTH).fill(value);\n }\n\n if (value.length) {\n switch (value.length) {\n case 1:\n return Array(LENGTH).fill(value[0]);\n case 2:\n return [value[0], ...Array(LENGTH - 1).fill(value[1])];\n case 3:\n return [value[0], value[1], ...Array(LENGTH - 2).fill(value[2])];\n case 4:\n return [\n value[0],\n value[1],\n value[2],\n ...Array(LENGTH - 3).fill(value[3]),\n ];\n case 5:\n return value;\n default:\n throw new Error(\n `Invalid responsive prop length: ${JSON.stringify(value)}`\n );\n }\n } else {\n throw new Error(`Invalid responsive prop type: ${JSON.stringify(value)}`);\n }\n};\n","/**\n * Tailwind CSS implementation of Stack component\n * Uses Seeds stack CSS classes from stack.css\n *\n * Handles only scalar space/align/direction values. Spacing is applied via the\n * flex `gap` property (replacing the per-child margin Box wrappers of the\n * styled-components path). Responsive (array) / arbitrary-string values and any\n * styled-system props route to the styled-components path via StackHybrid.\n */\n\nimport React from \"react\";\nimport type { TypeStackProps } from \"./StackTypes\";\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 StackTailwind = React.forwardRef<HTMLDivElement, TypeStackProps>(\n (\n {\n children,\n space = 300,\n align = \"left\",\n direction = \"vertical\",\n as,\n className,\n ...rest\n }: TypeStackProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n // Render the consumer-provided element (e.g. <Stack as=\"section\">) and\n // default to a div. `as` is a documented Stack prop (via TypeBoxProps) but\n // is not a styled-system prop, so scalar usage routes here rather than to\n // the styled-components path.\n const Component = (as || \"div\") as any;\n\n const classes = cn(\n \"seeds-stack\",\n `seeds-stack-${direction}`,\n `seeds-stack-align-${align}`,\n `seeds-stack-space-${space}`,\n className\n );\n\n // `as` has been destructured out, so the remaining props are plain\n // DOM/aria/data attributes spread onto the chosen element.\n return (\n <Component className={classes} ref={ref} {...rest}>\n {children}\n </Component>\n );\n }\n);\n\nStackTailwind.displayName = \"StackTailwind\";\n","import * as React from \"react\";\n\nimport type { TypeResponsive } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\n\nexport type TypeSpaceLiterals =\n | 0\n | 100\n | 200\n | 300\n | 350\n | 400\n | 450\n | 500\n | 600\n | string;\n\ntype TypeDirection = \"vertical\" | \"horizontal\";\n\ntype TypeAlignment = \"left\" | \"center\" | \"right\" | \"stretch\";\n\nexport interface TypeStackProps extends TypeBoxProps {\n /** Amount of space between items in the stack */\n space?: TypeResponsive<TypeSpaceLiterals>;\n\n /** Alignment of the items in the stack (horizontal or vertical) */\n align?: TypeResponsive<TypeAlignment>;\n\n /** Axis upon which the stack is laid out (left, center, right, or stretch) */\n direction?: TypeResponsive<TypeDirection>;\n children: React.ReactNode;\n}\n","import Stack from \"./Stack\";\n\nexport default Stack;\nexport { Stack };\nexport * from \"./StackTypes\";\n"],"mappings":";AAAA,OAAOA,YAAW;;;ACUlB,OAAOC,YAAW;;;ACHlB,YAAY,WAAW;AACvB,SAAS,gBAAgB;;;ACRzB,SAAS,aAAa;AAItB,IAAM,cAAc,MAAM;AAC1B,IAAM,SAAS,YAAY,SAAS;AAE7B,IAAM,0BAA0B,CAErC,UAEwB;AACxB,MAAI,CAAC,UAAU,QAAQ,EAAE,SAAS,OAAO,KAAK,GAAG;AAC/C,WAAO,MAAM,MAAM,EAAE,KAAK,KAAK;AAAA,EACjC;AAEA,MAAI,MAAM,QAAQ;AAChB,YAAQ,MAAM,QAAQ;AAAA,MACpB,KAAK;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,MAAM,CAA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AM,QAAQ,KAAK;AAErE,IAAM,cAAcC,OAAM;AAAA,EACxB,CAAC,OAAO,QAAQ;AACd,UAAM,EAAE,OAAO,OAAO,WAAW,UAAU,GAAG,KAAK,IAAI;AAEvD,UAAM,wBACJ,eAAe,IAAI,KACnB,aAAa,KAAK,KAClB,aAAa,KAAK,KAClB,aAAa,SAAS;AAAA,IAEtB,OAAO,UAAU;AAEnB,QAAI,uBAAuB;AACzB,aAAO,gBAAAD,KAAC,iCAAsB,KAAW,GAAG,OAAO;AAAA,IACrD;AAGA,WAAO,gBAAAA,KAAC,iBAAc,KAAW,GAAG,OAAO;AAAA,EAC7C;AACF;AAEA,YAAY,cAAc;AAC1B,IAAO,sBAAQ;;;AD9Bb,gBAAAE,YAAA;AADF,IAAM,QAAQC,OAAM,WAA2C,CAAC,OAAO,QACrE,gBAAAD,KAAC,uBAAa,GAAG,OAAO,KAAU,CACnC;AAED,MAAM,cAAc;AACpB,IAAO,gBAAQ;;;AKdf,OAAuB;;;ACEvB,IAAO,gBAAQ;","names":["React","React","React","jsx","jsx","React","jsx","React"]}
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import * as React from 'react';
2
+ import React__default from 'react';
3
3
  import { TypeResponsive } from '@sproutsocial/seeds-react-system-props';
4
4
  import { TypeBoxProps } from '@sproutsocial/seeds-react-box';
5
5
 
@@ -16,6 +16,11 @@ interface TypeStackProps extends TypeBoxProps {
16
16
  children: React.ReactNode;
17
17
  }
18
18
 
19
- declare const Stack: ({ children, space, align, direction, ...rest }: TypeStackProps) => react_jsx_runtime.JSX.Element;
19
+ /**
20
+ * Stack component. Automatically routes between the Tailwind implementation
21
+ * (preferred) and the styled-components implementation (for consumers using
22
+ * system props, a styled() extension, or responsive/arbitrary-string props).
23
+ */
24
+ declare const Stack: React__default.ForwardRefExoticComponent<Omit<TypeStackProps, "ref"> & React__default.RefAttributes<HTMLDivElement>>;
20
25
 
21
26
  export { Stack, type TypeSpaceLiterals, type TypeStackProps, Stack as default };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import * as React from 'react';
2
+ import React__default from 'react';
3
3
  import { TypeResponsive } from '@sproutsocial/seeds-react-system-props';
4
4
  import { TypeBoxProps } from '@sproutsocial/seeds-react-box';
5
5
 
@@ -16,6 +16,11 @@ interface TypeStackProps extends TypeBoxProps {
16
16
  children: React.ReactNode;
17
17
  }
18
18
 
19
- declare const Stack: ({ children, space, align, direction, ...rest }: TypeStackProps) => react_jsx_runtime.JSX.Element;
19
+ /**
20
+ * Stack component. Automatically routes between the Tailwind implementation
21
+ * (preferred) and the styled-components implementation (for consumers using
22
+ * system props, a styled() extension, or responsive/arbitrary-string props).
23
+ */
24
+ declare const Stack: React__default.ForwardRefExoticComponent<Omit<TypeStackProps, "ref"> & React__default.RefAttributes<HTMLDivElement>>;
20
25
 
21
26
  export { Stack, type TypeSpaceLiterals, type TypeStackProps, Stack as default };
package/dist/index.js CHANGED
@@ -36,7 +36,13 @@ __export(index_exports, {
36
36
  module.exports = __toCommonJS(index_exports);
37
37
 
38
38
  // src/Stack.tsx
39
- var React = require("react");
39
+ var import_react5 = __toESM(require("react"));
40
+
41
+ // src/StackHybrid.tsx
42
+ var import_react4 = __toESM(require("react"));
43
+
44
+ // src/StackStyledComponents.tsx
45
+ var React = __toESM(require("react"));
40
46
  var import_react = require("react");
41
47
 
42
48
  // src/utils.ts
@@ -74,7 +80,7 @@ var normalizeResponsiveProp = (value) => {
74
80
  }
75
81
  };
76
82
 
77
- // src/Stack.tsx
83
+ // src/StackStyledComponents.tsx
78
84
  var import_seeds_react_box = __toESM(require("@sproutsocial/seeds-react-box"));
79
85
  var import_jsx_runtime = require("react/jsx-runtime");
80
86
  var import_react2 = require("react");
@@ -114,59 +120,128 @@ var stackStyles = {
114
120
  }
115
121
  }
116
122
  };
117
- var Stack = ({
118
- children,
119
- space = 300,
120
- align = "left",
121
- direction = "vertical",
122
- ...rest
123
- }) => {
124
- const stackItems = import_react.Children.toArray(children);
125
- const responsiveAlignment = normalizeResponsiveProp(align);
126
- const responsiveDirection = normalizeResponsiveProp(direction);
127
- const responsiveSpace = normalizeResponsiveProp(space);
128
- const initialValue = ["initial", "initial", "initial", "initial", "initial"];
129
- const styleProps = {
130
- alignItems: [...initialValue],
131
- flexDirection: [...initialValue],
132
- justifyContent: [...initialValue]
133
- };
134
- const childFlexBasis = [...initialValue];
135
- const childMarginProps = {
136
- marginLeft: [...initialValue],
137
- marginTop: [...initialValue]
138
- };
139
- initialValue.forEach((_, i) => {
140
- const currentDirection = responsiveDirection[i];
141
- const currentAlignment = responsiveAlignment[i];
142
- const currentSpace = responsiveSpace[i];
143
- if (currentDirection && currentAlignment) {
144
- const styles = stackStyles[currentDirection][currentAlignment];
145
- Object.keys(styleProps).forEach((key) => {
146
- styleProps[key][i] = styles[key] || "initial";
147
- });
123
+ var StackStyledComponents = React.forwardRef(
124
+ ({ children, space = 300, align = "left", direction = "vertical", ...rest }, ref) => {
125
+ const stackItems = import_react.Children.toArray(children);
126
+ const responsiveAlignment = normalizeResponsiveProp(align);
127
+ const responsiveDirection = normalizeResponsiveProp(direction);
128
+ const responsiveSpace = normalizeResponsiveProp(space);
129
+ const initialValue = [
130
+ "initial",
131
+ "initial",
132
+ "initial",
133
+ "initial",
134
+ "initial"
135
+ ];
136
+ const styleProps = {
137
+ alignItems: [...initialValue],
138
+ flexDirection: [...initialValue],
139
+ justifyContent: [...initialValue]
140
+ };
141
+ const childFlexBasis = [...initialValue];
142
+ const childMarginProps = {
143
+ marginLeft: [...initialValue],
144
+ marginTop: [...initialValue]
145
+ };
146
+ initialValue.forEach((_, i) => {
147
+ const currentDirection = responsiveDirection[i];
148
+ const currentAlignment = responsiveAlignment[i];
149
+ const currentSpace = responsiveSpace[i];
150
+ if (currentDirection && currentAlignment) {
151
+ const styles = stackStyles[currentDirection][currentAlignment];
152
+ Object.keys(styleProps).forEach((key) => {
153
+ styleProps[key][i] = styles[key] || "initial";
154
+ });
155
+ }
156
+ const flexBasis = currentAlignment === "stretch" && currentDirection === "horizontal" ? "100%" : null;
157
+ childFlexBasis[i] = flexBasis;
158
+ const margin = currentDirection === "horizontal" ? "marginLeft" : "marginTop";
159
+ const opposite = currentDirection === "horizontal" ? "marginTop" : "marginLeft";
160
+ childMarginProps[margin][i] = currentSpace;
161
+ childMarginProps[opposite][i] = 0;
162
+ });
163
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_seeds_react_box.default, { display: "flex", ref, ...styleProps, ...rest, children: stackItems.map((item, i) => /* @__PURE__ */ (0, import_react2.createElement)(
164
+ import_seeds_react_box.default,
165
+ {
166
+ flexBasis: childFlexBasis,
167
+ ...i !== 0 ? childMarginProps : {},
168
+ key: i
169
+ },
170
+ item
171
+ )) });
172
+ }
173
+ );
174
+ StackStyledComponents.displayName = "StackStyledComponents";
175
+ var StackStyledComponents_default = StackStyledComponents;
176
+
177
+ // src/StackTailwind.tsx
178
+ var import_react3 = __toESM(require("react"));
179
+ var import_jsx_runtime2 = require("react/jsx-runtime");
180
+ function cn(...inputs) {
181
+ const classes = [];
182
+ for (const input of inputs) {
183
+ if (!input) continue;
184
+ if (typeof input === "string") {
185
+ classes.push(input);
186
+ } else if (typeof input === "object") {
187
+ for (const [key, value] of Object.entries(input)) {
188
+ if (value) {
189
+ classes.push(key);
190
+ }
191
+ }
148
192
  }
149
- const flexBasis = currentAlignment === "stretch" && currentDirection === "horizontal" ? "100%" : null;
150
- childFlexBasis[i] = flexBasis;
151
- const margin = currentDirection === "horizontal" ? "marginLeft" : "marginTop";
152
- const opposite = currentDirection === "horizontal" ? "marginTop" : "marginLeft";
153
- childMarginProps[margin][i] = currentSpace;
154
- childMarginProps[opposite][i] = 0;
155
- });
156
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_seeds_react_box.default, { display: "flex", ...styleProps, ...rest, children: stackItems.map((item, i) => /* @__PURE__ */ (0, import_react2.createElement)(
157
- import_seeds_react_box.default,
158
- {
159
- flexBasis: childFlexBasis,
160
- ...i !== 0 ? childMarginProps : {},
161
- key: i
162
- },
163
- item
164
- )) });
165
- };
193
+ }
194
+ return classes.join(" ");
195
+ }
196
+ var StackTailwind = import_react3.default.forwardRef(
197
+ ({
198
+ children,
199
+ space = 300,
200
+ align = "left",
201
+ direction = "vertical",
202
+ as,
203
+ className,
204
+ ...rest
205
+ }, ref) => {
206
+ const Component = as || "div";
207
+ const classes = cn(
208
+ "seeds-stack",
209
+ `seeds-stack-${direction}`,
210
+ `seeds-stack-align-${align}`,
211
+ `seeds-stack-space-${space}`,
212
+ className
213
+ );
214
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Component, { className: classes, ref, ...rest, children });
215
+ }
216
+ );
217
+ StackTailwind.displayName = "StackTailwind";
218
+
219
+ // src/StackHybrid.tsx
220
+ var import_seeds_react_system_props = require("@sproutsocial/seeds-react-system-props");
221
+ var import_jsx_runtime3 = require("react/jsx-runtime");
222
+ var isResponsive = (value) => Array.isArray(value);
223
+ var StackHybrid = import_react4.default.forwardRef(
224
+ (props, ref) => {
225
+ const { space, align, direction, children, ...rest } = props;
226
+ const needsStyledComponents = (0, import_seeds_react_system_props.hasStyledProps)(rest) || isResponsive(space) || isResponsive(align) || isResponsive(direction) || // arbitrary string spacing (e.g. "20px") can't map to a variant class
227
+ typeof space === "string";
228
+ if (needsStyledComponents) {
229
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StackStyledComponents_default, { ref, ...props });
230
+ }
231
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StackTailwind, { ref, ...props });
232
+ }
233
+ );
234
+ StackHybrid.displayName = "Stack";
235
+ var StackHybrid_default = StackHybrid;
236
+
237
+ // src/Stack.tsx
238
+ var import_jsx_runtime4 = require("react/jsx-runtime");
239
+ var Stack = import_react5.default.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StackHybrid_default, { ...props, ref }));
240
+ Stack.displayName = "Stack";
166
241
  var Stack_default = Stack;
167
242
 
168
243
  // src/StackTypes.ts
169
- var React2 = require("react");
244
+ var React5 = require("react");
170
245
 
171
246
  // src/index.ts
172
247
  var index_default = Stack_default;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/Stack.tsx","../src/utils.ts","../src/StackTypes.ts"],"sourcesContent":["import Stack from \"./Stack\";\n\nexport default Stack;\nexport { Stack };\nexport * from \"./StackTypes\";\n","import * as React from \"react\";\nimport { Children } from \"react\";\nimport { normalizeResponsiveProp } from \"./utils\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport type { TypeStackProps } from \"./StackTypes\";\n\nconst stackStyles = {\n horizontal: {\n left: {\n alignItems: \"center\",\n },\n center: {\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n right: {\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n },\n stretch: {\n alignItems: \"center\",\n },\n },\n vertical: {\n left: {\n flexDirection: \"column\",\n alignItems: \"flex-start\",\n },\n center: {\n flexDirection: \"column\",\n alignItems: \"center\",\n },\n right: {\n flexDirection: \"column\",\n alignItems: \"flex-end\",\n },\n stretch: {\n flexDirection: \"column\",\n alignItems: \"stretch\",\n },\n },\n};\n\nconst Stack = ({\n children,\n space = 300,\n align = \"left\",\n direction = \"vertical\",\n ...rest\n}: TypeStackProps) => {\n const stackItems = Children.toArray(children);\n const responsiveAlignment = normalizeResponsiveProp(align);\n const responsiveDirection = normalizeResponsiveProp(direction);\n const responsiveSpace = normalizeResponsiveProp(space);\n const initialValue = [\"initial\", \"initial\", \"initial\", \"initial\", \"initial\"];\n\n // TODO: rely on styled system to solve this during the refactor\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const styleProps: any = {\n alignItems: [...initialValue],\n flexDirection: [...initialValue],\n justifyContent: [...initialValue],\n };\n const childFlexBasis: (string | null)[] = [...initialValue];\n const childMarginProps = {\n marginLeft: [...initialValue],\n marginTop: [...initialValue],\n };\n\n initialValue.forEach((_, i) => {\n const currentDirection = responsiveDirection[i] as keyof typeof stackStyles;\n const currentAlignment = responsiveAlignment[\n i\n ] as keyof (typeof stackStyles)[\"horizontal\"];\n const currentSpace = responsiveSpace[i];\n\n if (currentDirection && currentAlignment) {\n const styles: { [key: string]: string } =\n stackStyles[currentDirection][currentAlignment];\n Object.keys(styleProps).forEach((key: string) => {\n styleProps[key][i] = styles[key] || \"initial\";\n });\n }\n\n const flexBasis =\n currentAlignment === \"stretch\" && currentDirection === \"horizontal\"\n ? \"100%\"\n : null;\n childFlexBasis[i] = flexBasis;\n\n const margin =\n currentDirection === \"horizontal\" ? \"marginLeft\" : \"marginTop\";\n\n const opposite =\n currentDirection === \"horizontal\" ? \"marginTop\" : \"marginLeft\";\n childMarginProps[margin][i] = currentSpace;\n // styled system can pass numbers that map to theme values and TS doesn't like it\n childMarginProps[opposite][i] = 0 as unknown as string;\n });\n\n return (\n <Box display=\"flex\" {...styleProps} {...rest}>\n {stackItems.map((item, i) => (\n <Box\n flexBasis={childFlexBasis}\n {...(i !== 0 ? childMarginProps : {})}\n key={i}\n >\n {item}\n </Box>\n ))}\n </Box>\n );\n};\n\nexport default Stack;\n","import { theme } from \"@sproutsocial/seeds-react-theme\";\n\nimport type { TypeResponsive } from \"@sproutsocial/seeds-react-system-props\";\n\nconst breakpoints = theme.breakpoints;\nconst LENGTH = breakpoints.length + 1;\n\nexport const normalizeResponsiveProp = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: TypeResponsive<any>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TypeResponsive<any> => {\n if ([\"string\", \"number\"].includes(typeof value)) {\n return Array(LENGTH).fill(value);\n }\n\n if (value.length) {\n switch (value.length) {\n case 1:\n return Array(LENGTH).fill(value[0]);\n case 2:\n return [value[0], ...Array(LENGTH - 1).fill(value[1])];\n case 3:\n return [value[0], value[1], ...Array(LENGTH - 2).fill(value[2])];\n case 4:\n return [\n value[0],\n value[1],\n value[2],\n ...Array(LENGTH - 3).fill(value[3]),\n ];\n case 5:\n return value;\n default:\n throw new Error(\n `Invalid responsive prop length: ${JSON.stringify(value)}`\n );\n }\n } else {\n throw new Error(`Invalid responsive prop type: ${JSON.stringify(value)}`);\n }\n};\n","import * as React from \"react\";\n\nimport type { TypeResponsive } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\n\nexport type TypeSpaceLiterals =\n | 0\n | 100\n | 200\n | 300\n | 350\n | 400\n | 450\n | 500\n | 600\n | string;\n\ntype TypeDirection = \"vertical\" | \"horizontal\";\n\ntype TypeAlignment = \"left\" | \"center\" | \"right\" | \"stretch\";\n\nexport interface TypeStackProps extends TypeBoxProps {\n /** Amount of space between items in the stack */\n space?: TypeResponsive<TypeSpaceLiterals>;\n\n /** Alignment of the items in the stack (horizontal or vertical) */\n align?: TypeResponsive<TypeAlignment>;\n\n /** Axis upon which the stack is laid out (left, center, right, or stretch) */\n direction?: TypeResponsive<TypeDirection>;\n children: React.ReactNode;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,mBAAyB;;;ACDzB,+BAAsB;AAItB,IAAM,cAAc,+BAAM;AAC1B,IAAM,SAAS,YAAY,SAAS;AAE7B,IAAM,0BAA0B,CAErC,UAEwB;AACxB,MAAI,CAAC,UAAU,QAAQ,EAAE,SAAS,OAAO,KAAK,GAAG;AAC/C,WAAO,MAAM,MAAM,EAAE,KAAK,KAAK;AAAA,EACjC;AAEA,MAAI,MAAM,QAAQ;AAChB,YAAQ,MAAM,QAAQ;AAAA,MACpB,KAAK;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,MAAM,CAAC,CAAC;AAAA,MACpC,KAAK;AACH,eAAO,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,SAAS,CAAC,EAAE,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MAAM,MACrB;AAAA,IAAC,uBAAAA;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,MACV,GAAI,MAAM,IAAI,mBAAmB,CAAC;AAAA,MACnC,KAAK;AAAA;AAAA,IAEJ;AAAA,EACH,CACD,GACH;AAEJ;AAEA,IAAO,gBAAQ;;;AEnHf,IAAAC,SAAuB;;;AHEvB,IAAO,gBAAQ;","names":["import_react","Box","React"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/Stack.tsx","../src/StackHybrid.tsx","../src/StackStyledComponents.tsx","../src/utils.ts","../src/StackTailwind.tsx","../src/StackTypes.ts"],"sourcesContent":["import Stack from \"./Stack\";\n\nexport default Stack;\nexport { Stack };\nexport * from \"./StackTypes\";\n","import React from \"react\";\nimport type { TypeStackProps } from \"./StackTypes\";\nimport StackHybrid from \"./StackHybrid\";\n\n/**\n * Stack component. Automatically routes between the Tailwind implementation\n * (preferred) and the styled-components implementation (for consumers using\n * system props, a styled() extension, or responsive/arbitrary-string props).\n */\nconst Stack = React.forwardRef<HTMLDivElement, TypeStackProps>((props, ref) => (\n <StackHybrid {...props} ref={ref} />\n));\n\nStack.displayName = \"Stack\";\nexport default Stack;\n","/**\n * Hybrid Stack Component\n * Automatically chooses between Tailwind and styled-components based on props.\n *\n * Routes to the styled-components path when a consumer passes styled-system\n * props (e.g. p, bg, color), a styled() extension, or responsive (array) /\n * arbitrary-string values for space/align/direction — none of which can be\n * expressed as a static CSS class. Otherwise renders the Tailwind path.\n */\n\nimport React from \"react\";\nimport type { TypeStackProps } from \"./StackTypes\";\nimport StackStyledComponents from \"./StackStyledComponents\"; // Styled-components version\nimport { StackTailwind } from \"./StackTailwind\"; // Tailwind version\nimport { hasStyledProps } from \"@sproutsocial/seeds-react-system-props\";\n\nconst isResponsive = (value: unknown): boolean => Array.isArray(value);\n\nconst StackHybrid = React.forwardRef<HTMLDivElement, TypeStackProps>(\n (props, ref) => {\n const { space, align, direction, children, ...rest } = props;\n\n const needsStyledComponents =\n hasStyledProps(rest) ||\n isResponsive(space) ||\n isResponsive(align) ||\n isResponsive(direction) ||\n // arbitrary string spacing (e.g. \"20px\") can't map to a variant class\n typeof space === \"string\";\n\n if (needsStyledComponents) {\n return <StackStyledComponents ref={ref} {...props} />;\n }\n\n // Use Tailwind version (preferred - better performance)\n return <StackTailwind ref={ref} {...props} />;\n }\n);\n\nStackHybrid.displayName = \"Stack\";\nexport default StackHybrid;\n","/**\n * Styled-components (Box-based) implementation of Stack.\n * This is the legacy path used whenever a consumer passes styled-system props,\n * a styled() extension, or responsive (array) / arbitrary-string values for\n * space/align/direction. Relocated verbatim from the original Stack.tsx.\n */\n\nimport * as React from \"react\";\nimport { Children } from \"react\";\nimport { normalizeResponsiveProp } from \"./utils\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport type { TypeStackProps } from \"./StackTypes\";\n\nconst stackStyles = {\n horizontal: {\n left: {\n alignItems: \"center\",\n },\n center: {\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n right: {\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n },\n stretch: {\n alignItems: \"center\",\n },\n },\n vertical: {\n left: {\n flexDirection: \"column\",\n alignItems: \"flex-start\",\n },\n center: {\n flexDirection: \"column\",\n alignItems: \"center\",\n },\n right: {\n flexDirection: \"column\",\n alignItems: \"flex-end\",\n },\n stretch: {\n flexDirection: \"column\",\n alignItems: \"stretch\",\n },\n },\n};\n\nconst StackStyledComponents = React.forwardRef<HTMLDivElement, TypeStackProps>(\n (\n { children, space = 300, align = \"left\", direction = \"vertical\", ...rest },\n ref\n ) => {\n const stackItems = Children.toArray(children);\n const responsiveAlignment = normalizeResponsiveProp(align);\n const responsiveDirection = normalizeResponsiveProp(direction);\n const responsiveSpace = normalizeResponsiveProp(space);\n const initialValue = [\n \"initial\",\n \"initial\",\n \"initial\",\n \"initial\",\n \"initial\",\n ];\n\n // TODO: rely on styled system to solve this during the refactor\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const styleProps: any = {\n alignItems: [...initialValue],\n flexDirection: [...initialValue],\n justifyContent: [...initialValue],\n };\n const childFlexBasis: (string | null)[] = [...initialValue];\n const childMarginProps = {\n marginLeft: [...initialValue],\n marginTop: [...initialValue],\n };\n\n initialValue.forEach((_, i) => {\n const currentDirection = responsiveDirection[i] as keyof typeof stackStyles;\n const currentAlignment = responsiveAlignment[\n i\n ] as keyof (typeof stackStyles)[\"horizontal\"];\n const currentSpace = responsiveSpace[i];\n\n if (currentDirection && currentAlignment) {\n const styles: { [key: string]: string } =\n stackStyles[currentDirection][currentAlignment];\n Object.keys(styleProps).forEach((key: string) => {\n styleProps[key][i] = styles[key] || \"initial\";\n });\n }\n\n const flexBasis =\n currentAlignment === \"stretch\" && currentDirection === \"horizontal\"\n ? \"100%\"\n : null;\n childFlexBasis[i] = flexBasis;\n\n const margin =\n currentDirection === \"horizontal\" ? \"marginLeft\" : \"marginTop\";\n\n const opposite =\n currentDirection === \"horizontal\" ? \"marginTop\" : \"marginLeft\";\n childMarginProps[margin][i] = currentSpace;\n // styled system can pass numbers that map to theme values and TS doesn't like it\n childMarginProps[opposite][i] = 0 as unknown as string;\n });\n\n return (\n <Box display=\"flex\" ref={ref} {...styleProps} {...rest}>\n {stackItems.map((item, i) => (\n <Box\n flexBasis={childFlexBasis}\n {...(i !== 0 ? childMarginProps : {})}\n key={i}\n >\n {item}\n </Box>\n ))}\n </Box>\n );\n }\n);\n\nStackStyledComponents.displayName = \"StackStyledComponents\";\nexport default StackStyledComponents;\n","import { theme } from \"@sproutsocial/seeds-react-theme\";\n\nimport type { TypeResponsive } from \"@sproutsocial/seeds-react-system-props\";\n\nconst breakpoints = theme.breakpoints;\nconst LENGTH = breakpoints.length + 1;\n\nexport const normalizeResponsiveProp = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: TypeResponsive<any>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TypeResponsive<any> => {\n if ([\"string\", \"number\"].includes(typeof value)) {\n return Array(LENGTH).fill(value);\n }\n\n if (value.length) {\n switch (value.length) {\n case 1:\n return Array(LENGTH).fill(value[0]);\n case 2:\n return [value[0], ...Array(LENGTH - 1).fill(value[1])];\n case 3:\n return [value[0], value[1], ...Array(LENGTH - 2).fill(value[2])];\n case 4:\n return [\n value[0],\n value[1],\n value[2],\n ...Array(LENGTH - 3).fill(value[3]),\n ];\n case 5:\n return value;\n default:\n throw new Error(\n `Invalid responsive prop length: ${JSON.stringify(value)}`\n );\n }\n } else {\n throw new Error(`Invalid responsive prop type: ${JSON.stringify(value)}`);\n }\n};\n","/**\n * Tailwind CSS implementation of Stack component\n * Uses Seeds stack CSS classes from stack.css\n *\n * Handles only scalar space/align/direction values. Spacing is applied via the\n * flex `gap` property (replacing the per-child margin Box wrappers of the\n * styled-components path). Responsive (array) / arbitrary-string values and any\n * styled-system props route to the styled-components path via StackHybrid.\n */\n\nimport React from \"react\";\nimport type { TypeStackProps } from \"./StackTypes\";\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 StackTailwind = React.forwardRef<HTMLDivElement, TypeStackProps>(\n (\n {\n children,\n space = 300,\n align = \"left\",\n direction = \"vertical\",\n as,\n className,\n ...rest\n }: TypeStackProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n // Render the consumer-provided element (e.g. <Stack as=\"section\">) and\n // default to a div. `as` is a documented Stack prop (via TypeBoxProps) but\n // is not a styled-system prop, so scalar usage routes here rather than to\n // the styled-components path.\n const Component = (as || \"div\") as any;\n\n const classes = cn(\n \"seeds-stack\",\n `seeds-stack-${direction}`,\n `seeds-stack-align-${align}`,\n `seeds-stack-space-${space}`,\n className\n );\n\n // `as` has been destructured out, so the remaining props are plain\n // DOM/aria/data attributes spread onto the chosen element.\n return (\n <Component className={classes} ref={ref} {...rest}>\n {children}\n </Component>\n );\n }\n);\n\nStackTailwind.displayName = \"StackTailwind\";\n","import * as React from \"react\";\n\nimport type { TypeResponsive } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\n\nexport type TypeSpaceLiterals =\n | 0\n | 100\n | 200\n | 300\n | 350\n | 400\n | 450\n | 500\n | 600\n | string;\n\ntype TypeDirection = \"vertical\" | \"horizontal\";\n\ntype TypeAlignment = \"left\" | \"center\" | \"right\" | \"stretch\";\n\nexport interface TypeStackProps extends TypeBoxProps {\n /** Amount of space between items in the stack */\n space?: TypeResponsive<TypeSpaceLiterals>;\n\n /** Alignment of the items in the stack (horizontal or vertical) */\n align?: TypeResponsive<TypeAlignment>;\n\n /** Axis upon which the stack is laid out (left, center, right, or stretch) */\n direction?: TypeResponsive<TypeDirection>;\n children: React.ReactNode;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAAkB;;;ACUlB,IAAAC,gBAAkB;;;ACHlB,YAAuB;AACvB,mBAAyB;;;ACRzB,+BAAsB;AAItB,IAAM,cAAc,+BAAM;AAC1B,IAAM,SAAS,YAAY,SAAS;AAE7B,IAAM,0BAA0B,CAErC,UAEwB;AACxB,MAAI,CAAC,UAAU,QAAQ,EAAE,SAAS,OAAO,KAAK,GAAG;AAC/C,WAAO,MAAM,MAAM,EAAE,KAAK,KAAK;AAAA,EACjC;AAEA,MAAI,MAAM,QAAQ;AAChB,YAAQ,MAAM,QAAQ;AAAA,MACpB,KAAK;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,MAAM,CAAC,CAAC;AAAA,MACpC,KAAK;AACH,eAAO,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,SAAS,CAAC,EAAE,KAAK,MAAM,CAAC,C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AQ;AACd,UAAM,EAAE,OAAO,OAAO,WAAW,UAAU,GAAG,KAAK,IAAI;AAEvD,UAAM,4BACJ,gDAAe,IAAI,KACnB,aAAa,KAAK,KAClB,aAAa,KAAK,KAClB,aAAa,SAAS;AAAA,IAEtB,OAAO,UAAU;AAEnB,QAAI,uBAAuB;AACzB,aAAO,6CAAC,iCAAsB,KAAW,GAAG,OAAO;AAAA,IACrD;AAGA,WAAO,6CAAC,iBAAc,KAAW,GAAG,OAAO;AAAA,EAC7C;AACF;AAEA,YAAY,cAAc;AAC1B,IAAO,sBAAQ;;;AD9Bb,IAAAC,sBAAA;AADF,IAAM,QAAQ,cAAAC,QAAM,WAA2C,CAAC,OAAO,QACrE,6CAAC,uBAAa,GAAG,OAAO,KAAU,CACnC;AAED,MAAM,cAAc;AACpB,IAAO,gBAAQ;;;AKdf,IAAAC,SAAuB;;;ANEvB,IAAO,gBAAQ;","names":["import_react","import_react","import_react","Box","import_react","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","React","React"]}