@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/Form.d.ts
CHANGED
|
@@ -1,13 +1,42 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
|
-
|
|
1
|
+
import { ReactNode, Ref } from "react";
|
|
2
|
+
import { View, ViewProps } from "react-native";
|
|
3
|
+
import { Except } from "type-fest";
|
|
4
|
+
type Props = Except<ViewProps, "role"> & {
|
|
5
|
+
ref?: Ref<View>;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
onReset?: (event: React.FormEvent<HTMLElement>) => void;
|
|
8
|
+
onSubmit?: (event: React.FormEvent<HTMLElement>) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const Form: import("react").MemoExoticComponent<({ ref, style, onReset, onSubmit, ...props }: Props) => import("react").ReactElement<{
|
|
11
|
+
ref: Ref<View> | undefined;
|
|
12
|
+
onReset: (event: React.FormEvent<HTMLElement>) => void;
|
|
13
|
+
onSubmit: (event: React.FormEvent<HTMLElement>) => void;
|
|
14
|
+
style: (import("react-native").StyleProp<import("react-native").ViewStyle> | {
|
|
15
|
+
readonly alignItems: "stretch";
|
|
16
|
+
readonly backgroundColor: "transparent";
|
|
17
|
+
readonly borderColor: "black";
|
|
18
|
+
readonly borderStyle: "solid";
|
|
19
|
+
readonly borderWidth: 0;
|
|
20
|
+
readonly boxSizing: "border-box";
|
|
21
|
+
readonly display: "flex";
|
|
22
|
+
readonly flexBasis: "auto";
|
|
23
|
+
readonly flexDirection: "column";
|
|
24
|
+
readonly flexShrink: 0;
|
|
25
|
+
readonly listStyle: "none";
|
|
26
|
+
readonly margin: 0;
|
|
27
|
+
readonly minHeight: 0;
|
|
28
|
+
readonly minWidth: 0;
|
|
29
|
+
readonly padding: 0;
|
|
30
|
+
readonly position: "relative";
|
|
31
|
+
readonly textDecoration: "none";
|
|
32
|
+
readonly zIndex: 0;
|
|
33
|
+
})[];
|
|
4
34
|
children?: ReactNode;
|
|
5
35
|
hitSlop?: import("react-native").Insets | undefined;
|
|
6
36
|
id?: string | undefined | undefined;
|
|
7
37
|
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined | undefined;
|
|
8
38
|
pointerEvents?: "box-none" | "none" | "box-only" | "auto" | undefined | undefined;
|
|
9
39
|
removeClippedSubviews?: boolean | undefined | undefined;
|
|
10
|
-
style?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
11
40
|
testID?: string | undefined | undefined;
|
|
12
41
|
nativeID?: string | undefined | undefined;
|
|
13
42
|
onKeyDown?: ((event: NativeSyntheticEvent<React.KeyboardEvent>) => void) | undefined;
|
|
@@ -123,8 +152,5 @@ export declare const Form: import("react").MemoExoticComponent<import("react").F
|
|
|
123
152
|
"aria-rowspan"?: number | undefined;
|
|
124
153
|
"aria-setsize"?: number | undefined;
|
|
125
154
|
"aria-sort"?: "ascending" | "descending" | "none" | "other" | undefined;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
onReset?: (event: React.FormEvent<HTMLElement>) => void;
|
|
129
|
-
onSubmit?: (event: React.FormEvent<HTMLElement>) => void;
|
|
130
|
-
} & import("react").RefAttributes<View>>>;
|
|
155
|
+
}, string | import("react").JSXElementConstructor<any>>>;
|
|
156
|
+
export {};
|
package/src/components/Form.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { memo } from "react";
|
|
2
2
|
import { unstable_createElement as createElement } from "react-native";
|
|
3
3
|
import { commonStyles } from "../constants/commonStyles";
|
|
4
|
-
export const Form = memo(
|
|
4
|
+
export const Form = memo(({ ref, style, onReset, onSubmit, ...props }) => createElement("form", {
|
|
5
5
|
...props,
|
|
6
|
-
ref
|
|
6
|
+
ref,
|
|
7
7
|
onReset: (event) => {
|
|
8
8
|
event.preventDefault();
|
|
9
9
|
onReset === null || onReset === void 0 ? void 0 : onReset(event);
|
|
@@ -13,5 +13,5 @@ export const Form = memo(forwardRef(({ style, onReset, onSubmit, ...props }, for
|
|
|
13
13
|
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(event);
|
|
14
14
|
},
|
|
15
15
|
style: [commonStyles.view, style],
|
|
16
|
-
}))
|
|
16
|
+
}));
|
|
17
17
|
Form.displayName = "Form";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { ReactNode, Ref } from "react";
|
|
2
2
|
import { GestureResponderEvent, HrefAttrs, PressableStateCallbackType, StyleProp, View, ViewStyle } from "react-native";
|
|
3
3
|
import { ColorVariants, Spacings } from "../constants/design";
|
|
4
4
|
import { IconName } from "./Icon";
|
|
5
5
|
export type ButtonProps = {
|
|
6
|
+
ref?: Ref<View>;
|
|
6
7
|
ariaControls?: string;
|
|
7
8
|
ariaExpanded?: boolean;
|
|
8
9
|
color?: ColorVariants;
|
|
@@ -29,7 +30,7 @@ export type ButtonProps = {
|
|
|
29
30
|
ariaLabel?: string;
|
|
30
31
|
children: ReactNode;
|
|
31
32
|
});
|
|
32
|
-
export declare const LakeButton: import("react").MemoExoticComponent<
|
|
33
|
+
export declare const LakeButton: import("react").MemoExoticComponent<({ ref, ariaControls, ariaExpanded, ariaLabel, children, color, direction, disabled, icon, grow, iconPosition, loading, mode, onPress, size, iconSize, style, forceBackground, href, hrefAttrs, pill, disabledUntil, }: ButtonProps) => import("react/jsx-runtime").JSX.Element>;
|
|
33
34
|
type GroupProps = {
|
|
34
35
|
children: ReactNode;
|
|
35
36
|
justifyContent?: ViewStyle["justifyContent"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Option } from "@swan-io/boxed";
|
|
3
|
-
import { Children,
|
|
3
|
+
import { Children, Fragment, memo, useEffect, useState } from "react";
|
|
4
4
|
import { ActivityIndicator, StyleSheet, View, } from "react-native";
|
|
5
5
|
import { match, P } from "ts-pattern";
|
|
6
6
|
import { commonStyles } from "../constants/commonStyles";
|
|
@@ -123,7 +123,7 @@ const styles = StyleSheet.create({
|
|
|
123
123
|
visibility: "hidden",
|
|
124
124
|
},
|
|
125
125
|
});
|
|
126
|
-
export const LakeButton = memo(
|
|
126
|
+
export const LakeButton = memo(({ ref, ariaControls, ariaExpanded, ariaLabel, children, color = "gray", direction = "row", disabled = false, icon, grow = false, iconPosition = "start", loading = false, mode = "primary", onPress, size = "large", iconSize = size === "small" ? 18 : 20, style, forceBackground = false, href, hrefAttrs, pill = false, disabledUntil, }) => {
|
|
127
127
|
const [progressAnimation, setProgressAnimation] = useState(() => Option.None());
|
|
128
128
|
const isPrimary = mode === "primary";
|
|
129
129
|
const isSmall = size === "small";
|
|
@@ -163,7 +163,7 @@ export const LakeButton = memo(forwardRef(({ ariaControls, ariaExpanded, ariaLab
|
|
|
163
163
|
return () => cancelAnimationFrame(animationFrameId);
|
|
164
164
|
}, [disabledUntil]);
|
|
165
165
|
const shouldHideContents = loading || progressAnimation.isSome();
|
|
166
|
-
return (_jsx(Pressable, { href: href, hrefAttrs: hrefAttrs, role: href != null ? "link" : "button", "aria-busy": loading, "aria-disabled": disabled, "aria-controls": ariaControls, "aria-expanded": ariaExpanded, "aria-label": ariaLabel, disabled: loading || disabled || progressAnimation.isSome(), ref:
|
|
166
|
+
return (_jsx(Pressable, { href: href, hrefAttrs: hrefAttrs, role: href != null ? "link" : "button", "aria-busy": loading, "aria-disabled": disabled, "aria-controls": ariaControls, "aria-expanded": ariaExpanded, "aria-label": ariaLabel, disabled: loading || disabled || progressAnimation.isSome(), ref: ref, onPress: onPress, style: ({ hovered, pressed, focused }) => [
|
|
167
167
|
styles.base,
|
|
168
168
|
(hovered || pressed) && styles.transition,
|
|
169
169
|
grow && styles.grow,
|
|
@@ -227,7 +227,7 @@ export const LakeButton = memo(forwardRef(({ ariaControls, ariaExpanded, ariaLab
|
|
|
227
227
|
] }), _jsx(LakeText, { color: isPrimary ? colors[color].contrast : colors[color].primary, children: Math.ceil((duration - (now - startTime)) / 1000) })] })))
|
|
228
228
|
.otherwise(() => null), pill && _jsx(View, { style: styles.pill })] }));
|
|
229
229
|
} }));
|
|
230
|
-
})
|
|
230
|
+
});
|
|
231
231
|
LakeButton.displayName = "Button";
|
|
232
232
|
const ZERO = 0;
|
|
233
233
|
export const LakeButtonGroup = ({ children, justifyContent = "flex-start", paddingBottom = 16, }) => (_jsx(View, { style: [
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { AsyncData, Result } from "@swan-io/boxed";
|
|
2
|
-
import {
|
|
2
|
+
import { ReactNode, Ref } from "react";
|
|
3
3
|
import { IconName } from "./Icon";
|
|
4
4
|
import { LakeTextInputProps } from "./LakeTextInput";
|
|
5
|
+
export type LakeComboboxRef = {
|
|
6
|
+
close: () => void;
|
|
7
|
+
open: () => void;
|
|
8
|
+
};
|
|
5
9
|
export type LakeComboboxProps<I> = {
|
|
6
|
-
|
|
10
|
+
ref?: Ref<LakeComboboxRef>;
|
|
11
|
+
inputRef?: Ref<unknown>;
|
|
7
12
|
value: string;
|
|
8
13
|
items: AsyncData<Result<I[], unknown>>;
|
|
9
14
|
itemHeight?: number;
|
|
@@ -23,12 +28,4 @@ export type LakeComboboxProps<I> = {
|
|
|
23
28
|
id?: string;
|
|
24
29
|
readOnly?: boolean;
|
|
25
30
|
};
|
|
26
|
-
export
|
|
27
|
-
close: () => void;
|
|
28
|
-
open: () => void;
|
|
29
|
-
};
|
|
30
|
-
declare const LakeComboboxWithRef: <I>({ inputRef, value, items, itemHeight, nbItemsDisplayed, ListFooterComponent, onChange, onValueChange, onSelectItem, renderItem, keyExtractor, icon, placeholder, disabled, emptyResultText, readOnly, id, error, hideErrors, }: LakeComboboxProps<I>, forwardedRef: ForwardedRef<LakeComboboxRef>) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
-
export declare const LakeCombobox: <I>(props: LakeComboboxProps<I> & {
|
|
32
|
-
ref?: RefObject<LakeComboboxRef>;
|
|
33
|
-
}) => ReturnType<typeof LakeComboboxWithRef>;
|
|
34
|
-
export {};
|
|
31
|
+
export declare const LakeCombobox: <I>({ ref, inputRef, value, items, itemHeight, nbItemsDisplayed, ListFooterComponent, onChange, onValueChange, onSelectItem, renderItem, keyExtractor, icon, placeholder, disabled, emptyResultText, readOnly, id, error, hideErrors, }: LakeComboboxProps<I>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useCallback, useId, useImperativeHandle, useRef, useState } from "react";
|
|
3
3
|
import { Pressable, StyleSheet, Text, View, } from "react-native";
|
|
4
4
|
import { backgroundColor, colors, spacings } from "../constants/design";
|
|
5
5
|
import { useMergeRefs } from "../hooks/useMergeRefs";
|
|
@@ -74,9 +74,9 @@ const styles = StyleSheet.create({
|
|
|
74
74
|
flexGrow: 1,
|
|
75
75
|
},
|
|
76
76
|
});
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
const inputTextRef = useMergeRefs(
|
|
77
|
+
export const LakeCombobox = ({ ref, inputRef, value, items, itemHeight = DEFAULT_ELEMENT_HEIGHT, nbItemsDisplayed = DEFAULT_NB_SUGGESTION_DISPLAYED, ListFooterComponent, onChange, onValueChange, onSelectItem, renderItem, keyExtractor, icon, placeholder, disabled = false, emptyResultText, readOnly, id, error, hideErrors, }) => {
|
|
78
|
+
const innerInputRef = useRef(null);
|
|
79
|
+
const inputTextRef = useMergeRefs(innerInputRef, inputRef);
|
|
80
80
|
const listContainerRef = useRef(null);
|
|
81
81
|
const blurTimeoutId = useRef(undefined);
|
|
82
82
|
const [isFetchingAdditionalInfo, setIsFetchingAdditionalInfo] = useState(false);
|
|
@@ -87,7 +87,7 @@ const LakeComboboxWithRef = ({ inputRef, value, items, itemHeight = DEFAULT_ELEM
|
|
|
87
87
|
const open = useCallback(() => setState("opened"), []);
|
|
88
88
|
const close = useCallback(() => setState("closed"), []);
|
|
89
89
|
const dismiss = useCallback(() => setState("dismissed"), []);
|
|
90
|
-
useImperativeHandle(
|
|
90
|
+
useImperativeHandle(ref, () => {
|
|
91
91
|
return {
|
|
92
92
|
open,
|
|
93
93
|
close,
|
|
@@ -122,7 +122,7 @@ const LakeComboboxWithRef = ({ inputRef, value, items, itemHeight = DEFAULT_ELEM
|
|
|
122
122
|
const nextIndex = index + direction;
|
|
123
123
|
event.preventDefault();
|
|
124
124
|
if (nextIndex === -1) {
|
|
125
|
-
(_a =
|
|
125
|
+
(_a = innerInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
126
126
|
}
|
|
127
127
|
else {
|
|
128
128
|
(_b = focusableElements[nextIndex === focusableElements.length ? 0 : nextIndex]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
@@ -148,7 +148,7 @@ const LakeComboboxWithRef = ({ inputRef, value, items, itemHeight = DEFAULT_ELEM
|
|
|
148
148
|
setState("dismissed");
|
|
149
149
|
}, 100);
|
|
150
150
|
}, []);
|
|
151
|
-
return (_jsxs(View, { children: [_jsx(LakeTextInput, { containerRef: inputTextRef, style: styles.input, ariaExpanded: state === "opened", ariaControls: state === "opened" ? suggestionsId : "", enterKeyHint: "search", icon: icon, role: "combobox", placeholder: placeholder, value: value, disabled: disabled, error: error, hideErrors: hideErrors, onChangeText: handleChangeText, onChange: onChange, onFocus: handleFocus, onBlur: handleBlur, onKeyPress: handleKeyPress, id: id, readOnly: readOnly }), _jsx(Popover, { id: suggestionsId, role: "listbox", matchReferenceWidth: true, onEscapeKey: dismiss, referenceRef:
|
|
151
|
+
return (_jsxs(View, { children: [_jsx(LakeTextInput, { containerRef: inputTextRef, style: styles.input, ariaExpanded: state === "opened", ariaControls: state === "opened" ? suggestionsId : "", enterKeyHint: "search", icon: icon, role: "combobox", placeholder: placeholder, value: value, disabled: disabled, error: error, hideErrors: hideErrors, onChangeText: handleChangeText, onChange: onChange, onFocus: handleFocus, onBlur: handleBlur, onKeyPress: handleKeyPress, id: id, readOnly: readOnly }), _jsx(Popover, { id: suggestionsId, role: "listbox", matchReferenceWidth: true, onEscapeKey: dismiss, referenceRef: innerInputRef, autoFocus: false, returnFocus: true, visible: state === "opened" && !items.isNotAsked(), underlay: false, forcedMode: "Dropdown", children: _jsx(View, { style: [styles.list, { maxHeight: itemHeight * nbItemsDisplayed }], children: items.match({
|
|
152
152
|
NotAsked: () => null,
|
|
153
153
|
Loading: () => _jsx(LoadingView, { style: styles.loader }),
|
|
154
154
|
Done: items => items.match({
|
|
@@ -173,4 +173,3 @@ const LakeComboboxWithRef = ({ inputRef, value, items, itemHeight = DEFAULT_ELEM
|
|
|
173
173
|
}),
|
|
174
174
|
}) }) })] }));
|
|
175
175
|
};
|
|
176
|
-
export const LakeCombobox = forwardRef(LakeComboboxWithRef);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { Text, TextStyle } from "react-native";
|
|
1
|
+
import { ReactNode, Ref } from "react";
|
|
2
|
+
import { Text, TextProps, TextStyle } from "react-native";
|
|
3
|
+
import { Except } from "type-fest";
|
|
3
4
|
declare const alignments: {
|
|
4
5
|
center: {
|
|
5
6
|
textAlign: "center";
|
|
@@ -21,110 +22,14 @@ declare const variants: {
|
|
|
21
22
|
};
|
|
22
23
|
type HeadingAlign = keyof typeof alignments;
|
|
23
24
|
type HeadingVariant = keyof typeof variants;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
children?: ReactNode;
|
|
27
|
-
ellipsizeMode?: "head" | "middle" | "tail" | "clip" | undefined | undefined;
|
|
28
|
-
id?: string | undefined | undefined;
|
|
29
|
-
lineBreakMode?: "head" | "middle" | "tail" | "clip" | undefined | undefined;
|
|
30
|
-
numberOfLines?: number | undefined | undefined;
|
|
31
|
-
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined | undefined;
|
|
32
|
-
onTextLayout?: ((event: import("react-native").NativeSyntheticEvent<import("react-native").TextLayoutEventData>) => void) | undefined | undefined;
|
|
33
|
-
onPress?: ((event: import("react-native").GestureResponderEvent) => void) | undefined | undefined;
|
|
34
|
-
onPressIn?: ((event: import("react-native").GestureResponderEvent) => void) | undefined | undefined;
|
|
35
|
-
onPressOut?: ((event: import("react-native").GestureResponderEvent) => void) | undefined | undefined;
|
|
36
|
-
onLongPress?: ((event: import("react-native").GestureResponderEvent) => void) | undefined | undefined;
|
|
37
|
-
style?: import("react-native").StyleProp<TextStyle>;
|
|
38
|
-
testID?: string | undefined | undefined;
|
|
39
|
-
nativeID?: string | undefined | undefined;
|
|
40
|
-
maxFontSizeMultiplier?: number | null | undefined | undefined;
|
|
41
|
-
href?: string | undefined;
|
|
42
|
-
hrefAttrs?: import("react-native").HrefAttrs | undefined;
|
|
43
|
-
lang?: string | undefined;
|
|
44
|
-
adjustsFontSizeToFit?: boolean | undefined | undefined;
|
|
45
|
-
dynamicTypeRamp?: "caption2" | "caption1" | "footnote" | "subheadline" | "callout" | "body" | "headline" | "title3" | "title2" | "title1" | "largeTitle" | undefined | undefined;
|
|
46
|
-
minimumFontScale?: number | undefined | undefined;
|
|
47
|
-
suppressHighlighting?: boolean | undefined | undefined;
|
|
48
|
-
lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined | undefined;
|
|
49
|
-
disabled?: boolean | undefined | undefined;
|
|
50
|
-
selectable?: boolean | undefined | undefined;
|
|
51
|
-
selectionColor?: import("react-native").ColorValue | undefined;
|
|
52
|
-
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined | undefined;
|
|
53
|
-
dataDetectorType?: null | "phoneNumber" | "link" | "email" | "none" | "all" | undefined | undefined;
|
|
54
|
-
android_hyphenationFrequency?: "normal" | "none" | "full" | undefined | undefined;
|
|
55
|
-
accessible?: boolean | undefined | undefined;
|
|
56
|
-
accessibilityActions?: readonly Readonly<{
|
|
57
|
-
name: import("react-native").AccessibilityActionName | string;
|
|
58
|
-
label?: string | undefined;
|
|
59
|
-
}>[] | undefined;
|
|
60
|
-
accessibilityLabel?: string | undefined | undefined;
|
|
61
|
-
"aria-label"?: string | undefined | undefined;
|
|
62
|
-
accessibilityRole?: import("react-native").AccessibilityRole | undefined;
|
|
63
|
-
accessibilityState?: import("react-native").AccessibilityState | undefined;
|
|
64
|
-
"aria-busy"?: boolean | undefined | undefined;
|
|
65
|
-
"aria-checked"?: boolean | "mixed" | undefined | undefined;
|
|
66
|
-
"aria-disabled"?: boolean | undefined | undefined;
|
|
67
|
-
"aria-expanded"?: boolean | undefined | undefined;
|
|
68
|
-
"aria-selected"?: boolean | undefined | undefined;
|
|
69
|
-
"aria-labelledby"?: string | undefined | undefined;
|
|
70
|
-
accessibilityHint?: string | undefined | undefined;
|
|
71
|
-
accessibilityValue?: import("react-native").AccessibilityValue | undefined;
|
|
72
|
-
"aria-valuemax"?: number | undefined;
|
|
73
|
-
"aria-valuemin"?: number | undefined;
|
|
74
|
-
"aria-valuenow"?: number | undefined;
|
|
75
|
-
"aria-valuetext"?: string | undefined;
|
|
76
|
-
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined | undefined;
|
|
77
|
-
importantForAccessibility?: ("auto" | "yes" | "no" | "no-hide-descendants") | undefined | undefined;
|
|
78
|
-
"aria-hidden"?: boolean | undefined | undefined;
|
|
79
|
-
"aria-live"?: ("polite" | "assertive" | "off") | undefined | undefined;
|
|
80
|
-
"aria-modal"?: boolean | undefined | undefined;
|
|
81
|
-
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined | undefined;
|
|
82
|
-
accessibilityLabelledBy?: string | string[] | undefined | undefined;
|
|
83
|
-
accessibilityElementsHidden?: boolean | undefined | undefined;
|
|
84
|
-
accessibilityViewIsModal?: boolean | undefined | undefined;
|
|
85
|
-
onAccessibilityEscape?: (() => void) | undefined | undefined;
|
|
86
|
-
onAccessibilityTap?: (() => void) | undefined | undefined;
|
|
87
|
-
onMagicTap?: (() => void) | undefined | undefined;
|
|
88
|
-
accessibilityIgnoresInvertColors?: boolean | undefined | undefined;
|
|
89
|
-
accessibilityLanguage?: string | undefined | undefined;
|
|
90
|
-
tabIndex?: 0 | -1 | undefined;
|
|
91
|
-
"aria-activedescendant"?: string | undefined;
|
|
92
|
-
"aria-atomic"?: boolean | undefined;
|
|
93
|
-
"aria-autocomplete"?: string | undefined;
|
|
94
|
-
"aria-colcount"?: number | undefined;
|
|
95
|
-
"aria-colindex"?: number | undefined;
|
|
96
|
-
"aria-colspan"?: number | undefined;
|
|
97
|
-
"aria-controls"?: string | undefined;
|
|
98
|
-
"aria-current"?: boolean | "page" | "step" | "location" | "date" | "time" | undefined;
|
|
99
|
-
"aria-describedby"?: string | undefined;
|
|
100
|
-
"aria-details"?: string | undefined;
|
|
101
|
-
"aria-errormessage"?: string | undefined;
|
|
102
|
-
"aria-flowto"?: string | undefined;
|
|
103
|
-
"aria-haspopup"?: string | undefined;
|
|
104
|
-
"aria-invalid"?: boolean | undefined;
|
|
105
|
-
"aria-keyshortcuts"?: string | undefined;
|
|
106
|
-
"aria-level"?: number | undefined;
|
|
107
|
-
"aria-multiline"?: boolean | undefined;
|
|
108
|
-
"aria-multiselectable"?: boolean | undefined;
|
|
109
|
-
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
|
110
|
-
"aria-owns"?: string | undefined;
|
|
111
|
-
"aria-placeholder"?: string | undefined;
|
|
112
|
-
"aria-posinset"?: number | undefined;
|
|
113
|
-
"aria-pressed"?: boolean | undefined;
|
|
114
|
-
"aria-readonly"?: boolean | undefined;
|
|
115
|
-
"aria-required"?: boolean | undefined;
|
|
116
|
-
"aria-roledescription"?: string | undefined;
|
|
117
|
-
"aria-rowcount"?: number | undefined;
|
|
118
|
-
"aria-rowindex"?: number | undefined;
|
|
119
|
-
"aria-rowspan"?: number | undefined;
|
|
120
|
-
"aria-setsize"?: number | undefined;
|
|
121
|
-
"aria-sort"?: "ascending" | "descending" | "none" | "other" | undefined;
|
|
122
|
-
} & {
|
|
25
|
+
type Props = Except<TextProps, "role"> & {
|
|
26
|
+
ref?: Ref<Text>;
|
|
123
27
|
align?: HeadingAlign;
|
|
124
28
|
children: ReactNode;
|
|
125
29
|
color?: string;
|
|
126
30
|
level: 1 | 2 | 3 | 4 | 5 | 6 | "none";
|
|
127
31
|
userSelect?: TextStyle["userSelect"];
|
|
128
32
|
variant?: HeadingVariant;
|
|
129
|
-
}
|
|
33
|
+
};
|
|
34
|
+
export declare const LakeHeading: ({ ref, align, children, color, level, style, userSelect, variant, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
130
35
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
2
|
import { StyleSheet, Text } from "react-native";
|
|
4
3
|
import { texts } from "../constants/design";
|
|
5
4
|
import { isNotNullish } from "../utils/nullish";
|
|
@@ -16,10 +15,10 @@ const variants = StyleSheet.create({
|
|
|
16
15
|
h5: texts.h5,
|
|
17
16
|
h6: texts.h6,
|
|
18
17
|
});
|
|
19
|
-
export const LakeHeading =
|
|
18
|
+
export const LakeHeading = ({ ref, align = "left", children, color, level, style, userSelect, variant = "h1", ...props }) => (_jsx(Text, { ref: ref, role: level === "none" ? undefined : "heading", "aria-level": level === "none" ? undefined : level, style: [
|
|
20
19
|
variants[variant],
|
|
21
20
|
alignments[align],
|
|
22
21
|
isNotNullish(color) && { color },
|
|
23
22
|
isNotNullish(userSelect) && { userSelect },
|
|
24
23
|
style,
|
|
25
|
-
], ...props, children: children }))
|
|
24
|
+
], ...props, children: children }));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement, ReactNode, Ref } from "react";
|
|
2
2
|
import { StyleProp, TextStyle, View, ViewStyle } from "react-native";
|
|
3
3
|
import { ColorVariants } from "../constants/design";
|
|
4
4
|
import { IconName } from "./Icon";
|
|
@@ -8,6 +8,7 @@ export type Item<V> = {
|
|
|
8
8
|
icon?: ReactNode;
|
|
9
9
|
};
|
|
10
10
|
export type SelectProps<V> = {
|
|
11
|
+
ref?: Ref<View>;
|
|
11
12
|
placeholder?: string;
|
|
12
13
|
items: Item<V>[];
|
|
13
14
|
matchReferenceWidth?: boolean;
|
|
@@ -31,8 +32,4 @@ export type SelectProps<V> = {
|
|
|
31
32
|
readOnly?: boolean;
|
|
32
33
|
style?: StyleProp<ViewStyle>;
|
|
33
34
|
};
|
|
34
|
-
declare const
|
|
35
|
-
export declare const LakeSelect: <I>(props: SelectProps<I> & {
|
|
36
|
-
ref?: ForwardedRef<View>;
|
|
37
|
-
}) => ReturnType<typeof LakeSelectWithRef>;
|
|
38
|
-
export {};
|
|
35
|
+
export declare const LakeSelect: <V>({ ref, title, items, valueStyle, size, color, disabled, mode, placeholder, readOnly, id, matchReferenceWidth, value, error, hideErrors, icon, onValueChange, disabledItems, PopoverFooter, style, }: SelectProps<V>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useCallback, useRef } from "react";
|
|
3
3
|
import { StyleSheet, View, } from "react-native";
|
|
4
4
|
import { commonStyles } from "../constants/commonStyles";
|
|
5
5
|
import { colors, invariantColors, radii, shadows, spacings, texts, } from "../constants/design";
|
|
@@ -112,14 +112,14 @@ const styles = StyleSheet.create({
|
|
|
112
112
|
borderColor: colors.negative[500],
|
|
113
113
|
},
|
|
114
114
|
});
|
|
115
|
-
const
|
|
115
|
+
export const LakeSelect = ({ ref, title, items, valueStyle, size, color = "current", disabled = false, mode = "normal", placeholder, readOnly = false, id, matchReferenceWidth = true, value, error, hideErrors = false, icon, onValueChange, disabledItems = [], PopoverFooter, style, }) => {
|
|
116
116
|
var _a;
|
|
117
117
|
const inputRef = useRef(null);
|
|
118
118
|
const listRef = useRef(null);
|
|
119
119
|
const typingTimeoutRef = useRef(undefined);
|
|
120
120
|
const currentlyTypedRef = useRef(undefined);
|
|
121
121
|
const listItemRefs = useRef(Array(items.length));
|
|
122
|
-
const mergedRef = useMergeRefs(inputRef,
|
|
122
|
+
const mergedRef = useMergeRefs(inputRef, ref);
|
|
123
123
|
const [visible, { close, open }] = useDisclosure(false);
|
|
124
124
|
const hasValue = isNotNullish(value);
|
|
125
125
|
const isSmall = size === "small";
|
|
@@ -202,4 +202,3 @@ const LakeSelectWithRef = ({ title, items, valueStyle, size, color = "current",
|
|
|
202
202
|
}, children: [isNotNullish(item.icon) && (_jsxs(_Fragment, { children: [item.icon, _jsx(Space, { width: 12 })] })), _jsx(LakeText, { color: colors.gray[900], numberOfLines: 1, style: [styles.itemText, isSelected && styles.selected], children: item.name }), _jsx(Fill, { minWidth: 12 }), isSelected && (_jsx(Icon, { color: colors.positive[500], name: "checkmark-filled", size: 14 }))] }) }));
|
|
203
203
|
} }), PopoverFooter] })] }));
|
|
204
204
|
};
|
|
205
|
-
export const LakeSelect = forwardRef(LakeSelectWithRef);
|