@geowiki/design-system 0.16.10-dev.0 → 0.16.10-dev.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/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +38 -10
- package/dist/index.mjs +43 -15
- package/package.json +2 -2
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
|
@@ -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) {
|
|
@@ -7692,13 +7709,23 @@ var GalleryCarouselOpen = ({
|
|
|
7692
7709
|
}
|
|
7693
7710
|
)
|
|
7694
7711
|
] }),
|
|
7695
|
-
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "
|
|
7696
|
-
/* @__PURE__ */ (0, import_jsx_runtime134.
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
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") && /* @__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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
6030
|
+
Image3,
|
|
6031
6031
|
{
|
|
6032
6032
|
className: "rounded-xl",
|
|
6033
6033
|
src,
|
|
@@ -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) {
|
|
@@ -7325,13 +7342,23 @@ var GalleryCarouselOpen = ({
|
|
|
7325
7342
|
}
|
|
7326
7343
|
)
|
|
7327
7344
|
] }),
|
|
7328
|
-
/* @__PURE__ */ jsxs58("div", { className: "
|
|
7329
|
-
/* @__PURE__ */
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
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") && /* @__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.
|
|
3
|
+
"version": "0.16.10-dev.1",
|
|
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.
|
|
18
|
+
"@geowiki/core": "0.16.10-dev.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/react": "^19.2.14",
|