@anywayseo/tools 5.3.0 → 5.4.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.
@@ -1,8 +1,8 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { Box, Collapse, Text, Button, Flex, Stack, Center as Center$1, SimpleGrid, Link as Link$1, Card, CardHeader, Heading, CardBody, Popover, PopoverTrigger, Portal, PopoverContent, PopoverBody, CardFooter, useToast, useColorModeValue, VStack, FormControl, FormLabel, InputGroup, InputLeftElement, Input, Textarea, Accordion, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, LinkBox, LinkOverlay, IconButton, AbsoluteCenter, Spinner, useDisclosure, Divider, Circle, Container as Container$1, Menu, MenuButton, HStack, Icon, MenuList, MenuItem, List as List$1, ListItem, ListIcon, TableContainer, Table as Table$1, Thead, Tr, Th, Tbody, Td, TableCaption, Tabs as Tabs$1, TabList, Tab, TabPanels, TabPanel } from "@chakra-ui/react";
2
+ import { Link, Flex, Box, Collapse, Text, Button, Stack, Center as Center$1, SimpleGrid, Card, CardHeader, Heading, CardBody, Popover, PopoverTrigger, Portal, PopoverContent, PopoverBody, CardFooter, useToast, useColorModeValue, VStack, FormControl, FormLabel, InputGroup, InputLeftElement, Input, Textarea, Accordion, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, LinkBox, LinkOverlay, IconButton, AbsoluteCenter, Spinner, useDisclosure, Divider, Circle, Container as Container$1, Menu, MenuButton, HStack, Icon, MenuList, MenuItem, List as List$1, ListItem, ListIcon, TableContainer, Table as Table$1, Thead, Tr, Th, Tbody, Td, TableCaption, Tabs as Tabs$1, TabList, Tab, TabPanels, TabPanel } from "@chakra-ui/react";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import "react-medium-image-zoom";
5
- import { I as Image, a as useSiteContext, L as Link, u as usePageContext } from "./index-Bwlxdh5F.mjs";
5
+ import { I as Image, a as useSiteContext, L as Link$1, u as usePageContext } from "./index-Bwlxdh5F.mjs";
6
6
  import { useRef, useState, useLayoutEffect, Fragment as Fragment$1, useMemo, forwardRef, useEffect } from "react";
7
7
  import { A as Animation } from "./index-BJRvnR8Q.mjs";
8
8
  import { a as GameCharacteristic } from "./index-Bts2DBYS.mjs";
@@ -13,6 +13,89 @@ import { i as isRelativePath, b as buildPath } from "./index-BmaWfWLV.mjs";
13
13
  import { u as usePrimaryColors } from "./index-tj12BA6U.mjs";
14
14
  import { t } from "i18next";
15
15
  import Markdown from "react-markdown";
16
+ const FacebookIcon = (props) => {
17
+ return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", "aria-label": "Facebook", ...props, children: [
18
+ /* @__PURE__ */ jsx("rect", { x: "1", y: "1", width: "22", height: "22", rx: "5", fill: "none", stroke: "currentColor", strokeWidth: "2" }),
19
+ /* @__PURE__ */ jsx(
20
+ "path",
21
+ {
22
+ d: "M13.5 8h2V6h-2c-2.2 0-3.5 1.3-3.5 3.5V11H8v2h2v5h2v-5h2l.5-2h-2v-1.3c0-.5.2-.7 1-.7Z",
23
+ fill: "currentColor"
24
+ }
25
+ )
26
+ ] });
27
+ };
28
+ const InstagramIcon = (props) => {
29
+ return /* @__PURE__ */ jsxs(
30
+ "svg",
31
+ {
32
+ xmlns: "http://www.w3.org/2000/svg",
33
+ width: "24",
34
+ height: "24",
35
+ viewBox: "0 0 24 24",
36
+ "aria-label": "Instagram",
37
+ ...props,
38
+ children: [
39
+ /* @__PURE__ */ jsx("rect", { x: "1", y: "1", width: "22", height: "22", rx: "5", fill: "none", stroke: "currentColor", strokeWidth: "2" }),
40
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "4", fill: "none", stroke: "currentColor", "stroke-width": "2" }),
41
+ /* @__PURE__ */ jsx("circle", { cx: "17", cy: "7", r: "1.25", fill: "currentColor" })
42
+ ]
43
+ }
44
+ );
45
+ };
46
+ const PinterestIcon = (props) => {
47
+ return /* @__PURE__ */ jsx(
48
+ "svg",
49
+ {
50
+ xmlns: "http://www.w3.org/2000/svg",
51
+ width: "24",
52
+ height: "24",
53
+ viewBox: "0 0 24 24",
54
+ "aria-label": "Pinterest",
55
+ ...props,
56
+ children: /* @__PURE__ */ jsx(
57
+ "path",
58
+ {
59
+ fill: "currentColor",
60
+ d: "M12 0C5.373 0 0 5.373 0 12c0 4.99 3.657 9.128 8.438 10.122-.117-.858-.222-2.178.047-3.116.242-.83 1.557-5.288 1.557-5.288s-.396-.792-.396-1.963c0-1.84 1.067-3.215 2.395-3.215 1.13 0 1.675.848 1.675 1.866 0 1.138-.724 2.842-1.097 4.421-.312 1.319.663 2.395 1.965 2.395 2.358 0 3.947-3.032 3.947-6.617 0-2.727-1.84-4.769-5.178-4.769-3.774 0-6.134 2.822-6.134 5.97 0 1.086.322 1.852.827 2.443.232.274.264.384.18.698-.06.23-.197.786-.256 1.007-.084.322-.34.437-.628.318-1.75-.714-2.564-2.63-2.564-4.785 0-3.555 2.998-7.817 8.946-7.817 4.782 0 7.923 3.454 7.923 7.168 0 4.924-2.74 8.6-6.781 8.6-1.356 0-2.63-.73-3.066-1.565l-.833 3.173c-.301 1.147-1.118 2.582-1.667 3.455C9.708 23.812 10.828 24 12 24c6.627 0 12-5.373 12-12S18.627 0 12 0z"
61
+ }
62
+ )
63
+ }
64
+ );
65
+ };
66
+ const XcomIcon = (props) => {
67
+ return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", "aria-label": "X", ...props, children: /* @__PURE__ */ jsx(
68
+ "path",
69
+ {
70
+ fill: "currentColor",
71
+ d: "M18.244 2H21l-6.57 7.498L22 22h-5.657l-4.403-5.808L6.06 22H3.302l7.02-8.006L2 2h5.822l3.983 5.293L18.244 2zM16.97 20h1.9L8.153 4h-1.9L16.97 20z"
72
+ }
73
+ ) });
74
+ };
75
+ const YoutubeIcon = (props) => {
76
+ return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", "aria-label": "YouTube", ...props, children: /* @__PURE__ */ jsx(
77
+ "path",
78
+ {
79
+ fill: "currentColor",
80
+ d: "M23.498 6.186a2.974 2.974 0 0 0-2.095-2.107C19.505 3.5 12 3.5 12 3.5s-7.505 0-9.403.579A2.974 2.974 0 0 0 .502 6.186C0 8.09 0 12 0 12s0 3.91.502 5.814a2.974 2.974 0 0 0 2.095 2.107C4.495 20.5 12 20.5 12 20.5s7.505 0 9.403-.579a2.974 2.974 0 0 0 2.095-2.107C24 15.91 24 12 24 12s0-3.91-.502-5.814zM9.75 15.02V8.98L15.5 12l-5.75 3.02z"
81
+ }
82
+ ) });
83
+ };
84
+ const SocialNetworkMap = {
85
+ facebook: FacebookIcon,
86
+ instagram: InstagramIcon,
87
+ pinterest: PinterestIcon,
88
+ x: XcomIcon,
89
+ youtube: YoutubeIcon
90
+ };
91
+ const SocialNetwork = ({ kind, url }) => {
92
+ const Icon2 = SocialNetworkMap[kind];
93
+ return /* @__PURE__ */ jsx(Link, { href: url, target: "_blank", rel: "noopener noreferrer nofollow", children: /* @__PURE__ */ jsx(Icon2, {}) });
94
+ };
95
+ const SocialNetworks = ({ socialNetworks, ...flexProps }) => {
96
+ const uniqueSocialNetworks = [...new Map(socialNetworks.map((item) => [item.kind, item])).values()];
97
+ return /* @__PURE__ */ jsx(Flex, { gap: 2, ...flexProps, children: uniqueSocialNetworks.map((socialNetwork) => /* @__PURE__ */ jsx(SocialNetwork, { ...socialNetwork }, socialNetwork.kind)) });
98
+ };
16
99
  const ONE_LINE_HEIGHT = 24;
17
100
  const Bio = ({ content, maxLines = 1 }) => {
18
101
  const ref = useRef(null);
@@ -38,7 +121,7 @@ const Bio = ({ content, maxLines = 1 }) => {
38
121
  ] });
39
122
  };
40
123
  const Author = ({ author, variant }) => {
41
- const { name, role, bio, avatar } = author;
124
+ const { name, role, bio, avatar, socialNetworks } = author;
42
125
  if (variant === "short") {
43
126
  return /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 4, children: [
44
127
  /* @__PURE__ */ jsx(Box, { w: 12, h: 12, children: /* @__PURE__ */ jsx(Image, { src: avatar, alt: name, rounded: "full" }) }),
@@ -53,8 +136,9 @@ const Author = ({ author, variant }) => {
53
136
  /* @__PURE__ */ jsx(Flex, { flex: 1, children: /* @__PURE__ */ jsxs(Stack, { children: [
54
137
  /* @__PURE__ */ jsxs(Text, { fontSize: "lg", fontWeight: 600, children: [
55
138
  `${name}, `,
56
- /* @__PURE__ */ jsx(Text, { as: "span", color: "gray.500", children: role })
139
+ /* @__PURE__ */ jsx(Text, { as: "span", display: "inline-block", color: "gray.500", children: role })
57
140
  ] }),
141
+ (socialNetworks == null ? void 0 : socialNetworks.length) && /* @__PURE__ */ jsx(SocialNetworks, { socialNetworks }),
58
142
  /* @__PURE__ */ jsx(Bio, { content: bio })
59
143
  ] }) })
60
144
  ] });
@@ -84,7 +168,7 @@ const LinkButton = ({
84
168
  const isInvertedColor = (_a = config == null ? void 0 : config.theme) == null ? void 0 : _a.isInvertedColor;
85
169
  const isRedirectLink = linkType === "redirect";
86
170
  const isInternalLink = isRelativePath(href);
87
- const LinkComponent = isInternalLink ? Link : Link$1;
171
+ const LinkComponent = isInternalLink ? Link$1 : Link;
88
172
  const hrefKey = isInternalLink ? "to" : "href";
89
173
  const hrefValue = isRedirectLink ? `/follow?to=${href}` : href;
90
174
  return /* @__PURE__ */ jsx(
@@ -607,7 +691,7 @@ const Logo = () => {
607
691
  const Brand$1 = ({ brand }) => {
608
692
  return /* @__PURE__ */ jsxs(Box, { position: "relative", my: 2, py: 8, children: [
609
693
  /* @__PURE__ */ jsx(Divider, {}),
610
- /* @__PURE__ */ jsx(AbsoluteCenter, { display: "flex", bgColor: useColorModeValue("gray.50", "gray.900"), children: /* @__PURE__ */ jsx(Link, { to: "/", children: brand }) })
694
+ /* @__PURE__ */ jsx(AbsoluteCenter, { display: "flex", bgColor: useColorModeValue("gray.50", "gray.900"), children: /* @__PURE__ */ jsx(Link$1, { to: "/", children: brand }) })
611
695
  ] });
612
696
  };
613
697
  const Copyright = () => {
@@ -644,7 +728,7 @@ const Navigation$1 = ({ menu }) => {
644
728
  children: menu.map(({ slug, label }, index) => /* @__PURE__ */ jsx(Flex, { as: "li", children: /* @__PURE__ */ jsx(
645
729
  Text,
646
730
  {
647
- as: Link,
731
+ as: Link$1,
648
732
  to: slug,
649
733
  fontSize: "md",
650
734
  fontWeight: "semibold",
@@ -657,13 +741,13 @@ const Navigation$1 = ({ menu }) => {
657
741
  );
658
742
  };
659
743
  const Footer = () => {
660
- var _a, _b;
661
- const { navigation, config } = useSiteContext();
744
+ const { metadata, navigation, config } = useSiteContext();
662
745
  const { currentLocale } = usePageContext();
663
746
  const menu = navigation.footer[currentLocale.code] ?? [];
664
- const extra = (_a = config == null ? void 0 : config.footer) == null ? void 0 : _a.extra;
665
- const showDisclaimer = ((_b = config == null ? void 0 : config.footer) == null ? void 0 : _b.showDisclaimer) ?? true;
747
+ const socialNetworks = metadata.socialNetworks ?? [];
748
+ const { extra, showDisclaimer = true } = (config == null ? void 0 : config.footer) ?? {};
666
749
  const hasNavigation = !!menu.length;
750
+ const hasSocialNetworks = !!socialNetworks.length;
667
751
  const hasExtra = !!extra;
668
752
  return /* @__PURE__ */ jsx(
669
753
  Box,
@@ -677,13 +761,14 @@ const Footer = () => {
677
761
  hasExtra && /* @__PURE__ */ jsx(Extra, { children: extra }),
678
762
  showDisclaimer && /* @__PURE__ */ jsx(Disclaimer, {}),
679
763
  /* @__PURE__ */ jsx(Brand$1, { brand: /* @__PURE__ */ jsx(Logo, {}) }),
764
+ hasSocialNetworks && /* @__PURE__ */ jsx(SocialNetworks, { socialNetworks, justify: "center", my: 2 }),
680
765
  /* @__PURE__ */ jsx(Copyright, {})
681
766
  ] })
682
767
  }
683
768
  );
684
769
  };
685
770
  const Brand = ({ brand }) => {
686
- return /* @__PURE__ */ jsx(Link, { to: "/", children: brand });
771
+ return /* @__PURE__ */ jsx(Link$1, { to: "/", children: brand });
687
772
  };
688
773
  const FranceIcon = (props) => {
689
774
  return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", width: "1em", height: "1em", ...props, children: [
@@ -778,7 +863,7 @@ const LocaleSwitcher = ({ currentLocale, locales }) => {
778
863
  ] })
779
864
  }
780
865
  ),
781
- /* @__PURE__ */ jsx(MenuList, { minW: "fit-content", children: localeMenuItems.map(({ code, name, icon }) => /* @__PURE__ */ jsx(MenuItem, { as: Link, to: `/${code}`, icon: /* @__PURE__ */ jsx(Icon, { as: icon, w: 4, h: 4 }), children: name }, code)) })
866
+ /* @__PURE__ */ jsx(MenuList, { minW: "fit-content", children: localeMenuItems.map(({ code, name, icon }) => /* @__PURE__ */ jsx(MenuItem, { as: Link$1, to: `/${code}`, icon: /* @__PURE__ */ jsx(Icon, { as: icon, w: 4, h: 4 }), children: name }, code)) })
782
867
  ] });
783
868
  };
784
869
  const NavLink = forwardRef(({ slug, label }, ref) => {
@@ -786,7 +871,7 @@ const NavLink = forwardRef(({ slug, label }, ref) => {
786
871
  Text,
787
872
  {
788
873
  ref,
789
- as: Link,
874
+ as: Link$1,
790
875
  to: slug,
791
876
  p: 2,
792
877
  fontWeight: "semibold",
@@ -823,7 +908,7 @@ const NavList$1 = ({ slug, label, children }) => {
823
908
  boxShadow: "xl",
824
909
  bg: background,
825
910
  children: /* @__PURE__ */ jsx(List$1, { spacing: 2, p: 0, children: children == null ? void 0 : children.map((child, index) => {
826
- return /* @__PURE__ */ jsx(ListItem, { rounded: "md", _hover: { bg: backgroundHover }, children: /* @__PURE__ */ jsxs(Flex, { as: Link, to: buildPath(child.slug, slug), p: 2, role: "group", children: [
911
+ return /* @__PURE__ */ jsx(ListItem, { rounded: "md", _hover: { bg: backgroundHover }, children: /* @__PURE__ */ jsxs(Flex, { as: Link$1, to: buildPath(child.slug, slug), p: 2, role: "group", children: [
827
912
  /* @__PURE__ */ jsx(Text, { fontWeight: 500, transition: "all .3s ease", _groupHover: { color: "brand.400" }, children: child.label }),
828
913
  /* @__PURE__ */ jsx(
829
914
  Flex,
@@ -887,7 +972,7 @@ const NavList = ({ slug, label, children, isExpanded, onExpand }) => {
887
972
  borderLeft: 1,
888
973
  borderStyle: "solid",
889
974
  borderColor: useColorModeValue("gray.200", "gray.700"),
890
- children: children == null ? void 0 : children.map((child, index) => /* @__PURE__ */ jsx(Flex, { as: "li", role: "listitem", children: /* @__PURE__ */ jsx(Text, { as: Link, to: buildPath(child.slug, slug), p: 2, fontSize: "sm", children: child.label }) }, index))
975
+ children: children == null ? void 0 : children.map((child, index) => /* @__PURE__ */ jsx(Flex, { as: "li", role: "listitem", children: /* @__PURE__ */ jsx(Text, { as: Link$1, to: buildPath(child.slug, slug), p: 2, fontSize: "sm", children: child.label }) }, index))
891
976
  }
892
977
  ) })
893
978
  ] });
@@ -1081,7 +1166,7 @@ const NotFound = () => {
1081
1166
  /* @__PURE__ */ jsxs(Text, { fontSize: "xl", children: [
1082
1167
  t2("description"),
1083
1168
  " ",
1084
- /* @__PURE__ */ jsx(Button, { as: Link, to: "/", variant: "link", colorScheme: "brand", fontSize: "xl", children: t2("action") })
1169
+ /* @__PURE__ */ jsx(Button, { as: Link$1, to: "/", variant: "link", colorScheme: "brand", fontSize: "xl", children: t2("action") })
1085
1170
  ] })
1086
1171
  ] });
1087
1172
  };
@@ -1393,5 +1478,7 @@ export {
1393
1478
  Author as k,
1394
1479
  Center as l,
1395
1480
  Grid as m,
1396
- LinkButton as n
1481
+ LinkButton as n,
1482
+ SocialNetwork as o,
1483
+ SocialNetworks as p
1397
1484
  };
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-BGMR4f6W.js");
3
+ const index = require("./index-DGc-4DpA.js");
4
4
  const index$1 = require("./index-BltrZp3R.js");
5
5
  const index$2 = require("./index-WFgDSB1A.js");
6
6
  const index$3 = require("./index-CAfBnNV6.js");
@@ -33,6 +33,8 @@ exports.List = index.List;
33
33
  exports.NotFound = index.NotFound;
34
34
  exports.ProsCons = index.ProsCons;
35
35
  exports.Seo = index.Seo;
36
+ exports.SocialNetwork = index.SocialNetwork;
37
+ exports.SocialNetworks = index.SocialNetworks;
36
38
  exports.StrapiContentRenderer = index.StrapiContentRenderer;
37
39
  exports.Table = index.Table;
38
40
  exports.Tabs = index.Tabs;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { k, A, B, a, l, C, F, b, c, G, d, e, f, m, H, L, n, g, N, P, S, h, T, i, j } from "./index-CjaAcLJf.mjs";
1
+ import { k, A, B, a, l, C, F, b, c, G, d, e, f, m, H, L, n, g, N, P, S, o, p, h, T, i, j } from "./index-PLwa86VY.mjs";
2
2
  import { I, L as L2, P as P2, S as S2, u, a as a2 } from "./index-Bwlxdh5F.mjs";
3
3
  import { u as u2 } from "./index-BzbpMLDD.mjs";
4
4
  import { u as u3 } from "./index-tj12BA6U.mjs";
@@ -43,6 +43,8 @@ export {
43
43
  P as ProsCons,
44
44
  S as Seo,
45
45
  S2 as SiteProvider,
46
+ o as SocialNetwork,
47
+ p as SocialNetworks,
46
48
  h as StrapiContentRenderer,
47
49
  T as Table,
48
50
  i as Tabs,
@@ -13,5 +13,6 @@ export * from './link';
13
13
  export * from './locale-switcher';
14
14
  export * from './navigation';
15
15
  export * from './pros-cons';
16
+ export * from './social-network';
16
17
  export * from './strapi-component';
17
18
  export * from './tabs';
@@ -0,0 +1,6 @@
1
+ type SocialNetwork = 'facebook' | 'x' | 'pinterest' | 'youtube' | 'instagram';
2
+ export interface ISocialNetwork {
3
+ kind: SocialNetwork;
4
+ url: string;
5
+ }
6
+ export {};
@@ -1,18 +1,13 @@
1
- import { ImageType } from '../../components';
2
- type SocialNetwork = 'fb' | 'tw';
1
+ import { ImageType, ISocialNetwork } from '../../components';
3
2
  type Phone = string;
4
- interface ISocialNetwork {
5
- type: SocialNetwork;
6
- link: string;
7
- }
8
3
  export interface IAuthor {
9
4
  name: string;
10
5
  role: string;
11
6
  bio: string;
12
7
  avatar: ImageType;
8
+ socialNetworks?: ISocialNetwork[];
13
9
  /** Planned */
14
10
  address?: string;
15
11
  phone?: Phone;
16
- socialNetworks?: ISocialNetwork[];
17
12
  }
18
13
  export {};
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { ImageType, INavigation } from '../components';
2
+ import { ImageType, INavigation, ISocialNetwork } from '../components';
3
3
  import { ISeo } from '../content';
4
4
  import { Currency, ILocale } from '../i18n';
5
5
  interface ISiteHeaderConfig {
@@ -31,6 +31,7 @@ export interface ISiteMetadata {
31
31
  lang: ILocale['code'];
32
32
  seo: ISeo;
33
33
  logo: ImageType;
34
+ socialNetworks?: ISocialNetwork[];
34
35
  /** Planned */
35
36
  favicon?: ImageType;
36
37
  }
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": "5.3.0",
4
+ "version": "5.4.1",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",