@swan-io/lake 2.7.31 → 2.7.32

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": "2.7.31",
3
+ "version": "2.7.32",
4
4
  "engines": {
5
5
  "node": ">=18.0.0",
6
6
  "yarn": "^1.22.0"
@@ -1,9 +1,13 @@
1
+ import { ReactNode } from "react";
1
2
  import { StyleProp, ViewStyle } from "react-native";
2
3
  import { SpacingValue } from "./Space";
3
- type Props = {
4
+ type LineProps = {
4
5
  horizontal?: boolean;
5
6
  space?: SpacingValue;
6
7
  style?: StyleProp<ViewStyle>;
7
8
  };
8
- export declare const Separator: ({ horizontal, space, style }: Props) => import("react/jsx-runtime").JSX.Element;
9
+ type Props = LineProps & {
10
+ children?: ReactNode;
11
+ };
12
+ export declare const Separator: ({ horizontal, space, style, children }: Props) => import("react/jsx-runtime").JSX.Element;
9
13
  export {};
@@ -1,7 +1,10 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { StyleSheet, View } from "react-native";
3
+ import { commonStyles } from "../constants/commonStyles";
3
4
  import { colors } from "../constants/design";
4
- import { isNotNullish } from "../utils/nullish";
5
+ import { isNotNullish, isNullishOrEmpty } from "../utils/nullish";
6
+ import { LakeText } from "./LakeText";
7
+ import { Space } from "./Space";
5
8
  const styles = StyleSheet.create({
6
9
  horizontal: {
7
10
  backgroundColor: colors.gray[100],
@@ -13,7 +16,23 @@ const styles = StyleSheet.create({
13
16
  height: 1,
14
17
  alignSelf: "stretch",
15
18
  },
19
+ horizontalContainer: {
20
+ display: "flex",
21
+ flexDirection: "column",
22
+ height: "100%",
23
+ },
24
+ verticalContainer: {
25
+ display: "flex",
26
+ flexDirection: "row",
27
+ width: "100%",
28
+ },
16
29
  });
17
- export const Separator = ({ horizontal = false, space, style }) => (_jsx(View, { role: "none", style: horizontal
30
+ const Line = ({ horizontal = false, style, space }) => (_jsx(View, { role: "none", style: horizontal
18
31
  ? [styles.horizontal, isNotNullish(space) && { marginHorizontal: space }, style]
19
32
  : [styles.vertical, isNotNullish(space) && { marginVertical: space }, style] }));
33
+ export const Separator = ({ horizontal = false, space, style, children }) => {
34
+ if (isNullishOrEmpty(children)) {
35
+ return _jsx(Line, { horizontal: horizontal, space: space, style: style });
36
+ }
37
+ return (_jsxs(View, { style: horizontal ? styles.horizontalContainer : styles.verticalContainer, children: [_jsx(Line, { horizontal: horizontal, space: space, style: [style, commonStyles.fill] }), _jsx(Space, { width: 12 }), _jsx(LakeText, { align: "center", style: !horizontal && { lineHeight: 2 * (space ?? 0) }, children: children }), _jsx(Space, { width: 12 }), _jsx(Line, { horizontal: horizontal, space: space, style: [style, commonStyles.fill] })] }));
38
+ };