@swan-io/lake 8.15.8 → 8.15.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-io/lake",
3
- "version": "8.15.8",
3
+ "version": "8.15.10",
4
4
  "engines": {
5
5
  "node": ">=20.9.0",
6
6
  "yarn": "^1.22.0"
@@ -5,6 +5,7 @@ import { backgroundColor, colors, negativeSpacings, radii, shadows, spacings, te
5
5
  import { isNotNullish } from "../utils/nullish";
6
6
  import { Box } from "./Box";
7
7
  import { LakeText } from "./LakeText";
8
+ import { ResponsiveContainer } from "./ResponsiveContainer";
8
9
  import { Space } from "./Space";
9
10
  const styles = StyleSheet.create({
10
11
  container: {
@@ -97,24 +98,21 @@ export const TileFullWidthContent = ({ children, flexGrow, fitToBottom = false,
97
98
  };
98
99
  const SPACE = _jsx(Space, { height: 24 });
99
100
  export const TileGrid = ({ children, breakpoint = 1000 }) => {
100
- const [flexDirection, setFlexDirection] = useState("row");
101
- const onLayout = useCallback(({ nativeEvent: { layout: { width }, }, }) => {
102
- setFlexDirection(() => (width < breakpoint ? "column" : "row"));
103
- }, [breakpoint]);
104
- const childrenArray = Children.toArray(children);
105
- const leftColumn = [];
106
- const rightColumn = [];
107
- const nonNullChildren = childrenArray.filter(isNotNullish);
108
- nonNullChildren.forEach((item, index) => {
109
- if (flexDirection === "column" || index % 2 === 0) {
110
- leftColumn.push(_jsxs(Fragment, { children: [item, SPACE] }, index));
111
- }
112
- else {
113
- rightColumn.push(_jsxs(Fragment, { children: [item, SPACE] }, index));
114
- }
115
- });
116
- const isRow = flexDirection === "row";
117
- return (_jsxs(Box, { direction: flexDirection, onLayout: onLayout, children: [_jsx(View, { style: [isRow && styles.column, isRow && { flexBasis: breakpoint / 2 }], children: leftColumn }), _jsx(Space, { width: 24 }), _jsx(View, { style: [isRow && styles.column, isRow && { flexBasis: breakpoint / 2 }], children: rightColumn })] }));
101
+ return (_jsx(ResponsiveContainer, { breakpoint: breakpoint, children: ({ small, large }) => {
102
+ const childrenArray = Children.toArray(children);
103
+ const leftColumn = [];
104
+ const rightColumn = [];
105
+ const nonNullChildren = childrenArray.filter(isNotNullish);
106
+ nonNullChildren.forEach((item, index) => {
107
+ if (small || index % 2 === 0) {
108
+ leftColumn.push(_jsxs(Fragment, { children: [item, SPACE] }, index));
109
+ }
110
+ else {
111
+ rightColumn.push(_jsxs(Fragment, { children: [item, SPACE] }, index));
112
+ }
113
+ });
114
+ return (_jsxs(Box, { direction: small ? "column" : "row", children: [_jsx(View, { style: [large && styles.column, large && { flexBasis: breakpoint / 2 }], children: leftColumn }), _jsx(Space, { width: 24 }), _jsx(View, { style: [large && styles.column, large && { flexBasis: breakpoint / 2 }], children: rightColumn })] }));
115
+ } }));
118
116
  };
119
117
  export const TileRows = ({ children, breakpoint = 1000 }) => {
120
118
  const [flexDirection, setFlexDirection] = useState("row");