@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/src/components/Tag.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
2
|
import { StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
import { ColorVariants } from "../constants/design";
|
|
4
4
|
import { IconName } from "./Icon";
|
|
5
5
|
type Props = {
|
|
6
|
-
children?:
|
|
6
|
+
children?: ReactNode;
|
|
7
7
|
label?: string;
|
|
8
8
|
icon?: IconName;
|
|
9
9
|
iconSize?: number;
|
package/src/components/Tile.js
CHANGED
|
@@ -123,6 +123,8 @@ export const TileRows = ({ children, breakpoint = 1000 }) => {
|
|
|
123
123
|
const nonNullChildren = childrenArray.filter(isNotNullish);
|
|
124
124
|
const isRow = flexDirection === "row";
|
|
125
125
|
return (_jsx(Box, { direction: flexDirection, onLayout: onLayout, style: styles.row, children: nonNullChildren.map((item, index) => {
|
|
126
|
-
return (_jsx(View, { style: [styles.rowCol, isRow && { flexBasis: breakpoint / 2 }], children: cloneElement(item,
|
|
126
|
+
return (_jsx(View, { style: [styles.rowCol, isRow && { flexBasis: breakpoint / 2 }], children: cloneElement(item,
|
|
127
|
+
// @ts-expect-error
|
|
128
|
+
{ flexGrow: 1 }) }, index));
|
|
127
129
|
}) }));
|
|
128
130
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode, RefObject } from "react";
|
|
2
2
|
import { ViewProps } from "react-native";
|
|
3
3
|
import { ColorVariants } from "../constants/design";
|
|
4
4
|
type Props = {
|
|
@@ -6,7 +6,7 @@ type Props = {
|
|
|
6
6
|
style?: ViewProps["style"];
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
};
|
|
9
|
-
export declare const CurrentColorContext: import("react").Context<"gray" | "live" | "sandbox" | "positive" | "warning" | "negative" | "
|
|
10
|
-
export declare const useCurrentColor: (containerRef:
|
|
9
|
+
export declare const CurrentColorContext: import("react").Context<"current" | "gray" | "live" | "sandbox" | "positive" | "warning" | "negative" | "partner" | "swan" | "shakespear" | "darkPink" | "sunglow" | "mediumSladeBlue" | undefined>;
|
|
10
|
+
export declare const useCurrentColor: (containerRef: RefObject<HTMLElement | null>, variant: ColorVariants | undefined) => void;
|
|
11
11
|
export declare const WithCurrentColor: ({ variant, style, children }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Based on https://github.com/necolas/react-native-web/blob/0.
|
|
1
|
+
// Based on https://github.com/necolas/react-native-web/blob/0.20.0/packages/react-native-web/src/exports/useWindowDimensions/index.js
|
|
2
2
|
import { useCallback, useSyncExternalStore } from "react";
|
|
3
3
|
import { windowSize } from "../utils/windowSize";
|
|
4
4
|
export const useBreakpoint = (breakpoint) => useSyncExternalStore(useCallback(onStoreChange => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Option } from "@swan-io/boxed";
|
|
2
|
-
import {
|
|
2
|
+
import { RefObject } from "react";
|
|
3
3
|
import { Text, View, ViewStyle } from "react-native";
|
|
4
4
|
export type ElementPosition = {
|
|
5
5
|
availableSpaceAbove: number;
|
|
@@ -21,7 +21,7 @@ type Config = {
|
|
|
21
21
|
visible: boolean;
|
|
22
22
|
matchReferenceWidth?: boolean;
|
|
23
23
|
matchReferenceMinWidth?: boolean;
|
|
24
|
-
referenceRef?:
|
|
24
|
+
referenceRef?: RefObject<View | Text | null>;
|
|
25
25
|
};
|
|
26
26
|
export type ContextualLayerPosition = {
|
|
27
27
|
rootStyle: ViewStyle;
|
|
@@ -30,7 +30,7 @@ export type ContextualLayerPosition = {
|
|
|
30
30
|
horizontalPosition: "left" | "center" | "right";
|
|
31
31
|
};
|
|
32
32
|
type ContextualLayerConfig = {
|
|
33
|
-
referenceRef:
|
|
33
|
+
referenceRef: RefObject<View | Text | null>;
|
|
34
34
|
position: Option<ContextualLayerPosition>;
|
|
35
35
|
};
|
|
36
36
|
export declare const useContextualLayer: ({ placement, visible, matchReferenceWidth, matchReferenceMinWidth, referenceRef: externalReferenceRef, }: Config) => ContextualLayerConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// https://github.com/necolas/react-native-web/blob/0.
|
|
1
|
+
// https://github.com/necolas/react-native-web/blob/0.20.0/packages/react-native-web/src/exports/Pressable/index.js#L221
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
export const useForceableState = (forced) => {
|
|
4
4
|
const [value, setValue] = useState(false);
|
package/src/hooks/useHover.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ref } from "react";
|
|
2
2
|
type HoverEventsConfig = {
|
|
3
3
|
contain?: boolean;
|
|
4
4
|
disabled?: boolean;
|
|
@@ -7,5 +7,5 @@ type HoverEventsConfig = {
|
|
|
7
7
|
onHoverStart?: (event: unknown) => void;
|
|
8
8
|
onHoverUpdate?: (event: unknown) => void;
|
|
9
9
|
};
|
|
10
|
-
export declare const useHover: <T>(ref:
|
|
10
|
+
export declare const useHover: <T>(ref: Ref<T | null>, config: HoverEventsConfig) => void;
|
|
11
11
|
export {};
|
package/src/hooks/useHover.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// https://github.com/necolas/react-native-web/blob/0.
|
|
1
|
+
// https://github.com/necolas/react-native-web/blob/0.20.0/packages/react-native-web/src/modules/useHover/index.js
|
|
2
2
|
// @ts-expect-error
|
|
3
3
|
import originaUseHover from "react-native-web/dist/cjs/modules/useHover";
|
|
4
4
|
export const useHover = originaUseHover;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const useMergeRefs: <T>(...refs: Ref<T>[]) =>
|
|
1
|
+
import { Ref } from "react";
|
|
2
|
+
export declare const useMergeRefs: <T>(...refs: (Ref<T> | undefined)[]) => Ref<T>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
// https://github.com/necolas/react-native-web/blob/0.
|
|
2
|
-
// https://github.com/theKashey/use-callback-ref (for typing)
|
|
1
|
+
// https://github.com/necolas/react-native-web/blob/0.20.0/packages/react-native-web/src/modules/useMergeRefs/index.js
|
|
3
2
|
// @ts-expect-error
|
|
4
3
|
import originalUseMergeRefs from "react-native-web/dist/cjs/modules/useMergeRefs";
|
|
5
4
|
export const useMergeRefs = originalUseMergeRefs;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const useNativeProp: <T>(ref:
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
export declare const useNativeProp: <T>(ref: RefObject<T | null>, name: string, value: number | string | undefined) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ref } from "react";
|
|
2
2
|
import { GestureResponderEvent } from "react-native";
|
|
3
3
|
type ClickEvent = unknown;
|
|
4
4
|
type KeyboardEvent = unknown;
|
|
@@ -27,5 +27,5 @@ type EventHandlers = {
|
|
|
27
27
|
onResponderTerminationRequest?: (event: ResponderEvent) => boolean;
|
|
28
28
|
onStartShouldSetResponder?: (event: ResponderEvent) => boolean;
|
|
29
29
|
};
|
|
30
|
-
export declare const usePressEvents: <T>(ref:
|
|
30
|
+
export declare const usePressEvents: <T>(ref: Ref<T | null>, config: PressResponderConfig) => EventHandlers;
|
|
31
31
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// https://github.com/necolas/react-native-web/blob/0.
|
|
1
|
+
// https://github.com/necolas/react-native-web/blob/0.20.0/packages/react-native-web/src/modules/usePressEvents/index.js
|
|
2
2
|
// @ts-expect-error
|
|
3
3
|
import originalUsePressEvents from "react-native-web/dist/cjs/modules/usePressEvents";
|
|
4
4
|
export const usePressEvents = originalUsePressEvents;
|
package/src/utils/clipboard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Based on https://github.com/necolas/react-native-web/blob/0.
|
|
1
|
+
// Based on https://github.com/necolas/react-native-web/blob/0.20.0/packages/react-native-web/src/exports/Clipboard/index.js
|
|
2
2
|
export const setClipboardText = (text) => {
|
|
3
3
|
// add the text to a hidden node
|
|
4
4
|
const node = document.createElement("span");
|
package/src/utils/refs.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const mergeRefs: <T>(refs: (
|
|
1
|
+
import { Ref, RefCallback } from "react";
|
|
2
|
+
export declare const mergeRefs: <T>(refs: (Ref<T> | undefined)[]) => RefCallback<T>;
|
package/src/utils/windowSize.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Based on https://github.com/necolas/react-native-web/blob/0.
|
|
1
|
+
// Based on https://github.com/necolas/react-native-web/blob/0.20.0/packages/react-native-web/src/exports/Dimensions/index.js
|
|
2
2
|
const get = () => {
|
|
3
3
|
const viewport = window.visualViewport;
|
|
4
4
|
/**
|