@swan-io/lake 11.4.3 → 12.0.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 +15 -16
- package/src/components/AutoWidthImage.d.ts +8 -105
- package/src/components/AutoWidthImage.js +4 -4
- package/src/components/AutocompleteSearchInput.d.ts +2 -2
- package/src/components/AutocompleteSearchInput.js +1 -1
- package/src/components/Avatar.d.ts +0 -7
- package/src/components/Avatar.js +3 -6
- package/src/components/Box.d.ts +3 -11
- package/src/components/Box.js +3 -5
- package/src/components/Card3dPreview.d.ts +3 -1
- package/src/components/Card3dPreview.js +4 -4
- package/src/components/Cells.d.ts +1 -66
- package/src/components/Cells.js +1 -50
- package/src/components/FlatList.d.ts +3 -5
- package/src/components/FlatList.js +3 -4
- package/src/components/FocusTrap.d.ts +6 -5
- package/src/components/FocusTrap.js +3 -3
- package/src/components/Form.d.ts +35 -9
- package/src/components/Form.js +4 -4
- package/src/components/LakeButton.d.ts +3 -2
- package/src/components/LakeButton.js +4 -4
- package/src/components/LakeCombobox.d.ts +8 -11
- package/src/components/LakeCombobox.js +7 -8
- package/src/components/LakeHeading.d.ts +7 -102
- package/src/components/LakeHeading.js +2 -3
- package/src/components/LakeSelect.d.ts +3 -6
- package/src/components/LakeSelect.js +3 -4
- package/src/components/LakeTagInput.d.ts +7 -207
- package/src/components/LakeTagInput.js +7 -9
- package/src/components/LakeText.d.ts +5 -3
- package/src/components/LakeText.js +2 -3
- package/src/components/LakeTextInput.d.ts +3 -218
- package/src/components/LakeTextInput.js +5 -5
- package/src/components/LakeTooltip.d.ts +10 -8
- package/src/components/LakeTooltip.js +8 -8
- package/src/components/Link.d.ts +3 -122
- package/src/components/Link.js +4 -4
- package/src/components/ListRightPanel.d.ts +3 -4
- package/src/components/ListRightPanel.js +2 -5
- package/src/components/LoadingView.d.ts +3 -1
- package/src/components/LoadingView.js +1 -2
- package/src/components/PlainListView.d.ts +5 -3
- package/src/components/Popover.d.ts +1 -1
- package/src/components/Pressable.d.ts +1 -0
- package/src/components/Pressable.js +6 -6
- package/src/components/RightPanel.d.ts +3 -2
- package/src/components/RightPanel.js +3 -3
- package/src/components/ScrollView.d.ts +3 -8
- package/src/components/ScrollView.js +4 -4
- package/src/components/SectionList.d.ts +3 -5
- package/src/components/SectionList.js +3 -4
- package/src/components/Stack.d.ts +7 -11
- package/src/components/Stack.js +5 -6
- package/src/components/Switch.d.ts +3 -1
- package/src/components/Switch.js +2 -4
- package/src/components/TabView.js +5 -5
- package/src/components/Tag.d.ts +2 -2
- package/src/components/Tile.js +3 -1
- package/src/components/WithCurrentColor.d.ts +3 -3
- package/src/hooks/useBreakpoint.js +1 -1
- package/src/hooks/useContextualLayer.d.ts +3 -3
- package/src/hooks/useForceableState.js +1 -1
- package/src/hooks/useHover.d.ts +2 -2
- package/src/hooks/useHover.js +1 -1
- package/src/hooks/useMergeRefs.d.ts +2 -2
- package/src/hooks/useMergeRefs.js +1 -2
- package/src/hooks/useNativeProp.d.ts +2 -2
- package/src/hooks/usePressEvents.d.ts +2 -2
- package/src/hooks/usePressEvents.js +1 -1
- package/src/utils/clipboard.js +1 -1
- package/src/utils/refs.d.ts +2 -2
- package/src/utils/windowSize.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swan-io/lake",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": "^22.12.0",
|
|
6
6
|
"pnpm": "^10.2.0"
|
|
@@ -26,29 +26,28 @@
|
|
|
26
26
|
],
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@react-three/drei": "^
|
|
30
|
-
"@react-three/fiber": "^
|
|
29
|
+
"@react-three/drei": "^10.0.6",
|
|
30
|
+
"@react-three/fiber": "^9.1.2",
|
|
31
31
|
"@swan-io/boxed": "^3.2.0",
|
|
32
|
-
"@swan-io/chicane": "^2.
|
|
32
|
+
"@swan-io/chicane": "^2.2.0",
|
|
33
33
|
"@swan-io/use-form": "^3.1.0",
|
|
34
34
|
"dayjs": "^1.11.13",
|
|
35
35
|
"polished": "^4.3.1",
|
|
36
36
|
"prism-react-renderer": "^2.4.1",
|
|
37
|
-
"react": "^
|
|
38
|
-
"react-dom": "^
|
|
39
|
-
"react-native-web": "^0.
|
|
37
|
+
"react": "^19.1.0",
|
|
38
|
+
"react-dom": "^19.1.0",
|
|
39
|
+
"react-native-web": "^0.20.0",
|
|
40
40
|
"rifm": "^0.12.1",
|
|
41
|
-
"three": "^0.
|
|
42
|
-
"ts-
|
|
43
|
-
"
|
|
44
|
-
"uuid": "^11.0.5"
|
|
41
|
+
"three": "^0.175.0",
|
|
42
|
+
"ts-pattern": "^5.7.0",
|
|
43
|
+
"uuid": "^11.1.0"
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
47
|
-
"@types/react": "^
|
|
48
|
-
"@types/react-dom": "^
|
|
46
|
+
"@types/react": "^19.1.2",
|
|
47
|
+
"@types/react-dom": "^19.1.2",
|
|
49
48
|
"@types/react-native": "^0.72.8",
|
|
50
|
-
"@types/three": "^0.
|
|
51
|
-
"jsdom": "^26.
|
|
52
|
-
"type-fest": "^4.
|
|
49
|
+
"@types/three": "^0.175.0",
|
|
50
|
+
"jsdom": "^26.1.0",
|
|
51
|
+
"type-fest": "^4.40.0"
|
|
53
52
|
}
|
|
54
53
|
}
|
|
@@ -1,109 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
draggable?: boolean | undefined;
|
|
7
|
-
id?: string | undefined | undefined;
|
|
8
|
-
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined | undefined;
|
|
9
|
-
onError?: ((error: import("react-native").NativeSyntheticEvent<import("react-native").ImageErrorEventData>) => void) | undefined | undefined;
|
|
10
|
-
onLoad?: ((event: import("react-native").NativeSyntheticEvent<import("react-native").ImageLoadEventData>) => void) | undefined | undefined;
|
|
11
|
-
onLoadEnd?: (() => void) | undefined | undefined;
|
|
12
|
-
onLoadStart?: (() => void) | undefined | undefined;
|
|
13
|
-
progressiveRenderingEnabled?: boolean | undefined | undefined;
|
|
14
|
-
borderRadius?: number | undefined | undefined;
|
|
15
|
-
borderTopLeftRadius?: number | undefined | undefined;
|
|
16
|
-
borderTopRightRadius?: number | undefined | undefined;
|
|
17
|
-
borderBottomLeftRadius?: number | undefined | undefined;
|
|
18
|
-
borderBottomRightRadius?: number | undefined | undefined;
|
|
19
|
-
resizeMode?: import("react-native").ImageResizeMode | undefined;
|
|
20
|
-
resizeMethod?: "auto" | "resize" | "scale" | undefined | undefined;
|
|
21
|
-
src?: string | undefined | undefined;
|
|
22
|
-
srcSet?: string | undefined | undefined;
|
|
23
|
-
loadingIndicatorSource?: import("react-native").ImageURISource | undefined;
|
|
24
|
-
testID?: string | undefined | undefined;
|
|
25
|
-
nativeID?: string | undefined | undefined;
|
|
26
|
-
alt?: string | undefined | undefined;
|
|
27
|
-
height?: number | undefined | undefined;
|
|
28
|
-
width?: number | undefined | undefined;
|
|
29
|
-
crossOrigin?: "anonymous" | "use-credentials" | undefined | undefined;
|
|
30
|
-
tintColor?: import("react-native").ColorValue | undefined;
|
|
31
|
-
referrerPolicy?: "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url" | undefined | undefined;
|
|
32
|
-
blurRadius?: number | undefined | undefined;
|
|
33
|
-
capInsets?: import("react-native").Insets | undefined;
|
|
34
|
-
onProgress?: ((event: import("react-native").NativeSyntheticEvent<import("react-native").ImageProgressEventDataIOS>) => void) | undefined | undefined;
|
|
35
|
-
onPartialLoad?: (() => void) | undefined | undefined;
|
|
36
|
-
fadeDuration?: number | undefined | undefined;
|
|
37
|
-
accessible?: boolean | undefined | undefined;
|
|
38
|
-
accessibilityActions?: readonly Readonly<{
|
|
39
|
-
name: import("react-native").AccessibilityActionName | string;
|
|
40
|
-
label?: string | undefined;
|
|
41
|
-
}>[] | undefined;
|
|
42
|
-
accessibilityLabel?: string | undefined | undefined;
|
|
43
|
-
"aria-label"?: string | undefined | undefined;
|
|
44
|
-
accessibilityRole?: import("react-native").AccessibilityRole | undefined;
|
|
45
|
-
accessibilityState?: import("react-native").AccessibilityState | undefined;
|
|
46
|
-
"aria-busy"?: boolean | undefined | undefined;
|
|
47
|
-
"aria-checked"?: boolean | "mixed" | undefined | undefined;
|
|
48
|
-
"aria-disabled"?: boolean | undefined | undefined;
|
|
49
|
-
"aria-expanded"?: boolean | undefined | undefined;
|
|
50
|
-
"aria-selected"?: boolean | undefined | undefined;
|
|
51
|
-
"aria-labelledby"?: string | undefined | undefined;
|
|
52
|
-
accessibilityHint?: string | undefined | undefined;
|
|
53
|
-
accessibilityValue?: import("react-native").AccessibilityValue | undefined;
|
|
54
|
-
"aria-valuemax"?: number | undefined;
|
|
55
|
-
"aria-valuemin"?: number | undefined;
|
|
56
|
-
"aria-valuenow"?: number | undefined;
|
|
57
|
-
"aria-valuetext"?: string | undefined;
|
|
58
|
-
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined | undefined;
|
|
59
|
-
importantForAccessibility?: ("auto" | "yes" | "no" | "no-hide-descendants") | undefined | undefined;
|
|
60
|
-
"aria-hidden"?: boolean | undefined | undefined;
|
|
61
|
-
"aria-live"?: ("polite" | "assertive" | "off") | undefined | undefined;
|
|
62
|
-
"aria-modal"?: boolean | undefined | undefined;
|
|
63
|
-
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined | undefined;
|
|
64
|
-
accessibilityLabelledBy?: string | string[] | undefined | undefined;
|
|
65
|
-
accessibilityElementsHidden?: boolean | undefined | undefined;
|
|
66
|
-
accessibilityViewIsModal?: boolean | undefined | undefined;
|
|
67
|
-
onAccessibilityEscape?: (() => void) | undefined | undefined;
|
|
68
|
-
onAccessibilityTap?: (() => void) | undefined | undefined;
|
|
69
|
-
onMagicTap?: (() => void) | undefined | undefined;
|
|
70
|
-
accessibilityIgnoresInvertColors?: boolean | undefined | undefined;
|
|
71
|
-
accessibilityLanguage?: string | undefined | undefined;
|
|
72
|
-
tabIndex?: 0 | -1 | undefined;
|
|
73
|
-
"aria-activedescendant"?: string | undefined;
|
|
74
|
-
"aria-atomic"?: boolean | undefined;
|
|
75
|
-
"aria-autocomplete"?: string | undefined;
|
|
76
|
-
"aria-colcount"?: number | undefined;
|
|
77
|
-
"aria-colindex"?: number | undefined;
|
|
78
|
-
"aria-colspan"?: number | undefined;
|
|
79
|
-
"aria-controls"?: string | undefined;
|
|
80
|
-
"aria-current"?: boolean | "page" | "step" | "location" | "date" | "time" | undefined;
|
|
81
|
-
"aria-describedby"?: string | undefined;
|
|
82
|
-
"aria-details"?: string | undefined;
|
|
83
|
-
"aria-errormessage"?: string | undefined;
|
|
84
|
-
"aria-flowto"?: string | undefined;
|
|
85
|
-
"aria-haspopup"?: string | undefined;
|
|
86
|
-
"aria-invalid"?: boolean | undefined;
|
|
87
|
-
"aria-keyshortcuts"?: string | undefined;
|
|
88
|
-
"aria-level"?: number | undefined;
|
|
89
|
-
"aria-multiline"?: boolean | undefined;
|
|
90
|
-
"aria-multiselectable"?: boolean | undefined;
|
|
91
|
-
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
|
92
|
-
"aria-owns"?: string | undefined;
|
|
93
|
-
"aria-placeholder"?: string | undefined;
|
|
94
|
-
"aria-posinset"?: number | undefined;
|
|
95
|
-
"aria-pressed"?: boolean | undefined;
|
|
96
|
-
"aria-readonly"?: boolean | undefined;
|
|
97
|
-
"aria-required"?: boolean | undefined;
|
|
98
|
-
"aria-roledescription"?: string | undefined;
|
|
99
|
-
"aria-rowcount"?: number | undefined;
|
|
100
|
-
"aria-rowindex"?: number | undefined;
|
|
101
|
-
"aria-rowspan"?: number | undefined;
|
|
102
|
-
"aria-setsize"?: number | undefined;
|
|
103
|
-
"aria-sort"?: "ascending" | "descending" | "none" | "other" | undefined;
|
|
104
|
-
} & {
|
|
1
|
+
import { Ref } from "react";
|
|
2
|
+
import { Image, ImageProps } from "react-native";
|
|
3
|
+
import { Except } from "type-fest";
|
|
4
|
+
type Props = Except<ImageProps, "source"> & {
|
|
5
|
+
ref?: Ref<Image>;
|
|
105
6
|
ariaLabel?: string;
|
|
106
7
|
maxWidth?: number;
|
|
107
8
|
height: number;
|
|
108
9
|
sourceUri: string;
|
|
109
|
-
}
|
|
10
|
+
};
|
|
11
|
+
export declare const AutoWidthImage: import("react").MemoExoticComponent<({ ref, ariaLabel, maxWidth, height, sourceUri, onLoadEnd, style, ...props }: Props) => import("react/jsx-runtime").JSX.Element>;
|
|
12
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { memo, useLayoutEffect, useState } from "react";
|
|
3
3
|
import { Image } from "react-native";
|
|
4
4
|
import { isNotNullish } from "../utils/nullish";
|
|
5
|
-
export const AutoWidthImage = memo(
|
|
5
|
+
export const AutoWidthImage = memo(({ ref, ariaLabel, maxWidth, height, sourceUri, onLoadEnd, style, ...props }) => {
|
|
6
6
|
const [{ fetching, size }, setState] = useState({
|
|
7
7
|
fetching: true,
|
|
8
8
|
size: { height, width: 0 },
|
|
@@ -19,10 +19,10 @@ export const AutoWidthImage = memo(forwardRef(({ ariaLabel, maxWidth, height, so
|
|
|
19
19
|
setState(({ size }) => ({ fetching: false, size }));
|
|
20
20
|
});
|
|
21
21
|
}, [maxWidth, height, sourceUri]);
|
|
22
|
-
return (_jsx(Image, { "aria-label": ariaLabel, ref:
|
|
22
|
+
return (_jsx(Image, { "aria-label": ariaLabel, ref: ref, style: [style, size], source: fetching ? null : sourceUri, onLoadEnd: () => {
|
|
23
23
|
if (!fetching) {
|
|
24
24
|
onLoadEnd === null || onLoadEnd === void 0 ? void 0 : onLoadEnd();
|
|
25
25
|
}
|
|
26
26
|
}, ...props }));
|
|
27
|
-
})
|
|
27
|
+
});
|
|
28
28
|
AutoWidthImage.displayName = "AutoWidthImage";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Future, Result } from "@swan-io/boxed";
|
|
2
|
-
import {
|
|
2
|
+
import { ReactNode, Ref } from "react";
|
|
3
3
|
type Suggestion<T> = {
|
|
4
4
|
title: string;
|
|
5
5
|
subtitle: string;
|
|
6
6
|
value: T;
|
|
7
7
|
};
|
|
8
8
|
type Props<T> = {
|
|
9
|
-
inputRef?:
|
|
9
|
+
inputRef?: Ref<unknown>;
|
|
10
10
|
value?: string;
|
|
11
11
|
onValueChange: (value: string) => void;
|
|
12
12
|
disabled?: boolean;
|
|
@@ -14,7 +14,7 @@ const styles = StyleSheet.create({
|
|
|
14
14
|
});
|
|
15
15
|
export const AutocompleteSearchInput = ({ inputRef, value, onValueChange, disabled, id, placeholder, error, emptyResultText, ListFooterComponent, shouldDisplaySuggestions = true, loadSuggestions, onSuggestion, onLoadError, }) => {
|
|
16
16
|
const [state, setState] = useState(AsyncData.NotAsked());
|
|
17
|
-
const lastRequest = useRef();
|
|
17
|
+
const lastRequest = useRef(undefined);
|
|
18
18
|
return (_jsx(LakeCombobox, { inputRef: inputRef, id: id, placeholder: placeholder, value: value !== null && value !== void 0 ? value : "", items: state, icon: loadSuggestions != null ? "search-filled" : undefined, disabled: disabled, error: error, ListFooterComponent: ListFooterComponent != null && (_jsxs(_Fragment, { children: [match(state)
|
|
19
19
|
.with(AsyncData.P.Done(Result.P.Ok(P.select())), suggestions => suggestions.length > 0 ? _jsx(Separator, {}) : null)
|
|
20
20
|
.otherwise(() => null), ListFooterComponent] })), onSelectItem: item => {
|
|
@@ -6,13 +6,6 @@ type User = {
|
|
|
6
6
|
type Props = {
|
|
7
7
|
size: number;
|
|
8
8
|
user: User | null | undefined;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated
|
|
12
|
-
*/
|
|
13
|
-
| {
|
|
14
|
-
size: number;
|
|
15
|
-
initials?: string;
|
|
16
9
|
};
|
|
17
10
|
export declare const Avatar: import("react").NamedExoticComponent<Props>;
|
|
18
11
|
export {};
|
package/src/components/Avatar.js
CHANGED
|
@@ -4,7 +4,6 @@ import { StyleSheet, View } from "react-native";
|
|
|
4
4
|
import { match, P } from "ts-pattern";
|
|
5
5
|
import { commonStyles } from "../constants/commonStyles";
|
|
6
6
|
import { colors } from "../constants/design";
|
|
7
|
-
import { identity } from "../utils/function";
|
|
8
7
|
import { Icon } from "./Icon";
|
|
9
8
|
import { LakeText } from "./LakeText";
|
|
10
9
|
const styles = StyleSheet.create({
|
|
@@ -26,15 +25,13 @@ const initialsToVariant = (initials) => {
|
|
|
26
25
|
return "shakespear";
|
|
27
26
|
}
|
|
28
27
|
};
|
|
29
|
-
export const Avatar = memo(
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
.with({ user: P.select(P.nonNullable) }, user => {
|
|
28
|
+
export const Avatar = memo(({ user, size }) => {
|
|
29
|
+
const initials = match(user)
|
|
30
|
+
.with(P.nonNullable, user => {
|
|
33
31
|
var _a, _b, _c, _d, _e;
|
|
34
32
|
return ((_b = (_a = user.firstName) === null || _a === void 0 ? void 0 : _a.charAt(0)) !== null && _b !== void 0 ? _b : "") +
|
|
35
33
|
((_e = (_d = ((_c = user.preferredLastName) !== null && _c !== void 0 ? _c : user.lastName)) === null || _d === void 0 ? void 0 : _d.charAt(0)) !== null && _e !== void 0 ? _e : "");
|
|
36
34
|
})
|
|
37
|
-
.with({ initials: P.select(P.nonNullable) }, identity)
|
|
38
35
|
.otherwise(() => "");
|
|
39
36
|
const variant = initialsToVariant(initials);
|
|
40
37
|
return (_jsx(View, { role: "img", style: [
|
package/src/components/Box.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { ReactNode, Ref } from "react";
|
|
2
2
|
import { StyleProp, View, ViewProps, ViewStyle } from "react-native";
|
|
3
3
|
declare const alignItemsStyles: {
|
|
4
4
|
baseline: {
|
|
@@ -58,6 +58,7 @@ type BoxDirection = keyof typeof directionStyles | "column";
|
|
|
58
58
|
type BoxJustifyContent = keyof typeof justifyContentStyles | "normal";
|
|
59
59
|
type BoxWrap = keyof typeof wrapStyles | "nowrap";
|
|
60
60
|
export type BoxProps = ViewProps & {
|
|
61
|
+
ref?: Ref<View>;
|
|
61
62
|
alignItems?: BoxAlignItems;
|
|
62
63
|
children?: ReactNode;
|
|
63
64
|
direction?: BoxDirection;
|
|
@@ -67,14 +68,5 @@ export type BoxProps = ViewProps & {
|
|
|
67
68
|
shrink?: number;
|
|
68
69
|
style?: StyleProp<ViewStyle>;
|
|
69
70
|
};
|
|
70
|
-
export declare const Box: import("react").
|
|
71
|
-
alignItems?: BoxAlignItems;
|
|
72
|
-
children?: ReactNode;
|
|
73
|
-
direction?: BoxDirection;
|
|
74
|
-
justifyContent?: BoxJustifyContent;
|
|
75
|
-
wrap?: BoxWrap;
|
|
76
|
-
grow?: number;
|
|
77
|
-
shrink?: number;
|
|
78
|
-
style?: StyleProp<ViewStyle>;
|
|
79
|
-
} & import("react").RefAttributes<View>>;
|
|
71
|
+
export declare const Box: ({ ref, alignItems, direction, justifyContent, wrap, grow, shrink, style, ...props }: BoxProps) => import("react/jsx-runtime").JSX.Element;
|
|
80
72
|
export {};
|
package/src/components/Box.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
2
|
import { StyleSheet, View } from "react-native";
|
|
4
3
|
const alignItemsStyles = StyleSheet.create({
|
|
5
4
|
baseline: { alignItems: "baseline" },
|
|
@@ -28,9 +27,8 @@ const otherStyles = StyleSheet.create({
|
|
|
28
27
|
grow1: { flexGrow: 1 },
|
|
29
28
|
shrink1: { flexShrink: 1 },
|
|
30
29
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
{ alignItems = "stretch", direction = "column", justifyContent = "normal", wrap = "nowrap", grow = 0, shrink = 0, style, ...props }, forwardedRef) => (_jsx(View, { ref: forwardedRef, ...props, style: [
|
|
30
|
+
// Default <View /> styles https://github.com/necolas/react-native-web/blob/0.20.0/packages/react-native-web/src/exports/View/index.js#L149
|
|
31
|
+
export const Box = ({ ref, alignItems = "stretch", direction = "column", justifyContent = "normal", wrap = "nowrap", grow = 0, shrink = 0, style, ...props }) => (_jsx(View, { ref: ref, ...props, style: [
|
|
34
32
|
alignItems !== "stretch" && alignItemsStyles[alignItems],
|
|
35
33
|
direction !== "column" && directionStyles[direction],
|
|
36
34
|
justifyContent !== "normal" && justifyContentStyles[justifyContent],
|
|
@@ -38,4 +36,4 @@ export const Box = forwardRef((
|
|
|
38
36
|
grow !== 0 && (grow === 1 ? otherStyles.grow1 : { flexGrow: grow }),
|
|
39
37
|
shrink !== 0 && (shrink === 1 ? otherStyles.shrink1 : { flexShrink: shrink }),
|
|
40
38
|
style,
|
|
41
|
-
] }))
|
|
39
|
+
] }));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JSX, Ref } from "react";
|
|
1
2
|
import * as THREE from "three";
|
|
2
3
|
export type Card3dAssetsUrls = {
|
|
3
4
|
envNx: string;
|
|
@@ -15,6 +16,7 @@ export type Card3dAssetsUrls = {
|
|
|
15
16
|
colorSilver: string;
|
|
16
17
|
};
|
|
17
18
|
type CardParams = {
|
|
19
|
+
ref?: Ref<THREE.Group>;
|
|
18
20
|
ownerName: string;
|
|
19
21
|
cardNumber: string;
|
|
20
22
|
expirationDate: string;
|
|
@@ -31,4 +33,4 @@ type Props = CardParams & {
|
|
|
31
33
|
declare const _default: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
32
34
|
export default _default;
|
|
33
35
|
type CardProps = JSX.IntrinsicElements["group"] & CardParams;
|
|
34
|
-
export declare const Card:
|
|
36
|
+
export declare const Card: ({ ref, ownerName, cardNumber, expirationDate, cvv, color, logo, logoScale, assetsUrls, onSvgError, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { Environment, OrbitControls, Text, useGLTF, useTexture } from "@react-three/drei";
|
|
3
3
|
import { Canvas, useFrame } from "@react-three/fiber";
|
|
4
4
|
import { Result } from "@swan-io/boxed";
|
|
5
|
-
import {
|
|
5
|
+
import { useEffect, useRef, useState } from "react";
|
|
6
6
|
import * as THREE from "three";
|
|
7
|
-
import {
|
|
7
|
+
import { match, P } from "ts-pattern";
|
|
8
8
|
import { isNotNullish, isNullish } from "../utils/nullish";
|
|
9
9
|
import { createSvgImage, getMonochromeSvg } from "../utils/svg";
|
|
10
10
|
/*
|
|
@@ -98,7 +98,7 @@ const setTextureColorSpace = (texture) => {
|
|
|
98
98
|
texture.colorSpace = THREE.SRGBColorSpace;
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
|
-
export const Card =
|
|
101
|
+
export const Card = ({ ref, ownerName, cardNumber, expirationDate, cvv, color, logo, logoScale, assetsUrls, onSvgError, ...props }) => {
|
|
102
102
|
const { nodes, materials } = useGLTF(assetsUrls.cardGltf);
|
|
103
103
|
const [logoData, setLogoData] = useState(null);
|
|
104
104
|
const silverTexture = useTexture(assetsUrls.colorSilver, setTextureColorSpace);
|
|
@@ -194,4 +194,4 @@ export const Card = forwardRef(({ ownerName, cardNumber, expirationDate, cvv, co
|
|
|
194
194
|
.with("Silver", () => 0x000000)
|
|
195
195
|
.with("Black", () => 0xffffff)
|
|
196
196
|
.otherwise(() => 0xffffff), metalness: 0.1, roughness: 0.35, envMapIntensity: ENV_MAP_INTENSITY, transparent: true, alphaMap: logoData.alphaMap })] })) }), _jsx("mesh", { geometry: nodes.black_band.geometry, material: materials.black_band, position: [0, 1.774, BACK_TEXT_POSITION], rotation: [0, Math.PI / 2, 0] }), _jsx("mesh", { geometry: nodes.chip.geometry, material: materials.chip, position: [-2.78, 0.439, FRONT_TEXT_POSITION], rotation: [0, Math.PI / 2, 0] }), _jsx("mesh", { geometry: nodes.chip_pattern.geometry, material: materials.chip_pattern, position: [-2.778, 0.442, FRONT_TEXT_POSITION + 0.001], rotation: [0, Math.PI / 2, 0] }), _jsx("mesh", { geometry: nodes.mc_center.geometry, material: materials.mastercard_orange, position: [3.052, -1.832, FRONT_TEXT_POSITION], rotation: [Math.PI / 2, 0, 0] }), _jsx("mesh", { geometry: nodes.mc_left.geometry, material: materials.mastercard_red, position: [2.676, -1.773, FRONT_TEXT_POSITION], rotation: [Math.PI / 2, 0, 0] }), _jsx("mesh", { geometry: nodes.mc_right.geometry, material: materials.mastercard_yellow, position: [3.47, -1.773, FRONT_TEXT_POSITION], rotation: [-Math.PI / 2, 0, 0] }), _jsx("mesh", { geometry: nodes.metal_circle.geometry, material: materials.rainbow, position: [-2.33, -1.849, BACK_TEXT_POSITION], rotation: [-Math.PI / 2, Math.PI / 2, 0] }), _jsx("mesh", { geometry: nodes.metal_circle001.geometry, material: materials.rainbow_rough, position: [-2.629, -1.849, BACK_TEXT_POSITION - 0.001], rotation: [-Math.PI / 2, Math.PI / 2, 0], scale: [0.35, 1, 0.35] }), _jsx("mesh", { geometry: nodes.metal_circle002.geometry, material: materials.rainbow_rough, position: [-2.33, -1.849, BACK_TEXT_POSITION - 0.001], rotation: [-Math.PI / 2, Math.PI / 2, 0] }), _jsx("mesh", { geometry: nodes.metal_mastercard.geometry, material: materials.rainbow_mastercard, position: [0.914, -1.298, BACK_TEXT_POSITION - 0.001], rotation: [Math.PI / 2, 0, Math.PI], scale: 0.09 })] }) }));
|
|
197
|
-
}
|
|
197
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode } from "react";
|
|
2
2
|
import { StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
import { Except } from "type-fest";
|
|
4
|
-
import { ColorVariants } from "../constants/design";
|
|
5
4
|
import { TextVariant } from "./LakeText";
|
|
6
5
|
import { LakeTooltip } from "./LakeTooltip";
|
|
7
6
|
declare const directionStyles: {
|
|
@@ -57,14 +56,10 @@ type BalanceCellProps = {
|
|
|
57
56
|
value: number;
|
|
58
57
|
currency: string;
|
|
59
58
|
};
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated Use `align` prop instead
|
|
62
|
-
*/
|
|
63
|
-
textAlign?: Align;
|
|
64
59
|
value: number;
|
|
65
60
|
variant?: TextVariant;
|
|
66
61
|
};
|
|
67
|
-
export declare const BalanceCell: ({
|
|
62
|
+
export declare const BalanceCell: ({ align, currency, formatCurrency, originalValue, value, variant, }: BalanceCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
68
63
|
type LinkCellProps = {
|
|
69
64
|
buttonPosition?: "start" | "end";
|
|
70
65
|
children: ReactNode;
|
|
@@ -75,64 +70,4 @@ type LinkCellProps = {
|
|
|
75
70
|
variant?: TextVariant;
|
|
76
71
|
};
|
|
77
72
|
export declare const LinkCell: ({ buttonPosition, children, external, fadeOn, onPress, tooltip, variant, }: LinkCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
78
|
-
/**
|
|
79
|
-
* @deprecated Avoid usage
|
|
80
|
-
*/
|
|
81
|
-
export declare const ColorPatchCell: ({ alternativeText, color, isHovered, }: {
|
|
82
|
-
alternativeText?: string;
|
|
83
|
-
color: ColorVariants;
|
|
84
|
-
isHovered: boolean;
|
|
85
|
-
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
86
|
-
/**
|
|
87
|
-
* @deprecated Use `HeaderCell` instead
|
|
88
|
-
*/
|
|
89
|
-
export declare const SimpleHeaderCell: ({ justifyContent, ...props }: {
|
|
90
|
-
justifyContent?: "flex-start" | "center" | "flex-end";
|
|
91
|
-
text: string;
|
|
92
|
-
sort?: SortDirection;
|
|
93
|
-
onPress?: (direction: SortDirection) => void;
|
|
94
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
95
|
-
/**
|
|
96
|
-
* @deprecated Use `TextCell` with color={…} and variant="medium" instead
|
|
97
|
-
*/
|
|
98
|
-
export declare const SimpleTitleCell: ({ isHighlighted, text, tooltip, }: {
|
|
99
|
-
isHighlighted?: boolean;
|
|
100
|
-
text: string;
|
|
101
|
-
tooltip?: TooltipProp;
|
|
102
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
103
|
-
/**
|
|
104
|
-
* @deprecated Use `TextCell` instead
|
|
105
|
-
*/
|
|
106
|
-
export declare const SimpleRegularTextCell: ({ color, text, textAlign, variant, }: {
|
|
107
|
-
color?: string;
|
|
108
|
-
text: string;
|
|
109
|
-
textAlign?: Align;
|
|
110
|
-
variant?: TextVariant;
|
|
111
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
112
|
-
/**
|
|
113
|
-
* @deprecated Use `CopyableTextCell` instead
|
|
114
|
-
*/
|
|
115
|
-
export declare const CopyableRegularTextCell: ({ copiedWording, copyWording, text, textToCopy, tooltip, variant, }: CopyableTextCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
116
|
-
/**
|
|
117
|
-
* @deprecated Use `<Cell align="left" />` instead
|
|
118
|
-
*/
|
|
119
|
-
export declare const StartAlignedCell: (props: Except<CellProps, "align">) => import("react/jsx-runtime").JSX.Element;
|
|
120
|
-
/**
|
|
121
|
-
* @deprecated Use `<Cell align="center" />` instead
|
|
122
|
-
*/
|
|
123
|
-
export declare const CenteredCell: (props: Except<CellProps, "align">) => import("react/jsx-runtime").JSX.Element;
|
|
124
|
-
/**
|
|
125
|
-
* @deprecated Use `<Cell align="right" />` instead
|
|
126
|
-
*/
|
|
127
|
-
export declare const EndAlignedCell: (props: Except<CellProps, "align">) => import("react/jsx-runtime").JSX.Element;
|
|
128
|
-
/**
|
|
129
|
-
* @deprecated Use `<Cell align="right" />` instead
|
|
130
|
-
*/
|
|
131
|
-
export declare const ActionCell: (props: CellProps) => import("react/jsx-runtime").JSX.Element;
|
|
132
|
-
/**
|
|
133
|
-
* @deprecated Use <ActionCell /> instead
|
|
134
|
-
*/
|
|
135
|
-
export declare const CellAction: ({ children }: {
|
|
136
|
-
children: ReactNode;
|
|
137
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
138
73
|
export {};
|
package/src/components/Cells.js
CHANGED
|
@@ -2,12 +2,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
3
|
import { StyleSheet, View } from "react-native";
|
|
4
4
|
import { match } from "ts-pattern";
|
|
5
|
-
import { visuallyHiddenStyle } from "../constants/commonStyles";
|
|
6
5
|
import { colors, invariantColors, spacings } from "../constants/design";
|
|
7
6
|
import { setClipboardText } from "../utils/clipboard";
|
|
8
|
-
import { identity } from "../utils/function";
|
|
9
7
|
import { isNotNullish, isNullish } from "../utils/nullish";
|
|
10
|
-
import { Box } from "./Box";
|
|
11
8
|
import { Icon } from "./Icon";
|
|
12
9
|
import { LakeText } from "./LakeText";
|
|
13
10
|
import { LakeTooltip } from "./LakeTooltip";
|
|
@@ -132,7 +129,7 @@ export const CopyableTextCell = ({ copiedWording, copyWording, text, textToCopy,
|
|
|
132
129
|
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 })] }));
|
|
133
130
|
};
|
|
134
131
|
// TODO: handle `+` sign properly
|
|
135
|
-
export const BalanceCell = ({
|
|
132
|
+
export const BalanceCell = ({ align = "left", 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: [
|
|
136
133
|
value > 0 && { color: colors.positive.primary },
|
|
137
134
|
value < 0 && { color: colors.negative.primary },
|
|
138
135
|
], 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 ? "+" : "") +
|
|
@@ -146,49 +143,3 @@ export const LinkCell = ({ buttonPosition = "start", children, external = false,
|
|
|
146
143
|
const text = (_jsx(LakeText, { numberOfLines: 1, color: colors.gray[900], variant: variant, tooltip: tooltip, children: children }));
|
|
147
144
|
return (_jsx(Cell, { fadeOn: fadeOn, children: atEnd ? (_jsxs(_Fragment, { children: [text, button] })) : (_jsxs(_Fragment, { children: [button, text] })) }));
|
|
148
145
|
};
|
|
149
|
-
/**
|
|
150
|
-
* @deprecated Avoid usage
|
|
151
|
-
*/
|
|
152
|
-
export const ColorPatchCell = ({ alternativeText, color, isHovered, }) => {
|
|
153
|
-
return isHovered ? (_jsx(Box, { grow: 1, style: { backgroundColor: colors[color].primary }, children: isNotNullish(alternativeText) ? (_jsx(LakeText, { style: visuallyHiddenStyle, children: alternativeText })) : null })) : null;
|
|
154
|
-
};
|
|
155
|
-
/**
|
|
156
|
-
* @deprecated Use `HeaderCell` instead
|
|
157
|
-
*/
|
|
158
|
-
export const SimpleHeaderCell = ({ justifyContent = "flex-start", ...props }) => (_jsx(HeaderCell, { ...props, align: match(justifyContent)
|
|
159
|
-
.returnType()
|
|
160
|
-
.with("flex-start", () => "left")
|
|
161
|
-
.with("flex-end", () => "right")
|
|
162
|
-
.otherwise(identity) }));
|
|
163
|
-
/**
|
|
164
|
-
* @deprecated Use `TextCell` with color={…} and variant="medium" instead
|
|
165
|
-
*/
|
|
166
|
-
export const SimpleTitleCell = ({ isHighlighted = false, text, tooltip, }) => (_jsx(TextCell, { color: isHighlighted ? colors.current.primary : colors.gray[900], text: text, tooltip: tooltip, variant: "medium" }));
|
|
167
|
-
/**
|
|
168
|
-
* @deprecated Use `TextCell` instead
|
|
169
|
-
*/
|
|
170
|
-
export const SimpleRegularTextCell = ({ color = colors.gray[900], text, textAlign = "left", variant = "regular", }) => _jsx(TextCell, { align: textAlign, color: color, text: text, variant: variant });
|
|
171
|
-
/**
|
|
172
|
-
* @deprecated Use `CopyableTextCell` instead
|
|
173
|
-
*/
|
|
174
|
-
export const CopyableRegularTextCell = CopyableTextCell;
|
|
175
|
-
/**
|
|
176
|
-
* @deprecated Use `<Cell align="left" />` instead
|
|
177
|
-
*/
|
|
178
|
-
export const StartAlignedCell = (props) => (_jsx(Cell, { align: "left", ...props }));
|
|
179
|
-
/**
|
|
180
|
-
* @deprecated Use `<Cell align="center" />` instead
|
|
181
|
-
*/
|
|
182
|
-
export const CenteredCell = (props) => (_jsx(Cell, { align: "center", ...props }));
|
|
183
|
-
/**
|
|
184
|
-
* @deprecated Use `<Cell align="right" />` instead
|
|
185
|
-
*/
|
|
186
|
-
export const EndAlignedCell = (props) => (_jsx(Cell, { align: "right", ...props }));
|
|
187
|
-
/**
|
|
188
|
-
* @deprecated Use `<Cell align="right" />` instead
|
|
189
|
-
*/
|
|
190
|
-
export const ActionCell = (props) => _jsx(Cell, { align: "right", ...props });
|
|
191
|
-
/**
|
|
192
|
-
* @deprecated Use <ActionCell /> instead
|
|
193
|
-
*/
|
|
194
|
-
export const CellAction = ({ children }) => (_jsx(ActionCell, { children: children }));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode, Ref } from "react";
|
|
2
2
|
import { StyleProp, ViewStyle, WebRole } from "react-native";
|
|
3
3
|
import { ScrollViewProps, ScrollViewRef } from "./ScrollView";
|
|
4
4
|
export type FlatListRef = ScrollViewRef;
|
|
@@ -7,6 +7,7 @@ export type ListRenderItemInfo<T> = {
|
|
|
7
7
|
index: number;
|
|
8
8
|
};
|
|
9
9
|
type Props<T> = {
|
|
10
|
+
ref?: Ref<FlatListRef>;
|
|
10
11
|
ItemSeparatorComponent?: ReactNode;
|
|
11
12
|
ListEmptyComponent?: ReactNode;
|
|
12
13
|
ListFooterComponent?: ReactNode;
|
|
@@ -25,8 +26,5 @@ type Props<T> = {
|
|
|
25
26
|
showsScrollIndicators?: boolean;
|
|
26
27
|
style?: StyleProp<ViewStyle>;
|
|
27
28
|
};
|
|
28
|
-
declare const
|
|
29
|
-
export declare const FlatList: <T>(props: Props<T> & {
|
|
30
|
-
ref?: ForwardedRef<FlatListRef>;
|
|
31
|
-
}) => ReturnType<typeof FlatListWithRef>;
|
|
29
|
+
export declare const FlatList: <T>({ ref, ItemSeparatorComponent, ListEmptyComponent, ListFooterComponent, ListHeaderComponent, contentContainerStyle, data, horizontal, keyExtractor, onEndReached, onEndReachedThresholdPx, onKeyDown, onScroll, renderItem, role, scrollEventThrottle, showsScrollIndicators, style, }: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
|
32
30
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment,
|
|
2
|
+
import { Fragment, useEffect, useRef } from "react";
|
|
3
3
|
import { StyleSheet, View } from "react-native";
|
|
4
4
|
import { ScrollView } from "./ScrollView";
|
|
5
5
|
const styles = StyleSheet.create({
|
|
@@ -10,7 +10,7 @@ const styles = StyleSheet.create({
|
|
|
10
10
|
bottom: 0,
|
|
11
11
|
},
|
|
12
12
|
});
|
|
13
|
-
const
|
|
13
|
+
export const FlatList = ({ ref, ItemSeparatorComponent, ListEmptyComponent, ListFooterComponent, ListHeaderComponent, contentContainerStyle, data, horizontal = false, keyExtractor, onEndReached, onEndReachedThresholdPx = 200, onKeyDown, onScroll, renderItem, role, scrollEventThrottle = 16, showsScrollIndicators = true, style, }) => {
|
|
14
14
|
const scrollTrackerRef = useRef(null);
|
|
15
15
|
const scrollTrackerStyle = horizontal
|
|
16
16
|
? { top: 0, width: onEndReachedThresholdPx }
|
|
@@ -34,8 +34,7 @@ const FlatListWithRef = ({ ItemSeparatorComponent, ListEmptyComponent, ListFoote
|
|
|
34
34
|
}
|
|
35
35
|
// re-create an observer only on list length change
|
|
36
36
|
}, [data.length]);
|
|
37
|
-
return (_jsxs(ScrollView, { contentContainerStyle: contentContainerStyle, horizontal: horizontal, onKeyDown: onKeyDown, onScroll: onScroll, ref:
|
|
37
|
+
return (_jsxs(ScrollView, { contentContainerStyle: contentContainerStyle, horizontal: horizontal, onKeyDown: onKeyDown, onScroll: onScroll, ref: ref, role: role, scrollEventThrottle: scrollEventThrottle, showsScrollIndicators: showsScrollIndicators, style: style, children: [ListHeaderComponent, data.length <= 0
|
|
38
38
|
? ListEmptyComponent
|
|
39
39
|
: data.map((item, index) => (_jsxs(Fragment, { children: [index !== 0 && ItemSeparatorComponent, renderItem({ item, index })] }, keyExtractor(item, index)))), ListFooterComponent, _jsx(View, { role: "none", ref: scrollTrackerRef, style: [styles.scrollTracker, scrollTrackerStyle] })] }));
|
|
40
40
|
};
|
|
41
|
-
export const FlatList = forwardRef(FlatListWithRef);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { ReactNode, Ref } from "react";
|
|
2
2
|
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
export type FocusTrapRef = {
|
|
4
|
+
setInitiallyFocusedElement: (element: HTMLElement) => void;
|
|
5
|
+
};
|
|
3
6
|
type Props = {
|
|
7
|
+
ref?: Ref<FocusTrapRef>;
|
|
4
8
|
autoFocus: boolean;
|
|
5
9
|
children: ReactNode;
|
|
6
10
|
focusLock: boolean;
|
|
@@ -9,8 +13,5 @@ type Props = {
|
|
|
9
13
|
returnFocus: boolean;
|
|
10
14
|
style?: StyleProp<ViewStyle>;
|
|
11
15
|
};
|
|
12
|
-
export
|
|
13
|
-
setInitiallyFocusedElement: (element: HTMLElement) => void;
|
|
14
|
-
};
|
|
15
|
-
export declare const FocusTrap: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<FocusTrapRef>>;
|
|
16
|
+
export declare const FocusTrap: ({ ref, children, focusLock, onClickOutside, onEscapeKey, returnFocus, style, autoFocus, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useCallback, useEffect, useImperativeHandle, useRef, useState, } from "react";
|
|
3
3
|
import { View } from "react-native";
|
|
4
4
|
import { match } from "ts-pattern";
|
|
5
5
|
import { useInterval } from "../hooks/useInterval";
|
|
@@ -8,7 +8,7 @@ import { getFocusableElements } from "../utils/a11y";
|
|
|
8
8
|
import { first, last } from "../utils/array";
|
|
9
9
|
import { isNotNullish } from "../utils/nullish";
|
|
10
10
|
let escapeListenerCount = 0;
|
|
11
|
-
export const FocusTrap =
|
|
11
|
+
export const FocusTrap = ({ ref, children, focusLock, onClickOutside, onEscapeKey, returnFocus, style, autoFocus, }) => {
|
|
12
12
|
const containerRef = useRef(null);
|
|
13
13
|
const previouslyFocusedRef = useRef(null);
|
|
14
14
|
const hasFocusedOutside = useRef(false);
|
|
@@ -90,4 +90,4 @@ export const FocusTrap = forwardRef(({ children, focusLock, onClickOutside, onEs
|
|
|
90
90
|
onFocusOutside,
|
|
91
91
|
});
|
|
92
92
|
return (_jsx(View, { ref: containerRef, onKeyDownCapture: onKeyDownCapture, style: style, children: children }));
|
|
93
|
-
}
|
|
93
|
+
};
|