@swan-io/lake 2.7.31 → 2.7.33

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.33",
4
4
  "engines": {
5
5
  "node": ">=18.0.0",
6
6
  "yarn": "^1.22.0"
@@ -40,10 +40,10 @@ export const LakeLabel = ({ label, optionalLabel, extra, readOnly = false, color
40
40
  target?.focus();
41
41
  }
42
42
  }, [id]);
43
- return (_jsx(Box, { style: [styles.container, style], direction: "row", alignItems: "center", justifyContent: "spaceBetween", children: _jsxs(View, { style: commonStyles.fill, ref: containerRef, children: [_jsxs(Box, { direction: "row", justifyContent: "spaceBetween", alignItems: "center", children: [_jsxs(Box, { direction: "row", style: styles.shrink, children: [type === "form" || type === "formSmall" || type === "radioGroup" ? (_jsxs(Label, { onClick: onClick, htmlFor: id, style: [styles.label, readOnly && { color: readOnlyColor }], children: [label, optionalLabel != null ? (_jsxs(_Fragment, { children: [" - ", _jsx(LakeText, { color: colors.gray[400], style: styles.optionalLabel, children: optionalLabel })] })) : null] })) : (_jsxs(LakeText, { variant: "medium", color: readOnlyColor, id: id, children: [label, optionalLabel != null ? (_jsxs(_Fragment, { children: [" - ", _jsx(LakeText, { color: colors.gray[400], style: styles.optionalLabel, children: optionalLabel })] })) : null] })), isNotNullish(extra) && extra()] }), isNotNullish(help) && (_jsxs(_Fragment, { children: [_jsx(Space, { width: 16 }), help] }))] }), _jsx(Space, { height: match(type)
44
- .returnType()
45
- .with("formSmall", "viewSmall", () => 4)
46
- .with("form", "view", () => 8)
47
- .with("radioGroup", () => 12)
48
- .exhaustive() }), _jsxs(Box, { "aria-labelledby": type === "view" || type === "viewSmall" ? id : undefined, direction: "row", children: [render(id), isNotNullish(actions) && (_jsxs(_Fragment, { children: [_jsx(Space, { width: 16 }), actions] }))] })] }) }));
43
+ return (_jsxs(Box, { style: [styles.container, style], direction: "row", alignItems: "center", justifyContent: "spaceBetween", children: [_jsxs(View, { style: commonStyles.fill, ref: containerRef, children: [_jsxs(Box, { direction: "row", justifyContent: "spaceBetween", alignItems: "center", children: [_jsxs(Box, { direction: "row", style: styles.shrink, children: [type === "form" || type === "formSmall" || type === "radioGroup" ? (_jsxs(Label, { onClick: onClick, htmlFor: id, style: [styles.label, readOnly && { color: readOnlyColor }], children: [label, optionalLabel != null ? (_jsxs(_Fragment, { children: [" - ", _jsx(LakeText, { color: colors.gray[400], style: styles.optionalLabel, children: optionalLabel })] })) : null] })) : (_jsxs(LakeText, { variant: "medium", color: readOnlyColor, id: id, children: [label, optionalLabel != null ? (_jsxs(_Fragment, { children: [" - ", _jsx(LakeText, { color: colors.gray[400], style: styles.optionalLabel, children: optionalLabel })] })) : null] })), isNotNullish(extra) && extra()] }), isNotNullish(help) && (_jsxs(_Fragment, { children: [_jsx(Space, { width: 16 }), help] }))] }), _jsx(Space, { height: match(type)
44
+ .returnType()
45
+ .with("formSmall", "viewSmall", () => 4)
46
+ .with("form", "view", () => 8)
47
+ .with("radioGroup", () => 12)
48
+ .exhaustive() }), _jsx(View, { "aria-labelledby": type === "view" || type === "viewSmall" ? id : undefined, children: render(id) })] }), isNotNullish(actions) && (_jsxs(_Fragment, { children: [_jsx(Space, { width: 16 }), actions] }))] }));
49
49
  };
@@ -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
+ };