@anywayseo/tools 1.5.0 → 1.5.3

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,6 +1,7 @@
1
1
  import { FC, PropsWithChildren } from 'react';
2
+ import { BoxPositionProps } from '../../../types';
2
3
  type CenterProps = PropsWithChildren<{
3
- className: string;
4
- }>;
4
+ className?: string;
5
+ } & BoxPositionProps>;
5
6
  declare const Center: FC<CenterProps>;
6
7
  export default Center;
@@ -1,5 +1,5 @@
1
1
  import { Key } from 'react';
2
- import { KeyGetter, RenderFunction } from '../../../types';
2
+ import { BoxPositionProps, KeyGetter, RenderFunction } from '../../../types';
3
3
  import { ColumnsConfig, SpacingConfig } from './types';
4
4
  type GridGetKeyProp<T> = T extends {
5
5
  key: Key;
@@ -14,6 +14,6 @@ type GridProps<T> = {
14
14
  gap?: SpacingConfig;
15
15
  className?: string;
16
16
  render: RenderFunction<T>;
17
- } & GridGetKeyProp<T>;
18
- declare const Grid: <T>({ items, columns, gap, render, getKey, className }: GridProps<T>) => import("react/jsx-runtime").JSX.Element;
17
+ } & GridGetKeyProp<T> & BoxPositionProps;
18
+ declare const Grid: <T>({ items, columns, gap, render, getKey, className, ...boxProps }: GridProps<T>) => import("react/jsx-runtime").JSX.Element;
19
19
  export default Grid;
@@ -1,3 +1,3 @@
1
1
  export { default as Center } from './center';
2
- export { default as Grid } from './center';
2
+ export { default as Grid } from './grid';
3
3
  export { default as LinkButton } from './link-button';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../index-CB4bJU2N.js");
3
+ const index = require("../index-C5pGuMKq.js");
4
4
  exports.Author = index.Author;
5
5
  exports.BonusCard = index.BonusCard;
6
6
  exports.Center = index.Center;
@@ -11,7 +11,7 @@ exports.Features = index.Features;
11
11
  exports.GameCard = index.GameCard;
12
12
  exports.GameDemo = index.GameDemo;
13
13
  exports.GameInfo = index.GameInfo;
14
- exports.Grid = index.Center;
14
+ exports.Grid = index.Grid;
15
15
  exports.HowTo = index.HowTo;
16
16
  exports.Layout = index.Layout;
17
17
  exports.LinkButton = index.LinkButton;
@@ -1,4 +1,4 @@
1
- import { A, B, f, C, E, F, a, G, b, c, f as f2, H, L, g, d, P, S, T, e } from "../index-CD5ZU1Gw.mjs";
1
+ import { A, B, f, C, E, F, a, G, b, c, g, H, L, h, d, P, S, T, e } from "../index-DZkjaSoV.mjs";
2
2
  export {
3
3
  A as Author,
4
4
  B as BonusCard,
@@ -10,10 +10,10 @@ export {
10
10
  G as GameCard,
11
11
  b as GameDemo,
12
12
  c as GameInfo,
13
- f2 as Grid,
13
+ g as Grid,
14
14
  H as HowTo,
15
15
  L as Layout,
16
- g as LinkButton,
16
+ h as LinkButton,
17
17
  d as List,
18
18
  P as ProsCons,
19
19
  S as Seo,
@@ -1,4 +1,4 @@
1
- import { RenderFunction } from '../../types';
1
+ import { BoxPositionProps, RenderFunction } from '../../types';
2
2
  type ListRenderProps<T> = T extends string ? {
3
3
  render?: never;
4
4
  } : {
@@ -8,6 +8,6 @@ type ListProps<T = string> = {
8
8
  items: T[];
9
9
  bullet?: string;
10
10
  className?: string;
11
- } & ListRenderProps<T>;
12
- declare const List: <T>({ items, bullet, render, className }: ListProps<T>) => import("react/jsx-runtime").JSX.Element;
11
+ } & ListRenderProps<T> & BoxPositionProps;
12
+ declare const List: <T>({ items, bullet, render, className, ...boxProps }: ListProps<T>) => import("react/jsx-runtime").JSX.Element;
13
13
  export default List;
@@ -1,4 +1,5 @@
1
1
  import { FC, ReactNode } from 'react';
2
+ import { BoxPositionProps } from '../../types';
2
3
  type TableProps = {
3
4
  columnNumber: number;
4
5
  items: ReactNode[];
@@ -7,6 +8,6 @@ type TableProps = {
7
8
  striped?: boolean;
8
9
  scrollable?: boolean;
9
10
  className?: string;
10
- };
11
+ } & BoxPositionProps;
11
12
  declare const Table: FC<TableProps>;
12
13
  export default Table;
@@ -1,8 +1,8 @@
1
- import { ITabItem, RenderFunction } from '../../types';
1
+ import { BoxPositionProps, ITabItem, RenderFunction } from '../../types';
2
2
  type TabsProps<T> = {
3
3
  items: ITabItem<T>[];
4
4
  className?: string;
5
5
  render: RenderFunction<T>;
6
- };
7
- declare const Tabs: <T>({ items, className, render }: TabsProps<T>) => import("react/jsx-runtime").JSX.Element;
6
+ } & BoxPositionProps;
7
+ declare const Tabs: <T>({ items, className, render, ...boxProps }: TabsProps<T>) => import("react/jsx-runtime").JSX.Element;
8
8
  export default Tabs;
@@ -79,8 +79,25 @@ const Author = ({ author, ...cardProps }) => {
79
79
  )
80
80
  ] });
81
81
  };
82
- const Center = ({ children, className }) => {
83
- return /* @__PURE__ */ jsxRuntime.jsx(react$1.Center, { className, children });
82
+ const Center = ({ children, className, ...boxProps }) => {
83
+ return /* @__PURE__ */ jsxRuntime.jsx(react$1.Center, { className, ...boxProps, children });
84
+ };
85
+ const defaultColumns = { base: 1, sm: 2, md: 3, lg: 4, xl: 5 };
86
+ const Grid = ({ items, columns = defaultColumns, gap, render, getKey, className, ...boxProps }) => {
87
+ return /* @__PURE__ */ jsxRuntime.jsx(
88
+ react$1.SimpleGrid,
89
+ {
90
+ as: "ul",
91
+ columns,
92
+ spacing: gap,
93
+ p: 0,
94
+ m: 0,
95
+ listStyleType: "none",
96
+ className,
97
+ ...boxProps,
98
+ children: items.map((item, index2) => /* @__PURE__ */ jsxRuntime.jsx(react$1.Box, { as: "li", children: render(item) }, getKey ? getKey(item) : index2))
99
+ }
100
+ );
84
101
  };
85
102
  const LinkButton = ({ label, url, width = "auto" }) => {
86
103
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -791,11 +808,11 @@ const Layout = ({ children }) => {
791
808
  /* @__PURE__ */ jsxRuntime.jsx(ScrollToTop, {})
792
809
  ] });
793
810
  };
794
- const List = ({ items, bullet = "—", render, className }) => {
795
- return /* @__PURE__ */ jsxRuntime.jsx(react$1.List, { as: "ul", pl: 0, ml: 2, mb: 4, className, children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(react$1.ListItem, { as: "li", display: "flex", gap: 1, children: [
811
+ const List = ({ items, bullet = "—", render, className, ...boxProps }) => {
812
+ return /* @__PURE__ */ jsxRuntime.jsx(react$1.List, { pl: 0, ml: 2, mb: 4, className, ...boxProps, children: items.map((item, index2) => /* @__PURE__ */ jsxRuntime.jsxs(react$1.ListItem, { display: "flex", gap: 1, children: [
796
813
  /* @__PURE__ */ jsxRuntime.jsx(react$1.Box, { children: bullet }),
797
814
  render ? render(item) : item
798
- ] })) });
815
+ ] }, index2)) });
799
816
  };
800
817
  const TitleMap = {
801
818
  pros: "advantages",
@@ -893,7 +910,8 @@ const Table = ({
893
910
  bordered = false,
894
911
  striped = true,
895
912
  scrollable,
896
- className
913
+ className,
914
+ ...boxProps
897
915
  }) => {
898
916
  const headerItems = items.slice(0, columnNumber);
899
917
  const bodyItems = items.slice(columnNumber);
@@ -903,6 +921,7 @@ const Table = ({
903
921
  border: bordered ? void 0 : "none",
904
922
  ...scrollable ? { maxH: "50vh", overflowY: "auto" } : {},
905
923
  className,
924
+ ...boxProps,
906
925
  children: [
907
926
  /* @__PURE__ */ jsxRuntime.jsxs(react$1.Table, { variant: striped ? "striped" : "simple", children: [
908
927
  /* @__PURE__ */ jsxRuntime.jsx(react$1.Thead, { ...scrollable ? { position: "sticky", top: 0, zIndex: 1, bg: "gray.800" } : {}, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.Tr, { children: headerItems.map((item, index2) => /* @__PURE__ */ jsxRuntime.jsx(react$1.Th, { children: item }, index2)) }) }),
@@ -913,7 +932,7 @@ const Table = ({
913
932
  }
914
933
  );
915
934
  };
916
- const Tabs = ({ items, className, render }) => {
935
+ const Tabs = ({ items, className, render, ...boxProps }) => {
917
936
  const { tabs, panels } = react.useMemo(() => {
918
937
  const tabs2 = [];
919
938
  const panels2 = [];
@@ -923,7 +942,7 @@ const Tabs = ({ items, className, render }) => {
923
942
  });
924
943
  return { tabs: tabs2, panels: panels2 };
925
944
  }, []);
926
- return /* @__PURE__ */ jsxRuntime.jsxs(react$1.Tabs, { overflow: "hidden", colorScheme: "brand", className, children: [
945
+ return /* @__PURE__ */ jsxRuntime.jsxs(react$1.Tabs, { overflow: "hidden", colorScheme: "brand", className, ...boxProps, children: [
927
946
  /* @__PURE__ */ jsxRuntime.jsx(react$1.TabList, { overflow: "auto hidden", children: tabs.map(({ label, icon }, index2) => /* @__PURE__ */ jsxRuntime.jsx(react$1.Tab, { children: /* @__PURE__ */ jsxRuntime.jsx(react$1.Text, { as: "h3", isTruncated: true, children: icon ? `${icon} ${label}` : label }) }, index2)) }),
928
947
  /* @__PURE__ */ jsxRuntime.jsx(react$1.TabPanels, { children: panels.map((panel, index2) => /* @__PURE__ */ jsxRuntime.jsx(react$1.TabPanel, { children: render(panel) }, index2)) })
929
948
  ] });
@@ -938,6 +957,7 @@ exports.Features = Features;
938
957
  exports.GameCard = GameCard;
939
958
  exports.GameDemo = GameDemo;
940
959
  exports.GameInfo = GameInfo;
960
+ exports.Grid = Grid;
941
961
  exports.HowTo = HowTo;
942
962
  exports.Layout = Layout;
943
963
  exports.LinkButton = LinkButton;
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { Box, Collapse, Text, Button, Flex, Stack, Card, CardHeader, Heading, CardBody, Center as Center$1, Link, Popover, PopoverTrigger, PopoverContent, PopoverBody, CardFooter, useToast, useColorModeValue, VStack, FormControl, FormLabel, InputGroup, InputLeftElement, Input, Textarea, Accordion, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, SimpleGrid, LinkBox, Image, LinkOverlay, IconButton, AbsoluteCenter, Spinner, useDisclosure, Divider, Circle, Container as Container$1, Icon, useBreakpointValue, 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 { Box, Collapse, Text, Button, Flex, Stack, Card, CardHeader, Heading, CardBody, Center as Center$1, SimpleGrid, Link, Popover, PopoverTrigger, PopoverContent, PopoverBody, CardFooter, useToast, useColorModeValue, VStack, FormControl, FormLabel, InputGroup, InputLeftElement, Input, Textarea, Accordion, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, LinkBox, Image, LinkOverlay, IconButton, AbsoluteCenter, Spinner, useDisclosure, Divider, Circle, Container as Container$1, Icon, useBreakpointValue, 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 { EmailIcon, StarIcon, CloseIcon, ExternalLinkIcon, ChevronRightIcon, ChevronDownIcon, HamburgerIcon, ChevronUpIcon, WarningIcon, CheckCircleIcon } from "@chakra-ui/icons";
5
5
  import { getImage, GatsbyImage } from "gatsby-plugin-image";
@@ -78,8 +78,25 @@ const Author = ({ author, ...cardProps }) => {
78
78
  )
79
79
  ] });
80
80
  };
81
- const Center = ({ children, className }) => {
82
- return /* @__PURE__ */ jsx(Center$1, { className, children });
81
+ const Center = ({ children, className, ...boxProps }) => {
82
+ return /* @__PURE__ */ jsx(Center$1, { className, ...boxProps, children });
83
+ };
84
+ const defaultColumns = { base: 1, sm: 2, md: 3, lg: 4, xl: 5 };
85
+ const Grid = ({ items, columns = defaultColumns, gap, render, getKey, className, ...boxProps }) => {
86
+ return /* @__PURE__ */ jsx(
87
+ SimpleGrid,
88
+ {
89
+ as: "ul",
90
+ columns,
91
+ spacing: gap,
92
+ p: 0,
93
+ m: 0,
94
+ listStyleType: "none",
95
+ className,
96
+ ...boxProps,
97
+ children: items.map((item, index) => /* @__PURE__ */ jsx(Box, { as: "li", children: render(item) }, getKey ? getKey(item) : index))
98
+ }
99
+ );
83
100
  };
84
101
  const LinkButton = ({ label, url, width = "auto" }) => {
85
102
  return /* @__PURE__ */ jsx(
@@ -790,11 +807,11 @@ const Layout = ({ children }) => {
790
807
  /* @__PURE__ */ jsx(ScrollToTop, {})
791
808
  ] });
792
809
  };
793
- const List = ({ items, bullet = "—", render, className }) => {
794
- return /* @__PURE__ */ jsx(List$1, { as: "ul", pl: 0, ml: 2, mb: 4, className, children: items.map((item) => /* @__PURE__ */ jsxs(ListItem, { as: "li", display: "flex", gap: 1, children: [
810
+ const List = ({ items, bullet = "—", render, className, ...boxProps }) => {
811
+ return /* @__PURE__ */ jsx(List$1, { pl: 0, ml: 2, mb: 4, className, ...boxProps, children: items.map((item, index) => /* @__PURE__ */ jsxs(ListItem, { display: "flex", gap: 1, children: [
795
812
  /* @__PURE__ */ jsx(Box, { children: bullet }),
796
813
  render ? render(item) : item
797
- ] })) });
814
+ ] }, index)) });
798
815
  };
799
816
  const TitleMap = {
800
817
  pros: "advantages",
@@ -892,7 +909,8 @@ const Table = ({
892
909
  bordered = false,
893
910
  striped = true,
894
911
  scrollable,
895
- className
912
+ className,
913
+ ...boxProps
896
914
  }) => {
897
915
  const headerItems = items.slice(0, columnNumber);
898
916
  const bodyItems = items.slice(columnNumber);
@@ -902,6 +920,7 @@ const Table = ({
902
920
  border: bordered ? void 0 : "none",
903
921
  ...scrollable ? { maxH: "50vh", overflowY: "auto" } : {},
904
922
  className,
923
+ ...boxProps,
905
924
  children: [
906
925
  /* @__PURE__ */ jsxs(Table$1, { variant: striped ? "striped" : "simple", children: [
907
926
  /* @__PURE__ */ jsx(Thead, { ...scrollable ? { position: "sticky", top: 0, zIndex: 1, bg: "gray.800" } : {}, children: /* @__PURE__ */ jsx(Tr, { children: headerItems.map((item, index) => /* @__PURE__ */ jsx(Th, { children: item }, index)) }) }),
@@ -912,7 +931,7 @@ const Table = ({
912
931
  }
913
932
  );
914
933
  };
915
- const Tabs = ({ items, className, render }) => {
934
+ const Tabs = ({ items, className, render, ...boxProps }) => {
916
935
  const { tabs, panels } = useMemo(() => {
917
936
  const tabs2 = [];
918
937
  const panels2 = [];
@@ -922,7 +941,7 @@ const Tabs = ({ items, className, render }) => {
922
941
  });
923
942
  return { tabs: tabs2, panels: panels2 };
924
943
  }, []);
925
- return /* @__PURE__ */ jsxs(Tabs$1, { overflow: "hidden", colorScheme: "brand", className, children: [
944
+ return /* @__PURE__ */ jsxs(Tabs$1, { overflow: "hidden", colorScheme: "brand", className, ...boxProps, children: [
926
945
  /* @__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)) }),
927
946
  /* @__PURE__ */ jsx(TabPanels, { children: panels.map((panel, index) => /* @__PURE__ */ jsx(TabPanel, { children: render(panel) }, index)) })
928
947
  ] });
@@ -945,5 +964,6 @@ export {
945
964
  List as d,
946
965
  Tabs as e,
947
966
  Center as f,
948
- LinkButton as g
967
+ Grid as g,
968
+ LinkButton as h
949
969
  };
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-CB4bJU2N.js");
3
+ const index = require("./index-C5pGuMKq.js");
4
4
  const index$1 = require("./index-IpSV-c71.js");
5
5
  const i18n$1 = require("./index-DCIXk-YH.js");
6
6
  const index$2 = require("./index-BWuTDC6H.js");
@@ -18,7 +18,7 @@ exports.Features = index.Features;
18
18
  exports.GameCard = index.GameCard;
19
19
  exports.GameDemo = index.GameDemo;
20
20
  exports.GameInfo = index.GameInfo;
21
- exports.Grid = index.Center;
21
+ exports.Grid = index.Grid;
22
22
  exports.HowTo = index.HowTo;
23
23
  exports.Layout = index.Layout;
24
24
  exports.LinkButton = index.LinkButton;
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { A, B, f, C, E, F, a, G, b, c, f as f2, H, L, g, d, P, S, T, e } from "./index-CD5ZU1Gw.mjs";
1
+ import { A, B, f, C, E, F, a, G, b, c, g, H, L, h, d, P, S, T, e } from "./index-DZkjaSoV.mjs";
2
2
  import { u } from "./index-xuSxvz5z.mjs";
3
3
  import { a as a2, G as G2, r } from "./index-DxLcykuT.mjs";
4
4
  import { M } from "./index-wbMOJRW_.mjs";
5
5
  import { S as S2, u as u2 } from "./index-Bs4zA1wD.mjs";
6
- import { f as f3, b as b2, c as c2, a as a3, g as g2, d as d2, p, r as r2, t } from "./index-CJvs4SfG.mjs";
6
+ import { f as f2, b as b2, c as c2, a as a3, g as g2, d as d2, p, r as r2, t } from "./index-CJvs4SfG.mjs";
7
7
  import { e as e2, g as g3 } from "./index-BUx1Bxrs.mjs";
8
8
  import { default as default2 } from "i18next";
9
9
  export {
@@ -19,10 +19,10 @@ export {
19
19
  b as GameDemo,
20
20
  c as GameInfo,
21
21
  G2 as GameVolatility,
22
- f2 as Grid,
22
+ g as Grid,
23
23
  H as HowTo,
24
24
  L as Layout,
25
- g as LinkButton,
25
+ h as LinkButton,
26
26
  d as List,
27
27
  M as MdxProvider,
28
28
  P as ProsCons,
@@ -31,7 +31,7 @@ export {
31
31
  T as Table,
32
32
  e as Tabs,
33
33
  e2 as extractTheme,
34
- f3 as formatDate,
34
+ f2 as formatDate,
35
35
  b2 as formatNumber,
36
36
  g3 as generateColorPalette,
37
37
  c2 as getCurrencySymbol,
@@ -1,3 +1,8 @@
1
1
  import { Key, ReactElement } from 'react';
2
+ import { BoxProps } from '@chakra-ui/react';
2
3
  export type KeyGetter<T> = (item: T) => Key;
3
4
  export type RenderFunction<T> = (item: T) => ReactElement;
5
+ type BoxPaddingProps = Pick<BoxProps, 'p' | 'pt' | 'pr' | 'pb' | 'pl' | 'px' | 'py' | 'ps' | 'pe'>;
6
+ type BoxMarginProps = Pick<BoxProps, 'm' | 'mt' | 'mr' | 'mb' | 'ml' | 'mx' | 'my' | 'ms' | 'me'>;
7
+ export type BoxPositionProps = BoxMarginProps & BoxPaddingProps;
8
+ export {};
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": "1.5.0",
4
+ "version": "1.5.3",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",
@@ -67,7 +67,11 @@
67
67
  "start": "npm pack",
68
68
  "build": "tsc -b && vite build",
69
69
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
70
- "prepack": "npm run build"
70
+ "prepack": "npm run build",
71
+ "bump:patch": "npm version patch",
72
+ "bump:minor": "npm version minor",
73
+ "bump:major": "npm version major",
74
+ "postversion": "git push --follow-tags && npm publish"
71
75
  },
72
76
  "devDependencies": {
73
77
  "@types/react": "18.3.12",
@@ -98,4 +102,4 @@
98
102
  "react-dom": "^18.3.1",
99
103
  "react-i18next": "^15.0.0"
100
104
  }
101
- }
105
+ }