@swan-io/shared-business 15.5.0 → 15.5.2

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/shared-business",
3
- "version": "15.5.0",
3
+ "version": "15.5.2",
4
4
  "engines": {
5
5
  "node": ">22.12.0"
6
6
  },
@@ -28,7 +28,7 @@
28
28
  "react": ">=19.0.0",
29
29
  "react-dom": ">=19.0.0",
30
30
  "react-native-web": ">=0.21.2",
31
- "@swan-io/lake": "15.5.0"
31
+ "@swan-io/lake": "15.5.2"
32
32
  },
33
33
  "dependencies": {
34
34
  "@formatjs/intl": "^4.1.16",
@@ -53,6 +53,6 @@
53
53
  "react-dom": "^19.2.7",
54
54
  "react-native-web": "^0.21.2",
55
55
  "type-fest": "^5.8.0",
56
- "@swan-io/lake": "15.5.0"
56
+ "@swan-io/lake": "15.5.2"
57
57
  }
58
58
  }
@@ -4,6 +4,7 @@ type DistFile = {
4
4
  name?: string;
5
5
  };
6
6
  type Props = {
7
+ id?: string;
7
8
  accept: string[];
8
9
  value?: DistFile | File;
9
10
  disabled?: boolean;
@@ -16,5 +17,5 @@ type Props = {
16
17
  onError?: () => void;
17
18
  onPressRemove?: () => void;
18
19
  };
19
- export declare const FileInput: ({ icon, accept, value, disabled, onPressRemove, onFiles, onError, layout, description, error, maxSize, }: Props) => import("react").JSX.Element;
20
+ export declare const FileInput: ({ id, icon, accept, value, disabled, onPressRemove, onFiles, onError, layout, description, error, maxSize, }: Props) => import("react").JSX.Element;
20
21
  export {};
@@ -94,7 +94,7 @@ const styles = StyleSheet.create({
94
94
  top: spacings[20],
95
95
  },
96
96
  });
97
- export const FileInput = ({ icon = "document-regular", accept, value, disabled = false, onPressRemove, onFiles, onError, layout = "vertical", description, error, maxSize, }) => {
97
+ export const FileInput = ({ id, icon = "document-regular", accept, value, disabled = false, onPressRemove, onFiles, onError, layout = "vertical", description, error, maxSize, }) => {
98
98
  var _a;
99
99
  const [isHovered, setIsHovered] = useBoolean(false);
100
100
  // We use the `accept` field as a heuristic to know if we can display a preview
@@ -130,7 +130,7 @@ export const FileInput = ({ icon = "document-regular", accept, value, disabled =
130
130
  !disabled && isHovered && styles.hoveredContainer,
131
131
  isDragActive && styles.activeContainer,
132
132
  (error != null || fileRejections.length > 0) && styles.errorContainer,
133
- ], children: [_jsx("input", { ...getInputProps() }), match({ file, isImageOnly })
133
+ ], children: [_jsx("input", { ...getInputProps({ id }) }), match({ file, isImageOnly })
134
134
  .with({ file: Option.Some(P.select()), isImageOnly: true }, ({ url }) => (_jsxs(_Fragment, { children: [_jsx(View, { style: [styles.preview, { backgroundImage: `url("${url}")` }] }), onPressRemove != null ? (_jsx(LakeButton, { mode: "tertiary", size: "small", icon: "delete-regular", color: "negative", onPress: onPressRemove, style: styles.deleteButton, ariaLabel: t("common.remove") })) : null] })))
135
135
  .with({ file: Option.Some(P.select()), isImageOnly: false }, ({ name }) => (_jsxs(_Fragment, { children: [_jsx(Icon, { name: getIconNameFromFilename(name), size: 48, color: disabled ? colors.gray[200] : colors.current[500] }), _jsx(Space, { width: layout === "horizontal" ? 48 : 16, height: layout === "horizontal" ? 48 : 16 }), _jsxs(View, { style: styles.browseBlock, children: [_jsx(LakeHeading, { level: 5, variant: "h5", align: layout === "horizontal" ? "left" : "center", children: t("fileInput.clickToModify") }), _jsx(Space, { height: 4 }), _jsx(LakeText, { variant: "smallRegular", color: colors.gray[200], align: layout === "horizontal" ? "left" : "center", children: name })] }), onPressRemove != null ? (_jsx(LakeButton, { mode: "tertiary", size: "small", icon: "delete-regular", color: "negative", style: styles.deleteButton, onPress: onPressRemove, ariaLabel: t("common.remove") })) : null] })))
136
136
  .otherwise(() => (_jsxs(_Fragment, { children: [_jsxs(View, { style: styles.icon, children: [_jsx(Icon, { name: icon, size: 48, color: disabled ? colors.gray[200] : colors.current[500], style: [