@swan-io/lake 5.0.0 → 5.0.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/package.json +1 -1
- package/src/components/FixedListViewCells.d.ts +3 -3
- package/src/components/LakeButton.js +1 -2
- package/src/components/LakeCombobox.js +1 -2
- package/src/components/LakeText.d.ts +1 -1
- package/src/components/LakeTooltip.d.ts +7 -3
- package/src/components/LakeTooltip.js +5 -6
package/package.json
CHANGED
|
@@ -31,7 +31,7 @@ export declare const SimpleTitleCell: ({ isHighlighted, text, tooltip, }: {
|
|
|
31
31
|
togglableOnFocus?: boolean | undefined;
|
|
32
32
|
containerStyle?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
33
33
|
disabled?: boolean | undefined;
|
|
34
|
-
}
|
|
34
|
+
} & import("react").RefAttributes<import("./LakeTooltip").TooltipRef>, "children"> | undefined;
|
|
35
35
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
36
36
|
export declare const SimpleRegularTextCell: ({ variant, text, textAlign, color, }: {
|
|
37
37
|
variant?: "light" | "medium" | "semibold" | "regular" | "smallSemibold" | "smallMedium" | "smallRegular" | undefined;
|
|
@@ -58,7 +58,7 @@ export declare const CopyableRegularTextCell: ({ variant, text, textToCopy, copy
|
|
|
58
58
|
togglableOnFocus?: boolean | undefined;
|
|
59
59
|
containerStyle?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
60
60
|
disabled?: boolean | undefined;
|
|
61
|
-
}
|
|
61
|
+
} & import("react").RefAttributes<import("./LakeTooltip").TooltipRef>, "children"> | undefined;
|
|
62
62
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
63
63
|
export declare const BalanceCell: ({ value, currency, originalValue, formatCurrency, textAlign, variant, }: {
|
|
64
64
|
value: number;
|
|
@@ -89,7 +89,7 @@ export declare const LinkCell: ({ children, external, onPress, variant, tooltip,
|
|
|
89
89
|
togglableOnFocus?: boolean | undefined;
|
|
90
90
|
containerStyle?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
91
91
|
disabled?: boolean | undefined;
|
|
92
|
-
}
|
|
92
|
+
} & import("react").RefAttributes<import("./LakeTooltip").TooltipRef>, "children"> | undefined;
|
|
93
93
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
94
94
|
export declare const StartAlignedCell: ({ children }: {
|
|
95
95
|
children: ReactNode;
|
|
@@ -100,7 +100,6 @@ const styles = StyleSheet.create({
|
|
|
100
100
|
right: -3,
|
|
101
101
|
},
|
|
102
102
|
});
|
|
103
|
-
const isReactText = (node) => ["string", "number"].includes(typeof node);
|
|
104
103
|
export const LakeButton = memo(forwardRef(({ ariaControls, ariaExpanded, ariaLabel, children, color = "gray", disabled = false, icon, grow = false, iconPosition = "start", loading = false, mode = "primary", onPress, size = "large", style, forceBackground = false, href, hrefAttrs, pill, }, forwardedRef) => {
|
|
105
104
|
const isSmall = size === "small";
|
|
106
105
|
const iconSize = isSmall ? 18 : 20;
|
|
@@ -158,7 +157,7 @@ export const LakeButton = memo(forwardRef(({ ariaControls, ariaExpanded, ariaLab
|
|
|
158
157
|
? colors[color][700]
|
|
159
158
|
: colors[color][600]
|
|
160
159
|
: colors[color].contrast;
|
|
161
|
-
return (_jsxs(_Fragment, { children: [hasIconStart && (_jsxs(_Fragment, { children: [_jsx(Icon, { color: textColor, name: icon, size: iconSize }), isNotNullish(children) && _jsx(Space, { width: isSmall ? 8 : 12 })] })),
|
|
160
|
+
return (_jsxs(_Fragment, { children: [hasIconStart && (_jsxs(_Fragment, { children: [_jsx(Icon, { color: textColor, name: icon, size: iconSize }), isNotNullish(children) && _jsx(Space, { width: isSmall ? 8 : 12 })] })), typeof children === "string" || typeof children === "number" ? (_jsx(LakeText, { numberOfLines: 1, userSelect: "none", style: [isSmall ? styles.textSmall : styles.text, { color: textColor }], children: children })) : (children), hasIconEnd && (_jsxs(_Fragment, { children: [isNotNullish(children) && _jsx(Space, { width: isSmall ? 8 : 12 }), _jsx(Icon, { color: textColor, name: icon, size: iconSize })] })), loading && (_jsx(View, { role: "none", style: [
|
|
162
161
|
styles.loaderContainer,
|
|
163
162
|
{
|
|
164
163
|
backgroundColor: mode === "secondary" || mode === "tertiary"
|
|
@@ -71,7 +71,6 @@ const styles = StyleSheet.create({
|
|
|
71
71
|
flexGrow: 1,
|
|
72
72
|
},
|
|
73
73
|
});
|
|
74
|
-
const isReactText = (node) => ["string", "number"].includes(typeof node);
|
|
75
74
|
const getItemLayout = (_data, index) => ({
|
|
76
75
|
length: DEFAULT_ELEMENT_HEIGHT,
|
|
77
76
|
offset: DEFAULT_ELEMENT_HEIGHT * index,
|
|
@@ -172,7 +171,7 @@ const LakeComboboxWithRef = ({ inputRef, value, items, itemHeight = DEFAULT_ELEM
|
|
|
172
171
|
setIsFetchingAdditionalInfo(false);
|
|
173
172
|
dismiss();
|
|
174
173
|
});
|
|
175
|
-
}, children:
|
|
174
|
+
}, children: typeof rendered === "string" || typeof rendered === "number" ? (_jsx(LakeText, { numberOfLines: 1, style: styles.itemText, children: rendered })) : (rendered) }));
|
|
176
175
|
} })), ListFooterComponent, isFetchingAdditionalInfo ? (_jsxs(View, { style: styles.loaderAdditional, children: [_jsx(View, { style: styles.loaderAdditionalUnderlay }), _jsx(LoadingView, {})] })) : null] })),
|
|
177
176
|
}),
|
|
178
177
|
}) }) })] }));
|
|
@@ -29,6 +29,6 @@ export declare const LakeText: import("react").ForwardRefExoticComponent<TextPro
|
|
|
29
29
|
togglableOnFocus?: boolean | undefined;
|
|
30
30
|
containerStyle?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
31
31
|
disabled?: boolean | undefined;
|
|
32
|
-
}
|
|
32
|
+
} & import("react").RefAttributes<import("./LakeTooltip").TooltipRef>, "children"> | undefined;
|
|
33
33
|
} & import("react").RefAttributes<Text>>;
|
|
34
34
|
export {};
|
|
@@ -14,8 +14,12 @@ type Props = {
|
|
|
14
14
|
containerStyle?: ViewProps["style"];
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
18
|
-
|
|
17
|
+
export type TooltipRef = {
|
|
18
|
+
show: () => void;
|
|
19
|
+
hide: () => void;
|
|
20
|
+
};
|
|
21
|
+
export declare const LakeTooltip: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<TooltipRef>>;
|
|
22
|
+
export declare const InformationTooltip: import("react").ForwardRefExoticComponent<{
|
|
19
23
|
text: string;
|
|
20
|
-
}
|
|
24
|
+
} & import("react").RefAttributes<TooltipRef>>;
|
|
21
25
|
export {};
|
|
@@ -81,14 +81,13 @@ const styles = StyleSheet.create({
|
|
|
81
81
|
flexGrow: 0,
|
|
82
82
|
},
|
|
83
83
|
});
|
|
84
|
-
const isReactText = (node) => ["string", "number"].includes(typeof node);
|
|
85
84
|
const MAX_WIDTH = "calc(100vw - 20px)";
|
|
86
|
-
export const LakeTooltip = ({ content, children, ...rest }) => {
|
|
85
|
+
export const LakeTooltip = forwardRef(({ content, children, ...rest }, forwardedRef) => {
|
|
87
86
|
if (isNullishOrEmpty(content)) {
|
|
88
87
|
return children;
|
|
89
88
|
}
|
|
90
|
-
return (_jsx(Tooltip, { content: content, ...rest, children: children }));
|
|
91
|
-
};
|
|
89
|
+
return (_jsx(Tooltip, { ref: forwardedRef, content: content, ...rest, children: children }));
|
|
90
|
+
});
|
|
92
91
|
const Tooltip = memo(forwardRef(({ children, content, describedBy, matchReferenceWidth = false, hideArrow = false, onHide, onShow, placement, width, togglableOnFocus = false, containerStyle, disabled = false, }, forwardedRef) => {
|
|
93
92
|
var _a, _b;
|
|
94
93
|
const referenceRef = useRef(null);
|
|
@@ -170,7 +169,7 @@ const Tooltip = memo(forwardRef(({ children, content, describedBy, matchReferenc
|
|
|
170
169
|
(state === null || state === void 0 ? void 0 : state.placement) === "bottom" && styles.baseBottom,
|
|
171
170
|
(state === null || state === void 0 ? void 0 : state.placement) === "right" && styles.baseRight,
|
|
172
171
|
(state === null || state === void 0 ? void 0 : state.placement) === "left" && styles.baseLeft,
|
|
173
|
-
], children: [_jsx(View, { style: [styles.content, { width, maxWidth: MAX_WIDTH }], children:
|
|
172
|
+
], children: [_jsx(View, { style: [styles.content, { width, maxWidth: MAX_WIDTH }], children: typeof content === "string" || typeof content === "number" ? (_jsx(LakeText, { align: "center", color: colors.gray.contrast, children: content })) : (content) }), !hideArrow && (_jsx(View, { role: "none", style: [
|
|
174
173
|
(state === null || state === void 0 ? void 0 : state.placement) === "right" || (state === null || state === void 0 ? void 0 : state.placement) === "left"
|
|
175
174
|
? styles.arrowContainerHorizontal
|
|
176
175
|
: styles.arrowContainer,
|
|
@@ -187,4 +186,4 @@ const Tooltip = memo(forwardRef(({ children, content, describedBy, matchReferenc
|
|
|
187
186
|
},
|
|
188
187
|
], children: _jsx(View, { style: styles.arrow }) }))] }) }) }))] }));
|
|
189
188
|
}));
|
|
190
|
-
export const InformationTooltip = ({ text }) => (_jsx(LakeTooltip, { describedBy: "copy", placement: "bottom", togglableOnFocus: true, width: 300, content: text, children: _jsx(View, { style: styles.info, children: _jsx(Icon, { name: "info-regular", size: 24, color: colors.gray[900] }) }) }));
|
|
189
|
+
export const InformationTooltip = forwardRef(({ text }, forwardedRef) => (_jsx(LakeTooltip, { ref: forwardedRef, describedBy: "copy", placement: "bottom", togglableOnFocus: true, width: 300, content: text, children: _jsx(View, { style: styles.info, children: _jsx(Icon, { name: "info-regular", size: 24, color: colors.gray[900] }) }) })));
|