@swan-io/lake 11.1.5 → 11.1.7

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": "11.1.5",
3
+ "version": "11.1.7",
4
4
  "engines": {
5
5
  "node": ">=20.9.0",
6
6
  "pnpm": "^9.13.0"
@@ -3,7 +3,7 @@ import { useCallback, useState } from "react";
3
3
  import { StyleSheet, View } from "react-native";
4
4
  import { match } from "ts-pattern";
5
5
  import { visuallyHiddenStyle } from "../constants/commonStyles";
6
- import { colors, invariantColors, negativeSpacings, spacings, } from "../constants/design";
6
+ import { colors, invariantColors, spacings } from "../constants/design";
7
7
  import { setClipboardText } from "../utils/clipboard";
8
8
  import { identity } from "../utils/function";
9
9
  import { isNotNullish, isNullish } from "../utils/nullish";
@@ -73,24 +73,30 @@ const styles = StyleSheet.create({
73
73
  headerUnderlineActive: {
74
74
  backgroundColor: colors.current[500],
75
75
  },
76
+ // eslint-disable-next-line react-native/no-color-literals
76
77
  buttonUnderline: {
77
- boxShadow: "inset 0 -2px currentColor",
78
+ position: "absolute",
79
+ bottom: 0,
80
+ left: 0,
81
+ right: spacings[8],
82
+ height: 2,
83
+ backgroundColor: "currentColor",
78
84
  },
79
- copyButton: {
80
- justifyContent: "center",
81
- alignSelf: "stretch",
82
- marginHorizontal: negativeSpacings[8],
85
+ buttonEndUnderline: {
86
+ right: 0,
87
+ left: spacings[8],
83
88
  },
84
- copyButtonTooltip: {
85
- justifyContent: "center",
89
+ fullHeight: {
86
90
  height: "100%",
87
- paddingHorizontal: spacings[8],
88
91
  },
89
- linkButton: {
92
+ button: {
90
93
  justifyContent: "center",
91
- alignSelf: "stretch",
92
- marginHorizontal: negativeSpacings[8],
93
- paddingHorizontal: spacings[8],
94
+ height: "100%",
95
+ paddingRight: spacings[8],
96
+ },
97
+ buttonEnd: {
98
+ paddingRight: 0,
99
+ paddingLeft: spacings[8],
94
100
  },
95
101
  actionCell: {
96
102
  paddingVertical: spacings[16],
@@ -130,7 +136,7 @@ export const CopyableTextCell = ({ copiedWording, copyWording, text, textToCopy,
130
136
  setClipboardText(clipboardText);
131
137
  setVisibleState("copied");
132
138
  }, [clipboardText]);
133
- return (_jsxs(Cell, { children: [_jsx(Pressable, { "aria-label": copyWording, role: "button", onPress: onPress, style: ({ hovered }) => [styles.copyButton, hovered && styles.buttonUnderline], children: ({ hovered }) => (_jsx(LakeTooltip, { content: visibleState === "copy" ? copyWording : copiedWording, onHide: () => setVisibleState("copy"), placement: "center", togglableOnFocus: true, containerStyle: styles.copyButtonTooltip, children: _jsx(Icon, { name: hovered ? "copy-filled" : "copy-regular", color: "currentColor", size: 14 }) })) }), _jsx(Space, { width: 8 }), _jsx(LakeText, { numberOfLines: 1, color: colors.gray[900], tooltip: tooltip, variant: variant, children: text })] }));
139
+ 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 })] }));
134
140
  };
135
141
  // TODO: handle `+` sign properly
136
142
  export const BalanceCell = ({ textAlign = "right", 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,15 +145,15 @@ export const BalanceCell = ({ textAlign = "right", align = textAlign, currency,
139
145
  ], 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 ? "+" : "") +
140
146
  formatCurrency(originalValue.value, originalValue.currency) }))] }));
141
147
  export const LinkCell = ({ buttonPosition = "start", children, external = false, fadeOn, onPress, tooltip, variant = "medium", }) => {
148
+ const atEnd = buttonPosition === "end";
142
149
  const elements = [
143
- _jsx(Pressable, { style: ({ hovered }) => [styles.linkButton, hovered && styles.buttonUnderline], onPress: event => {
150
+ _jsx(Pressable, { style: [styles.button, atEnd && styles.buttonEnd], onPress: event => {
144
151
  event.preventDefault();
145
152
  onPress();
146
- }, children: _jsx(Icon, { size: 14, name: external ? "open-regular" : "arrow-right-filled" }) }),
147
- _jsx(Space, { width: 8 }),
153
+ }, children: ({ hovered }) => (_jsxs(_Fragment, { children: [_jsx(Icon, { size: 14, name: external ? "open-regular" : "arrow-right-filled" }), hovered && (_jsx(View, { role: "none", style: [styles.buttonUnderline, atEnd && styles.buttonEndUnderline] }))] })) }),
148
154
  _jsx(LakeText, { numberOfLines: 1, color: colors.gray[900], variant: variant, tooltip: tooltip, children: children }),
149
155
  ];
150
- if (buttonPosition === "end") {
156
+ if (atEnd) {
151
157
  elements.reverse();
152
158
  }
153
159
  return _jsx(Cell, { fadeOn: fadeOn, children: elements });
@@ -54,6 +54,7 @@ declare const paths: {
54
54
  "add-circle-filled": string;
55
55
  "add-circle-regular": string;
56
56
  "add-filled": string;
57
+ "alert-regular": string;
57
58
  "airplane-regular": string;
58
59
  "approvals-app-filled": string;
59
60
  "apps-list-filled": string;
@@ -36,7 +36,7 @@ export const useContextualLayer = ({ placement, visible, matchReferenceWidth = f
36
36
  top: rect.top + height,
37
37
  };
38
38
  const horizontalPosition = match(inferedPlacement)
39
- .with("left", () => ({ left: rect.left }))
39
+ .with("left", () => ({ left: rect.left - 12 }))
40
40
  .with("right", () => ({ right: window.innerWidth - rect.right }))
41
41
  .with("center", () => ({ left: rect.left + width / 2, transform: "translateX(-50%)" }))
42
42
  .exhaustive();
@@ -2,6 +2,7 @@
2
2
  "add-circle-filled": "M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm0 5c-.38 0-.7.28-.74.65l-.01.1v3.5h-3.5a.75.75 0 0 0-.1 1.5h3.6v3.5a.75.75 0 0 0 1.5.1v-3.6h3.5a.75.75 0 0 0 .1-1.5h-3.6v-3.5A.75.75 0 0 0 12 7Z",
3
3
  "add-circle-regular": "M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm0 1.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17ZM12 7c.41 0 .75.34.75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5c0-.41.34-.75.75-.75Z",
4
4
  "add-filled": "M11.88 3H12a1 1 0 0 1 1 .88V11h7a1 1 0 0 1 1 .88V12a1 1 0 0 1-.88 1H13v7a1 1 0 0 1-.88 1H12a1 1 0 0 1-1-.88V13H4a1 1 0 0 1-1-.88V12a1 1 0 0 1 .88-1H11V4a1 1 0 0 1 .88-1H12h-.12Z",
5
+ "alert-regular": "M12 2a7.5 7.5 0 0 1 7.5 7.25v4.35l1.38 3.15a1.25 1.25 0 0 1-1.15 1.75H15a3 3 0 0 1-6 .18v-.18H4.27a1.25 1.25 0 0 1-1.14-1.75L4.5 13.6V9.5C4.5 5.35 7.85 2 12 2Zm1.5 16.5h-3a1.5 1.5 0 0 0 3 .15v-.15ZM12 3.5c-3.32 0-6 2.67-6 6v4.4L4.66 17h14.7L18 13.9V9.29a5.99 5.99 0 0 0-6-5.78Z",
5
6
  "airplane-regular": "m9.47 9.64-.7-5.87v-.08c0-.88.72-1.6 1.6-1.6.8 0 1.55.42 1.98 1.13l.1.16 2.94 6.09 3.95-.12a2.6 2.6 0 0 1 2.68 2.53v.07a2.6 2.6 0 0 1-2.62 2.6l-3.97-.12-2.99 6.19a2.3 2.3 0 0 1-2.06 1.3c-.9 0-1.61-.73-1.61-1.64v-.12l.71-5.9-2.13-.07-.27.74a1.95 1.95 0 0 1-1.83 1.28c-.87 0-1.58-.71-1.58-1.59v-.76l-.16-.03a1.92 1.92 0 0 1 0-3.76l.16-.03v-.76c0-.8.6-1.48 1.43-1.58h.15c.75 0 1.43.42 1.77 1.12l.06.15.27.74 2.12-.07Zm.9-6.05c-.05 0-.1.04-.1.08l.88 7.42-4.84.15-.62-1.72-.04-.08c-.07-.15-.23-.25-.35-.25h-.06a.09.09 0 0 0-.07.09v1.98l-1.35.28a.42.42 0 0 0 0 .82l1.35.28v1.98c0 .05.03.09.08.09.19 0 .36-.12.42-.3l.64-1.75 4.86.15-.9 7.47v.03c0 .06.05.1.1.1a.8.8 0 0 0 .72-.44l3.42-7.07 4.9.15c.61 0 1.1-.5 1.1-1.09v-.04a1.1 1.1 0 0 0-1.12-1.07l-4.93.15-3.35-6.93-.06-.1a.8.8 0 0 0-.67-.38Z",
6
7
  "approvals-app-filled": "M10.54 1.8a1 1 0 0 1 1.42 0l2.5 2.5a1 1 0 0 1 0 1.4l-2.5 2.5a1 1 0 1 1-1.42-1.4l.76-.77a7 7 0 1 0 7.65 7.85 1 1 0 1 1 1.98.24 9 9 0 1 1-9.57-10.1l-.82-.81a1 1 0 0 1 0-1.42Zm5.67 8a1 1 0 0 1 0 1.4l-4.5 4.5a1 1 0 0 1-1.42 0l-2-2a1 1 0 1 1 1.42-1.4L11 13.58l3.8-3.8a1 1 0 0 1 1.4 0Z",
7
8
  "apps-list-filled": "M6.25 16C7.2 16 8 16.8 8 17.75v2.5C8 21.22 7.2 22 6.25 22h-2.5C2.78 22 2 21.22 2 20.25v-2.5C2 16.8 2.78 16 3.75 16h2.5Zm3.5 2h11.5a.75.75 0 0 1 .1 1.5H9.75a.75.75 0 0 1-.1-1.5h11.6-11.5Zm-3.5-9C7.2 9 8 9.78 8 10.75v2.5C8 14.22 7.2 15 6.25 15h-2.5C2.78 15 2 14.22 2 13.25v-2.5C2 9.78 2.78 9 3.75 9h2.5Zm3.5 2h11.5a.75.75 0 0 1 .1 1.5H9.75a.75.75 0 0 1-.1-1.5h11.6-11.5Zm-3.5-9C7.2 2 8 2.78 8 3.75v2.5C8 7.2 7.2 8 6.25 8h-2.5C2.78 8 2 7.2 2 6.25v-2.5C2 2.78 2.78 2 3.75 2h2.5Zm3.5 2h11.5a.75.75 0 0 1 .1 1.5H9.75a.75.75 0 0 1-.1-1.5h11.6-11.5Z",