@anywayseo/tools 2.3.0 → 2.4.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.
@@ -1,9 +1,15 @@
1
- import { FC } from 'react';
1
+ import { FC, ReactElement } from 'react';
2
2
  import { BoxPositionProps, ImageFit } from '../../types';
3
+ type GamePreviewImageProps = {
4
+ previewImage: string;
5
+ previewImageFit?: ImageFit;
6
+ } | {
7
+ previewImage: ReactElement;
8
+ previewImageFit?: never;
9
+ };
3
10
  type GameDemoProps = {
4
11
  name: string;
5
12
  src: string;
6
- previewImageFit?: ImageFit;
7
- } & BoxPositionProps;
13
+ } & BoxPositionProps & GamePreviewImageProps;
8
14
  declare const GameDemo: FC<GameDemoProps>;
9
15
  export default GameDemo;
@@ -1,6 +1,7 @@
1
- import { FC } from 'react';
1
+ import { FC, ReactElement } from 'react';
2
2
  import { ImageFit } from '../../../types';
3
3
  type GameDemoPreviewProps = {
4
+ image: string | ReactElement;
4
5
  alt: string;
5
6
  imageFit?: ImageFit;
6
7
  onPlay: VoidFunction;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../index-C5BWCSo_.js");
3
+ const index = require("../index-BKBWEEyT.js");
4
4
  exports.Author = index.Author;
5
5
  exports.BonusCard = index.BonusCard;
6
6
  exports.Center = index.Center;
@@ -1,4 +1,4 @@
1
- import { A, B, g, C, h, E, F, a, b, G, c, d, i, H, L, j, e, P, k, S, T, f } from "../index-DaSzU8Hb.mjs";
1
+ import { A, B, g, C, h, E, F, a, b, G, c, d, i, H, L, j, e, P, k, S, T, f } from "../index-DF1kFmrH.mjs";
2
2
  export {
3
3
  A as Author,
4
4
  B as BonusCard,
@@ -1,7 +1,10 @@
1
1
  import { BoxPositionProps, ITabItem, RenderFunction } from '../../types';
2
2
  type TabsProps<T> = {
3
3
  items: ITabItem<T>[];
4
+ } & BoxPositionProps & (T extends unknown[] ? {
4
5
  render: RenderFunction<T>;
5
- } & BoxPositionProps;
6
+ } : {
7
+ render?: never;
8
+ });
6
9
  declare const Tabs: <T>({ items, render, ...boxProps }: TabsProps<T>) => import("react/jsx-runtime").JSX.Element;
7
10
  export default Tabs;
@@ -363,18 +363,15 @@ const GameDemoContent = ({ src, isFullscreen, isLoaded, onLoad, onToggleFullscre
363
363
  /* @__PURE__ */ jsxRuntime.jsx(react.AbsoluteCenter, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Spinner, { size: "xl", thickness: "0.6rem", display: isLoaded ? "none" : "block", color: "brand.100" }) })
364
364
  ] });
365
365
  };
366
- const GameDemoPreview = ({ alt, imageFit = "contain", onPlay }) => {
367
- var _a;
368
- const { assets } = index.useSiteContext();
366
+ const GameDemoPreview = ({ image, alt, imageFit = "contain", onPlay }) => {
369
367
  const { t } = reactI18next.useTranslation("gameDemo");
370
- const gamePreviewImage = (_a = assets == null ? void 0 : assets.images) == null ? void 0 : _a.gamePreview;
371
- const gamePreviewImageComponent = typeof gamePreviewImage === "string" ? /* @__PURE__ */ jsxRuntime.jsx(react.Image, { src: gamePreviewImage, alt, objectFit: imageFit }) : gamePreviewImage;
368
+ const imageComponent = typeof image === "string" ? /* @__PURE__ */ jsxRuntime.jsx(react.Image, { src: image, alt, objectFit: imageFit }) : image;
372
369
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
373
- gamePreviewImageComponent,
370
+ imageComponent,
374
371
  /* @__PURE__ */ jsxRuntime.jsx(react.AbsoluteCenter, { children: /* @__PURE__ */ jsxRuntime.jsx(PulseButton, { label: t("action.playForFree"), onClick: onPlay }) })
375
372
  ] });
376
373
  };
377
- const GameDemo = ({ name, src, previewImageFit, ...boxProps }) => {
374
+ const GameDemo = ({ name, src, previewImage, previewImageFit, ...boxProps }) => {
378
375
  const [isRunning, setIsRunning] = react$1.useState(false);
379
376
  const [isLoaded, setIsLoaded] = react$1.useState(false);
380
377
  const { isOpen: isFullscreen, onToggle } = react.useDisclosure({ defaultIsOpen: false });
@@ -406,7 +403,7 @@ const GameDemo = ({ name, src, previewImageFit, ...boxProps }) => {
406
403
  onLoad,
407
404
  onToggleFullscreen: handleToggleFullscreen
408
405
  }
409
- ) : /* @__PURE__ */ jsxRuntime.jsx(GameDemoPreview, { alt: name, imageFit: previewImageFit, onPlay: handlePlay })
406
+ ) : /* @__PURE__ */ jsxRuntime.jsx(GameDemoPreview, { image: previewImage, alt: name, imageFit: previewImageFit, onPlay: handlePlay })
410
407
  }
411
408
  );
412
409
  };
@@ -495,10 +492,11 @@ const GameInfo = ({ info }) => {
495
492
  };
496
493
  const HowTo = ({ steps, ...boxProps }) => {
497
494
  const { color, bgColor } = index$2.usePrimaryColors();
498
- return /* @__PURE__ */ jsxRuntime.jsx(react.SimpleGrid, { as: "ol", columns: { base: 1, md: 2, lg: 3 }, gap: 4, p: 0, ...boxProps, children: steps.map(({ title, description }, index2) => /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { as: "li", alignItems: "flex-start", gap: 4, children: [
495
+ return /* @__PURE__ */ jsxRuntime.jsx(react.SimpleGrid, { as: "ol", columns: { base: 1, md: 2, lg: 3 }, gap: 4, p: 0, ...boxProps, children: steps.map(({ title, description, image }, index2) => /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { as: "li", alignItems: "flex-start", gap: 4, children: [
499
496
  /* @__PURE__ */ jsxRuntime.jsx(react.Circle, { size: 12, bgColor, color, fontSize: "lg", fontWeight: "bold", children: String(index2 + 1) }),
500
497
  /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { flex: 1, children: [
501
498
  /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "lg", fontWeight: "bold", children: title }),
499
+ typeof image === "string" ? /* @__PURE__ */ jsxRuntime.jsx(react.Image, { src: image, alt: title, aspectRatio: "16/9", objectFit: "cover" }) : image,
502
500
  /* @__PURE__ */ jsxRuntime.jsx(react.Text, { children: description })
503
501
  ] })
504
502
  ] }, index2)) });
@@ -981,7 +979,7 @@ const Tabs = ({ items, render, ...boxProps }) => {
981
979
  }, []);
982
980
  return /* @__PURE__ */ jsxRuntime.jsxs(react.Tabs, { overflow: "hidden", colorScheme: "brand", ...boxProps, children: [
983
981
  /* @__PURE__ */ jsxRuntime.jsx(react.TabList, { overflow: "auto hidden", children: tabs.map(({ label, icon }, index2) => /* @__PURE__ */ jsxRuntime.jsx(react.Tab, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Text, { as: "h3", isTruncated: true, children: icon ? `${icon} ${label}` : label }) }, index2)) }),
984
- /* @__PURE__ */ jsxRuntime.jsx(react.TabPanels, { children: panels.map((panel, index2) => /* @__PURE__ */ jsxRuntime.jsx(react.TabPanel, { children: render(panel) }, index2)) })
982
+ /* @__PURE__ */ jsxRuntime.jsx(react.TabPanels, { children: panels.map((panel, index2) => /* @__PURE__ */ jsxRuntime.jsx(react.TabPanel, { children: render ? render(panel) : panel }, index2)) })
985
983
  ] });
986
984
  };
987
985
  exports.Author = Author;
@@ -362,18 +362,15 @@ const GameDemoContent = ({ src, isFullscreen, isLoaded, onLoad, onToggleFullscre
362
362
  /* @__PURE__ */ jsx(AbsoluteCenter, { children: /* @__PURE__ */ jsx(Spinner, { size: "xl", thickness: "0.6rem", display: isLoaded ? "none" : "block", color: "brand.100" }) })
363
363
  ] });
364
364
  };
365
- const GameDemoPreview = ({ alt, imageFit = "contain", onPlay }) => {
366
- var _a;
367
- const { assets } = useSiteContext();
365
+ const GameDemoPreview = ({ image, alt, imageFit = "contain", onPlay }) => {
368
366
  const { t: t2 } = useTranslation("gameDemo");
369
- const gamePreviewImage = (_a = assets == null ? void 0 : assets.images) == null ? void 0 : _a.gamePreview;
370
- const gamePreviewImageComponent = typeof gamePreviewImage === "string" ? /* @__PURE__ */ jsx(Image, { src: gamePreviewImage, alt, objectFit: imageFit }) : gamePreviewImage;
367
+ const imageComponent = typeof image === "string" ? /* @__PURE__ */ jsx(Image, { src: image, alt, objectFit: imageFit }) : image;
371
368
  return /* @__PURE__ */ jsxs(Fragment, { children: [
372
- gamePreviewImageComponent,
369
+ imageComponent,
373
370
  /* @__PURE__ */ jsx(AbsoluteCenter, { children: /* @__PURE__ */ jsx(PulseButton, { label: t2("action.playForFree"), onClick: onPlay }) })
374
371
  ] });
375
372
  };
376
- const GameDemo = ({ name, src, previewImageFit, ...boxProps }) => {
373
+ const GameDemo = ({ name, src, previewImage, previewImageFit, ...boxProps }) => {
377
374
  const [isRunning, setIsRunning] = useState(false);
378
375
  const [isLoaded, setIsLoaded] = useState(false);
379
376
  const { isOpen: isFullscreen, onToggle } = useDisclosure({ defaultIsOpen: false });
@@ -405,7 +402,7 @@ const GameDemo = ({ name, src, previewImageFit, ...boxProps }) => {
405
402
  onLoad,
406
403
  onToggleFullscreen: handleToggleFullscreen
407
404
  }
408
- ) : /* @__PURE__ */ jsx(GameDemoPreview, { alt: name, imageFit: previewImageFit, onPlay: handlePlay })
405
+ ) : /* @__PURE__ */ jsx(GameDemoPreview, { image: previewImage, alt: name, imageFit: previewImageFit, onPlay: handlePlay })
409
406
  }
410
407
  );
411
408
  };
@@ -494,10 +491,11 @@ const GameInfo = ({ info }) => {
494
491
  };
495
492
  const HowTo = ({ steps, ...boxProps }) => {
496
493
  const { color, bgColor } = usePrimaryColors();
497
- return /* @__PURE__ */ jsx(SimpleGrid, { as: "ol", columns: { base: 1, md: 2, lg: 3 }, gap: 4, p: 0, ...boxProps, children: steps.map(({ title, description }, index) => /* @__PURE__ */ jsxs(Flex, { as: "li", alignItems: "flex-start", gap: 4, children: [
494
+ return /* @__PURE__ */ jsx(SimpleGrid, { as: "ol", columns: { base: 1, md: 2, lg: 3 }, gap: 4, p: 0, ...boxProps, children: steps.map(({ title, description, image }, index) => /* @__PURE__ */ jsxs(Flex, { as: "li", alignItems: "flex-start", gap: 4, children: [
498
495
  /* @__PURE__ */ jsx(Circle, { size: 12, bgColor, color, fontSize: "lg", fontWeight: "bold", children: String(index + 1) }),
499
496
  /* @__PURE__ */ jsxs(Stack, { flex: 1, children: [
500
497
  /* @__PURE__ */ jsx(Text, { fontSize: "lg", fontWeight: "bold", children: title }),
498
+ typeof image === "string" ? /* @__PURE__ */ jsx(Image, { src: image, alt: title, aspectRatio: "16/9", objectFit: "cover" }) : image,
501
499
  /* @__PURE__ */ jsx(Text, { children: description })
502
500
  ] })
503
501
  ] }, index)) });
@@ -980,7 +978,7 @@ const Tabs = ({ items, render, ...boxProps }) => {
980
978
  }, []);
981
979
  return /* @__PURE__ */ jsxs(Tabs$1, { overflow: "hidden", colorScheme: "brand", ...boxProps, children: [
982
980
  /* @__PURE__ */ jsx(TabList, { overflow: "auto hidden", children: tabs.map(({ label, icon }, index) => /* @__PURE__ */ jsx(Tab, { children: /* @__PURE__ */ jsx(Text, { as: "h3", isTruncated: true, children: icon ? `${icon} ${label}` : label }) }, index)) }),
983
- /* @__PURE__ */ jsx(TabPanels, { children: panels.map((panel, index) => /* @__PURE__ */ jsx(TabPanel, { children: render(panel) }, index)) })
981
+ /* @__PURE__ */ jsx(TabPanels, { children: panels.map((panel, index) => /* @__PURE__ */ jsx(TabPanel, { children: render ? render(panel) : panel }, index)) })
984
982
  ] });
985
983
  };
986
984
  export {
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-C5BWCSo_.js");
3
+ const index = require("./index-BKBWEEyT.js");
4
4
  const index$1 = require("./index-IpSV-c71.js");
5
5
  const i18n$1 = require("./index-uq_uSyaC.js");
6
6
  const index$2 = require("./index-m97PmVsd.js");
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A, B, g, C, h, E, F, a, b, G, c, d, i, H, L, j, e, P, k, S, T, f } from "./index-DaSzU8Hb.mjs";
1
+ import { A, B, g, C, h, E, F, a, b, G, c, d, i, H, L, j, e, P, k, S, T, f } from "./index-DF1kFmrH.mjs";
2
2
  import { u } from "./index-xuSxvz5z.mjs";
3
3
  import { a as a2, G as G2, r } from "./index-DjBQjd1k.mjs";
4
4
  import { M } from "./index-C-e_0aJJ.mjs";
@@ -1,5 +1,6 @@
1
+ import { ReactElement } from 'react';
1
2
  export interface IHowToStep {
2
3
  title: string;
3
4
  description?: string;
4
- image?: string;
5
+ image?: string | ReactElement;
5
6
  }
@@ -7,7 +7,6 @@ type Image = ImageUrl | ImageComponent;
7
7
  export interface ISiteAssets {
8
8
  images?: {
9
9
  logo?: Image;
10
- gamePreview?: Image;
11
10
  expert?: Image;
12
11
  };
13
12
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@anywayseo/tools",
3
3
  "description": "Shared UI Components and Modules",
4
- "version": "2.3.0",
4
+ "version": "2.4.0",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",