@equinor/react-native-mad-tag-ocr 0.1.7 → 0.2.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/CHANGELOG.md +18 -0
- package/dist/chunk-AINAHK2V.js +47 -0
- package/dist/{chunk-IQVHXPCW.js → chunk-BMAS5ZHG.js} +48 -37
- package/dist/chunk-MCSD3EN7.js +50 -0
- package/dist/components/Camera/OCRCamera.d.ts +1 -2
- package/dist/components/Camera/OCRCamera.js +3 -3
- package/dist/components/PopoverButton.d.ts +1 -2
- package/dist/components/PopoverButton.js +1 -1
- package/dist/components/SelectTagDialog.d.ts +1 -2
- package/dist/components/SelectTagDialog.js +1 -1
- package/dist/index.js +3 -3
- package/package.json +6 -6
- package/dist/chunk-GWY64QKM.js +0 -44
- package/dist/chunk-XLETJGD5.js +0 -41
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @equinor/react-native-mad-ocr
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7bf5e2b: React Native Architecture Upgrade -> Expo sdk upgraded to version 53
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [7bf5e2b]
|
|
12
|
+
- @equinor/mad-components@0.23.0
|
|
13
|
+
|
|
14
|
+
## 0.1.8
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [30521d3]
|
|
19
|
+
- @equinor/mad-components@0.22.0
|
|
20
|
+
|
|
3
21
|
## 0.1.7
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// src/components/PopoverButton.tsx
|
|
2
|
+
import { useRef, useState } from "react";
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
EDSStyleSheet,
|
|
6
|
+
Popover,
|
|
7
|
+
Typography,
|
|
8
|
+
useStyles
|
|
9
|
+
} from "@equinor/mad-components";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var PopoverButton = ({ icon, title, text }) => {
|
|
12
|
+
const style = useStyles(themeStyles);
|
|
13
|
+
const buttonRef = useRef(null);
|
|
14
|
+
const [showPopover, setShowPopover] = useState(false);
|
|
15
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16
|
+
/* @__PURE__ */ jsxs(
|
|
17
|
+
Popover,
|
|
18
|
+
{
|
|
19
|
+
open: showPopover,
|
|
20
|
+
placement: "bottom",
|
|
21
|
+
anchorEl: buttonRef,
|
|
22
|
+
style: style.popover,
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h5", style: style.title, children: title }),
|
|
25
|
+
/* @__PURE__ */ jsx(Typography, { children: text })
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
Button.Icon,
|
|
31
|
+
{
|
|
32
|
+
ref: buttonRef,
|
|
33
|
+
name: icon,
|
|
34
|
+
iconSize: 30,
|
|
35
|
+
onPress: () => setShowPopover(!showPopover)
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
] });
|
|
39
|
+
};
|
|
40
|
+
var themeStyles = EDSStyleSheet.create(() => ({
|
|
41
|
+
title: { marginBottom: 10 },
|
|
42
|
+
popover: { maxWidth: 500 }
|
|
43
|
+
}));
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
PopoverButton
|
|
47
|
+
};
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
} from "./chunk-JFXZ5SLD.js";
|
|
14
14
|
import {
|
|
15
15
|
PopoverButton
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-AINAHK2V.js";
|
|
17
17
|
import {
|
|
18
18
|
SelectTagDialog
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-MCSD3EN7.js";
|
|
20
20
|
import {
|
|
21
21
|
useStateToSharedValue
|
|
22
22
|
} from "./chunk-JE4UMMVX.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from "./chunk-5JBD5THX.js";
|
|
26
26
|
|
|
27
27
|
// src/components/Camera/OCRCamera.tsx
|
|
28
|
-
import
|
|
28
|
+
import { useState } from "react";
|
|
29
29
|
import {
|
|
30
30
|
Camera,
|
|
31
31
|
useCameraDevice,
|
|
@@ -37,6 +37,7 @@ import { View, useWindowDimensions } from "react-native";
|
|
|
37
37
|
import { useRunOnJS, useSharedValue } from "react-native-worklets-core";
|
|
38
38
|
import { Button, EDSStyleSheet, useStyles } from "@equinor/mad-components";
|
|
39
39
|
import { scanOCR } from "@ismaelmoreiraa/vision-camera-ocr";
|
|
40
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
40
41
|
var OCRCamera = ({
|
|
41
42
|
buttonConfig = defaultButtonConfig,
|
|
42
43
|
enableConfirmTextDialog = true,
|
|
@@ -147,40 +148,50 @@ var OCRCamera = ({
|
|
|
147
148
|
onClickClose();
|
|
148
149
|
return null;
|
|
149
150
|
}
|
|
150
|
-
return /* @__PURE__ */
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
{
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
151
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
152
|
+
/* @__PURE__ */ jsx(
|
|
153
|
+
SelectTagDialog,
|
|
154
|
+
{
|
|
155
|
+
show: showDialog,
|
|
156
|
+
tagText: clickedText,
|
|
157
|
+
maxTagLength: MaxTagLength,
|
|
158
|
+
onChangeTagText: (text) => setClickedText(text),
|
|
159
|
+
onClickRetry: clearSelection,
|
|
160
|
+
onClickConfirm: () => confirmSelection(clickedText)
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
/* @__PURE__ */ jsxs(View, { style: styles.container, children: [
|
|
164
|
+
!!buttonConfig && /* @__PURE__ */ jsxs(View, { style: styles.buttonContainer, children: [
|
|
165
|
+
buttonConfig.showCloseButton && /* @__PURE__ */ jsx(Button.Icon, { name: "close", iconSize: 30, onPress: onClickClose }),
|
|
166
|
+
buttonConfig.showInfoButton && /* @__PURE__ */ jsx(
|
|
167
|
+
PopoverButton,
|
|
168
|
+
{
|
|
169
|
+
icon: "information",
|
|
170
|
+
title: "How to use the tag scanner",
|
|
171
|
+
text: OcrUsageSteps.join("\n")
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
(_a = buttonConfig.extraButtons) == null ? void 0 : _a.map((buttonProps, index) => /* @__PURE__ */ jsx(Button.Icon, __spreadValues({ iconSize: 30 }, buttonProps), index))
|
|
175
|
+
] }),
|
|
176
|
+
/* @__PURE__ */ jsx(
|
|
177
|
+
Camera,
|
|
178
|
+
{
|
|
179
|
+
onLayout,
|
|
180
|
+
onTouchStart: onTap,
|
|
181
|
+
device,
|
|
182
|
+
format,
|
|
183
|
+
fps,
|
|
184
|
+
isActive: !showDialog,
|
|
185
|
+
style: { flex: 1 },
|
|
186
|
+
resizeMode: "cover",
|
|
187
|
+
frameProcessor,
|
|
188
|
+
enableZoomGesture: true,
|
|
189
|
+
videoStabilizationMode: "auto",
|
|
190
|
+
outputOrientation: "device"
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
] })
|
|
194
|
+
] });
|
|
184
195
|
};
|
|
185
196
|
var themeStyles = EDSStyleSheet.create((theme) => ({
|
|
186
197
|
container: {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// src/components/SelectTagDialog.tsx
|
|
2
|
+
import { Button, TextField, Typography } from "@equinor/mad-components";
|
|
3
|
+
import { Dialog } from "@equinor/mad-components/dist/components/Dialog";
|
|
4
|
+
import { DialogActions } from "@equinor/mad-components/dist/components/Dialog/DialogActions";
|
|
5
|
+
import { DialogCustomContent } from "@equinor/mad-components/dist/components/Dialog/DialogCustomContent";
|
|
6
|
+
import { DialogHeader } from "@equinor/mad-components/dist/components/Dialog/DialogHeader";
|
|
7
|
+
import { View } from "react-native";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
var SelectTagDialog = ({
|
|
10
|
+
show,
|
|
11
|
+
tagText,
|
|
12
|
+
maxTagLength,
|
|
13
|
+
onChangeTagText,
|
|
14
|
+
onClickRetry,
|
|
15
|
+
onClickConfirm
|
|
16
|
+
}) => {
|
|
17
|
+
return /* @__PURE__ */ jsxs(Dialog, { isOpen: show, children: [
|
|
18
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(Typography, { variant: "h6", children: "Confirm & edit selection" }) }),
|
|
19
|
+
/* @__PURE__ */ jsx(DialogCustomContent, { children: /* @__PURE__ */ jsx(
|
|
20
|
+
TextField,
|
|
21
|
+
{
|
|
22
|
+
multiline: false,
|
|
23
|
+
label: "Selected tag",
|
|
24
|
+
value: tagText,
|
|
25
|
+
onChange: onChangeTagText,
|
|
26
|
+
maxLength: maxTagLength,
|
|
27
|
+
style: { textAlign: "center" }
|
|
28
|
+
}
|
|
29
|
+
) }),
|
|
30
|
+
/* @__PURE__ */ jsx(DialogActions, { align: "left", children: /* @__PURE__ */ jsxs(
|
|
31
|
+
View,
|
|
32
|
+
{
|
|
33
|
+
style: {
|
|
34
|
+
display: "flex",
|
|
35
|
+
flexDirection: "row",
|
|
36
|
+
justifyContent: "space-between",
|
|
37
|
+
width: "100%"
|
|
38
|
+
},
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ jsx(Button, { title: "Retry", onPress: onClickRetry }),
|
|
41
|
+
/* @__PURE__ */ jsx(Button, { title: "Confirm", disabled: !tagText.length, onPress: onClickConfirm })
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
) })
|
|
45
|
+
] });
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
SelectTagDialog
|
|
50
|
+
};
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { OCRCameraProps } from "../../types";
|
|
3
|
-
export declare const OCRCamera: ({ buttonConfig, enableConfirmTextDialog, fps, textHighlightColor, onSelectTag, onClose, shouldHighlightText, }: OCRCameraProps) =>
|
|
2
|
+
export declare const OCRCamera: ({ buttonConfig, enableConfirmTextDialog, fps, textHighlightColor, onSelectTag, onClose, shouldHighlightText, }: OCRCameraProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OCRCamera
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-BMAS5ZHG.js";
|
|
4
4
|
import "../../chunk-WA2RO7BG.js";
|
|
5
5
|
import "../../chunk-JFXZ5SLD.js";
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-AINAHK2V.js";
|
|
7
|
+
import "../../chunk-MCSD3EN7.js";
|
|
8
8
|
import "../../chunk-JE4UMMVX.js";
|
|
9
9
|
import "../../chunk-5JBD5THX.js";
|
|
10
10
|
export {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { IconName } from "@equinor/mad-components";
|
|
3
2
|
type PopoverButtonProps = {
|
|
4
3
|
icon: IconName;
|
|
5
4
|
title: string;
|
|
6
5
|
text: string;
|
|
7
6
|
};
|
|
8
|
-
export declare const PopoverButton: ({ icon, title, text }: PopoverButtonProps) =>
|
|
7
|
+
export declare const PopoverButton: ({ icon, title, text }: PopoverButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
export type DialogOptions = {
|
|
3
2
|
show: boolean;
|
|
4
3
|
tagText: string;
|
|
@@ -7,4 +6,4 @@ export type DialogOptions = {
|
|
|
7
6
|
onClickRetry: () => void;
|
|
8
7
|
onClickConfirm: () => void;
|
|
9
8
|
};
|
|
10
|
-
export declare const SelectTagDialog: ({ show, tagText, maxTagLength, onChangeTagText, onClickRetry, onClickConfirm, }: DialogOptions) =>
|
|
9
|
+
export declare const SelectTagDialog: ({ show, tagText, maxTagLength, onChangeTagText, onClickRetry, onClickConfirm, }: DialogOptions) => import("react/jsx-runtime").JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "./chunk-6F4PWJZI.js";
|
|
2
2
|
import {
|
|
3
3
|
OCRCamera
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BMAS5ZHG.js";
|
|
5
5
|
import "./chunk-WA2RO7BG.js";
|
|
6
6
|
import "./chunk-JFXZ5SLD.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-AINAHK2V.js";
|
|
8
|
+
import "./chunk-MCSD3EN7.js";
|
|
9
9
|
import "./chunk-JE4UMMVX.js";
|
|
10
10
|
import "./chunk-5JBD5THX.js";
|
|
11
11
|
export {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/react-native-mad-tag-ocr",
|
|
3
3
|
"description": "A React Native library for scanning tags",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Equinor Mobile App Delivery team (MAD)"
|
|
7
7
|
},
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"@equinor/mad-tsconfig": "*",
|
|
15
15
|
"@ismaelmoreiraa/vision-camera-ocr": "^3.0.1",
|
|
16
16
|
"@shopify/react-native-skia": "1.5.0",
|
|
17
|
-
"@types/react": "
|
|
17
|
+
"@types/react": "19.1.0",
|
|
18
18
|
"eslint": "^8.46.0",
|
|
19
19
|
"react-native-vision-camera": "^4.0.4",
|
|
20
20
|
"react-native-worklets-core": "^1.3.3",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"main": "./dist/index.js",
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@ismaelmoreiraa/vision-camera-ocr": "^3.0.1",
|
|
40
|
-
"@shopify/react-native-skia": "1.
|
|
41
|
-
"react": "
|
|
42
|
-
"react-native": "
|
|
43
|
-
"react-native-gesture-handler": "~2.
|
|
40
|
+
"@shopify/react-native-skia": "2.1.1",
|
|
41
|
+
"react": "19.1.0",
|
|
42
|
+
"react-native": "0.79.5",
|
|
43
|
+
"react-native-gesture-handler": "~2.24.0",
|
|
44
44
|
"react-native-vision-camera": "^4.0.4",
|
|
45
45
|
"react-native-worklets-core": "^1.3.3"
|
|
46
46
|
},
|
package/dist/chunk-GWY64QKM.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// src/components/SelectTagDialog.tsx
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Button, TextField, Typography } from "@equinor/mad-components";
|
|
4
|
-
import { Dialog } from "@equinor/mad-components/dist/components/Dialog";
|
|
5
|
-
import { DialogActions } from "@equinor/mad-components/dist/components/Dialog/DialogActions";
|
|
6
|
-
import { DialogCustomContent } from "@equinor/mad-components/dist/components/Dialog/DialogCustomContent";
|
|
7
|
-
import { DialogHeader } from "@equinor/mad-components/dist/components/Dialog/DialogHeader";
|
|
8
|
-
import { View } from "react-native";
|
|
9
|
-
var SelectTagDialog = ({
|
|
10
|
-
show,
|
|
11
|
-
tagText,
|
|
12
|
-
maxTagLength,
|
|
13
|
-
onChangeTagText,
|
|
14
|
-
onClickRetry,
|
|
15
|
-
onClickConfirm
|
|
16
|
-
}) => {
|
|
17
|
-
return /* @__PURE__ */ React.createElement(Dialog, { isOpen: show }, /* @__PURE__ */ React.createElement(DialogHeader, null, /* @__PURE__ */ React.createElement(Typography, { variant: "h6" }, "Confirm & edit selection")), /* @__PURE__ */ React.createElement(DialogCustomContent, null, /* @__PURE__ */ React.createElement(
|
|
18
|
-
TextField,
|
|
19
|
-
{
|
|
20
|
-
multiline: false,
|
|
21
|
-
label: "Selected tag",
|
|
22
|
-
value: tagText,
|
|
23
|
-
onChange: onChangeTagText,
|
|
24
|
-
maxLength: maxTagLength,
|
|
25
|
-
style: { textAlign: "center" }
|
|
26
|
-
}
|
|
27
|
-
)), /* @__PURE__ */ React.createElement(DialogActions, { align: "left" }, /* @__PURE__ */ React.createElement(
|
|
28
|
-
View,
|
|
29
|
-
{
|
|
30
|
-
style: {
|
|
31
|
-
display: "flex",
|
|
32
|
-
flexDirection: "row",
|
|
33
|
-
justifyContent: "space-between",
|
|
34
|
-
width: "100%"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
/* @__PURE__ */ React.createElement(Button, { title: "Retry", onPress: onClickRetry }),
|
|
38
|
-
/* @__PURE__ */ React.createElement(Button, { title: "Confirm", disabled: !tagText.length, onPress: onClickConfirm })
|
|
39
|
-
)));
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export {
|
|
43
|
-
SelectTagDialog
|
|
44
|
-
};
|
package/dist/chunk-XLETJGD5.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// src/components/PopoverButton.tsx
|
|
2
|
-
import React, { useRef, useState } from "react";
|
|
3
|
-
import {
|
|
4
|
-
Button,
|
|
5
|
-
EDSStyleSheet,
|
|
6
|
-
Popover,
|
|
7
|
-
Typography,
|
|
8
|
-
useStyles
|
|
9
|
-
} from "@equinor/mad-components";
|
|
10
|
-
var PopoverButton = ({ icon, title, text }) => {
|
|
11
|
-
const style = useStyles(themeStyles);
|
|
12
|
-
const buttonRef = useRef(null);
|
|
13
|
-
const [showPopover, setShowPopover] = useState(false);
|
|
14
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
15
|
-
Popover,
|
|
16
|
-
{
|
|
17
|
-
open: showPopover,
|
|
18
|
-
placement: "bottom",
|
|
19
|
-
anchorEl: buttonRef,
|
|
20
|
-
style: style.popover
|
|
21
|
-
},
|
|
22
|
-
/* @__PURE__ */ React.createElement(Typography, { variant: "h5", style: style.title }, title),
|
|
23
|
-
/* @__PURE__ */ React.createElement(Typography, null, text)
|
|
24
|
-
), /* @__PURE__ */ React.createElement(
|
|
25
|
-
Button.Icon,
|
|
26
|
-
{
|
|
27
|
-
ref: buttonRef,
|
|
28
|
-
name: icon,
|
|
29
|
-
iconSize: 30,
|
|
30
|
-
onPress: () => setShowPopover(!showPopover)
|
|
31
|
-
}
|
|
32
|
-
));
|
|
33
|
-
};
|
|
34
|
-
var themeStyles = EDSStyleSheet.create(() => ({
|
|
35
|
-
title: { marginBottom: 10 },
|
|
36
|
-
popover: { maxWidth: 500 }
|
|
37
|
-
}));
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
PopoverButton
|
|
41
|
-
};
|