@swan-io/lake 2.7.14 → 2.7.16

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.14",
3
+ "version": "2.7.16",
4
4
  "engines": {
5
5
  "node": ">=18.0.0",
6
6
  "yarn": "^1.22.0"
@@ -131,5 +131,5 @@ export const LakeModal = ({ visible, icon, title, color = "current", children, m
131
131
  if (rootElement == null) {
132
132
  return null;
133
133
  }
134
- return (_jsx(Portal, { container: rootElement, children: _jsxs(View, { "aria-modal": true, style: [styles.container, !visible && styles.inert], children: [_jsx(TransitionView, { style: styles.fill, enter: styles.overlayEnter, leave: styles.overlayLeave, children: visible ? _jsx(View, { style: styles.overlay }) : null }), _jsx(Suspense, { fallback: _jsx(LoadingView, { color: backgroundColor.accented, delay: 0 }), children: _jsx(TransitionView, { style: styles.fill, enter: styles.modalEnter, leave: styles.modalLeave, children: visible ? (_jsx(ResponsiveContainer, { style: styles.root, breakpoint: breakpoints.tiny, children: ({ large, small }) => (_jsx(FocusTrap, { autoFocus: true, focusLock: true, returnFocus: true, onEscapeKey: onPressClose, style: styles.trap, children: _jsxs(ScrollView, { style: styles.modalContainer, contentContainerStyle: large ? styles.modalContentContainer : styles.modalContentContainerSmall, children: [onPressClose != null ? (_jsx(Pressable, { onPress: onPressClose, style: styles.pressableOverlay })) : null, _jsxs(View, { style: [large ? styles.modal : styles.modalSmall, { maxWidth }], children: [_jsxs(View, { style: styles.modalHeader, children: [_jsxs(View, { style: styles.modalIconTitle, children: [icon != null ? (_jsx(Icon, { name: icon, size: large ? 40 : 32, color: colors[color][500] })) : null, icon != null && title != null ? _jsx(Space, { height: 12 }) : null, title != null ? (_jsxs(_Fragment, { children: [_jsx(LakeHeading, { level: 2, variant: "h3", children: title }), _jsx(Space, { height: 12 })] })) : null] }), onPressClose != null ? (_jsx(LakeButton, { style: styles.closeButton, mode: "tertiary", onPress: onPressClose, icon: "lake-close" })) : null] }), typeof children == "function" ? children({ large, small }) : children] })] }) })) })) : null }) })] }) }));
134
+ return (_jsx(Portal, { container: rootElement, children: _jsxs(View, { "aria-modal": true, style: [styles.container, !visible && styles.inert], children: [_jsx(TransitionView, { style: styles.fill, enter: styles.overlayEnter, leave: styles.overlayLeave, children: visible ? _jsx(View, { style: styles.overlay }) : null }), _jsx(Suspense, { fallback: _jsx(LoadingView, { color: backgroundColor.accented, delay: 0 }), children: _jsx(TransitionView, { style: styles.fill, enter: styles.modalEnter, leave: styles.modalLeave, children: visible ? (_jsx(ResponsiveContainer, { style: styles.root, breakpoint: breakpoints.tiny, children: ({ large, small }) => (_jsx(FocusTrap, { autoFocus: true, focusLock: true, returnFocus: true, onEscapeKey: onPressClose, style: styles.trap, children: _jsxs(ScrollView, { style: styles.modalContainer, contentContainerStyle: large ? styles.modalContentContainer : styles.modalContentContainerSmall, children: [onPressClose != null ? (_jsx(Pressable, { onPress: onPressClose, style: styles.pressableOverlay })) : null, _jsxs(View, { role: "dialog", style: [large ? styles.modal : styles.modalSmall, { maxWidth }], children: [_jsxs(View, { style: styles.modalHeader, children: [_jsxs(View, { style: styles.modalIconTitle, children: [icon != null ? (_jsx(Icon, { name: icon, size: large ? 40 : 32, color: colors[color][500] })) : null, icon != null && title != null ? _jsx(Space, { height: 12 }) : null, title != null ? (_jsxs(_Fragment, { children: [_jsx(LakeHeading, { level: 2, variant: "h3", children: title }), _jsx(Space, { height: 12 })] })) : null] }), onPressClose != null ? (_jsx(LakeButton, { style: styles.closeButton, mode: "tertiary", onPress: onPressClose, icon: "lake-close" })) : null] }), typeof children == "function" ? children({ large, small }) : children] })] }) })) })) : null }) })] }) }));
135
135
  };
@@ -21,6 +21,7 @@ const styles = StyleSheet.create({
21
21
  // to trigger the change
22
22
  maxWidth: 202,
23
23
  minWidth: 38,
24
+ justifyContent: "flex-end",
24
25
  },
25
26
  focus: {
26
27
  outlineStyle: "none",
@@ -38,6 +39,11 @@ const styles = StyleSheet.create({
38
39
  justifyContent: "flex-end",
39
40
  flexGrow: 1,
40
41
  },
42
+ largeInputContainer: {
43
+ flexDirection: "row",
44
+ justifyContent: "flex-end",
45
+ flexGrow: 1,
46
+ },
41
47
  openSearchFieldContainer: {
42
48
  position: "absolute",
43
49
  right: 0,
@@ -74,7 +80,7 @@ const ExpandedSearchField = ({ inputRef, placeholder, initialValue, onChange, se
74
80
  timeoutRef.current = window.setTimeout(() => {
75
81
  setFocused.off();
76
82
  }, 300);
77
- }, style: [styles.input, hasFocus ? styles.focus : null] }));
83
+ }, containerStyle: styles.largeInputContainer, style: [styles.input, hasFocus ? styles.focus : null] }));
78
84
  };
79
85
  export const LakeSearchField = ({ initialValue, placeholder, onChangeText, debounceDuration = 500, maxWidth, renderEnd, }) => {
80
86
  const [hasFocus, setFocused] = useBoolean(false);
@@ -1,5 +1,5 @@
1
1
  import { ChangeEventHandler, ReactNode, Ref } from "react";
2
- import { NativeSyntheticEvent, TextInput, TextInputFocusEventData, TextInputProps, View } from "react-native";
2
+ import { NativeSyntheticEvent, TextInput, TextInputFocusEventData, TextInputProps, View, ViewProps } from "react-native";
3
3
  import { Except } from "type-fest";
4
4
  import { ColorVariants } from "../constants/design";
5
5
  import { IconName } from "./Icon";
@@ -20,6 +20,7 @@ export type LakeTextInputProps = Except<TextInputProps, "editable" | "keyboardTy
20
20
  children?: ReactNode;
21
21
  hideErrors?: boolean;
22
22
  style?: TextInputProps["style"];
23
+ containerStyle?: ViewProps["style"];
23
24
  onChange?: ChangeEventHandler<HTMLInputElement>;
24
25
  maxCharCount?: number;
25
26
  help?: string;
@@ -233,6 +234,7 @@ export declare const LakeTextInput: import("react").ForwardRefExoticComponent<{
233
234
  children?: ReactNode;
234
235
  hideErrors?: boolean | undefined;
235
236
  style?: TextInputProps["style"];
237
+ containerStyle?: ViewProps["style"];
236
238
  onChange?: ChangeEventHandler<HTMLInputElement> | undefined;
237
239
  maxCharCount?: number | undefined;
238
240
  help?: string | undefined;
@@ -121,7 +121,7 @@ const styles = StyleSheet.create({
121
121
  paddingTop: spacings[4],
122
122
  },
123
123
  });
124
- export const LakeTextInput = forwardRef(({ ariaExpanded, ariaControls, error, disabled = false, validating = false, valid = false, readOnly = false, icon, children, unit, color = "gray", inputMode = "text", hideErrors = false, onChange, pattern, style: stylesFromProps, onFocus: originalOnFocus, onBlur: originalOnBlur, value, defaultValue, multiline = false, containerRef,
124
+ export const LakeTextInput = forwardRef(({ ariaExpanded, ariaControls, error, disabled = false, validating = false, valid = false, readOnly = false, icon, children, unit, color = "gray", inputMode = "text", hideErrors = false, onChange, pattern, style: stylesFromProps, containerStyle: containerStylesFromProps, onFocus: originalOnFocus, onBlur: originalOnBlur, value, defaultValue, multiline = false, containerRef,
125
125
  //maxCharCount is different from maxLength(props inherited of TextInput)
126
126
  //maxLength truncates the text in the limitation asked,
127
127
  //maxCharCount doesn't have limitation but displays a counter of characters
@@ -146,7 +146,7 @@ maxCharCount, help, renderEnd, ...props }, forwardRef) => {
146
146
  const isInteractive = !disabled && !readOnly;
147
147
  const hasError = isNotNullishOrEmpty(error);
148
148
  const charCount = isNullish(value) ? 0 : value.length;
149
- return (_jsxs(View, { style: commonStyles.fill, children: [_jsxs(View, { style: styles.root, "aria-errormessage": error, children: [_jsxs(View, { style: styles.container, children: [_jsxs(View, { style: [
149
+ return (_jsxs(View, { style: commonStyles.fill, children: [_jsxs(View, { style: styles.root, "aria-errormessage": error, children: [_jsxs(View, { style: [styles.container, containerStylesFromProps], children: [_jsxs(View, { style: [
150
150
  styles.contents,
151
151
  isHovered && isInteractive && styles.hovered,
152
152
  isFocused && { borderColor: colors[color][500] },