@anywayseo/tools 2.2.5 → 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-BN2dAI6c.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-BNnjW2A2.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,
@@ -0,0 +1,3 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ declare const Extra: FC<PropsWithChildren>;
3
+ export default Extra;
@@ -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)) });
@@ -539,17 +537,22 @@ const Disclaimer = () => {
539
537
  t("disclaimer.description", { domain: index$1.getDomain(siteUrl) })
540
538
  ] });
541
539
  };
540
+ const Extra = ({ children }) => {
541
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Box, { as: "section", my: 2, children });
542
+ };
542
543
  const Navigation$1 = ({ menu }) => {
543
544
  return /* @__PURE__ */ jsxRuntime.jsx(
544
545
  react.SimpleGrid,
545
546
  {
547
+ as: "ul",
546
548
  columns: { base: 1, sm: 2, md: 4 },
547
- pt: 4,
548
- pb: 6,
549
+ mt: 4,
550
+ mb: 6,
551
+ p: 0,
549
552
  spacing: 4,
550
553
  justifyItems: { base: "flex-start", md: "center" },
551
554
  justifyContent: "space-between",
552
- children: menu.map(({ path, label }) => /* @__PURE__ */ jsxRuntime.jsx(
555
+ children: menu.map(({ path, label }, index2) => /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { as: "li", children: /* @__PURE__ */ jsxRuntime.jsx(
553
556
  react.Text,
554
557
  {
555
558
  as: gatsby.Link,
@@ -561,14 +564,15 @@ const Navigation$1 = ({ menu }) => {
561
564
  children: label
562
565
  },
563
566
  path
564
- ))
567
+ ) }, index2))
565
568
  }
566
569
  );
567
570
  };
568
571
  const Footer = () => {
569
- var _a;
572
+ var _a, _b;
570
573
  const { configs } = index.useSiteContext();
571
574
  const navigation = ((_a = configs == null ? void 0 : configs.footer) == null ? void 0 : _a.navigation) ?? [];
575
+ const extra = (_b = configs == null ? void 0 : configs.footer) == null ? void 0 : _b.extra;
572
576
  return /* @__PURE__ */ jsxRuntime.jsx(
573
577
  react.Box,
574
578
  {
@@ -578,6 +582,7 @@ const Footer = () => {
578
582
  py: 4,
579
583
  children: /* @__PURE__ */ jsxRuntime.jsxs(Container, { children: [
580
584
  /* @__PURE__ */ jsxRuntime.jsx(Navigation$1, { menu: navigation }),
585
+ !!extra && /* @__PURE__ */ jsxRuntime.jsx(Extra, { children: extra }),
581
586
  /* @__PURE__ */ jsxRuntime.jsx(Disclaimer, {}),
582
587
  /* @__PURE__ */ jsxRuntime.jsx(Brand$1, { brand: /* @__PURE__ */ jsxRuntime.jsx(Logo, {}) }),
583
588
  /* @__PURE__ */ jsxRuntime.jsx(Copyright, {})
@@ -974,7 +979,7 @@ const Tabs = ({ items, render, ...boxProps }) => {
974
979
  }, []);
975
980
  return /* @__PURE__ */ jsxRuntime.jsxs(react.Tabs, { overflow: "hidden", colorScheme: "brand", ...boxProps, children: [
976
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)) }),
977
- /* @__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)) })
978
983
  ] });
979
984
  };
980
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)) });
@@ -538,17 +536,22 @@ const Disclaimer = () => {
538
536
  t2("disclaimer.description", { domain: getDomain(siteUrl) })
539
537
  ] });
540
538
  };
539
+ const Extra = ({ children }) => {
540
+ return /* @__PURE__ */ jsx(Box, { as: "section", my: 2, children });
541
+ };
541
542
  const Navigation$1 = ({ menu }) => {
542
543
  return /* @__PURE__ */ jsx(
543
544
  SimpleGrid,
544
545
  {
546
+ as: "ul",
545
547
  columns: { base: 1, sm: 2, md: 4 },
546
- pt: 4,
547
- pb: 6,
548
+ mt: 4,
549
+ mb: 6,
550
+ p: 0,
548
551
  spacing: 4,
549
552
  justifyItems: { base: "flex-start", md: "center" },
550
553
  justifyContent: "space-between",
551
- children: menu.map(({ path, label }) => /* @__PURE__ */ jsx(
554
+ children: menu.map(({ path, label }, index) => /* @__PURE__ */ jsx(Flex, { as: "li", children: /* @__PURE__ */ jsx(
552
555
  Text,
553
556
  {
554
557
  as: Link$1,
@@ -560,14 +563,15 @@ const Navigation$1 = ({ menu }) => {
560
563
  children: label
561
564
  },
562
565
  path
563
- ))
566
+ ) }, index))
564
567
  }
565
568
  );
566
569
  };
567
570
  const Footer = () => {
568
- var _a;
571
+ var _a, _b;
569
572
  const { configs } = useSiteContext();
570
573
  const navigation = ((_a = configs == null ? void 0 : configs.footer) == null ? void 0 : _a.navigation) ?? [];
574
+ const extra = (_b = configs == null ? void 0 : configs.footer) == null ? void 0 : _b.extra;
571
575
  return /* @__PURE__ */ jsx(
572
576
  Box,
573
577
  {
@@ -577,6 +581,7 @@ const Footer = () => {
577
581
  py: 4,
578
582
  children: /* @__PURE__ */ jsxs(Container, { children: [
579
583
  /* @__PURE__ */ jsx(Navigation$1, { menu: navigation }),
584
+ !!extra && /* @__PURE__ */ jsx(Extra, { children: extra }),
580
585
  /* @__PURE__ */ jsx(Disclaimer, {}),
581
586
  /* @__PURE__ */ jsx(Brand$1, { brand: /* @__PURE__ */ jsx(Logo, {}) }),
582
587
  /* @__PURE__ */ jsx(Copyright, {})
@@ -973,7 +978,7 @@ const Tabs = ({ items, render, ...boxProps }) => {
973
978
  }, []);
974
979
  return /* @__PURE__ */ jsxs(Tabs$1, { overflow: "hidden", colorScheme: "brand", ...boxProps, children: [
975
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)) }),
976
- /* @__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)) })
977
982
  ] });
978
983
  };
979
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-BN2dAI6c.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-BNnjW2A2.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
  }
@@ -17,6 +16,7 @@ interface ISiteHeaderConfig {
17
16
  }
18
17
  interface ISiteFooterConfig {
19
18
  navigation?: INavItem[];
19
+ extra?: ReactNode;
20
20
  }
21
21
  export interface ISiteConfigs {
22
22
  header?: ISiteHeaderConfig;
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.2.5",
4
+ "version": "2.4.0",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",