@swan-io/lake 2.7.6 → 2.7.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": "2.7.
|
|
3
|
+
"version": "2.7.7",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=18.0.0",
|
|
6
6
|
"yarn": "^1.22.0"
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@popperjs/core": "^2.11.8",
|
|
30
|
-
"@react-three/drei": "^9.
|
|
31
|
-
"@react-three/fiber": "^8.13.
|
|
32
|
-
"@swan-io/boxed": "^1.0
|
|
30
|
+
"@react-three/drei": "^9.80.1",
|
|
31
|
+
"@react-three/fiber": "^8.13.6",
|
|
32
|
+
"@swan-io/boxed": "^1.1.0",
|
|
33
33
|
"@swan-io/chicane": "^1.4.1",
|
|
34
34
|
"dayjs": "^1.11.9",
|
|
35
35
|
"polished": "^4.2.2",
|
|
@@ -39,21 +39,21 @@
|
|
|
39
39
|
"react-dom": "^18.2.0",
|
|
40
40
|
"react-native-web": "^0.19.7",
|
|
41
41
|
"react-popper": "^2.3.0",
|
|
42
|
-
"react-ux-form": "^1.
|
|
42
|
+
"react-ux-form": "^1.5.0",
|
|
43
43
|
"rifm": "^0.12.1",
|
|
44
|
-
"three": "^0.
|
|
44
|
+
"three": "^0.155.0",
|
|
45
45
|
"ts-dedent": "^2.2.0",
|
|
46
|
-
"ts-pattern": "^5.0.
|
|
47
|
-
"urql": "^4.0.
|
|
46
|
+
"ts-pattern": "^5.0.5",
|
|
47
|
+
"urql": "^4.0.5",
|
|
48
48
|
"uuid": "^9.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@types/react": "^18.2.
|
|
51
|
+
"@types/react": "^18.2.19",
|
|
52
52
|
"@types/react-dom": "^18.2.7",
|
|
53
53
|
"@types/react-native": "^0.72.2",
|
|
54
|
-
"@types/three": "^0.
|
|
54
|
+
"@types/three": "^0.155.0",
|
|
55
55
|
"@types/uuid": "^9.0.2",
|
|
56
56
|
"jsdom": "^22.1.0",
|
|
57
|
-
"type-fest": "^4.
|
|
57
|
+
"type-fest": "^4.2.0"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -115,11 +115,12 @@ export const SimpleRegularTextCell = ({ variant = "regular", text, textAlign = "
|
|
|
115
115
|
};
|
|
116
116
|
export const CopyableRegularTextCell = ({ variant = "regular", text, textToCopy, copyWording, copiedWording, tooltip, }) => {
|
|
117
117
|
const [visibleState, setVisibleState] = useState("copy");
|
|
118
|
+
const clipboardText = textToCopy ?? text;
|
|
118
119
|
const onPress = useCallback((event) => {
|
|
119
120
|
event.preventDefault();
|
|
120
|
-
Clipboard.setString(
|
|
121
|
+
Clipboard.setString(clipboardText);
|
|
121
122
|
setVisibleState("copied");
|
|
122
|
-
}, [
|
|
123
|
+
}, [clipboardText]);
|
|
123
124
|
return (_jsxs(View, { style: styles.cell, children: [_jsx(LakeTooltip, { placement: "top", onHide: () => setVisibleState("copy"), togglableOnFocus: true, content: visibleState === "copy" ? copyWording : copiedWording, containerStyle: styles.iconContainer, children: _jsx(Pressable, { role: "button", "aria-label": copyWording, onPress: onPress, style: ({ hovered }) => [styles.icon, hovered && styles.underline], children: ({ hovered }) => (_jsx(Icon, { name: hovered ? "copy-filled" : "copy-regular", color: "currentColor", size: 14 })) }) }), _jsx(Space, { width: 4 }), _jsx(LakeText, { tooltip: tooltip, color: colors.gray[900], style: styles.regularText, variant: variant, children: text })] }));
|
|
124
125
|
};
|
|
125
126
|
// TODO: handle `+` sign properly
|
|
@@ -3,7 +3,6 @@ import { forwardRef, useCallback, useId, useImperativeHandle, useRef, useState,
|
|
|
3
3
|
import { FlatList, Pressable, StyleSheet, Text, View, } from "react-native";
|
|
4
4
|
import { backgroundColor, colors, spacings } from "../constants/design";
|
|
5
5
|
import { typography } from "../constants/typography";
|
|
6
|
-
import { useDisclosure } from "../hooks/useDisclosure";
|
|
7
6
|
import { useMergeRefs } from "../hooks/useMergeRefs";
|
|
8
7
|
import { getFocusableElements } from "../utils/a11y";
|
|
9
8
|
import { Box } from "./Box";
|
|
@@ -86,9 +85,10 @@ const LakeComboboxWithRef = ({ inputRef, value, items, itemHeight = DEFAULT_ELEM
|
|
|
86
85
|
const listRef = useRef(null);
|
|
87
86
|
const listContainerRef = useRef(null);
|
|
88
87
|
const blurTimeoutId = useRef(undefined);
|
|
89
|
-
const [isFocused,
|
|
88
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
90
89
|
const [isFetchingAdditionalInfo, setIsFetchingAdditionalInfo] = useState(false);
|
|
91
|
-
const
|
|
90
|
+
const open = useCallback(() => ref.current?.focus(), []);
|
|
91
|
+
const close = useCallback(() => ref.current?.blur(), []);
|
|
92
92
|
useImperativeHandle(externalRef, () => {
|
|
93
93
|
return {
|
|
94
94
|
open,
|
|
@@ -133,19 +133,16 @@ const LakeComboboxWithRef = ({ inputRef, value, items, itemHeight = DEFAULT_ELEM
|
|
|
133
133
|
const handleFocus = useCallback(() => {
|
|
134
134
|
window.clearTimeout(blurTimeoutId.current);
|
|
135
135
|
blurTimeoutId.current = window.setTimeout(() => {
|
|
136
|
-
|
|
136
|
+
setIsFocused(true);
|
|
137
137
|
}, 100);
|
|
138
|
-
}, [
|
|
138
|
+
}, []);
|
|
139
139
|
const handleBlur = useCallback(() => {
|
|
140
140
|
window.clearTimeout(blurTimeoutId.current);
|
|
141
141
|
blurTimeoutId.current = window.setTimeout(() => {
|
|
142
|
-
|
|
142
|
+
setIsFocused(false);
|
|
143
143
|
}, 100);
|
|
144
|
-
}, [
|
|
145
|
-
return (_jsxs(View, { children: [_jsx(LakeTextInput, { containerRef: inputTextRef, style: styles.input, ariaExpanded: isFocused, ariaControls: isFocused ? suggestionsId : "", enterKeyHint: "search", icon: icon, role: "combobox", placeholder: placeholder, value: value, disabled: disabled, error: error, hideErrors: hideErrors, onChangeText: onValueChange, onChange:
|
|
146
|
-
setHasChanged(true);
|
|
147
|
-
onChange?.(event);
|
|
148
|
-
}, onFocus: handleFocus, onBlur: handleBlur, onKeyPress: handleKeyPress, id: id, readOnly: readOnly }), _jsx(Popover, { id: suggestionsId, role: "listbox", matchReferenceWidth: true, onDismiss: close, referenceRef: ref, autoFocus: false, returnFocus: true, visible: isFocused && !items.isNotAsked() && hasChanged, underlay: false, forcedMode: "Dropdown", children: _jsx(View, { style: [styles.list, { maxHeight: itemHeight * nbItemsDisplayed }], children: items.match({
|
|
144
|
+
}, []);
|
|
145
|
+
return (_jsxs(View, { children: [_jsx(LakeTextInput, { containerRef: inputTextRef, style: styles.input, ariaExpanded: isFocused, ariaControls: isFocused ? suggestionsId : "", enterKeyHint: "search", icon: icon, role: "combobox", placeholder: placeholder, value: value, disabled: disabled, error: error, hideErrors: hideErrors, onChangeText: onValueChange, onChange: onChange, onFocus: handleFocus, onBlur: handleBlur, onKeyPress: handleKeyPress, id: id, readOnly: readOnly }), _jsx(Popover, { id: suggestionsId, role: "listbox", matchReferenceWidth: true, onDismiss: close, referenceRef: ref, autoFocus: false, returnFocus: false, visible: isFocused && !items.isNotAsked(), underlay: false, forcedMode: "Dropdown", children: _jsx(View, { style: [styles.list, { maxHeight: itemHeight * nbItemsDisplayed }], children: items.match({
|
|
149
146
|
NotAsked: () => null,
|
|
150
147
|
Loading: () => _jsx(LoadingView, { style: styles.loader }),
|
|
151
148
|
Done: items => items.match({
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { useMemo, useState } from "react";
|
|
2
|
-
export const useDisclosure = (initialValue
|
|
2
|
+
export const useDisclosure = (initialValue) => {
|
|
3
3
|
const [value, setValue] = useState(initialValue);
|
|
4
4
|
return [
|
|
5
5
|
value,
|
|
6
6
|
useMemo(() => ({
|
|
7
7
|
open: () => setValue(true),
|
|
8
|
-
close: () =>
|
|
9
|
-
setValue(false);
|
|
10
|
-
onClose?.();
|
|
11
|
-
},
|
|
8
|
+
close: () => setValue(false),
|
|
12
9
|
toggle: () => setValue(prevValue => !prevValue),
|
|
13
10
|
}), []),
|
|
14
11
|
];
|