@equinor/react-native-mad-tag-ocr 0.1.8 → 0.2.1

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @equinor/react-native-mad-ocr
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [6264746]
8
+ - @equinor/mad-components@0.24.0
9
+
10
+ ## 0.2.0
11
+
12
+ ### Minor Changes
13
+
14
+ - 7bf5e2b: React Native Architecture Upgrade -> Expo sdk upgraded to version 53
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [7bf5e2b]
19
+ - @equinor/mad-components@0.23.0
20
+
3
21
  ## 0.1.8
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-XLETJGD5.js";
16
+ } from "./chunk-AINAHK2V.js";
17
17
  import {
18
18
  SelectTagDialog
19
- } from "./chunk-GWY64QKM.js";
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 React, { useState } from "react";
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__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
151
- SelectTagDialog,
152
- {
153
- show: showDialog,
154
- tagText: clickedText,
155
- maxTagLength: MaxTagLength,
156
- onChangeTagText: (text) => setClickedText(text),
157
- onClickRetry: clearSelection,
158
- onClickConfirm: () => confirmSelection(clickedText)
159
- }
160
- ), /* @__PURE__ */ React.createElement(View, { style: styles.container }, !!buttonConfig && /* @__PURE__ */ React.createElement(View, { style: styles.buttonContainer }, buttonConfig.showCloseButton && /* @__PURE__ */ React.createElement(Button.Icon, { name: "close", iconSize: 30, onPress: onClickClose }), buttonConfig.showInfoButton && /* @__PURE__ */ React.createElement(
161
- PopoverButton,
162
- {
163
- icon: "information",
164
- title: "How to use the tag scanner",
165
- text: OcrUsageSteps.join("\n")
166
- }
167
- ), (_a = buttonConfig.extraButtons) == null ? void 0 : _a.map((buttonProps, index) => /* @__PURE__ */ React.createElement(Button.Icon, __spreadValues({ key: index, iconSize: 30 }, buttonProps)))), /* @__PURE__ */ React.createElement(
168
- Camera,
169
- {
170
- onLayout,
171
- onTouchStart: onTap,
172
- device,
173
- format,
174
- fps,
175
- isActive: !showDialog,
176
- style: { flex: 1 },
177
- resizeMode: "cover",
178
- frameProcessor,
179
- enableZoomGesture: true,
180
- videoStabilizationMode: "auto",
181
- outputOrientation: "device"
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) => React.JSX.Element | null;
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-IQVHXPCW.js";
3
+ } from "../../chunk-BMAS5ZHG.js";
4
4
  import "../../chunk-WA2RO7BG.js";
5
5
  import "../../chunk-JFXZ5SLD.js";
6
- import "../../chunk-XLETJGD5.js";
7
- import "../../chunk-GWY64QKM.js";
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) => React.JSX.Element;
7
+ export declare const PopoverButton: ({ icon, title, text }: PopoverButtonProps) => import("react/jsx-runtime").JSX.Element;
9
8
  export {};
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PopoverButton
3
- } from "../chunk-XLETJGD5.js";
3
+ } from "../chunk-AINAHK2V.js";
4
4
  import "../chunk-5JBD5THX.js";
5
5
  export {
6
6
  PopoverButton
@@ -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) => React.JSX.Element;
9
+ export declare const SelectTagDialog: ({ show, tagText, maxTagLength, onChangeTagText, onClickRetry, onClickConfirm, }: DialogOptions) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SelectTagDialog
3
- } from "../chunk-GWY64QKM.js";
3
+ } from "../chunk-MCSD3EN7.js";
4
4
  import "../chunk-5JBD5THX.js";
5
5
  export {
6
6
  SelectTagDialog
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import "./chunk-6F4PWJZI.js";
2
2
  import {
3
3
  OCRCamera
4
- } from "./chunk-IQVHXPCW.js";
4
+ } from "./chunk-BMAS5ZHG.js";
5
5
  import "./chunk-WA2RO7BG.js";
6
6
  import "./chunk-JFXZ5SLD.js";
7
- import "./chunk-XLETJGD5.js";
8
- import "./chunk-GWY64QKM.js";
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.1.8",
4
+ "version": "0.2.1",
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": "~18.3.12",
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.5.0",
41
- "react": "~18.3.1",
42
- "react-native": "~0.76.3",
43
- "react-native-gesture-handler": "~2.20.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
  },
@@ -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
- };
@@ -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
- };