@swan-io/lake 4.4.1 → 4.5.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/package.json +5 -5
- package/src/components/FixedListView.js +3 -7
- package/src/components/ResponsiveContainer.d.ts +5 -5
- package/src/components/ResponsiveContainer.js +8 -8
- package/src/hooks/useBreakpoint.d.ts +1 -0
- package/src/hooks/useBreakpoint.js +13 -0
- package/src/hooks/useResponsive.d.ts +1 -1
- package/src/hooks/useResponsive.js +4 -17
- package/src/icons/custom-icons.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swan-io/lake",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=18.0.0",
|
|
6
6
|
"yarn": "^1.22.0"
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@popperjs/core": "^2.11.8",
|
|
30
|
-
"@react-three/drei": "^9.
|
|
31
|
-
"@react-three/fiber": "^8.15.
|
|
30
|
+
"@react-three/drei": "^9.94.1",
|
|
31
|
+
"@react-three/fiber": "^8.15.14",
|
|
32
32
|
"@swan-io/boxed": "^2.0.0",
|
|
33
33
|
"@swan-io/chicane": "^1.4.1",
|
|
34
34
|
"dayjs": "^1.11.10",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"uuid": "^9.0.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@types/react": "^18.2.
|
|
51
|
+
"@types/react": "^18.2.48",
|
|
52
52
|
"@types/react-dom": "^18.2.18",
|
|
53
53
|
"@types/react-native": "^0.72.8",
|
|
54
54
|
"@types/three": "^0.160.0",
|
|
55
55
|
"@types/uuid": "^9.0.7",
|
|
56
|
-
"jsdom": "^23.0
|
|
56
|
+
"jsdom": "^23.2.0",
|
|
57
57
|
"type-fest": "^4.9.0"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -275,11 +275,7 @@ const styles = StyleSheet.create({
|
|
|
275
275
|
borderBottomRightRadius: radii[4],
|
|
276
276
|
},
|
|
277
277
|
emptyListContainer: {
|
|
278
|
-
|
|
279
|
-
top: 0,
|
|
280
|
-
left: 0,
|
|
281
|
-
right: 0,
|
|
282
|
-
bottom: 0,
|
|
278
|
+
flexGrow: 1,
|
|
283
279
|
flexDirection: "column",
|
|
284
280
|
alignItems: "center",
|
|
285
281
|
justifyContent: "center",
|
|
@@ -725,7 +721,7 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
|
|
|
725
721
|
setHasHorizontalScroll(centerColumnsWidth > width);
|
|
726
722
|
}, [centerColumnsWidth]);
|
|
727
723
|
const isLoading = isNotNullish(loading) && loading.isLoading;
|
|
728
|
-
return (_jsxs(View, { style: styles.root, children: [_jsx(View, { ref: startFocusAnchorRef, tabIndex: 0 }), _jsxs(ScrollView, { onKeyDown: onKeyDown, onLayout: onLayout, onScroll: onScroll, scrollEventThrottle: 32, style: [styles.container, mode === "tile" && styles.containerTile], contentContainerStyle: [
|
|
724
|
+
return (_jsxs(View, { style: styles.root, children: [_jsx(View, { ref: startFocusAnchorRef, tabIndex: 0 }), data.length === 0 && isNotNullish(renderEmptyList) && !isLoading ? (_jsx(View, { style: styles.emptyListContainer, children: renderEmptyList() })) : (_jsxs(ScrollView, { onKeyDown: onKeyDown, onLayout: onLayout, onScroll: onScroll, scrollEventThrottle: 32, style: [styles.container, mode === "tile" && styles.containerTile], contentContainerStyle: [
|
|
729
725
|
styles.contentContainer,
|
|
730
726
|
{
|
|
731
727
|
height: totalHeight +
|
|
@@ -808,7 +804,7 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
|
|
|
808
804
|
], children: [_jsx(View, { style: [
|
|
809
805
|
styles.stickyColumnEndOverflow,
|
|
810
806
|
{ width: horizontalPadding, backgroundColor: headerBackgroundColor },
|
|
811
|
-
] }), _jsx(HeaderSegment, { columns: stickedToEndColumns, extraInfo: extraInfo, viewId: viewId, width: stickedToEndColumnsWidth }), _jsx(View, { style: [styles.topGradient, isScrolled && styles.visibleTopGradient] })] }), _jsx(View, { style: { height: rowsHeight }, children: endRows })] })) : null] })] })
|
|
807
|
+
] }), _jsx(HeaderSegment, { columns: stickedToEndColumns, extraInfo: extraInfo, viewId: viewId, width: stickedToEndColumnsWidth }), _jsx(View, { style: [styles.topGradient, isScrolled && styles.visibleTopGradient] })] }), _jsx(View, { style: { height: rowsHeight }, children: endRows })] })) : null] })] })), _jsx(View, { ref: endFocusAnchorRef, tabIndex: 0 })] }));
|
|
812
808
|
};
|
|
813
809
|
export const FixedListViewPlaceholder = ({ count, rowHeight, rowVerticalSpacing, groupHeaderHeight, headerHeight, paddingHorizontal = HORIZONTAL_SAFE_AREA, }) => {
|
|
814
810
|
const totalRowHeight = rowHeight + rowVerticalSpacing;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { ViewProps } from "react-native";
|
|
3
|
+
import { Merge } from "type-fest";
|
|
3
4
|
export type Context = {
|
|
4
5
|
small: boolean;
|
|
5
6
|
large: boolean;
|
|
6
7
|
};
|
|
7
|
-
type Props = {
|
|
8
|
-
children: (context: Context) => ReactNode;
|
|
9
|
-
style?: ViewProps["style"];
|
|
8
|
+
type Props = Merge<ViewProps, {
|
|
10
9
|
breakpoint?: number;
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
children: (context: Context) => ReactNode;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const ResponsiveContainer: ({ breakpoint, children, style, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -6,18 +6,18 @@ const styles = StyleSheet.create({
|
|
|
6
6
|
opacity: 0,
|
|
7
7
|
},
|
|
8
8
|
});
|
|
9
|
-
export const ResponsiveContainer = ({ children, style,
|
|
10
|
-
const [isSmall, setIsSmall] = useState(null);
|
|
9
|
+
export const ResponsiveContainer = ({ breakpoint = 1000, children, style, ...props }) => {
|
|
11
10
|
const containerRef = useRef(null);
|
|
11
|
+
const [small, setSmall] = useState(null);
|
|
12
12
|
const onLayout = useCallback(({ nativeEvent: { layout: { width }, }, }) => {
|
|
13
|
-
|
|
13
|
+
setSmall(width < breakpoint);
|
|
14
14
|
}, [breakpoint]);
|
|
15
15
|
useLayoutEffect(() => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const element = containerRef.current;
|
|
17
|
+
if (element != null) {
|
|
18
|
+
setSmall(element.offsetWidth < breakpoint);
|
|
19
19
|
}
|
|
20
20
|
}, [breakpoint]);
|
|
21
|
-
const isSmallWithDefault =
|
|
22
|
-
return (_jsx(View, { ref: containerRef, onLayout: onLayout, style: [style,
|
|
21
|
+
const isSmallWithDefault = small ?? false;
|
|
22
|
+
return (_jsx(View, { ref: containerRef, onLayout: onLayout, style: [style, small == null ? styles.hidden : null], ...props, children: children({ small: isSmallWithDefault, large: !isSmallWithDefault }) }));
|
|
23
23
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useBreakpoint: (breakpoint: number) => boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Based on https://github.com/necolas/react-native-web/blob/0.19.10/packages/react-native-web/src/exports/useWindowDimensions/index.js
|
|
2
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
3
|
+
import { Dimensions } from "react-native";
|
|
4
|
+
export const useBreakpoint = (breakpoint) => useSyncExternalStore(useCallback(onStoreChange => {
|
|
5
|
+
const subscription = Dimensions.addEventListener("change", ({ window }) => {
|
|
6
|
+
if (window != null) {
|
|
7
|
+
onStoreChange();
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
return subscription.remove;
|
|
11
|
+
}, []), useCallback(() => {
|
|
12
|
+
return Dimensions.get("window").width >= breakpoint;
|
|
13
|
+
}, [breakpoint]));
|
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const BREAKPOINT = 992;
|
|
6
|
-
const isDesktop = ({ width }, breakpoint) => width >= breakpoint;
|
|
7
|
-
export const useResponsive = (breakpoint = BREAKPOINT) => {
|
|
8
|
-
const desktop = useSyncExternalStore(onStoreChange => {
|
|
9
|
-
const subscription = Dimensions.addEventListener("change", ({ window }) => {
|
|
10
|
-
if (isNotNullish(window)) {
|
|
11
|
-
onStoreChange();
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
return () => {
|
|
15
|
-
subscription.remove();
|
|
16
|
-
};
|
|
17
|
-
}, () => isDesktop(Dimensions.get("window"), breakpoint));
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { useBreakpoint } from "./useBreakpoint";
|
|
3
|
+
export const useResponsive = (breakpoint = 992) => {
|
|
4
|
+
const desktop = useBreakpoint(breakpoint);
|
|
18
5
|
const media = useCallback((values) => desktop ? values.desktop ?? values.mobile : values.mobile, [desktop]);
|
|
19
6
|
return { desktop, media };
|
|
20
7
|
};
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"lake-face-id": "M0 4.06A4.06 4.06 0 0 1 4.06 0h4.393a.682.682 0 1 1 0 1.365H4.06A2.696 2.696 0 0 0 1.365 4.06v4.392a.682.682 0 1 1-1.365 0V4.06ZM14.865.683c0-.376.305-.682.682-.682h4.392A4.06 4.06 0 0 1 24 4.06v4.393a.682.682 0 1 1-1.365 0V4.06a2.696 2.696 0 0 0-2.696-2.696h-4.392a.682.682 0 0 1-.682-.683ZM9.459 9.297a2.54 2.54 0 1 1 5.082 0 2.54 2.54 0 0 1-5.082 0ZM7.838 14.23c0-.544.442-.986.986-.986h6.352c.544 0 .986.441.986.986v.203c0 .95-.487 1.661-1.252 2.127-.758.461-1.79.684-2.91.684s-2.152-.223-2.91-.684c-.765-.466-1.252-1.177-1.252-2.127v-.203ZM0 15.547a.682.682 0 0 1 1.365 0v4.392a2.696 2.696 0 0 0 2.696 2.696h4.392a.682.682 0 0 1 0 1.365H4.06A4.06 4.06 0 0 1 0 19.94v-4.393Zm22.635 0a.682.682 0 0 1 1.365 0v4.392A4.06 4.06 0 0 1 19.94 24h-4.393a.682.682 0 1 1 0-1.365h4.392a2.696 2.696 0 0 0 2.696-2.696v-4.392Z",
|
|
33
33
|
"lake-fingerprint": "M5.134 1.578C6.968.46 9.46-.075 11.955.008c2.499.084 5.077.79 7.079 2.242a.65.65 0 0 1-.763 1.051c-1.744-1.265-4.054-1.917-6.36-1.994-2.308-.078-4.533.425-6.101 1.38a.65.65 0 1 1-.676-1.11ZM2.792 3.574a.65.65 0 0 1 .859.974C2.61 5.468 1.907 6.393 1.212 7.6a.65.65 0 1 1-1.125-.648c.75-1.302 1.536-2.347 2.705-3.378Zm9.107.73a.65.65 0 0 1 .722-.568c5.847.694 9.493 5.24 10.529 11.144a.65.65 0 1 1-1.28.224c-.967-5.513-4.282-9.47-9.402-10.078a.65.65 0 0 1-.569-.722Zm-3.143-.198a.65.65 0 0 1 .504 1.197C4.15 7.452 1.562 12.219 2.259 18.131a.65.65 0 0 1-1.29.152C.212 11.86 3.058 6.503 8.756 4.106ZM7.422 8.929c1.537-1.23 3.476-1.803 5.43-1.496 1.958.308 3.868 1.49 5.37 3.652a.65.65 0 0 1-1.068.74c-1.328-1.912-2.943-2.864-4.504-3.11-1.567-.245-3.144.21-4.417 1.228-2.522 2.018-3.926 6.356-1.215 11.833a.65.65 0 0 1-1.164.577C2.932 16.449 4.325 11.407 7.422 8.929Zm1.998 3.06c.75-.674 1.736-.965 2.864-.859 1.366.13 2.27.628 2.867 1.437.558.758.79 1.727.99 2.633l.05.23h.001v.001l.003.011c.395 1.8.804 3.664 2.84 5.131a.65.65 0 0 1-.76 1.054c-2.444-1.762-2.95-4.07-3.339-5.858l-.063-.288c-.208-.942-.397-1.64-.768-2.144-.333-.451-.865-.811-1.944-.913-.82-.078-1.43.134-1.873.531-.454.409-.8 1.075-.952 2.02-.305 1.904.21 4.747 1.864 8.087a.65.65 0 0 1-1.165.576c-1.716-3.467-2.346-6.595-1.98-8.869.183-1.143.627-2.117 1.365-2.78Zm9.294 2.361a.65.65 0 0 1 .741.542c.256 1.646 1.077 2.66 2.149 3.43a.65.65 0 1 1-.759 1.055c-1.292-.93-2.353-2.227-2.673-4.285a.65.65 0 0 1 .542-.742Zm-6.861.637a.65.65 0 0 1 .696.6c.199 2.652 1.17 4.904 2.735 6.693a.65.65 0 1 1-.978.855c-1.753-2.006-2.833-4.525-3.052-7.452a.65.65 0 0 1 .599-.696Z",
|
|
34
34
|
"lake-id-card": "M9.996 10.586a.89.89 0 1 1-1.782 0 .89.89 0 0 1 1.782 0Zm-2.49 2.298c0-.2.162-.36.361-.36h2.475c.2 0 .36.16.36.36v.185c0 .008 0 .02-.002.037a1.33 1.33 0 0 1-.192.571c-.188.301-.574.628-1.403.628-.83 0-1.215-.327-1.403-.627a1.33 1.33 0 0 1-.195-.609v-.185Zm4.95-2.21c0-.15.122-.272.273-.272h3.358a.272.272 0 0 1 0 .544H12.73a.272.272 0 0 1-.273-.272Zm0 2.475c0-.15.122-.272.273-.272h3.358a.272.272 0 0 1 0 .544H12.73a.272.272 0 0 1-.273-.272ZM5.032 7.846c0-.736.597-1.333 1.333-1.333H17.5c.736 0 1.333.597 1.333 1.333v8.308c0 .736-.597 1.333-1.333 1.333H6.365a1.333 1.333 0 0 1-1.333-1.333V7.846Zm1.333-.788a.788.788 0 0 0-.788.788v8.308c0 .435.352.788.788.788H17.5a.788.788 0 0 0 .789-.788V7.846a.788.788 0 0 0-.789-.788H6.365Z",
|
|
35
|
-
"lake-inbox-empty": "
|
|
35
|
+
"lake-inbox-empty": "M6.66 10.309a.381.381 0 0 1 .202-.12H17.07c.08 0 .157.025.222.072l.053.052L21 14.17v4.006c0 1.05-.852 1.902-1.902 1.902H4.902A1.902 1.902 0 0 1 3 18.175V14.17l3.658-3.859.001-.001Zm1.41 4.981v-.283H3.762v3.168a1.14 1.14 0 0 0 1.003 1.14H19.098a1.14 1.14 0 0 0 1.139-1.003v-3.305H15.93v.183l-.01.166a1.902 1.902 0 0 1-1.735 1.68h-4.27l-.165-.01a1.902 1.902 0 0 1-1.68-1.736Zm11.96-1.045-3.119-3.294H7.08L3.96 14.245h4.871v.888a1.14 1.14 0 0 0 1.003 1.14h4.193a1.14 1.14 0 0 0 1.139-1.003v-1.025h4.862Zm-8.411-9.941c0-.215.167-.381.381-.381h.002a.381.381 0 0 1 .38.302V6.627a.383.383 0 0 1-.763.074V4.304ZM7.039 5.66a.381.381 0 0 1 .137-.518.381.381 0 0 1 .476.08l.044.062 1.151 2a.381.381 0 0 1-.613.437l-.042-.059-1.153-2.002Zm8.114 1.623 1.153-2.003a.381.381 0 0 1 .688.314l-.035.069-1.153 2.003a.381.381 0 0 1-.688-.314l.035-.07Z",
|
|
36
36
|
"lake-key": "M9.92 17.673h2.555V15.12c0-.312.253-.564.565-.564h3.118a6.713 6.713 0 1 0-6.261-4.288c.08.208.03.445-.127.603l-8.641 8.641v3.36h5.109v-2.554c0-.312.252-.564.564-.564h2.554v-1.515c0-.312.253-.565.565-.565Zm3.12 1.129h-2.555v1.515a.564.564 0 0 1-.564.564H7.366v1.515c0 .886-.718 1.604-1.604 1.604H1.604A1.604 1.604 0 0 1 0 22.396v-2.688c0-.425.169-.833.47-1.134l8.244-8.245-.08-.27a7.842 7.842 0 1 1 7.524 5.625h-2.554v2.554a.564.564 0 0 1-.564.564Zm6.802-13.04a1.604 1.604 0 1 1-3.208 0 1.604 1.604 0 0 1 3.208 0Z",
|
|
37
37
|
"lake-lock-closed": "M6.971 5.029a5.029 5.029 0 1 1 10.058 0v1.743a.2.2 0 0 0 .2.199h1.306a2.85 2.85 0 0 1 2.85 2.85V21.15A2.85 2.85 0 0 1 18.537 24H5.466a2.85 2.85 0 0 1-2.852-2.85V9.821a2.85 2.85 0 0 1 2.85-2.851h1.308a.2.2 0 0 0 .2-.2V5.029Zm5.03-3.685A3.685 3.685 0 0 0 8.315 5.03v1.743a.2.2 0 0 0 .2.199h6.97a.2.2 0 0 0 .2-.2V5.03a3.685 3.685 0 0 0-3.686-3.685l.002-.001ZM5.465 8.315c-.832 0-1.507.675-1.507 1.507v11.327c0 .832.675 1.507 1.506 1.507h13.07c.832 0 1.507-.675 1.507-1.507V9.822c0-.832-.675-1.507-1.506-1.507H5.465Zm4.99 7.17a1.544 1.544 0 1 1 3.089 0 1.544 1.544 0 0 1-3.088 0Z",
|
|
38
38
|
"lake-menu": "M5 5h14a1 1 0 0 1 0 2H5a1 1 0 1 1 0-2Zm0 6h14a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Zm0 6h14a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Z",
|