@geowiki/design-system 0.16.10-dev.0 → 0.16.10-dev.2

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/index.d.mts CHANGED
@@ -1124,8 +1124,9 @@ interface CarouselGalleryItemProps {
1124
1124
 
1125
1125
  interface Props$6 {
1126
1126
  galleryItems: CarouselGalleryItemProps[];
1127
+ saveRotationChanges?: (base64: string | null) => void;
1127
1128
  }
1128
- declare const CarouselItemList: ({ galleryItems }: Props$6) => react_jsx_runtime.JSX.Element;
1129
+ declare const CarouselItemList: ({ galleryItems, saveRotationChanges }: Props$6) => react_jsx_runtime.JSX.Element;
1129
1130
 
1130
1131
  declare const OldButton: ({ label, appearance, compact, handleClick, loading, type, }: any) => react_jsx_runtime.JSX.Element;
1131
1132
 
package/dist/index.d.ts CHANGED
@@ -1124,8 +1124,9 @@ interface CarouselGalleryItemProps {
1124
1124
 
1125
1125
  interface Props$6 {
1126
1126
  galleryItems: CarouselGalleryItemProps[];
1127
+ saveRotationChanges?: (base64: string | null) => void;
1127
1128
  }
1128
- declare const CarouselItemList: ({ galleryItems }: Props$6) => react_jsx_runtime.JSX.Element;
1129
+ declare const CarouselItemList: ({ galleryItems, saveRotationChanges }: Props$6) => react_jsx_runtime.JSX.Element;
1129
1130
 
1130
1131
  declare const OldButton: ({ label, appearance, compact, handleClick, loading, type, }: any) => react_jsx_runtime.JSX.Element;
1131
1132
 
package/dist/index.js CHANGED
@@ -7547,7 +7547,7 @@ var VideoPlayer = (props) => {
7547
7547
  var import_jsx_runtime133 = require("react/jsx-runtime");
7548
7548
  var CarouselGalleryItem = ({ text, url }) => {
7549
7549
  return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, { children: [
7550
- !url.includes(".mp4") && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "aspect-square sm:w-auto bg-center relative flex group ", children: [
7550
+ !url.includes(".mp4") && !url.includes(".mov") && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "aspect-square sm:w-auto bg-center relative flex group ", children: [
7551
7551
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
7552
7552
  ImageElement,
7553
7553
  {
@@ -7559,7 +7559,7 @@ var CarouselGalleryItem = ({ text, url }) => {
7559
7559
  ),
7560
7560
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: " absolute bottom-6 opacity-0 group-hover:opacity-100", children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: " mx-6 text-white text-base leading-[120%] line-clamp-4", children: text }) })
7561
7561
  ] }),
7562
- url.includes(".mp4") && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: " max-w-sm aspect-square relative group cursor-pointer overflow-hidden rounded-xl", children: [
7562
+ (url.includes(".mp4") || !url.includes(".mov")) && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: " max-w-sm aspect-square relative group cursor-pointer overflow-hidden rounded-xl", children: [
7563
7563
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: "transition-all duration-300 group-hover:brightness-50", children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
7564
7564
  VideoPlayer,
7565
7565
  {
@@ -7584,7 +7584,8 @@ var GalleryCarouselOpen = ({
7584
7584
  list,
7585
7585
  currentPhoto,
7586
7586
  open,
7587
- setOpen
7587
+ setOpen,
7588
+ saveRotationChanges
7588
7589
  }) => {
7589
7590
  const [defaultPhoto, setDefaultPhoto] = (0, import_react25.useState)(currentPhoto);
7590
7591
  const [text, setDefaultText] = (0, import_react25.useState)("");
@@ -7610,6 +7611,22 @@ var GalleryCarouselOpen = ({
7610
7611
  setDefaultPhoto({ imageUrl: list[nextIndex].url });
7611
7612
  }
7612
7613
  };
7614
+ const generateBase64ofImage = () => {
7615
+ const img = new Image();
7616
+ let base64;
7617
+ img.src = defaultPhoto.imageUrl;
7618
+ img.crossOrigin = "anonymous";
7619
+ const canvas = document.createElement("canvas");
7620
+ const ctx = canvas.getContext("2d");
7621
+ if (!ctx) return null;
7622
+ canvas.width = img.height;
7623
+ canvas.height = img.width;
7624
+ ctx.translate(canvas.width / 2, canvas.height / 2);
7625
+ ctx.rotate(rotation * Math.PI / 180);
7626
+ ctx.drawImage(img, -img.width / 2, -img.height / 2);
7627
+ base64 = canvas.toDataURL("image/jpeg");
7628
+ return base64 != null ? base64 : null;
7629
+ };
7613
7630
  (0, import_react25.useEffect)(() => {
7614
7631
  const foundPhoto = list.find((list2) => list2.url === defaultPhoto.imageUrl);
7615
7632
  if (foundPhoto) {
@@ -7661,7 +7678,7 @@ var GalleryCarouselOpen = ({
7661
7678
  }
7662
7679
  ),
7663
7680
  /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "w-full flex-col flex justify-center items-center", children: [
7664
- !defaultPhoto.imageUrl.includes(".mp4") && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
7681
+ !defaultPhoto.imageUrl.includes(".mp4") && !defaultPhoto.imageUrl.includes(".mov") && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
7665
7682
  "img",
7666
7683
  {
7667
7684
  src: defaultPhoto.imageUrl,
@@ -7670,7 +7687,7 @@ var GalleryCarouselOpen = ({
7670
7687
  className: " p-4"
7671
7688
  }
7672
7689
  ),
7673
- defaultPhoto.imageUrl.includes(".mp4") && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
7690
+ (defaultPhoto.imageUrl.includes(".mp4") || defaultPhoto.imageUrl.includes(".mov")) && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
7674
7691
  "video",
7675
7692
  {
7676
7693
  src: defaultPhoto.imageUrl,
@@ -7692,13 +7709,23 @@ var GalleryCarouselOpen = ({
7692
7709
  }
7693
7710
  )
7694
7711
  ] }),
7695
- /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "gap-2 flex flex-row", children: [
7696
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_lucide_react20.RotateCcw, { className: "h-6 w-6 text-white cursor-pointer", onClick: () => {
7697
- setRotation(rotation - 90);
7698
- } }),
7699
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_lucide_react20.RotateCw, { className: "h-6 w-6 text-white cursor-pointer", onClick: () => {
7700
- setRotation(rotation + 90);
7701
- } })
7712
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "justify-between flex flex-row mb-5", children: [
7713
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "gap-2 flex flex-row", children: [
7714
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_lucide_react20.RotateCcw, { className: "h-6 w-6 text-white cursor-pointer", onClick: () => {
7715
+ setRotation(rotation - 90);
7716
+ } }),
7717
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_lucide_react20.RotateCw, { className: "h-6 w-6 text-white cursor-pointer", onClick: () => {
7718
+ setRotation(rotation + 90);
7719
+ } })
7720
+ ] }),
7721
+ saveRotationChanges && !defaultPhoto.imageUrl.includes(".mp4") && defaultPhoto.imageUrl.includes(".mov") && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
7722
+ "div",
7723
+ {
7724
+ className: "z-40 text-white hover:cursor-pointer",
7725
+ onClick: () => saveRotationChanges(generateBase64ofImage()),
7726
+ children: "Save rotation changes"
7727
+ }
7728
+ )
7702
7729
  ] })
7703
7730
  ] }) })
7704
7731
  ] }) })
@@ -7708,7 +7735,7 @@ var GalleryCarouselOpen = ({
7708
7735
  // src/components/DesignElements/Carousel/CarouselGalleryItemList.tsx
7709
7736
  var import_react26 = require("react");
7710
7737
  var import_jsx_runtime135 = require("react/jsx-runtime");
7711
- var CarouselItemList = ({ galleryItems }) => {
7738
+ var CarouselItemList = ({ galleryItems, saveRotationChanges }) => {
7712
7739
  const [open, setOpen] = (0, import_react26.useState)(false);
7713
7740
  const [selectedItemId, setSelectedItemId] = (0, import_react26.useState)("");
7714
7741
  const handleOpenGallery = (id) => {
@@ -7737,7 +7764,8 @@ var CarouselItemList = ({ galleryItems }) => {
7737
7764
  text: galleryItem.text
7738
7765
  })),
7739
7766
  open,
7740
- setOpen
7767
+ setOpen,
7768
+ saveRotationChanges
7741
7769
  }
7742
7770
  )
7743
7771
  ] });
package/dist/index.mjs CHANGED
@@ -5975,7 +5975,7 @@ import { ChevronDownIcon } from "@heroicons/react/20/solid";
5975
5975
  import { Link as Link3 } from "@geowiki/core";
5976
5976
 
5977
5977
  // src/components/Elements/ImageElement.tsx
5978
- import { Image as Image2 } from "@geowiki/core";
5978
+ import { Image as Image3 } from "@geowiki/core";
5979
5979
  import { jsx as jsx118 } from "react/jsx-runtime";
5980
5980
  var ImageElement = ({
5981
5981
  src,
@@ -5988,7 +5988,7 @@ var ImageElement = ({
5988
5988
  if (width && height) {
5989
5989
  if (!showPlaceholder)
5990
5990
  return /* @__PURE__ */ jsx118(
5991
- Image2,
5991
+ Image3,
5992
5992
  {
5993
5993
  className,
5994
5994
  src,
@@ -6000,7 +6000,7 @@ var ImageElement = ({
6000
6000
  }
6001
6001
  );
6002
6002
  return /* @__PURE__ */ jsx118(
6003
- Image2,
6003
+ Image3,
6004
6004
  {
6005
6005
  className,
6006
6006
  src,
@@ -6015,7 +6015,7 @@ var ImageElement = ({
6015
6015
  }
6016
6016
  if (!showPlaceholder)
6017
6017
  return /* @__PURE__ */ jsx118(
6018
- Image2,
6018
+ Image3,
6019
6019
  {
6020
6020
  className,
6021
6021
  src,
@@ -6027,7 +6027,7 @@ var ImageElement = ({
6027
6027
  }
6028
6028
  );
6029
6029
  return /* @__PURE__ */ jsx118("div", { className, children: /* @__PURE__ */ jsx118(
6030
- Image2,
6030
+ Image3,
6031
6031
  {
6032
6032
  className: "rounded-xl",
6033
6033
  src,
@@ -7180,7 +7180,7 @@ var VideoPlayer = (props) => {
7180
7180
  import { Fragment as Fragment9, jsx as jsx132, jsxs as jsxs57 } from "react/jsx-runtime";
7181
7181
  var CarouselGalleryItem = ({ text, url }) => {
7182
7182
  return /* @__PURE__ */ jsxs57(Fragment9, { children: [
7183
- !url.includes(".mp4") && /* @__PURE__ */ jsxs57("div", { className: "aspect-square sm:w-auto bg-center relative flex group ", children: [
7183
+ !url.includes(".mp4") && !url.includes(".mov") && /* @__PURE__ */ jsxs57("div", { className: "aspect-square sm:w-auto bg-center relative flex group ", children: [
7184
7184
  /* @__PURE__ */ jsx132(
7185
7185
  ImageElement,
7186
7186
  {
@@ -7192,7 +7192,7 @@ var CarouselGalleryItem = ({ text, url }) => {
7192
7192
  ),
7193
7193
  /* @__PURE__ */ jsx132("div", { className: " absolute bottom-6 opacity-0 group-hover:opacity-100", children: /* @__PURE__ */ jsx132("div", { className: " mx-6 text-white text-base leading-[120%] line-clamp-4", children: text }) })
7194
7194
  ] }),
7195
- url.includes(".mp4") && /* @__PURE__ */ jsxs57("div", { className: " max-w-sm aspect-square relative group cursor-pointer overflow-hidden rounded-xl", children: [
7195
+ (url.includes(".mp4") || !url.includes(".mov")) && /* @__PURE__ */ jsxs57("div", { className: " max-w-sm aspect-square relative group cursor-pointer overflow-hidden rounded-xl", children: [
7196
7196
  /* @__PURE__ */ jsx132("div", { className: "transition-all duration-300 group-hover:brightness-50", children: /* @__PURE__ */ jsx132(
7197
7197
  VideoPlayer,
7198
7198
  {
@@ -7217,7 +7217,8 @@ var GalleryCarouselOpen = ({
7217
7217
  list,
7218
7218
  currentPhoto,
7219
7219
  open,
7220
- setOpen
7220
+ setOpen,
7221
+ saveRotationChanges
7221
7222
  }) => {
7222
7223
  const [defaultPhoto, setDefaultPhoto] = useState14(currentPhoto);
7223
7224
  const [text, setDefaultText] = useState14("");
@@ -7243,6 +7244,22 @@ var GalleryCarouselOpen = ({
7243
7244
  setDefaultPhoto({ imageUrl: list[nextIndex].url });
7244
7245
  }
7245
7246
  };
7247
+ const generateBase64ofImage = () => {
7248
+ const img = new Image();
7249
+ let base64;
7250
+ img.src = defaultPhoto.imageUrl;
7251
+ img.crossOrigin = "anonymous";
7252
+ const canvas = document.createElement("canvas");
7253
+ const ctx = canvas.getContext("2d");
7254
+ if (!ctx) return null;
7255
+ canvas.width = img.height;
7256
+ canvas.height = img.width;
7257
+ ctx.translate(canvas.width / 2, canvas.height / 2);
7258
+ ctx.rotate(rotation * Math.PI / 180);
7259
+ ctx.drawImage(img, -img.width / 2, -img.height / 2);
7260
+ base64 = canvas.toDataURL("image/jpeg");
7261
+ return base64 != null ? base64 : null;
7262
+ };
7246
7263
  useEffect8(() => {
7247
7264
  const foundPhoto = list.find((list2) => list2.url === defaultPhoto.imageUrl);
7248
7265
  if (foundPhoto) {
@@ -7294,7 +7311,7 @@ var GalleryCarouselOpen = ({
7294
7311
  }
7295
7312
  ),
7296
7313
  /* @__PURE__ */ jsxs58("div", { className: "w-full flex-col flex justify-center items-center", children: [
7297
- !defaultPhoto.imageUrl.includes(".mp4") && /* @__PURE__ */ jsx133(
7314
+ !defaultPhoto.imageUrl.includes(".mp4") && !defaultPhoto.imageUrl.includes(".mov") && /* @__PURE__ */ jsx133(
7298
7315
  "img",
7299
7316
  {
7300
7317
  src: defaultPhoto.imageUrl,
@@ -7303,7 +7320,7 @@ var GalleryCarouselOpen = ({
7303
7320
  className: " p-4"
7304
7321
  }
7305
7322
  ),
7306
- defaultPhoto.imageUrl.includes(".mp4") && /* @__PURE__ */ jsx133(
7323
+ (defaultPhoto.imageUrl.includes(".mp4") || defaultPhoto.imageUrl.includes(".mov")) && /* @__PURE__ */ jsx133(
7307
7324
  "video",
7308
7325
  {
7309
7326
  src: defaultPhoto.imageUrl,
@@ -7325,13 +7342,23 @@ var GalleryCarouselOpen = ({
7325
7342
  }
7326
7343
  )
7327
7344
  ] }),
7328
- /* @__PURE__ */ jsxs58("div", { className: "gap-2 flex flex-row", children: [
7329
- /* @__PURE__ */ jsx133(RotateCcw, { className: "h-6 w-6 text-white cursor-pointer", onClick: () => {
7330
- setRotation(rotation - 90);
7331
- } }),
7332
- /* @__PURE__ */ jsx133(RotateCw, { className: "h-6 w-6 text-white cursor-pointer", onClick: () => {
7333
- setRotation(rotation + 90);
7334
- } })
7345
+ /* @__PURE__ */ jsxs58("div", { className: "justify-between flex flex-row mb-5", children: [
7346
+ /* @__PURE__ */ jsxs58("div", { className: "gap-2 flex flex-row", children: [
7347
+ /* @__PURE__ */ jsx133(RotateCcw, { className: "h-6 w-6 text-white cursor-pointer", onClick: () => {
7348
+ setRotation(rotation - 90);
7349
+ } }),
7350
+ /* @__PURE__ */ jsx133(RotateCw, { className: "h-6 w-6 text-white cursor-pointer", onClick: () => {
7351
+ setRotation(rotation + 90);
7352
+ } })
7353
+ ] }),
7354
+ saveRotationChanges && !defaultPhoto.imageUrl.includes(".mp4") && defaultPhoto.imageUrl.includes(".mov") && /* @__PURE__ */ jsx133(
7355
+ "div",
7356
+ {
7357
+ className: "z-40 text-white hover:cursor-pointer",
7358
+ onClick: () => saveRotationChanges(generateBase64ofImage()),
7359
+ children: "Save rotation changes"
7360
+ }
7361
+ )
7335
7362
  ] })
7336
7363
  ] }) })
7337
7364
  ] }) })
@@ -7341,7 +7368,7 @@ var GalleryCarouselOpen = ({
7341
7368
  // src/components/DesignElements/Carousel/CarouselGalleryItemList.tsx
7342
7369
  import { useState as useState15 } from "react";
7343
7370
  import { jsx as jsx134, jsxs as jsxs59 } from "react/jsx-runtime";
7344
- var CarouselItemList = ({ galleryItems }) => {
7371
+ var CarouselItemList = ({ galleryItems, saveRotationChanges }) => {
7345
7372
  const [open, setOpen] = useState15(false);
7346
7373
  const [selectedItemId, setSelectedItemId] = useState15("");
7347
7374
  const handleOpenGallery = (id) => {
@@ -7370,7 +7397,8 @@ var CarouselItemList = ({ galleryItems }) => {
7370
7397
  text: galleryItem.text
7371
7398
  })),
7372
7399
  open,
7373
- setOpen
7400
+ setOpen,
7401
+ saveRotationChanges
7374
7402
  }
7375
7403
  )
7376
7404
  ] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geowiki/design-system",
3
- "version": "0.16.10-dev.0",
3
+ "version": "0.16.10-dev.2",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -15,7 +15,7 @@
15
15
  "peerDependencies": {
16
16
  "react": "^19.2.0",
17
17
  "react-dom": "^19.2.0",
18
- "@geowiki/core": "0.16.10-dev.0"
18
+ "@geowiki/core": "0.16.10-dev.2"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/react": "^19.2.14",