@swan-io/lake 4.5.2 → 4.6.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
CHANGED
|
@@ -280,11 +280,14 @@ const styles = StyleSheet.create({
|
|
|
280
280
|
left: 0,
|
|
281
281
|
right: 0,
|
|
282
282
|
bottom: 0,
|
|
283
|
+
backgroundColor: backgroundColor.default,
|
|
284
|
+
},
|
|
285
|
+
emptyListContentContainer: {
|
|
283
286
|
flexDirection: "column",
|
|
284
287
|
alignItems: "center",
|
|
285
288
|
justifyContent: "center",
|
|
286
289
|
padding: spacings[48],
|
|
287
|
-
|
|
290
|
+
minHeight: "100%",
|
|
288
291
|
},
|
|
289
292
|
emptyList: {
|
|
290
293
|
flexDirection: "column",
|
|
@@ -808,7 +811,7 @@ export const FixedListView = ({ data: originalData, mode = "tile", keyExtractor,
|
|
|
808
811
|
], children: [_jsx(View, { style: [
|
|
809
812
|
styles.stickyColumnEndOverflow,
|
|
810
813
|
{ width: horizontalPadding, backgroundColor: headerBackgroundColor },
|
|
811
|
-
] }), _jsx(HeaderSegment, { columns: stickedToEndColumns, extraInfo: extraInfo, viewId: viewId, width: stickedToEndColumnsWidth }), _jsx(View, { style: [styles.topGradient, isScrolled && styles.visibleTopGradient] })] }), _jsx(View, { style: { height: rowsHeight }, children: endRows })] })) : null] })] }), data.length === 0 && isNotNullish(renderEmptyList) && !isLoading ? (_jsx(
|
|
814
|
+
] }), _jsx(HeaderSegment, { columns: stickedToEndColumns, extraInfo: extraInfo, viewId: viewId, width: stickedToEndColumnsWidth }), _jsx(View, { style: [styles.topGradient, isScrolled && styles.visibleTopGradient] })] }), _jsx(View, { style: { height: rowsHeight }, children: endRows })] })) : null] })] }), data.length === 0 && isNotNullish(renderEmptyList) && !isLoading ? (_jsx(ScrollView, { style: styles.emptyListContainer, contentContainerStyle: styles.emptyListContentContainer, children: renderEmptyList() })) : null, _jsx(View, { ref: endFocusAnchorRef, tabIndex: 0 })] }));
|
|
812
815
|
};
|
|
813
816
|
export const FixedListViewPlaceholder = ({ count, rowHeight, rowVerticalSpacing, groupHeaderHeight, headerHeight, paddingHorizontal = HORIZONTAL_SAFE_AREA, }) => {
|
|
814
817
|
const totalRowHeight = rowHeight + rowVerticalSpacing;
|
|
@@ -7,6 +7,7 @@ export type LakeTagInputProps = Merge<TextInputProps, {
|
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
valid?: boolean;
|
|
9
9
|
hideErrors?: boolean;
|
|
10
|
+
validateOnBlur?: boolean;
|
|
10
11
|
help?: string;
|
|
11
12
|
validator?: (value: string) => boolean;
|
|
12
13
|
values: string[];
|
|
@@ -211,6 +212,7 @@ export declare const LakeTagInput: import("react").ForwardRefExoticComponent<{
|
|
|
211
212
|
disabled?: boolean | undefined;
|
|
212
213
|
valid?: boolean | undefined;
|
|
213
214
|
hideErrors?: boolean | undefined;
|
|
215
|
+
validateOnBlur?: boolean | undefined;
|
|
214
216
|
help?: string | undefined;
|
|
215
217
|
validator?: ((value: string) => boolean) | undefined;
|
|
216
218
|
placeholder?: string | undefined;
|
|
@@ -77,7 +77,7 @@ const styles = StyleSheet.create({
|
|
|
77
77
|
},
|
|
78
78
|
});
|
|
79
79
|
const SEPARATORS_REGEX = /,| /;
|
|
80
|
-
export const LakeTagInput = forwardRef(({ validator = () => true, onFocus: originalOnFocus, onBlur: originalOnBlur, values, onValuesChanged, readOnly = false, disabled = false, valid = false, hideErrors = false, placeholder, help, error, }, forwardRef) => {
|
|
80
|
+
export const LakeTagInput = forwardRef(({ validator = () => true, onFocus: originalOnFocus, onBlur: originalOnBlur, validateOnBlur = true, values, onValuesChanged, readOnly = false, disabled = false, valid = false, hideErrors = false, placeholder, help, error, }, forwardRef) => {
|
|
81
81
|
const inputRef = useRef(null);
|
|
82
82
|
const containerRef = useRef(null);
|
|
83
83
|
const [isFocused, setIsFocused] = useState(false);
|
|
@@ -97,6 +97,9 @@ export const LakeTagInput = forwardRef(({ validator = () => true, onFocus: origi
|
|
|
97
97
|
}
|
|
98
98
|
}, [pushNewValues]);
|
|
99
99
|
const onTextInputKeyPress = useCallback(({ nativeEvent }) => {
|
|
100
|
+
if (disabled || readOnly) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
100
103
|
match({ key: nativeEvent.key, input: inputRef.current })
|
|
101
104
|
.with({ key: "Backspace", input: P.instanceOf(HTMLInputElement) }, ({ input }) => {
|
|
102
105
|
if (isNullishOrEmpty(input.value)) {
|
|
@@ -108,7 +111,7 @@ export const LakeTagInput = forwardRef(({ validator = () => true, onFocus: origi
|
|
|
108
111
|
pushNewValues([input.value]);
|
|
109
112
|
}
|
|
110
113
|
});
|
|
111
|
-
}, [onValuesChanged, pushNewValues, values]);
|
|
114
|
+
}, [onValuesChanged, pushNewValues, values, disabled, readOnly]);
|
|
112
115
|
const autoFocus = useCallback(() => {
|
|
113
116
|
inputRef.current?.focus();
|
|
114
117
|
}, []);
|
|
@@ -117,9 +120,15 @@ export const LakeTagInput = forwardRef(({ validator = () => true, onFocus: origi
|
|
|
117
120
|
originalOnFocus?.(event);
|
|
118
121
|
}, [originalOnFocus]);
|
|
119
122
|
const onBlur = useCallback((event) => {
|
|
123
|
+
const input = inputRef.current;
|
|
124
|
+
if (input instanceof HTMLInputElement &&
|
|
125
|
+
isNotNullishOrEmpty(input.value) &&
|
|
126
|
+
validateOnBlur) {
|
|
127
|
+
pushNewValues([input.value]);
|
|
128
|
+
}
|
|
120
129
|
setIsFocused(false);
|
|
121
130
|
originalOnBlur?.(event);
|
|
122
|
-
}, [originalOnBlur]);
|
|
131
|
+
}, [pushNewValues, originalOnBlur, validateOnBlur]);
|
|
123
132
|
const mergedRef = useMergeRefs(inputRef, forwardRef);
|
|
124
133
|
const hasError = isNotNullishOrEmpty(error);
|
|
125
134
|
return (_jsxs(View, { children: [_jsxs(Pressable, { style: [
|