@beda.software/web-item-controls 0.1.25 → 0.1.27

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.
Files changed (72) hide show
  1. package/dist/components/ModalQuestionnaireGroupItem/index.js +3 -2
  2. package/dist/components/SearchBar/SearchBarColumn/ChoiceColumn/hooks.js +3 -2
  3. package/dist/contexts/image-annotation.d.ts +23 -0
  4. package/dist/contexts/image-annotation.d.ts.map +1 -0
  5. package/dist/contexts/image-annotation.js +5 -0
  6. package/dist/contexts/index.d.ts +1 -0
  7. package/dist/contexts/index.d.ts.map +1 -1
  8. package/dist/contexts/index.js +4 -2
  9. package/dist/controls/Choice/index.js +11 -10
  10. package/dist/controls/Display/index.js +4 -2
  11. package/dist/controls/GroupTable/RenderFormItemReadOnly/index.js +4 -2
  12. package/dist/controls/ImageAnnotation/AnnotationImage.d.ts +9 -14
  13. package/dist/controls/ImageAnnotation/AnnotationImage.d.ts.map +1 -1
  14. package/dist/controls/ImageAnnotation/AnnotationImage.js +48 -32
  15. package/dist/controls/ImageAnnotation/BodyAnnotationImage/body-regions.d.ts +23 -0
  16. package/dist/controls/ImageAnnotation/BodyAnnotationImage/body-regions.d.ts.map +1 -0
  17. package/dist/controls/ImageAnnotation/BodyAnnotationImage/body-regions.js +436 -0
  18. package/dist/controls/ImageAnnotation/BodyAnnotationImage/index.d.ts +13 -0
  19. package/dist/controls/ImageAnnotation/BodyAnnotationImage/index.d.ts.map +1 -0
  20. package/dist/controls/ImageAnnotation/BodyAnnotationImage/index.js +95 -0
  21. package/dist/controls/ImageAnnotation/BodyAnnotationImage/labels.d.ts +3 -0
  22. package/dist/controls/ImageAnnotation/BodyAnnotationImage/labels.d.ts.map +1 -0
  23. package/dist/controls/ImageAnnotation/BodyAnnotationImage/labels.js +224 -0
  24. package/dist/controls/ImageAnnotation/BodyAnnotationImage/styles.d.ts +17 -0
  25. package/dist/controls/ImageAnnotation/BodyAnnotationImage/styles.d.ts.map +1 -0
  26. package/dist/controls/ImageAnnotation/BodyAnnotationImage/styles.js +42 -0
  27. package/dist/controls/ImageAnnotation/BodyAnnotationImage/utils.d.ts +17 -0
  28. package/dist/controls/ImageAnnotation/BodyAnnotationImage/utils.d.ts.map +1 -0
  29. package/dist/controls/ImageAnnotation/BodyAnnotationImage/utils.js +35 -0
  30. package/dist/controls/ImageAnnotation/index.d.ts +2 -3
  31. package/dist/controls/ImageAnnotation/index.d.ts.map +1 -1
  32. package/dist/controls/ImageAnnotation/index.js +60 -92
  33. package/dist/controls/ImageAnnotation/useAnnotationImageComponent.d.ts +5 -0
  34. package/dist/controls/ImageAnnotation/useAnnotationImageComponent.d.ts.map +1 -0
  35. package/dist/controls/ImageAnnotation/useAnnotationImageComponent.js +11 -0
  36. package/dist/controls/ImageAnnotation/utils.d.ts +14 -1
  37. package/dist/controls/ImageAnnotation/utils.d.ts.map +1 -1
  38. package/dist/controls/ImageAnnotation/utils.js +38 -6
  39. package/dist/controls/InlineChoice/index.d.ts.map +1 -1
  40. package/dist/controls/InlineChoice/index.js +46 -55
  41. package/dist/controls/InlineChoice/styles.d.ts +27 -0
  42. package/dist/controls/InlineChoice/styles.d.ts.map +1 -0
  43. package/dist/controls/InlineChoice/styles.js +40 -0
  44. package/dist/controls/InlineChoice/utils.d.ts +5 -0
  45. package/dist/controls/InlineChoice/utils.d.ts.map +1 -0
  46. package/dist/controls/InlineChoice/utils.js +11 -0
  47. package/dist/controls/controls.js +11 -14
  48. package/dist/controls/index.d.ts +1 -0
  49. package/dist/controls/index.d.ts.map +1 -1
  50. package/dist/controls/index.js +77 -75
  51. package/dist/locale/de/messages.d.ts.map +1 -1
  52. package/dist/locale/de/messages.js +1 -1
  53. package/dist/locale/en/messages.d.ts.map +1 -1
  54. package/dist/locale/en/messages.js +1 -1
  55. package/dist/locale/es/messages.d.ts.map +1 -1
  56. package/dist/locale/es/messages.js +1 -1
  57. package/dist/locale/ru/messages.d.ts.map +1 -1
  58. package/dist/locale/ru/messages.js +1 -1
  59. package/dist/readonly-controls/Display/index.js +4 -2
  60. package/dist/readonly-controls/ImageAnnotation/index.d.ts.map +1 -1
  61. package/dist/readonly-controls/ImageAnnotation/index.js +25 -30
  62. package/dist/readonly-controls/MarkdownRender/index.d.ts.map +1 -1
  63. package/dist/readonly-controls/MarkdownRender/index.js +51 -41
  64. package/package.json +3 -2
  65. package/src/locale/de/messages.po +172 -8
  66. package/src/locale/de/messages.ts +1 -1
  67. package/src/locale/en/messages.po +172 -8
  68. package/src/locale/en/messages.ts +1 -1
  69. package/src/locale/es/messages.po +172 -8
  70. package/src/locale/es/messages.ts +1 -1
  71. package/src/locale/ru/messages.po +172 -8
  72. package/src/locale/ru/messages.ts +1 -1
@@ -12,6 +12,7 @@ import "../Select/styles.js";
12
12
  import "lodash";
13
13
  import "../../contexts/valueset-expand.js";
14
14
  import "../../contexts/markdown-editor-context.js";
15
+ import "../../contexts/image-annotation.js";
15
16
  import "../SearchBar/SearchBarColumn/DateColumn/index.js";
16
17
  import "@lingui/core";
17
18
  import "yup";
@@ -33,7 +34,7 @@ import "../Table/TableCards/styles.js";
33
34
  import "../TimePicker/index.js";
34
35
  import m from "../BaseQuestionnaireResponseForm/BaseQuestionnaireResponseForm.module.scss.js";
35
36
  import { useModalQuestionnaireGroupItem as I } from "./hooks.js";
36
- function Z(t) {
37
+ function $(t) {
37
38
  const {
38
39
  open: i,
39
40
  groupItem: e,
@@ -54,5 +55,5 @@ function Z(t) {
54
55
  return /* @__PURE__ */ o(h, { title: u, open: i, onOk: a, onCancel: p, destroyOnClose: !0, closable: !1, children: /* @__PURE__ */ o("div", { className: d(m.content, "form__content", m.form), children: /* @__PURE__ */ o(f, { questionItems: s, parentPath: [...c], context: l }) }) });
55
56
  }
56
57
  export {
57
- Z as ModalQuestionnaireGroupItem
58
+ $ as ModalQuestionnaireGroupItem
58
59
  };
@@ -2,7 +2,8 @@ import i from "lodash";
2
2
  import { useContext as p, useCallback as f } from "react";
3
3
  import { ValueSetExpandProvider as g } from "../../../../contexts/valueset-expand.js";
4
4
  import "../../../../contexts/markdown-editor-context.js";
5
- function h(u) {
5
+ import "../../../../contexts/image-annotation.js";
6
+ function L(u) {
6
7
  const {
7
8
  columnFilterValue: r,
8
9
  onChange: o
@@ -33,5 +34,5 @@ function h(u) {
33
34
  };
34
35
  }
35
36
  export {
36
- h as useChoiceColumn
37
+ L as useChoiceColumn
37
38
  };
@@ -0,0 +1,23 @@
1
+ import { ComponentType } from 'react';
2
+ import { FCEQuestionnaireItem, FormItems } from 'sdc-qrf';
3
+ export interface AnnotationImageProps {
4
+ questionItem: FCEQuestionnaireItem;
5
+ items: FormItems[];
6
+ activeIndex?: number;
7
+ /** Fired with a new annotation item holding the clicked location. Omit to make the image readonly */
8
+ onAdd?: (item: FormItems) => void;
9
+ /** Fired when a marker is clicked. Omit to disable markers */
10
+ onSelect?: (index: number) => void;
11
+ }
12
+ /**
13
+ * Image annotation renderer. Besides the component itself it decides which child items of the group store
14
+ * the annotation location (e.g. x/y coordinates or a body site code) and which ones describe the annotation.
15
+ */
16
+ export type AnnotationImageComponent = ComponentType<AnnotationImageProps> & {
17
+ /** Child items shown in the annotation details panel; undefined when the group doesn't fit the renderer */
18
+ getDetailItems: (questionItem: FCEQuestionnaireItem) => FCEQuestionnaireItem[] | undefined;
19
+ };
20
+ /** Custom image annotation renderers keyed by the `backgroundImage` url of the image-annotation group */
21
+ export type ImageAnnotationComponents = Record<string, AnnotationImageComponent>;
22
+ export declare const ImageAnnotationProvider: import('react').Context<ImageAnnotationComponents>;
23
+ //# sourceMappingURL=image-annotation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-annotation.d.ts","sourceRoot":"","sources":["../../src/contexts/image-annotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAiB,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,WAAW,oBAAoB;IACjC,YAAY,EAAE,oBAAoB,CAAC;IACnC,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qGAAqG;IACrG,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IAClC,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAED;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,aAAa,CAAC,oBAAoB,CAAC,GAAG;IACzE,2GAA2G;IAC3G,cAAc,EAAE,CAAC,YAAY,EAAE,oBAAoB,KAAK,oBAAoB,EAAE,GAAG,SAAS,CAAC;CAC9F,CAAC;AAEF,yGAAyG;AACzG,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;AAEjF,eAAO,MAAM,uBAAuB,oDAA+C,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { createContext as o } from "react";
2
+ const e = o({});
3
+ export {
4
+ e as ImageAnnotationProvider
5
+ };
@@ -1,3 +1,4 @@
1
1
  export * from './valueset-expand';
2
2
  export * from './markdown-editor-context';
3
+ export * from './image-annotation';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC"}
@@ -1,7 +1,9 @@
1
1
  import { ValueSetExpandProvider as e } from "./valueset-expand.js";
2
- import { MarkdownProcessorContext as a, defaultMarkdownProcessor as d } from "./markdown-editor-context.js";
2
+ import { MarkdownProcessorContext as a, defaultMarkdownProcessor as n } from "./markdown-editor-context.js";
3
+ import { ImageAnnotationProvider as x } from "./image-annotation.js";
3
4
  export {
5
+ x as ImageAnnotationProvider,
4
6
  a as MarkdownProcessorContext,
5
7
  e as ValueSetExpandProvider,
6
- d as defaultMarkdownProcessor
8
+ n as defaultMarkdownProcessor
7
9
  };
@@ -9,12 +9,13 @@ import { useFieldController as w } from "../../components/BaseQuestionnaireRespo
9
9
  import { Select as V, AsyncSelect as k } from "../../components/Select/index.js";
10
10
  import { ValueSetExpandProvider as D } from "../../contexts/valueset-expand.js";
11
11
  import "../../contexts/markdown-editor-context.js";
12
+ import "../../contexts/image-annotation.js";
12
13
  import { getDisplay as S } from "../../utils/questionnaire.js";
13
14
  function E(d) {
14
15
  const {
15
16
  value: e,
16
17
  onChange: i,
17
- options: u,
18
+ options: p,
18
19
  repeats: a = !1,
19
20
  placeholder: l = C._(
20
21
  /*i18n*/
@@ -25,17 +26,17 @@ function E(d) {
25
26
  choiceColumn: s,
26
27
  disabled: c
27
28
  } = d;
28
- return /* @__PURE__ */ r(O, { children: /* @__PURE__ */ r(V, { value: e, options: u.map((o) => ({
29
+ return /* @__PURE__ */ r(O, { children: /* @__PURE__ */ r(V, { value: e, options: p.map((o) => ({
29
30
  value: I(o, "value")
30
31
  })), className: v.select, onChange: (o) => i(o), isOptionSelected: (o) => !!e && (e == null ? void 0 : e.findIndex((n) => g.isEqual(n == null ? void 0 : n.value, o.value))) !== -1, isMulti: a, getOptionLabel: (o) => S(o.value, s) || "", classNamePrefix: "react-select", placeholder: l, isDisabled: c }) });
31
32
  }
32
- function G({
33
+ function H({
33
34
  parentPath: d,
34
35
  questionItem: e
35
36
  }) {
36
37
  const {
37
38
  linkId: i,
38
- answerOption: u,
39
+ answerOption: p,
39
40
  repeats: a,
40
41
  answerValueSet: l,
41
42
  choiceColumn: s
@@ -51,25 +52,25 @@ function G({
51
52
  ),
52
53
  disabled: t
53
54
  } = w(c, e);
54
- return l ? /* @__PURE__ */ r(h.Item, { ...n, "data-testid": "question-choice", "data-linkid": i, children: /* @__PURE__ */ r(F, { answerValueSet: l, value: o ?? [], onChange: m, repeats: a, placeholder: f, choiceColumn: s, preferredTerminologyServer: e.preferredTerminologyServer, disabled: t }) }) : /* @__PURE__ */ r(h.Item, { ...n, "data-testid": "question-choice", "data-linkid": i, children: /* @__PURE__ */ r(E, { options: u ?? [], value: o ?? [], onChange: m, repeats: a, placeholder: f, choiceColumn: s, disabled: t }) });
55
+ return l ? /* @__PURE__ */ r(h.Item, { ...n, "data-testid": "question-choice", "data-linkid": i, children: /* @__PURE__ */ r(F, { answerValueSet: l, value: o ?? [], onChange: m, repeats: a, placeholder: f, choiceColumn: s, preferredTerminologyServer: e.preferredTerminologyServer, disabled: t }) }) : /* @__PURE__ */ r(h.Item, { ...n, "data-testid": "question-choice", "data-linkid": i, children: /* @__PURE__ */ r(E, { options: p ?? [], value: o ?? [], onChange: m, repeats: a, placeholder: f, choiceColumn: s, disabled: t }) });
55
56
  }
56
57
  function F(d) {
57
58
  const {
58
59
  answerValueSet: e,
59
60
  value: i,
60
- onChange: u,
61
+ onChange: p,
61
62
  repeats: a = !1,
62
63
  placeholder: l,
63
64
  choiceColumn: s,
64
65
  preferredTerminologyServer: c,
65
66
  disabled: o
66
- } = d, n = x(D), m = y(async (t) => n(e, t, c), [e, n, c]), f = b((t, p) => {
67
- (async () => p(await m(t)))();
67
+ } = d, n = x(D), m = y(async (t) => n(e, t, c), [e, n, c]), f = b((t, u) => {
68
+ (async () => u(await m(t)))();
68
69
  }, 500);
69
- return /* @__PURE__ */ r(k, { loadOptions: f, defaultOptions: !0, value: i, onChange: (t) => u(t), isOptionSelected: (t) => !!i && (i == null ? void 0 : i.findIndex((p) => g.isEqual(p == null ? void 0 : p.value, t.value))) !== -1, isMulti: a, getOptionLabel: (t) => S(t.value, s) || "", placeholder: l, isDisabled: o });
70
+ return /* @__PURE__ */ r(k, { loadOptions: f, defaultOptions: !0, value: i, onChange: (t) => p(t), isOptionSelected: (t) => !!i && (i == null ? void 0 : i.findIndex((u) => g.isEqual(u == null ? void 0 : u.value, t.value))) !== -1, isMulti: a, getOptionLabel: (t) => S(t.value, s) || "", placeholder: l, isDisabled: o });
70
71
  }
71
72
  export {
72
73
  E as ChoiceQuestionSelect,
73
74
  F as ChoiceQuestionValueSet,
74
- G as QuestionChoice
75
+ H as QuestionChoice
75
76
  };
@@ -31,13 +31,15 @@ import "../../components/Wizard/styles.js";
31
31
  import "../GroupWizard/index.js";
32
32
  import "../../readonly-controls/GroupWizard/styles.js";
33
33
  import "../ImageAnnotation/styles.js";
34
+ import "../../contexts/image-annotation.js";
35
+ import "../ImageAnnotation/AnnotationImage.js";
34
36
  import { MarkdownRender as c } from "../../readonly-controls/MarkdownRender/index.js";
35
37
  import "react-select";
36
38
  import "react-select/async";
37
39
  import "../../components/Select/styles.js";
38
40
  import "fhirpath/fhir-context/r4";
39
41
  import "../../sharedState/index.js";
40
- function C({
42
+ function tr({
41
43
  questionItem: m
42
44
  }) {
43
45
  var p, e;
@@ -63,6 +65,6 @@ const a = ({
63
65
  return t == null ? void 0 : t.map((r, o) => r.startsWith("http://") || r.startsWith("https://") ? /* @__PURE__ */ i("a", { href: r, target: "_blank", rel: "noreferrer", children: r }, o) : /* @__PURE__ */ i("span", { children: r }, o));
64
66
  };
65
67
  export {
66
- C as Display,
68
+ tr as Display,
67
69
  a as TextWithLink
68
70
  };
@@ -30,6 +30,8 @@ import "../../../components/Wizard/styles.js";
30
30
  import "../../GroupWizard/index.js";
31
31
  import "../../../readonly-controls/GroupWizard/styles.js";
32
32
  import "../../ImageAnnotation/styles.js";
33
+ import "../../../contexts/image-annotation.js";
34
+ import "../../ImageAnnotation/AnnotationImage.js";
33
35
  import { MarkdownRender as a } from "../../../readonly-controls/MarkdownRender/index.js";
34
36
  import "react-select";
35
37
  import "react-select/async";
@@ -38,7 +40,7 @@ import "fhirpath/fhir-context/r4";
38
40
  import "../../../sharedState/index.js";
39
41
  import { useRenderFormItemReadOnly as h } from "./hooks.js";
40
42
  import { S as i } from "./styles.js";
41
- const _ = (p) => {
43
+ const rr = (p) => {
42
44
  const {
43
45
  rows: m,
44
46
  emptySymbol: e
@@ -52,5 +54,5 @@ const _ = (p) => {
52
54
  }) });
53
55
  };
54
56
  export {
55
- _ as RenderFormItemReadOnly
57
+ rr as RenderFormItemReadOnly
56
58
  };
@@ -1,16 +1,11 @@
1
- import { MouseEvent } from 'react';
2
- import { FormItems } from 'sdc-qrf';
3
- interface AnnotationImageProps {
4
- imageUrl?: string;
5
- alt?: string;
6
- items: FormItems[];
7
- xLinkId: string;
8
- yLinkId: string;
9
- activeIndex?: number;
10
- onImageClick?: (event: MouseEvent<HTMLDivElement>) => void;
11
- onMarkerClick?: (index: number) => void;
1
+ import { AnnotationImageProps } from '../../contexts/image-annotation';
2
+ import { getAnnotationDetailItems } from './utils';
3
+ /**
4
+ * Image (`backgroundImage` of the group) with numbered markers positioned by x/y percentages
5
+ * stored in the first two child items. Shared by the editable and readonly views.
6
+ */
7
+ export declare function AnnotationImage(props: AnnotationImageProps): import("react/jsx-runtime").JSX.Element | null;
8
+ export declare namespace AnnotationImage {
9
+ var getDetailItems: typeof getAnnotationDetailItems;
12
10
  }
13
- /** Image with numbered markers positioned by x/y percentages. Shared by the editable and readonly views. */
14
- export declare function AnnotationImage(props: AnnotationImageProps): import("react/jsx-runtime").JSX.Element;
15
- export {};
16
11
  //# sourceMappingURL=AnnotationImage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnnotationImage.d.ts","sourceRoot":"","sources":["../../../src/controls/ImageAnnotation/AnnotationImage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,SAAS,EAAc,MAAM,SAAS,CAAC;AAKhD,UAAU,oBAAoB;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC3D,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,4GAA4G;AAC5G,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CAkC1D"}
1
+ {"version":3,"file":"AnnotationImage.d.ts","sourceRoot":"","sources":["../../../src/controls/ImageAnnotation/AnnotationImage.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAGrE,OAAO,EAAyB,wBAAwB,EAAgD,MAAM,SAAS,CAAC;AAExH;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,kDAgE1D;yBAhEe,eAAe"}
@@ -1,37 +1,53 @@
1
- import { jsxs as $, jsx as m } from "react/jsx-runtime";
2
- import { i18n as k } from "@lingui/core";
3
- import { getItemKey as b } from "sdc-qrf";
4
- import { S as r } from "./styles.js";
5
- import { getCoordinate as s } from "./utils.js";
6
- function x(c) {
1
+ import { jsxs as u, Fragment as v, jsx as a } from "react/jsx-runtime";
2
+ import { i18n as I } from "@lingui/core";
3
+ import { getItemKey as A, populateItemKey as j } from "sdc-qrf";
4
+ import { S as o } from "./styles.js";
5
+ import { getCoordinateItems as w, getCoordinate as p, buildCoordinateAnswer as f, toPercent as k, getAnnotationDetailItems as x } from "./utils.js";
6
+ function B(h) {
7
+ var d;
7
8
  const {
8
- imageUrl: o,
9
- alt: p,
10
- items: d,
11
- xLinkId: g,
12
- yLinkId: f,
13
- activeIndex: I,
14
- onImageClick: i,
15
- onMarkerClick: a
16
- } = c;
17
- return /* @__PURE__ */ $(r.ImageWrapper, { $clickable: !!i, onClick: i, "data-testid": "image-annotation-canvas", children: [
18
- o ? /* @__PURE__ */ m(r.Image, { src: o, alt: p ?? "", draggable: !1 }) : null,
19
- d.map((e, t) => {
20
- const n = s(e, g), l = s(e, f);
21
- return n === void 0 || l === void 0 ? null : /* @__PURE__ */ m(r.Marker, { type: "button", disabled: !a, $active: t === I, style: {
22
- left: `${n}%`,
23
- top: `${l}%`
24
- }, onClick: (u) => {
25
- u.stopPropagation(), a == null || a(t);
26
- }, "aria-label": `${k._(
27
- /*i18n*/
28
- {
29
- id: "V0Qg8j"
30
- }
31
- )} ${t + 1}`, "data-testid": `annotation-marker-${t}`, children: t + 1 }, b(e));
32
- })
9
+ questionItem: n,
10
+ items: b,
11
+ activeIndex: C,
12
+ onAdd: i,
13
+ onSelect: r
14
+ } = h, l = w(n);
15
+ if (!l)
16
+ return null;
17
+ const [m, c] = l, $ = (e) => {
18
+ const t = e.currentTarget.getBoundingClientRect();
19
+ !i || !t.width || !t.height || i(j({
20
+ [m.linkId]: f(k(e.clientX - t.left, t.width)),
21
+ [c.linkId]: f(k(e.clientY - t.top, t.height))
22
+ }));
23
+ };
24
+ return /* @__PURE__ */ u(v, { children: [
25
+ i ? /* @__PURE__ */ a(o.Hint, { children: I._(
26
+ /*i18n*/
27
+ {
28
+ id: "2mt1iB"
29
+ }
30
+ ) }) : null,
31
+ /* @__PURE__ */ u(o.ImageWrapper, { $clickable: !!i, onClick: i ? $ : void 0, "data-testid": "image-annotation-canvas", children: [
32
+ (d = n.backgroundImage) != null && d.url ? /* @__PURE__ */ a(o.Image, { src: n.backgroundImage.url, alt: n.text ?? "", draggable: !1 }) : null,
33
+ b.map((e, t) => {
34
+ const s = p(e, m.linkId), g = p(e, c.linkId);
35
+ return s === void 0 || g === void 0 ? null : /* @__PURE__ */ a(o.Marker, { type: "button", disabled: !r, $active: t === C, style: {
36
+ left: `${s}%`,
37
+ top: `${g}%`
38
+ }, onClick: (y) => {
39
+ y.stopPropagation(), r == null || r(t);
40
+ }, "aria-label": `${I._(
41
+ /*i18n*/
42
+ {
43
+ id: "V0Qg8j"
44
+ }
45
+ )} ${t + 1}`, "data-testid": `annotation-marker-${t}`, children: t + 1 }, A(e));
46
+ })
47
+ ] })
33
48
  ] });
34
49
  }
50
+ B.getDetailItems = x;
35
51
  export {
36
- x as AnnotationImage
52
+ B as AnnotationImage
37
53
  };
@@ -0,0 +1,23 @@
1
+ export declare const BODY_VIEW_BOX: {
2
+ width: number;
3
+ height: number;
4
+ };
5
+ export type BodyView = 'front' | 'back';
6
+ export type BodyRegionKey = 'face' | 'backOfHead' | 'leftNeck' | 'rightNeck' | 'leftShoulder' | 'rightShoulder' | 'leftChest' | 'rightChest' | 'leftUpperBack' | 'rightUpperBack' | 'leftFlank' | 'rightFlank' | 'leftAbdomen' | 'rightAbdomen' | 'leftLowerBack' | 'rightLowerBack' | 'leftUpperArm' | 'rightUpperArm' | 'leftForearm' | 'rightForearm' | 'leftGroin' | 'rightGroin' | 'leftButtock' | 'rightButtock' | 'leftThigh' | 'rightThigh' | 'leftKnee' | 'rightKnee' | 'leftBackOfKnee' | 'rightBackOfKnee' | 'leftLowerLeg' | 'rightLowerLeg' | 'leftCalf' | 'rightCalf' | 'leftHeel' | 'rightHeel';
7
+ export interface BodyRegion {
8
+ key: BodyRegionKey;
9
+ code: string;
10
+ paths: string[];
11
+ /** Centroid of the largest region path in view box coordinates, used to place the annotation number */
12
+ label: {
13
+ x: number;
14
+ y: number;
15
+ };
16
+ }
17
+ export interface BodyViewConfig {
18
+ /** Maps the view paths into the view box */
19
+ transform?: string;
20
+ regions: BodyRegion[];
21
+ }
22
+ export declare const BODY_VIEWS: Record<BodyView, BodyViewConfig>;
23
+ //# sourceMappingURL=body-regions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"body-regions.d.ts","sourceRoot":"","sources":["../../../../src/controls/ImageAnnotation/BodyAnnotationImage/body-regions.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;;CAA8B,CAAC;AA+HzD,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAExC,MAAM,MAAM,aAAa,GACnB,MAAM,GACN,YAAY,GACZ,UAAU,GACV,WAAW,GACX,cAAc,GACd,eAAe,GACf,WAAW,GACX,YAAY,GACZ,eAAe,GACf,gBAAgB,GAChB,WAAW,GACX,YAAY,GACZ,aAAa,GACb,cAAc,GACd,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,eAAe,GACf,aAAa,GACb,cAAc,GACd,WAAW,GACX,YAAY,GACZ,aAAa,GACb,cAAc,GACd,WAAW,GACX,YAAY,GACZ,UAAU,GACV,WAAW,GACX,gBAAgB,GAChB,iBAAiB,GACjB,cAAc,GACd,eAAe,GACf,UAAU,GACV,WAAW,GACX,UAAU,GACV,WAAW,CAAC;AAElB,MAAM,WAAW,UAAU;IACvB,GAAG,EAAE,aAAa,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,uGAAuG;IACvG,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACnC;AAED,MAAM,WAAW,cAAc;IAC3B,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,UAAU,EAAE,CAAC;CACzB;AAED,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE,cAAc,CA6QvD,CAAC"}