@swan-io/lake 11.1.12 → 11.2.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
CHANGED
package/src/components/Cells.js
CHANGED
|
@@ -135,7 +135,7 @@ export const CopyableTextCell = ({ copiedWording, copyWording, text, textToCopy,
|
|
|
135
135
|
return (_jsxs(Cell, { style: styles.fullHeight, children: [_jsx(LakeTooltip, { content: visibleState === "copy" ? copyWording : copiedWording, onHide: () => setVisibleState("copy"), placement: "left", togglableOnFocus: true, containerStyle: styles.fullHeight, children: _jsx(Pressable, { "aria-label": copyWording, role: "button", onPress: onPress, style: styles.button, children: ({ hovered }) => (_jsxs(_Fragment, { children: [_jsx(Icon, { name: hovered ? "copy-filled" : "copy-regular", color: "currentColor", size: 14 }), hovered && _jsx(View, { role: "none", style: styles.buttonUnderline })] })) }) }), _jsx(LakeText, { numberOfLines: 1, color: colors.gray[900], tooltip: tooltip, variant: variant, children: text })] }));
|
|
136
136
|
};
|
|
137
137
|
// TODO: handle `+` sign properly
|
|
138
|
-
export const BalanceCell = ({ textAlign = "
|
|
138
|
+
export const BalanceCell = ({ textAlign = "left", align = textAlign, currency, formatCurrency, originalValue, value, variant = "medium", }) => (_jsxs(Cell, { align: align, direction: "column", children: [_jsx(LakeText, { numberOfLines: 1, align: align, color: colors.gray[900], variant: variant, style: [
|
|
139
139
|
value > 0 && { color: colors.positive.primary },
|
|
140
140
|
value < 0 && { color: colors.negative.primary },
|
|
141
141
|
], children: (value > 0 ? "+" : "") + formatCurrency(value, currency) }), isNotNullish(originalValue) && originalValue.currency !== currency && (_jsx(LakeText, { numberOfLines: 1, align: align, color: colors.gray[500], variant: "smallRegular", children: (originalValue.value > 0 ? "+" : "") +
|
|
@@ -14,6 +14,9 @@ const styles = StyleSheet.create({
|
|
|
14
14
|
height: 1,
|
|
15
15
|
alignSelf: "stretch",
|
|
16
16
|
},
|
|
17
|
+
grow: {
|
|
18
|
+
flexGrow: 1,
|
|
19
|
+
},
|
|
17
20
|
contentContainer: {
|
|
18
21
|
minWidth: "100%",
|
|
19
22
|
},
|
|
@@ -32,6 +35,7 @@ const styles = StyleSheet.create({
|
|
|
32
35
|
zIndex: 2,
|
|
33
36
|
},
|
|
34
37
|
cellsContainer: {
|
|
38
|
+
boxShadow: `0 -1px ${colors.gray[100]}`,
|
|
35
39
|
flexDirection: "row",
|
|
36
40
|
transform: "translateZ(0)",
|
|
37
41
|
},
|
|
@@ -70,15 +74,11 @@ const styles = StyleSheet.create({
|
|
|
70
74
|
},
|
|
71
75
|
headerCell: {
|
|
72
76
|
flexDirection: "row",
|
|
73
|
-
flexGrow: 1,
|
|
74
77
|
alignItems: "center",
|
|
75
|
-
boxShadow: `0 -1px ${colors.gray[100]}`,
|
|
76
78
|
},
|
|
77
79
|
cell: {
|
|
78
80
|
flexDirection: "row",
|
|
79
|
-
flexGrow: 1,
|
|
80
81
|
alignItems: "stretch",
|
|
81
|
-
boxShadow: `0 -1px ${colors.gray[100]}`,
|
|
82
82
|
},
|
|
83
83
|
shadowsLayerContainer: {
|
|
84
84
|
position: "absolute",
|
|
@@ -306,12 +306,13 @@ export const VirtualizedList = ({ variant, data, stickedToStartColumns, columns,
|
|
|
306
306
|
styles.cellsContainer,
|
|
307
307
|
styles.centerColumnGroup,
|
|
308
308
|
{ width: centerColumnsWidth, backgroundColor, height: headerHeight },
|
|
309
|
-
], children: columns.map(({ id, width, title, renderTitle }, index) => {
|
|
309
|
+
], children: columns.map(({ id, grow = false, width, title, renderTitle }, index) => {
|
|
310
310
|
const columnId = `${viewId}_${id}`;
|
|
311
311
|
const paddingLeft = index === 0 ? centerFirstCellLeftPadding : 0;
|
|
312
312
|
const paddingRight = index === columns.length - 1 ? centerLastCellLeftPadding : 0;
|
|
313
313
|
return (_jsx(View, { style: [
|
|
314
314
|
styles.headerCell,
|
|
315
|
+
grow && styles.grow,
|
|
315
316
|
{ width: width + paddingLeft + paddingRight, paddingLeft, paddingRight },
|
|
316
317
|
], id: columnId, children: renderTitle({ title, extraInfo, id }) }, columnId));
|
|
317
318
|
}) }), Option.fromNullable(stickedToEndColumns)
|
|
@@ -454,12 +455,13 @@ const RawVirtualizedRow = ({ viewId, rowHeight, absoluteIndex, variant, stickedT
|
|
|
454
455
|
? backgroundColorVariants[variant === "accented" ? "default" : "accented"]
|
|
455
456
|
: backgroundColorVariants[variant],
|
|
456
457
|
},
|
|
457
|
-
], children: columns.map(({ id, width, renderCell }, index) => {
|
|
458
|
+
], children: columns.map(({ id, grow = false, width, renderCell }, index) => {
|
|
458
459
|
const columnId = `${viewId}_${id}`;
|
|
459
460
|
const paddingLeft = index === 0 ? centerFirstCellLeftPadding : 0;
|
|
460
461
|
const paddingRight = index === columns.length - 1 ? centerLastCellLeftPadding : 0;
|
|
461
462
|
return (_jsx(View, { style: [
|
|
462
463
|
styles.cell,
|
|
464
|
+
grow && styles.grow,
|
|
463
465
|
{ width: width + paddingLeft + paddingRight, paddingLeft, paddingRight },
|
|
464
466
|
], "aria-describedby": columnId, children: renderCell({
|
|
465
467
|
columnId,
|