@lichens-innovation/react-native-common 3.2.0 → 3.3.1
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/components/layout/index.d.ts +1 -0
- package/dist/components/layout/index.js +1 -0
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/orientation-aware-tabs/index.d.ts +2 -0
- package/dist/components/layout/orientation-aware-tabs/index.js +3 -0
- package/dist/components/layout/orientation-aware-tabs/index.js.map +1 -0
- package/dist/components/layout/orientation-aware-tabs/orientation-aware-tab-button.d.ts +9 -0
- package/dist/components/layout/orientation-aware-tabs/orientation-aware-tab-button.js +40 -0
- package/dist/components/layout/orientation-aware-tabs/orientation-aware-tab-button.js.map +1 -0
- package/dist/components/layout/orientation-aware-tabs/orientation-aware-tabs-layout.d.ts +15 -0
- package/dist/components/layout/orientation-aware-tabs/orientation-aware-tabs-layout.js +40 -0
- package/dist/components/layout/orientation-aware-tabs/orientation-aware-tabs-layout.js.map +1 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.d.ts +3 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.js +80 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.js.map +1 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.types.d.ts +20 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.types.js +1 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.types.js.map +1 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.utils.d.ts +2 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.utils.js +23 -0
- package/dist/components/layout/resizable/horizontal-resizable-split-view.utils.js.map +1 -0
- package/dist/components/layout/resizable/index.d.ts +2 -0
- package/dist/components/layout/resizable/index.js +2 -0
- package/dist/components/layout/resizable/index.js.map +1 -1
- package/dist/components/layout/resizable/vertical-resizable-overlay-view.types.d.ts +3 -3
- package/dist/components/layout/resizable/vertical-resizable-split-view.types.d.ts +3 -3
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/use-window-orientation.d.ts +3 -0
- package/dist/hooks/use-window-orientation.js +10 -0
- package/dist/hooks/use-window-orientation.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/layout/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/layout/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/layout/orientation-aware-tabs/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TabTriggerSlotProps } from 'expo-router/ui';
|
|
2
|
+
import { FunctionComponent } from 'react';
|
|
3
|
+
export type OrientationAwareTabButtonProps = TabTriggerSlotProps & {
|
|
4
|
+
icon: string;
|
|
5
|
+
title: string;
|
|
6
|
+
activeColor: string;
|
|
7
|
+
isLabelHidden?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const OrientationAwareTabButton: FunctionComponent<OrientationAwareTabButtonProps>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Pressable, StyleSheet } from 'react-native';
|
|
14
|
+
import { Text } from 'react-native-paper';
|
|
15
|
+
import { useIsLandscape } from '../../../hooks/use-window-orientation';
|
|
16
|
+
import { useAppTheme } from '../../../theme/theme';
|
|
17
|
+
import { TabBarIcon } from '../../tab-bar-icon';
|
|
18
|
+
export const OrientationAwareTabButton = (_a) => {
|
|
19
|
+
var { icon, title, activeColor, isFocused, isLabelHidden = false } = _a, props = __rest(_a, ["icon", "title", "activeColor", "isFocused", "isLabelHidden"]);
|
|
20
|
+
const theme = useAppTheme();
|
|
21
|
+
const styles = useStyles();
|
|
22
|
+
const isLabelVisible = !isLabelHidden;
|
|
23
|
+
const color = isFocused ? activeColor : theme.colors.onSurfaceDisabled;
|
|
24
|
+
return (_jsxs(Pressable, Object.assign({}, props, { style: [styles.tabButton], children: [_jsx(TabBarIcon, { name: icon, color: color }), isLabelVisible && (_jsx(Text, { variant: "bodySmall", style: { color }, children: title }))] })));
|
|
25
|
+
};
|
|
26
|
+
const useStyles = () => {
|
|
27
|
+
const theme = useAppTheme();
|
|
28
|
+
const isLandscape = useIsLandscape();
|
|
29
|
+
const padding = theme.spacing(0.5);
|
|
30
|
+
return StyleSheet.create({
|
|
31
|
+
tabButton: {
|
|
32
|
+
flex: 1,
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
paddingLeft: isLandscape ? padding : 0,
|
|
36
|
+
paddingTop: isLandscape ? 0 : padding,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=orientation-aware-tab-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orientation-aware-tab-button.js","sourceRoot":"","sources":["../../../../src/components/layout/orientation-aware-tabs/orientation-aware-tab-button.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAShD,MAAM,CAAC,MAAM,yBAAyB,GAAsD,CAAC,EAO5F,EAAE,EAAE;QAPwF,EAC3F,IAAI,EACJ,KAAK,EACL,WAAW,EACX,SAAS,EACT,aAAa,GAAG,KAAK,OAEtB,EADI,KAAK,cANmF,8DAO5F,CADS;IAER,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,cAAc,GAAY,CAAC,aAAa,CAAC;IAC/C,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC;IAEvE,OAAO,CACL,MAAC,SAAS,oBAAK,KAAK,IAAE,KAAK,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,aAC7C,KAAC,UAAU,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAI,EAEvC,cAAc,IAAI,CACjB,KAAC,IAAI,IAAC,OAAO,EAAC,WAAW,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,YACvC,KAAK,GACD,CACR,KACS,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAC5B,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAEnC,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;YACP,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACtC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO;SACtC;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
export type TabItem = {
|
|
4
|
+
name: string;
|
|
5
|
+
href: string;
|
|
6
|
+
title: string;
|
|
7
|
+
icon: string;
|
|
8
|
+
};
|
|
9
|
+
export type OrientationAwareTabsLayoutProps = {
|
|
10
|
+
tabs: TabItem[];
|
|
11
|
+
activeColor?: string;
|
|
12
|
+
containerStyle?: ViewStyle;
|
|
13
|
+
tabListStyle?: ViewStyle;
|
|
14
|
+
};
|
|
15
|
+
export declare const OrientationAwareTabsLayout: FunctionComponent<OrientationAwareTabsLayoutProps>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { TabList, Tabs, TabSlot, TabTrigger } from 'expo-router/ui';
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
|
+
import { useIsLandscape } from '../../../hooks/use-window-orientation';
|
|
6
|
+
import { useAppTheme } from '../../../theme/theme';
|
|
7
|
+
import { OrientationAwareTabButton } from './orientation-aware-tab-button';
|
|
8
|
+
export const OrientationAwareTabsLayout = ({ tabs, activeColor, containerStyle, tabListStyle, }) => {
|
|
9
|
+
const theme = useAppTheme();
|
|
10
|
+
const styles = useStyles();
|
|
11
|
+
const isLandscape = useIsLandscape();
|
|
12
|
+
return (_jsxs(Tabs, { style: [styles.tabsContainer, containerStyle], children: [_jsx(TabSlot, { style: styles.tabSlot }), _jsx(TabList, { style: [styles.tabList, tabListStyle], children: tabs.map((tab) => (_jsx(TabTrigger, { name: tab.name, href: tab.href, asChild: true, children: _jsx(OrientationAwareTabButton, { isLabelHidden: isLandscape, icon: tab.icon, title: tab.title, activeColor: activeColor !== null && activeColor !== void 0 ? activeColor : theme.colors.primary }) }, tab.name))) })] }));
|
|
13
|
+
};
|
|
14
|
+
const useStyles = () => {
|
|
15
|
+
const theme = useAppTheme();
|
|
16
|
+
const { bottom, right } = useSafeAreaInsets();
|
|
17
|
+
const minPadding = theme.spacing(0.5);
|
|
18
|
+
const isLandscape = useIsLandscape();
|
|
19
|
+
return StyleSheet.create({
|
|
20
|
+
tabsContainer: {
|
|
21
|
+
flex: 1,
|
|
22
|
+
flexDirection: isLandscape ? 'row' : 'column',
|
|
23
|
+
},
|
|
24
|
+
tabSlot: {
|
|
25
|
+
flex: 1,
|
|
26
|
+
},
|
|
27
|
+
tabList: {
|
|
28
|
+
backgroundColor: theme.colors.elevation.level1,
|
|
29
|
+
justifyContent: 'space-around',
|
|
30
|
+
flexDirection: isLandscape ? 'column' : 'row',
|
|
31
|
+
paddingBottom: isLandscape ? minPadding : bottom,
|
|
32
|
+
paddingRight: isLandscape ? right : minPadding,
|
|
33
|
+
borderTopWidth: isLandscape ? undefined : StyleSheet.hairlineWidth,
|
|
34
|
+
borderTopColor: isLandscape ? undefined : theme.colors.outline,
|
|
35
|
+
borderLeftWidth: isLandscape ? StyleSheet.hairlineWidth : undefined,
|
|
36
|
+
borderLeftColor: isLandscape ? theme.colors.outline : undefined,
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=orientation-aware-tabs-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orientation-aware-tabs-layout.js","sourceRoot":"","sources":["../../../../src/components/layout/orientation-aware-tabs/orientation-aware-tabs-layout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAa,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAgB3E,MAAM,CAAC,MAAM,0BAA0B,GAAuD,CAAC,EAC7F,IAAI,EACJ,WAAW,EACX,cAAc,EACd,YAAY,GACb,EAAE,EAAE;IACH,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,OAAO,CACL,MAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC,aACjD,KAAC,OAAO,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,GAAI,EAElC,KAAC,OAAO,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,YAAY,CAAC,YAC3C,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACjB,KAAC,UAAU,IAAgB,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,kBAChE,KAAC,yBAAyB,IACxB,aAAa,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AE,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;YACnE,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;SAChE;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from 'react';
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
5
|
+
import Animated, { useAnimatedStyle, useSharedValue, withSpring } from 'react-native-reanimated';
|
|
6
|
+
import { isDevelopment } from '../../../utils';
|
|
7
|
+
import { validateResizableSplitViewProps } from './horizontal-resizable-split-view.utils';
|
|
8
|
+
const DRAG_HANDLE_WIDTH = 20;
|
|
9
|
+
const DEFAULT_ANIMATION_CONFIG = { damping: 25, stiffness: 300, mass: 0.8 };
|
|
10
|
+
export const HorizontalResizableSplitView = (props) => {
|
|
11
|
+
if (isDevelopment())
|
|
12
|
+
validateResizableSplitViewProps(props);
|
|
13
|
+
const { leftContent, rightContent, initialLeftRatio = 0.5, minLeftRatio = 0.15, maxLeftRatio = 0.85, handleContainerStyle, handleStyle, hideHandle = false, } = props;
|
|
14
|
+
// Track measured container width
|
|
15
|
+
const [isReady, setIsReady] = useState(false);
|
|
16
|
+
// Shared values for animation
|
|
17
|
+
const leftSectionWidth = useSharedValue(0);
|
|
18
|
+
const minWidth = useSharedValue(0);
|
|
19
|
+
const maxWidth = useSharedValue(0);
|
|
20
|
+
const startX = useSharedValue(0);
|
|
21
|
+
const isDragging = useSharedValue(false);
|
|
22
|
+
// Handle container layout measurement
|
|
23
|
+
const handleLayout = useCallback((event) => {
|
|
24
|
+
const { width } = event.nativeEvent.layout;
|
|
25
|
+
if (width > 0 && !isReady) {
|
|
26
|
+
minWidth.value = width * minLeftRatio;
|
|
27
|
+
maxWidth.value = width * maxLeftRatio;
|
|
28
|
+
leftSectionWidth.value = width * initialLeftRatio;
|
|
29
|
+
setIsReady(true);
|
|
30
|
+
}
|
|
31
|
+
}, [minLeftRatio, maxLeftRatio, initialLeftRatio, minWidth, maxWidth, leftSectionWidth, isReady]);
|
|
32
|
+
const panGesture = Gesture.Pan()
|
|
33
|
+
.onStart(() => {
|
|
34
|
+
startX.value = leftSectionWidth.value;
|
|
35
|
+
isDragging.value = true;
|
|
36
|
+
})
|
|
37
|
+
.onUpdate((event) => {
|
|
38
|
+
const newWidth = startX.value + event.translationX;
|
|
39
|
+
leftSectionWidth.value = Math.max(minWidth.value, Math.min(newWidth, maxWidth.value));
|
|
40
|
+
})
|
|
41
|
+
.onEnd(() => {
|
|
42
|
+
isDragging.value = false;
|
|
43
|
+
});
|
|
44
|
+
const leftSectionAnimatedStyle = useAnimatedStyle(() => ({ width: leftSectionWidth.value }));
|
|
45
|
+
const dragHandleContainerAnimatedStyle = useAnimatedStyle(() => ({
|
|
46
|
+
left: leftSectionWidth.value - DRAG_HANDLE_WIDTH / 2,
|
|
47
|
+
}));
|
|
48
|
+
const dragHandleAnimatedStyle = useAnimatedStyle(() => ({
|
|
49
|
+
transform: [{ scale: withSpring(isDragging.value ? 1.2 : 1, DEFAULT_ANIMATION_CONFIG) }],
|
|
50
|
+
}));
|
|
51
|
+
return (_jsxs(View, { style: [styles.container], onLayout: handleLayout, children: [_jsx(Animated.View, { style: [styles.leftSection, leftSectionAnimatedStyle], children: leftContent }), !hideHandle && (_jsx(GestureDetector, { gesture: panGesture, children: _jsx(Animated.View, { style: [styles.handleContainer, handleContainerStyle, dragHandleContainerAnimatedStyle], children: _jsx(Animated.View, { style: [styles.handle, handleStyle, dragHandleAnimatedStyle] }) }) })), _jsx(View, { style: [styles.rightSection], children: rightContent })] }));
|
|
52
|
+
};
|
|
53
|
+
const styles = StyleSheet.create({
|
|
54
|
+
container: {
|
|
55
|
+
flex: 1,
|
|
56
|
+
flexDirection: 'row',
|
|
57
|
+
},
|
|
58
|
+
leftSection: {
|
|
59
|
+
overflow: 'hidden',
|
|
60
|
+
},
|
|
61
|
+
rightSection: {
|
|
62
|
+
flex: 1,
|
|
63
|
+
overflow: 'hidden',
|
|
64
|
+
},
|
|
65
|
+
handleContainer: {
|
|
66
|
+
position: 'absolute',
|
|
67
|
+
top: 0,
|
|
68
|
+
bottom: 0,
|
|
69
|
+
width: DRAG_HANDLE_WIDTH,
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
justifyContent: 'center',
|
|
72
|
+
},
|
|
73
|
+
handle: {
|
|
74
|
+
width: 4,
|
|
75
|
+
height: 40,
|
|
76
|
+
backgroundColor: '#888888',
|
|
77
|
+
borderRadius: 2,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=horizontal-resizable-split-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"horizontal-resizable-split-view.js","sourceRoot":"","sources":["../../../../src/components/layout/resizable/horizontal-resizable-split-view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAA0B,MAAM,OAAO,CAAC;AACtE,OAAO,EAAqB,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,QAAQ,EAAE,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAE1F,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,wBAAwB,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AAE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AY,aACrD,KAAC,QAAQ,CAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,wBAAwB,CAAC,YAAG,WAAW,GAAiB,EAElG,CAAC,UAAU,IAAI,CACd,KAAC,eAAe,IAAC,OAAO,EAAE,UAAU,YAClC,KAAC,QAAQ,CAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,eAAe,EAAE,oBAAoB,EAAE,gCAAgC,CAAC,YACpG,KAAC,QAAQ,CAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,uBAAuB,CAAC,GAAI,GACjE,GACA,CACnB,EAED,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,YAAG,YAAY,GAAQ,IACpD,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;QACP,aAAa,EAAE,KAAK;KACrB;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,QAAQ;KACnB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,QAAQ;KACnB;IACD,eAAe,EAAE;QACf,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,iBAAiB;QACxB,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;IACD,MAAM,EAAE;QACN,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,EAAE;QACV,eAAe,EAAE,SAAS;QAC1B,YAAY,EAAE,CAAC;KAChB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export interface HorizontalResizableSplitViewProps {
|
|
4
|
+
/** Content to display in the left section */
|
|
5
|
+
leftContent: ReactNode;
|
|
6
|
+
/** Content to display in the right section */
|
|
7
|
+
rightContent: ReactNode;
|
|
8
|
+
/** Initial proportion for the left section (0 to 1). Default: 0.5 */
|
|
9
|
+
initialLeftRatio?: number;
|
|
10
|
+
/** Minimum proportion for the left section (0 to 1). Default: 0.15 */
|
|
11
|
+
minLeftRatio?: number;
|
|
12
|
+
/** Maximum proportion for the left section (0 to 1). Default: 0.85 */
|
|
13
|
+
maxLeftRatio?: number;
|
|
14
|
+
/** Style for the drag handle container */
|
|
15
|
+
handleContainerStyle?: StyleProp<ViewStyle>;
|
|
16
|
+
/** Style for the drag handle bar */
|
|
17
|
+
handleStyle?: StyleProp<ViewStyle>;
|
|
18
|
+
/** Whether to hide the drag handle. Default: false */
|
|
19
|
+
hideHandle?: boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=horizontal-resizable-split-view.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"horizontal-resizable-split-view.types.js","sourceRoot":"","sources":["../../../../src/components/layout/resizable/horizontal-resizable-split-view.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isNullish } from '@lichens-innovation/ts-common';
|
|
2
|
+
export const validateResizableSplitViewProps = (props) => {
|
|
3
|
+
const { initialLeftRatio, minLeftRatio, maxLeftRatio } = props;
|
|
4
|
+
if (!isNullish(initialLeftRatio)) {
|
|
5
|
+
if (initialLeftRatio < 0 || initialLeftRatio > 1)
|
|
6
|
+
throw new Error(`initialLeftRatio must be between 0 and 1. Provided: ${initialLeftRatio}`);
|
|
7
|
+
}
|
|
8
|
+
if (!isNullish(minLeftRatio)) {
|
|
9
|
+
if (minLeftRatio < 0 || minLeftRatio > 1)
|
|
10
|
+
throw new Error(`minLeftRatio must be between 0 and 1. Provided: ${minLeftRatio}`);
|
|
11
|
+
}
|
|
12
|
+
if (!isNullish(maxLeftRatio)) {
|
|
13
|
+
if (maxLeftRatio < 0 || maxLeftRatio > 1)
|
|
14
|
+
throw new Error(`maxLeftRatio must be between 0 and 1. Provided: ${maxLeftRatio}`);
|
|
15
|
+
}
|
|
16
|
+
if (!isNullish(minLeftRatio) && !isNullish(maxLeftRatio) && minLeftRatio >= maxLeftRatio)
|
|
17
|
+
throw new Error(`minLeftRatio must be less than maxLeftRatio. Provided: ${JSON.stringify({ minLeftRatio, maxLeftRatio })}`);
|
|
18
|
+
if (!isNullish(initialLeftRatio) && !isNullish(minLeftRatio) && initialLeftRatio < minLeftRatio)
|
|
19
|
+
throw new Error(`initialLeftRatio must be >= minLeftRatio. Provided: ${JSON.stringify({ initialLeftRatio, minLeftRatio })}`);
|
|
20
|
+
if (!isNullish(initialLeftRatio) && !isNullish(maxLeftRatio) && initialLeftRatio > maxLeftRatio)
|
|
21
|
+
throw new Error(`initialLeftRatio must be <= maxLeftRatio. Provided: ${JSON.stringify({ initialLeftRatio, maxLeftRatio })}`);
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=horizontal-resizable-split-view.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"horizontal-resizable-split-view.utils.js","sourceRoot":"","sources":["../../../../src/components/layout/resizable/horizontal-resizable-split-view.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG1D,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,KAAwC,EAAE,EAAE;IAC1F,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAE/D,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACjC,IAAI,gBAAgB,GAAG,CAAC,IAAI,gBAAgB,GAAG,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,uDAAuD,gBAAgB,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED,IAAI,CA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AChD,cAAc,uCAAuC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/layout/resizable/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,yCAAyC,CAAC;AACxD,cAAc,0BAA0B,CAAC;AACzC,cAAc,yCAAyC,CAAC;AACxD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { ViewStyle } from 'react-native';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
export type VerticalResizableOverlayViewAnchorType = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
|
|
4
4
|
export interface VerticalResizableOverlayViewProps {
|
|
5
5
|
/** Content to display in the overlay section (foreground, on top) */
|
|
@@ -20,9 +20,9 @@ export interface VerticalResizableOverlayViewProps {
|
|
|
20
20
|
/** Aspect ratio (width/height) for the foreground content. If provided, width will be calculated based on height */
|
|
21
21
|
foregroundContentAspectRatio?: number;
|
|
22
22
|
/** Style for the drag handle container */
|
|
23
|
-
handleContainerStyle?: ViewStyle
|
|
23
|
+
handleContainerStyle?: StyleProp<ViewStyle>;
|
|
24
24
|
/** Style for the drag handle bar */
|
|
25
|
-
handleStyle?: ViewStyle
|
|
25
|
+
handleStyle?: StyleProp<ViewStyle>;
|
|
26
26
|
/** Whether to hide the drag handle. Default: false */
|
|
27
27
|
hideHandle?: boolean;
|
|
28
28
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { ViewStyle } from 'react-native';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
export interface VerticalResizableSplitViewProps {
|
|
4
4
|
/** Content to display in the top section */
|
|
5
5
|
topContent: ReactNode;
|
|
@@ -12,9 +12,9 @@ export interface VerticalResizableSplitViewProps {
|
|
|
12
12
|
/** Maximum proportion for the top section (0 to 1). Default: 0.85 */
|
|
13
13
|
maxTopRatio?: number;
|
|
14
14
|
/** Style for the drag handle container */
|
|
15
|
-
handleContainerStyle?: ViewStyle
|
|
15
|
+
handleContainerStyle?: StyleProp<ViewStyle>;
|
|
16
16
|
/** Style for the drag handle bar */
|
|
17
|
-
handleStyle?: ViewStyle
|
|
17
|
+
handleStyle?: StyleProp<ViewStyle>;
|
|
18
18
|
/** Whether to hide the drag handle. Default: false */
|
|
19
19
|
hideHandle?: boolean;
|
|
20
20
|
}
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
package/dist/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useWindowDimensions } from 'react-native';
|
|
2
|
+
export const useWindowOrientation = () => {
|
|
3
|
+
const { width, height } = useWindowDimensions();
|
|
4
|
+
return width > height ? 'landscape' : 'portrait';
|
|
5
|
+
};
|
|
6
|
+
export const useIsLandscape = () => {
|
|
7
|
+
const orientation = useWindowOrientation();
|
|
8
|
+
return orientation === 'landscape';
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=use-window-orientation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-window-orientation.js","sourceRoot":"","sources":["../../src/hooks/use-window-orientation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAInD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAsB,EAAE;IAC1D,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,mBAAmB,EAAE,CAAC;IAChD,OAAO,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC;AACnD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,GAAY,EAAE;IAC1C,MAAM,WAAW,GAAG,oBAAoB,EAAE,CAAC;IAC3C,OAAO,WAAW,KAAK,WAAW,CAAC;AACrC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Lichens Innovation React Native Expo shared components, utilities, hooks and services",
|
|
4
4
|
"repository": "https://github.com/Lichens-Innovation/react-native-common",
|
|
5
5
|
"author": "Lichens Innovation",
|
|
6
|
-
"version": "3.
|
|
6
|
+
"version": "3.3.1",
|
|
7
7
|
"private": false,
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|