@overmap-ai/core 1.0.51-bulk-form-submission.3 → 1.0.51-fix-document-urls.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.
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  (function(global2, factory) {
8
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react/jsx-runtime"), require("@overmap-ai/blocks"), require("dependency-graph"), require("@redux-offline/redux-offline"), require("@redux-offline/redux-offline/lib/defaults"), require("localforage"), require("redux-persist-migrate"), require("@reduxjs/toolkit"), require("superagent"), require("react-redux"), require("file-saver"), require("uuid"), require("color"), require("jwt-decode"), require("@redux-offline/redux-offline/lib/constants"), require("idb"), require("formik"), require("lodash.get"), require("linkify-react"), require("@hello-pangea/dnd"), require("xlsx"), require("react-pdf"), require("react-pdf/dist/Page/AnnotationLayer.css"), require("react-pdf/dist/Page/TextLayer.css"), require("react-dom"), require("react-sketch-canvas"), require("lodash.set"), require("lodash.clonedeep")) : typeof define === "function" && define.amd ? define(["exports", "react", "react/jsx-runtime", "@overmap-ai/blocks", "dependency-graph", "@redux-offline/redux-offline", "@redux-offline/redux-offline/lib/defaults", "localforage", "redux-persist-migrate", "@reduxjs/toolkit", "superagent", "react-redux", "file-saver", "uuid", "color", "jwt-decode", "@redux-offline/redux-offline/lib/constants", "idb", "formik", "lodash.get", "linkify-react", "@hello-pangea/dnd", "xlsx", "react-pdf", "react-pdf/dist/Page/AnnotationLayer.css", "react-pdf/dist/Page/TextLayer.css", "react-dom", "react-sketch-canvas", "lodash.set", "lodash.clonedeep"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["overmap-core"] = {}, global2.React, global2.jsxRuntime, global2.blocks, global2.dependencyGraph, global2.reduxOffline, global2.offlineConfig, global2.localforage, global2.createMigration, global2.toolkit, global2.request, global2.reactRedux, global2.saveAs, global2.uuid, global2.ColorCls, global2.jwtDecode, global2.constants, global2.idb, global2.formik, global2.get, global2.Linkify, global2.dnd, global2.xlsx, global2.reactPdf, null, null, global2.ReactDOM, global2.reactSketchCanvas, global2.set, global2.cloneDeep));
9
- })(this, function(exports2, React, jsxRuntime, blocks, dependencyGraph, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, reactRedux, saveAs, uuid, ColorCls, jwtDecode, constants, idb, formik, get, Linkify, dnd, xlsx, reactPdf, AnnotationLayer_css, TextLayer_css, ReactDOM, reactSketchCanvas, set, cloneDeep) {
8
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react/jsx-runtime"), require("@overmap-ai/blocks"), require("dependency-graph"), require("@redux-offline/redux-offline"), require("@redux-offline/redux-offline/lib/defaults"), require("localforage"), require("redux-persist-migrate"), require("@reduxjs/toolkit"), require("superagent"), require("react-redux"), require("file-saver"), require("uuid"), require("color"), require("jwt-decode"), require("@redux-offline/redux-offline/lib/constants"), require("idb"), require("formik"), require("lodash.get"), require("linkify-react"), require("@hello-pangea/dnd"), require("qr-scanner"), require("xlsx"), require("react-pdf"), require("react-pdf/dist/Page/AnnotationLayer.css"), require("react-pdf/dist/Page/TextLayer.css"), require("react-dom"), require("react-sketch-canvas"), require("lodash.set"), require("lodash.clonedeep")) : typeof define === "function" && define.amd ? define(["exports", "react", "react/jsx-runtime", "@overmap-ai/blocks", "dependency-graph", "@redux-offline/redux-offline", "@redux-offline/redux-offline/lib/defaults", "localforage", "redux-persist-migrate", "@reduxjs/toolkit", "superagent", "react-redux", "file-saver", "uuid", "color", "jwt-decode", "@redux-offline/redux-offline/lib/constants", "idb", "formik", "lodash.get", "linkify-react", "@hello-pangea/dnd", "qr-scanner", "xlsx", "react-pdf", "react-pdf/dist/Page/AnnotationLayer.css", "react-pdf/dist/Page/TextLayer.css", "react-dom", "react-sketch-canvas", "lodash.set", "lodash.clonedeep"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["overmap-core"] = {}, global2.React, global2.jsxRuntime, global2.blocks, global2.dependencyGraph, global2.reduxOffline, global2.offlineConfig, global2.localforage, global2.createMigration, global2.toolkit, global2.request, global2.reactRedux, global2.saveAs, global2.uuid, global2.ColorCls, global2.jwtDecode, global2.constants, global2.idb, global2.formik, global2.get, global2.Linkify, global2.dnd, global2.QrScannerAPI, global2.xlsx, global2.reactPdf, null, null, global2.ReactDOM, global2.reactSketchCanvas, global2.set, global2.cloneDeep));
9
+ })(this, function(exports2, React, jsxRuntime, blocks, dependencyGraph, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, reactRedux, saveAs, uuid, ColorCls, jwtDecode, constants, idb, formik, get, Linkify, dnd, QrScannerAPI, xlsx, reactPdf, AnnotationLayer_css, TextLayer_css, ReactDOM, reactSketchCanvas, set, cloneDeep) {
10
10
  var _a;
11
11
  "use strict";
12
12
  function _interopNamespaceDefault(e) {
@@ -3641,7 +3641,7 @@ var __publicField = (obj, key, value) => {
3641
3641
  }
3642
3642
  for (const revision of Object.values(revisions)) {
3643
3643
  const form = formsOfComponentTypes[revision.form];
3644
- if (!form || !form.component_type || !ret[form.component_type] || formRevisionSortFn(ret[form.component_type], revision) < 0)
3644
+ if (!form || !form.component_type || ret[form.component_type] && formRevisionSortFn(ret[form.component_type], revision) > 0)
3645
3645
  continue;
3646
3646
  ret[form.component_type] = revision;
3647
3647
  }
@@ -7988,6 +7988,7 @@ var __publicField = (obj, key, value) => {
7988
7988
  }
7989
7989
  }
7990
7990
  class DocumentService extends BaseApiService {
7991
+ // TODO: Support adding for project or organization
7991
7992
  add(document2) {
7992
7993
  const { store } = this.client;
7993
7994
  const currentUserId = store.getState().userReducer.currentUser.id;
@@ -8109,15 +8110,25 @@ var __publicField = (obj, key, value) => {
8109
8110
  }
8110
8111
  async refreshStore() {
8111
8112
  const { store } = this.client;
8112
- const activeProjectId = store.getState().projectReducer.activeProjectId;
8113
- const result = await this.enqueueRequest({
8113
+ const state = store.getState();
8114
+ const activeProjectId = state.projectReducer.activeProjectId;
8115
+ const projectDocumentsPromise = this.enqueueRequest({
8114
8116
  description: "Get project documents",
8115
8117
  method: HttpMethod.GET,
8116
- url: `/documents/projects/${activeProjectId}/`,
8118
+ url: `/projects/${activeProjectId}/documents/`,
8119
+ blockers: [],
8120
+ blocks: []
8121
+ });
8122
+ const activeOrganizationId = state.organizationReducer.activeOrganizationId;
8123
+ const organizationDocumentsPromise = this.enqueueRequest({
8124
+ description: "Get organization documents",
8125
+ method: HttpMethod.GET,
8126
+ url: `/organizations/${activeOrganizationId}/documents/`,
8117
8127
  blockers: [],
8118
8128
  blocks: []
8119
8129
  });
8120
- store.dispatch(setDocuments(result));
8130
+ store.dispatch(setDocuments(await projectDocumentsPromise));
8131
+ store.dispatch(addDocuments(await organizationDocumentsPromise));
8121
8132
  }
8122
8133
  }
8123
8134
  class AgentService extends BaseApiService {
@@ -8222,7 +8233,7 @@ var __publicField = (obj, key, value) => {
8222
8233
  const patchfieldBorder = "_patchfieldBorder_1w0fq_73";
8223
8234
  const title = "_title_1w0fq_73";
8224
8235
  const error = "_error_1w0fq_89";
8225
- const styles$c = {
8236
+ const styles$d = {
8226
8237
  description: description$2,
8227
8238
  floatingButtonContainer: floatingButtonContainer$2,
8228
8239
  FullScreenImageContainer: FullScreenImageContainer$2,
@@ -8343,7 +8354,7 @@ var __publicField = (obj, key, value) => {
8343
8354
  const longIconButton$1 = "_longIconButton_10o76_36";
8344
8355
  const previewImage$1 = "_previewImage_10o76_42";
8345
8356
  const FullScreenImage$1 = "_FullScreenImage_10o76_12";
8346
- const styles$b = {
8357
+ const styles$c = {
8347
8358
  description: description$1,
8348
8359
  floatingButtonContainer: floatingButtonContainer$1,
8349
8360
  FullScreenImageContainer: FullScreenImageContainer$1,
@@ -8367,7 +8378,7 @@ var __publicField = (obj, key, value) => {
8367
8378
  /* @__PURE__ */ jsxRuntime.jsx(
8368
8379
  "button",
8369
8380
  {
8370
- className: styles$b.FullScreenImageContainer,
8381
+ className: styles$c.FullScreenImageContainer,
8371
8382
  type: "button",
8372
8383
  onClick: () => {
8373
8384
  setShowPreview(false);
@@ -8375,7 +8386,7 @@ var __publicField = (obj, key, value) => {
8375
8386
  children: /* @__PURE__ */ jsxRuntime.jsx(
8376
8387
  "img",
8377
8388
  {
8378
- className: styles$b.FullScreenImage,
8389
+ className: styles$c.FullScreenImage,
8379
8390
  src: url,
8380
8391
  alt: name,
8381
8392
  onClick: (e) => {
@@ -8385,11 +8396,11 @@ var __publicField = (obj, key, value) => {
8385
8396
  )
8386
8397
  }
8387
8398
  ),
8388
- /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { className: styles$b.TopBarContainer, align: "center", children: [
8399
+ /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { className: styles$c.TopBarContainer, align: "center", children: [
8389
8400
  /* @__PURE__ */ jsxRuntime.jsx(
8390
8401
  blocks.IconButton,
8391
8402
  {
8392
- className: styles$b.longIconButton,
8403
+ className: styles$c.longIconButton,
8393
8404
  variant: "soft",
8394
8405
  "aria-label": "Exit preview",
8395
8406
  onClick: () => {
@@ -8398,11 +8409,11 @@ var __publicField = (obj, key, value) => {
8398
8409
  children: /* @__PURE__ */ jsxRuntime.jsx(blocks.RiIcon, { icon: "RiArrowLeftLine" })
8399
8410
  }
8400
8411
  ),
8401
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: styles$b.fileName, children: name }),
8412
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: styles$c.fileName, children: name }),
8402
8413
  /* @__PURE__ */ jsxRuntime.jsx(
8403
8414
  blocks.IconButton,
8404
8415
  {
8405
- className: styles$b.longIconButton,
8416
+ className: styles$c.longIconButton,
8406
8417
  variant: "soft",
8407
8418
  "aria-label": `Download ${name}`,
8408
8419
  onClick: handleDownload,
@@ -8430,7 +8441,7 @@ var __publicField = (obj, key, value) => {
8430
8441
  /* @__PURE__ */ jsxRuntime.jsx(
8431
8442
  "img",
8432
8443
  {
8433
- className: styles$b.previewImage,
8444
+ className: styles$c.previewImage,
8434
8445
  src: resolvedImageURL,
8435
8446
  alt: resolvedImage.name,
8436
8447
  onClick: () => {
@@ -8458,7 +8469,7 @@ var __publicField = (obj, key, value) => {
8458
8469
  const { helpText, children, severity } = props;
8459
8470
  return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", gap: "1", children: [
8460
8471
  children,
8461
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Flex, { direction: "column", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "1", severity, className: styles$b.description, children: helpText }) })
8472
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Flex, { direction: "column", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "1", severity, className: styles$c.description, children: helpText }) })
8462
8473
  ] });
8463
8474
  };
8464
8475
  const InputWithLabelAndHelpText = (props) => {
@@ -8692,6 +8703,9 @@ var __publicField = (obj, key, value) => {
8692
8703
  function RiCalendarLine(props) {
8693
8704
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M9 1V3H15V1H17V3H21C21.5523 3 22 3.44772 22 4V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V4C2 3.44772 2.44772 3 3 3H7V1H9ZM20 11H4V19H20V11ZM7 5H4V9H20V5H17V7H15V5H9V7H7V5Z" }, "child": [] }] })(props);
8694
8705
  }
8706
+ function RiQrCodeLine(props) {
8707
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M16 17V16H13V13H16V15H18V17H17V19H15V21H13V18H15V17H16ZM21 21H17V19H19V17H21V21ZM3 3H11V11H3V3ZM5 5V9H9V5H5ZM13 3H21V11H13V3ZM15 5V9H19V5H15ZM3 13H11V21H3V13ZM5 15V19H9V15H5ZM18 13H21V15H18V13ZM6 6H8V8H6V6ZM6 16H8V18H6V16ZM16 6H18V8H16V6Z" }, "child": [] }] })(props);
8708
+ }
8695
8709
  function RiFileCopyLine(props) {
8696
8710
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M6.9998 6V3C6.9998 2.44772 7.44752 2 7.9998 2H19.9998C20.5521 2 20.9998 2.44772 20.9998 3V17C20.9998 17.5523 20.5521 18 19.9998 18H16.9998V20.9991C16.9998 21.5519 16.5499 22 15.993 22H4.00666C3.45059 22 3 21.5554 3 20.9991L3.0026 7.00087C3.0027 6.44811 3.45264 6 4.00942 6H6.9998ZM5.00242 8L5.00019 20H14.9998V8H5.00242ZM8.9998 6H16.9998V16H18.9998V4H8.9998V6Z" }, "child": [] }] })(props);
8697
8711
  }
@@ -9595,9 +9609,9 @@ var __publicField = (obj, key, value) => {
9595
9609
  return React__namespace.createElement("div", { ...insetProps, ref: forwardedRef, className: classNames("rt-Inset", className, withBreakpoints(side, "rt-r-side"), withBreakpoints(clip, "rt-r-clip"), withBreakpoints(p, "rt-r-p"), withBreakpoints(px, "rt-r-px"), withBreakpoints(py, "rt-r-py"), withBreakpoints(pt, "rt-r-pt"), withBreakpoints(pr, "rt-r-pr"), withBreakpoints(pb, "rt-r-pb"), withBreakpoints(pl, "rt-r-pl"), withMarginProps(marginProps)) });
9596
9610
  });
9597
9611
  Inset.displayName = "Inset";
9598
- const sizes$7 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9612
+ const sizes$8 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9599
9613
  const headingPropDefs = {
9600
- size: { type: "enum", values: sizes$7, default: "6", responsive: true },
9614
+ size: { type: "enum", values: sizes$8, default: "6", responsive: true },
9601
9615
  weight: { ...weightProp, default: "bold" },
9602
9616
  align: alignProp,
9603
9617
  trim: trimProp,
@@ -9610,9 +9624,9 @@ var __publicField = (obj, key, value) => {
9610
9624
  return React__namespace.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360, { "data-accent-color": color, ...headingProps, ref: forwardedRef, className: classNames("rt-Heading", className, withBreakpoints(size, "rt-r-size"), withBreakpoints(weight, "rt-r-weight"), withBreakpoints(align, "rt-r-ta"), withBreakpoints(trim, "rt-r-lt"), { "rt-high-contrast": highContrast }, withMarginProps(marginProps)) }, asChild ? children : React__namespace.createElement(Tag, null, children));
9611
9625
  });
9612
9626
  Heading.displayName = "Heading";
9613
- const sizes$6 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9627
+ const sizes$7 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9614
9628
  const textPropDefs = {
9615
- size: { type: "enum", values: sizes$6, default: void 0, responsive: true },
9629
+ size: { type: "enum", values: sizes$7, default: void 0, responsive: true },
9616
9630
  weight: weightProp,
9617
9631
  align: alignProp,
9618
9632
  trim: trimProp,
@@ -9625,6 +9639,21 @@ var __publicField = (obj, key, value) => {
9625
9639
  return React__namespace.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360, { "data-accent-color": color, ...textProps, ref: forwardedRef, className: classNames("rt-Text", className, withBreakpoints(size, "rt-r-size"), withBreakpoints(weight, "rt-r-weight"), withBreakpoints(align, "rt-r-ta"), withBreakpoints(trim, "rt-r-lt"), { "rt-high-contrast": highContrast }, withMarginProps(marginProps)) }, asChild ? children : React__namespace.createElement(Tag, null, children));
9626
9640
  });
9627
9641
  Text.displayName = "Text";
9642
+ const sizes$6 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9643
+ const variants$4 = ["solid", "soft", "outline", "ghost"];
9644
+ const codePropDefs = {
9645
+ size: { type: "enum", values: sizes$6, default: void 0, responsive: true },
9646
+ variant: { type: "enum", values: variants$4, default: "soft" },
9647
+ weight: weightProp,
9648
+ color: colorProp,
9649
+ highContrast: highContrastProp
9650
+ };
9651
+ const Code = React__namespace.forwardRef((props, forwardedRef) => {
9652
+ const { rest: marginRest, ...marginProps } = extractMarginProps(props);
9653
+ const { className, size = codePropDefs.size.default, variant = codePropDefs.variant.default, weight = codePropDefs.weight.default, color = codePropDefs.color.default, highContrast = codePropDefs.highContrast.default, ...codeProps } = marginRest;
9654
+ return React__namespace.createElement("code", { "data-accent-color": color, ...codeProps, ref: forwardedRef, className: classNames("rt-Code", className, withBreakpoints(size, "rt-r-size"), `rt-variant-${variant}`, withBreakpoints(weight, "rt-r-weight"), { "rt-high-contrast": highContrast }, withMarginProps(marginProps)) });
9655
+ });
9656
+ Code.displayName = "Code";
9628
9657
  const Em = React__namespace.forwardRef((props, forwardedRef) => React__namespace.createElement("em", { ...props, ref: forwardedRef, className: classNames("rt-Em", props.className) }));
9629
9658
  Em.displayName = "Em";
9630
9659
  const Strong = React__namespace.forwardRef((props, forwardedRef) => React__namespace.createElement("strong", { ...props, ref: forwardedRef, className: classNames("rt-Strong", props.className) }));
@@ -12015,7 +12044,7 @@ var __publicField = (obj, key, value) => {
12015
12044
  });
12016
12045
  const clickableLinkContainer = "_clickableLinkContainer_1ace7_1";
12017
12046
  const TextFieldInputCopy = "_TextFieldInputCopy_1ace7_5";
12018
- const styles$a = {
12047
+ const styles$b = {
12019
12048
  clickableLinkContainer,
12020
12049
  TextFieldInputCopy
12021
12050
  };
@@ -12044,13 +12073,13 @@ var __publicField = (obj, key, value) => {
12044
12073
  placeholder: field.placeholder,
12045
12074
  color
12046
12075
  }
12047
- ) : /* @__PURE__ */ jsxRuntime.jsxs(TextField$1.Root, { className: styles$a.clickableLinkContainer, children: [
12076
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(TextField$1.Root, { className: styles$b.clickableLinkContainer, children: [
12048
12077
  /* @__PURE__ */ jsxRuntime.jsx(
12049
12078
  "div",
12050
12079
  {
12051
12080
  className: classNames$1(
12052
12081
  "rt-TextFieldInput rt-r-size-2 rt-variant-surface",
12053
- styles$a.TextFieldInputCopy
12082
+ styles$b.TextFieldInputCopy
12054
12083
  ),
12055
12084
  children: /* @__PURE__ */ jsxRuntime.jsx(
12056
12085
  Linkify,
@@ -12742,6 +12771,158 @@ var __publicField = (obj, key, value) => {
12742
12771
  __publicField(_MultiSelectField, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options.");
12743
12772
  __publicField(_MultiSelectField, "Icon", RiCheckboxLine);
12744
12773
  let MultiSelectField = _MultiSelectField;
12774
+ const QrScannerWrapper = "_QrScannerWrapper_1puz3_1";
12775
+ const styles$a = {
12776
+ QrScannerWrapper
12777
+ };
12778
+ const QrInput = React.memo((props) => {
12779
+ const [{ inputId, labelId, label, helpText, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
12780
+ const [showQrScanner, setShowQrScanner] = React.useState(false);
12781
+ const value = fieldProps.value;
12782
+ const handleQrScan = React.useCallback(
12783
+ (data) => {
12784
+ fieldProps.onChange({ target: { value: data } });
12785
+ setShowQrScanner(false);
12786
+ },
12787
+ [fieldProps]
12788
+ );
12789
+ const handleClearScanResult = React.useCallback(() => {
12790
+ fieldProps.onChange({ target: { value: "" } });
12791
+ }, [fieldProps]);
12792
+ const handleScanButtonClicked = React.useCallback(() => {
12793
+ setShowQrScanner(true);
12794
+ }, []);
12795
+ const handleQrScannerClose = React.useCallback(() => {
12796
+ setShowQrScanner(false);
12797
+ }, []);
12798
+ return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsxRuntime.jsxs(
12799
+ InputWithLabel,
12800
+ {
12801
+ size,
12802
+ severity,
12803
+ inputId,
12804
+ labelId,
12805
+ label: showInputOnly ? label : "",
12806
+ image: showInputOnly ? void 0 : field.image,
12807
+ flexProps: { direction: "column", justify: "start", align: "start", gap: "1" },
12808
+ children: [
12809
+ /* @__PURE__ */ jsxRuntime.jsx(
12810
+ blocks.Overlay,
12811
+ {
12812
+ open: showQrScanner,
12813
+ content: () => /* @__PURE__ */ jsxRuntime.jsx(QrScanner, { onQrScan: handleQrScan, onClose: handleQrScannerClose }),
12814
+ onOpenChange: setShowQrScanner
12815
+ }
12816
+ ),
12817
+ /* @__PURE__ */ jsxRuntime.jsxs(Flex, { width: "max-content", gap: "1", align: "center", children: [
12818
+ /* @__PURE__ */ jsxRuntime.jsxs(blocks.Button, { ...rest, variant: "soft", onClick: handleScanButtonClicked, children: [
12819
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.RiIcon, { icon: "RiQrCodeLine" }),
12820
+ "Scan"
12821
+ ] }),
12822
+ value && /* @__PURE__ */ jsxRuntime.jsx(Text, { color: "jade", size: "1", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.RiIcon, { icon: "RiCheckLine", style: { verticalAlign: "bottom" } }) })
12823
+ ] }),
12824
+ value && /* @__PURE__ */ jsxRuntime.jsx(Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { width: "max-content", gap: "2", align: "center", children: [
12825
+ /* @__PURE__ */ jsxRuntime.jsx(Code, { color: "gray", highContrast: true, children: value }),
12826
+ /* @__PURE__ */ jsxRuntime.jsx(
12827
+ blocks.IconButton,
12828
+ {
12829
+ severity: "info",
12830
+ variant: "ghost",
12831
+ "aria-label": "delete",
12832
+ size: "small",
12833
+ onClick: handleClearScanResult,
12834
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.RiIcon, { icon: "RiCloseLine" })
12835
+ }
12836
+ )
12837
+ ] }) })
12838
+ ]
12839
+ }
12840
+ ) });
12841
+ });
12842
+ QrInput.displayName = "QrInput";
12843
+ const QrScanner = React.memo((props) => {
12844
+ const { onQrScan, onClose } = props;
12845
+ const videoRef = React.useRef(null);
12846
+ const [isScannerLoading, setIsScannerLoading] = React.useState(false);
12847
+ React.useEffect(() => {
12848
+ if (!videoRef.current)
12849
+ return;
12850
+ const qrScanner = new QrScannerAPI(
12851
+ videoRef.current,
12852
+ (result) => {
12853
+ const data = result.data;
12854
+ onQrScan(data);
12855
+ qrScanner.destroy();
12856
+ },
12857
+ {
12858
+ highlightCodeOutline: true,
12859
+ highlightScanRegion: true,
12860
+ maxScansPerSecond: 1
12861
+ }
12862
+ );
12863
+ setIsScannerLoading(true);
12864
+ qrScanner.start().then(() => {
12865
+ setIsScannerLoading(false);
12866
+ }).catch(() => {
12867
+ setIsScannerLoading(false);
12868
+ });
12869
+ }, [onQrScan]);
12870
+ return /* @__PURE__ */ jsxRuntime.jsxs(
12871
+ Flex,
12872
+ {
12873
+ className: styles$a.QrScannerWrapper,
12874
+ width: "100%",
12875
+ height: "100%",
12876
+ direction: "column",
12877
+ gap: "2",
12878
+ justify: "center",
12879
+ position: "relative",
12880
+ children: [
12881
+ /* @__PURE__ */ jsxRuntime.jsx(Flex, { width: "100%", position: "absolute", top: "0", p: "2", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { "aria-label": "close", variant: "soft", severity: "info", highContrast: true, onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.RiIcon, { icon: "RiCloseLine" }) }) }),
12882
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { style: { maxWidth: "100%", maxHeight: "100%" }, position: "relative", children: [
12883
+ /* @__PURE__ */ jsxRuntime.jsx("video", { ref: videoRef, style: { width: "100%", height: "100%" } }),
12884
+ isScannerLoading && /* @__PURE__ */ jsxRuntime.jsx(
12885
+ Flex,
12886
+ {
12887
+ position: "absolute",
12888
+ inset: "0",
12889
+ style: { background: "var(--color-background)" },
12890
+ justify: "center",
12891
+ align: "center",
12892
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Spinner, {})
12893
+ }
12894
+ )
12895
+ ] })
12896
+ ]
12897
+ }
12898
+ );
12899
+ });
12900
+ QrScanner.displayName = "QrScanner";
12901
+ const emptyQrField = {
12902
+ ...emptyBaseField,
12903
+ type: "qr"
12904
+ };
12905
+ const _QrField = class _QrField extends BaseField {
12906
+ constructor(options) {
12907
+ super({ ...options, type: "qr" });
12908
+ __publicField(this, "onlyValidateAfterTouched", false);
12909
+ }
12910
+ serialize() {
12911
+ return super._serialize();
12912
+ }
12913
+ static deserialize(data) {
12914
+ if (data.type !== "qr")
12915
+ throw new Error("Type mismatch.");
12916
+ return new _QrField(data);
12917
+ }
12918
+ getInput(props) {
12919
+ return /* @__PURE__ */ jsxRuntime.jsx(QrInput, { ...props, field: this });
12920
+ }
12921
+ };
12922
+ __publicField(_QrField, "fieldTypeName", "QR");
12923
+ __publicField(_QrField, "fieldTypeDescription", "Used for scanning/reading QR codes.");
12924
+ __publicField(_QrField, "Icon", RiQrCodeLine);
12925
+ let QrField = _QrField;
12745
12926
  const FieldInputCloner = React.memo((props) => {
12746
12927
  const { field, ...rest } = props;
12747
12928
  const [{ value: identifier }] = formik.useField(field.options.clonedFieldIdentifier);
@@ -13999,6 +14180,7 @@ var __publicField = (obj, key, value) => {
13999
14180
  text: TextField,
14000
14181
  custom: CustomField,
14001
14182
  upload: UploadField,
14183
+ qr: QrField,
14002
14184
  // TODO: Underscore
14003
14185
  "multi-string": MultiStringField,
14004
14186
  "multi-select": MultiSelectField
@@ -14012,6 +14194,7 @@ var __publicField = (obj, key, value) => {
14012
14194
  text: emptyTextField,
14013
14195
  custom: emptyCustomField,
14014
14196
  upload: emptyUploadField,
14197
+ qr: emptyQrField,
14015
14198
  // TODO: Underscore
14016
14199
  "multi-string": emptyMultiStringField,
14017
14200
  "multi-select": emptyMultiSelectField
@@ -14099,7 +14282,7 @@ var __publicField = (obj, key, value) => {
14099
14282
  return /* @__PURE__ */ jsxRuntime.jsx(Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", gap: "3", children: [
14100
14283
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", children: [
14101
14284
  /* @__PURE__ */ jsxRuntime.jsx(Heading, { as: "h3", size: "3", children: label }),
14102
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: styles$b.description, children: description2 })
14285
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: styles$c.description, children: description2 })
14103
14286
  ] }),
14104
14287
  inputs
14105
14288
  ] }) });
@@ -14342,7 +14525,7 @@ var __publicField = (obj, key, value) => {
14342
14525
  [schema.title]
14343
14526
  );
14344
14527
  const Description = React.useMemo(
14345
- () => typeof schema.description === "string" ? /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: styles$b.description, children: schema.description }) : schema.description,
14528
+ () => typeof schema.description === "string" ? /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: styles$c.description, children: schema.description }) : schema.description,
14346
14529
  [schema.description]
14347
14530
  );
14348
14531
  const inputs = useFieldInputs(schema.fields, { formId: formId2, disabled: readonly });
@@ -14358,7 +14541,7 @@ var __publicField = (obj, key, value) => {
14358
14541
  !hideDescription && Description
14359
14542
  ] }) }),
14360
14543
  inputs,
14361
- !readonly && /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { className: styles$b.floatingButtonContainer, align: "center", justify: "end", gap: "2", children: [
14544
+ !readonly && /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { className: styles$c.floatingButtonContainer, align: "center", justify: "end", gap: "2", children: [
14362
14545
  cancelText && /* @__PURE__ */ jsxRuntime.jsx(blocks.Button, { severity: "info", ...buttonProps, type: "button", onClick: onCancel, children: cancelText }),
14363
14546
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Button, { ...buttonProps, type: "submit", disabled: !formik$1.isValid, children: submitText })
14364
14547
  ] })
@@ -15706,12 +15889,12 @@ var __publicField = (obj, key, value) => {
15706
15889
  });
15707
15890
  const previewSchema = React.useMemo(() => formRevisionToSchema(formik$1.values), [formik$1.values]);
15708
15891
  return /* @__PURE__ */ jsxRuntime.jsx(Tabs.Root, { ref, defaultValue: "edit", children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", gap: "2", children: [
15709
- showTabs && /* @__PURE__ */ jsxRuntime.jsxs(Tabs.List, { className: classNames$1(styles$c.tabsList, tabsListClassName), children: [
15710
- /* @__PURE__ */ jsxRuntime.jsx(Tabs.Trigger, { className: styles$c.tabTrigger, value: "edit", children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { align: "center", gap: "2", children: [
15892
+ showTabs && /* @__PURE__ */ jsxRuntime.jsxs(Tabs.List, { className: classNames$1(styles$d.tabsList, tabsListClassName), children: [
15893
+ /* @__PURE__ */ jsxRuntime.jsx(Tabs.Trigger, { className: styles$d.tabTrigger, value: "edit", children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { align: "center", gap: "2", children: [
15711
15894
  /* @__PURE__ */ jsxRuntime.jsx(blocks.RiIcon, { icon: "RiPencilLine" }),
15712
15895
  "Edit"
15713
15896
  ] }) }),
15714
- /* @__PURE__ */ jsxRuntime.jsx(Tabs.Trigger, { className: styles$c.tabTrigger, value: "preview", children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { align: "center", gap: "2", children: [
15897
+ /* @__PURE__ */ jsxRuntime.jsx(Tabs.Trigger, { className: styles$d.tabTrigger, value: "preview", children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { align: "center", gap: "2", children: [
15715
15898
  /* @__PURE__ */ jsxRuntime.jsx(blocks.RiIcon, { icon: "RiEyeLine" }),
15716
15899
  "Preview"
15717
15900
  ] }) })
@@ -15735,8 +15918,8 @@ var __publicField = (obj, key, value) => {
15735
15918
  render: ({ setValue, value, meta }) => /* @__PURE__ */ jsxRuntime.jsx(InputWithHelpText, { severity: "danger", helpText: meta.error ?? null, children: /* @__PURE__ */ jsxRuntime.jsx(
15736
15919
  blocks.Input,
15737
15920
  {
15738
- className: classNames$1(styles$c.title, {
15739
- [styles$c.error]: meta.error
15921
+ className: classNames$1(styles$d.title, {
15922
+ [styles$d.error]: meta.error
15740
15923
  }),
15741
15924
  placeholder: "Form title",
15742
15925
  value,
@@ -15758,7 +15941,7 @@ var __publicField = (obj, key, value) => {
15758
15941
  render: ({ setValue, value }) => /* @__PURE__ */ jsxRuntime.jsx(
15759
15942
  blocks.TextArea,
15760
15943
  {
15761
- className: styles$c.description,
15944
+ className: styles$d.description,
15762
15945
  placeholder: "Explain the purpose of this form",
15763
15946
  value,
15764
15947
  onChange: (event) => {
@@ -15776,7 +15959,7 @@ var __publicField = (obj, key, value) => {
15776
15959
  /* @__PURE__ */ jsxRuntime.jsx(FieldsEditor, { fieldsOnly }),
15777
15960
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { severity: "danger", size: "1", children: typeof formik$1.errors.fields === "string" && formik$1.errors.fields })
15778
15961
  ] }),
15779
- /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { className: styles$c.floatingButtonContainer, align: "center", justify: "end", gap: "2", children: [
15962
+ /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { className: styles$d.floatingButtonContainer, align: "center", justify: "end", gap: "2", children: [
15780
15963
  onCancel && /* @__PURE__ */ jsxRuntime.jsx(blocks.Button, { type: "button", variant: "solid", severity: "info", onClick: onCancel, children: "Cancel" }),
15781
15964
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Button, { type: "submit", children: "Save form" })
15782
15965
  ] })
@@ -15811,6 +15994,9 @@ var __publicField = (obj, key, value) => {
15811
15994
  NumberInput,
15812
15995
  PatchField,
15813
15996
  PatchFormProvider,
15997
+ QrField,
15998
+ QrInput,
15999
+ QrScanner,
15814
16000
  SelectField,
15815
16001
  SelectInput,
15816
16002
  StringField,
@@ -15825,6 +16011,7 @@ var __publicField = (obj, key, value) => {
15825
16011
  emptyMultiSelectField,
15826
16012
  emptyMultiStringField,
15827
16013
  emptyNumberField,
16014
+ emptyQrField,
15828
16015
  emptySelectField,
15829
16016
  emptyStringField,
15830
16017
  emptyTextField,
@@ -15914,6 +16101,9 @@ var __publicField = (obj, key, value) => {
15914
16101
  exports2.ProjectFileService = ProjectFileService;
15915
16102
  exports2.ProjectService = ProjectService;
15916
16103
  exports2.ProjectType = ProjectType;
16104
+ exports2.QrField = QrField;
16105
+ exports2.QrInput = QrInput;
16106
+ exports2.QrScanner = QrScanner;
15917
16107
  exports2.SDKContext = SDKContext;
15918
16108
  exports2.SDKProvider = SDKProvider;
15919
16109
  exports2.SUPPORTED_IMAGE_FILE_TYPES = SUPPORTED_IMAGE_FILE_TYPES;
@@ -16037,6 +16227,7 @@ var __publicField = (obj, key, value) => {
16037
16227
  exports2.emptyMultiSelectField = emptyMultiSelectField;
16038
16228
  exports2.emptyMultiStringField = emptyMultiStringField;
16039
16229
  exports2.emptyNumberField = emptyNumberField;
16230
+ exports2.emptyQrField = emptyQrField;
16040
16231
  exports2.emptySelectField = emptySelectField;
16041
16232
  exports2.emptyStringField = emptyStringField;
16042
16233
  exports2.emptyTextField = emptyTextField;