@broberg/bodymap 0.6.0 → 0.7.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/dist/three.cjs CHANGED
@@ -183,6 +183,7 @@ var LABELS_DA = {
183
183
  intensity: "Intensitet (0-10)",
184
184
  quality: "Kvalitet",
185
185
  remove: "Fjern punkt",
186
+ close: "Luk",
186
187
  front: "Forfra",
187
188
  back: "Bagfra",
188
189
  empty: "V\xE6lg en kropsdel for at markere smerte.",
@@ -205,6 +206,7 @@ var LABELS_EN = {
205
206
  intensity: "Intensity (0-10)",
206
207
  quality: "Quality",
207
208
  remove: "Remove point",
209
+ close: "Close",
208
210
  front: "Front",
209
211
  back: "Back",
210
212
  empty: "Pick a body part to mark pain.",
@@ -623,9 +625,11 @@ function BodyMap3D(props) {
623
625
  };
624
626
  }, []);
625
627
  react.useEffect(() => {
626
- if (!isFullscreen) return;
628
+ if (!isFullscreen && !selected) return;
627
629
  const onKey = (e) => {
628
- if (e.key === "Escape") setFullscreen(false);
630
+ if (e.key !== "Escape") return;
631
+ if (selected) setSelected(null);
632
+ else setFullscreen(false);
629
633
  };
630
634
  window.addEventListener("keydown", onKey);
631
635
  return () => window.removeEventListener("keydown", onKey);
@@ -733,7 +737,18 @@ function BodyMap3D(props) {
733
737
  showRegionCode && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-testid": "bodymap3d-region-code", style: { font: "11px ui-monospace, monospace", color: chrome.mutedText, background: chrome.badgeBg, borderRadius: 6, padding: "2px 7px" }, children: [
734
738
  region.code,
735
739
  region.side ? " \xB7 " + region.side : ""
736
- ] })
740
+ ] }),
741
+ /* @__PURE__ */ jsxRuntime.jsx(
742
+ "button",
743
+ {
744
+ type: "button",
745
+ "data-testid": "bodymap3d-close",
746
+ "aria-label": L.close,
747
+ onClick: () => setSelected(null),
748
+ style: { ...btn, width: 32, height: 32, padding: 0, fontSize: 20, lineHeight: 1, color: chrome.mutedText, borderColor: chrome.border, background: chrome.panelBg },
749
+ children: "\xD7"
750
+ }
751
+ )
737
752
  ] }),
738
753
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 11, fontWeight: 700, letterSpacing: ".06em", textTransform: "uppercase", color: chrome.mutedText, marginBottom: 7 }, children: L.intensity }),
739
754
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 4, marginBottom: 12 }, children: Array.from({ length: 11 }, (_, i) => /* @__PURE__ */ jsxRuntime.jsx("button", { "data-testid": `bodymap3d-intensity-${i}`, onClick: () => setPain(region.key, i, current?.type), style: { ...btn, display: "inline-flex", alignItems: "center", justifyContent: "center", minWidth: 30, height: 30, padding: 0, background: current?.intensity === i ? "#0e8f8a" : "#fff", color: current?.intensity === i ? "#fff" : "#1e293b" }, children: i }, i)) }),