@ttoss/components 2.0.8 → 2.0.10

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.
Files changed (44) hide show
  1. package/LICENSE +21 -674
  2. package/dist/Accordion/index.d.ts +16 -0
  3. package/dist/Drawer/index.d.ts +12 -0
  4. package/dist/InstallPwa/index.d.ts +10 -0
  5. package/dist/List/index.d.ts +13 -0
  6. package/dist/Markdown/index.d.ts +11 -0
  7. package/dist/Menu/index.d.ts +32 -0
  8. package/dist/Modal/index.d.ts +10 -0
  9. package/dist/Search/index.d.ts +11 -0
  10. package/dist/Table/index.d.ts +14 -0
  11. package/dist/Toast/index.d.ts +7 -0
  12. package/dist/esm/Accordion/index.js +53 -0
  13. package/dist/esm/Drawer/index.js +53 -0
  14. package/dist/esm/InstallPwa/index.js +66 -0
  15. package/dist/esm/List/index.js +33 -0
  16. package/dist/esm/Markdown/index.js +24 -0
  17. package/dist/esm/Menu/index.js +2298 -0
  18. package/dist/esm/Modal/index.js +65 -0
  19. package/dist/esm/Search/index.js +30 -0
  20. package/dist/esm/Table/index.js +84 -0
  21. package/dist/esm/Toast/index.js +35 -0
  22. package/dist/esm/chunk-XEYGFSK5.js +29 -0
  23. package/package.json +10 -10
  24. package/src/components/Accordion/Accordion.tsx +0 -75
  25. package/src/components/Accordion/index.ts +0 -1
  26. package/src/components/Drawer/Drawer.tsx +0 -57
  27. package/src/components/Drawer/index.ts +0 -1
  28. package/src/components/InstallPwa/InstallPwa.tsx +0 -70
  29. package/src/components/InstallPwa/index.ts +0 -1
  30. package/src/components/List/List.tsx +0 -17
  31. package/src/components/List/ListItem.tsx +0 -18
  32. package/src/components/List/index.ts +0 -2
  33. package/src/components/Markdown/Markdown.tsx +0 -23
  34. package/src/components/Markdown/index.ts +0 -1
  35. package/src/components/Menu/Menu.tsx +0 -107
  36. package/src/components/Menu/index.ts +0 -1
  37. package/src/components/Modal/Modal.tsx +0 -64
  38. package/src/components/Modal/index.ts +0 -1
  39. package/src/components/Search/Search.tsx +0 -36
  40. package/src/components/Search/index.ts +0 -1
  41. package/src/components/Table/Table.tsx +0 -36
  42. package/src/components/Table/index.ts +0 -1
  43. package/src/components/Toast/Toast.tsx +0 -37
  44. package/src/components/Toast/index.ts +0 -1
@@ -0,0 +1,16 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { BoxProps } from '@ttoss/ui';
3
+ export { AccordionItem, AccordionItemButton, AccordionItemHeading, AccordionItemPanel } from 'react-accessible-accordion';
4
+
5
+ type AccordionProps = BoxProps & {
6
+ allowMultipleExpanded?: boolean;
7
+ allowZeroExpanded?: boolean;
8
+ preExpanded?: string[];
9
+ /**
10
+ * Callback which is invoked when items are expanded or collapsed. Gets passed uuids of the currently expanded AccordionItems.
11
+ */
12
+ onChange?: (args: string[]) => void;
13
+ };
14
+ declare const Accordion: ({ children, allowMultipleExpanded, allowZeroExpanded, preExpanded, onChange, ...boxProps }: AccordionProps) => react_jsx_runtime.JSX.Element;
15
+
16
+ export { Accordion, type AccordionProps };
@@ -0,0 +1,12 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import { BoxProps } from '@ttoss/ui';
4
+ import DrawerUi from 'react-modern-drawer';
5
+
6
+ type DrawerUiProps = React.ComponentProps<typeof DrawerUi>;
7
+ type DrawerProps = DrawerUiProps & {
8
+ sx?: BoxProps['sx'];
9
+ };
10
+ declare const Drawer: ({ children, sx, ...props }: DrawerProps) => react_jsx_runtime.JSX.Element;
11
+
12
+ export { Drawer, type DrawerProps };
@@ -0,0 +1,10 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+
4
+ type InstallPwaUiProps = {
5
+ onInstall: React.MouseEventHandler<HTMLButtonElement>;
6
+ };
7
+ declare const InstallPwaUi: ({ onInstall }: InstallPwaUiProps) => react_jsx_runtime.JSX.Element;
8
+ declare const InstallPwa: () => react_jsx_runtime.JSX.Element | null;
9
+
10
+ export { InstallPwa, InstallPwaUi, type InstallPwaUiProps };
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+
3
+ interface ListProps extends React.HTMLProps<HTMLUListElement> {
4
+ children: React.ReactNode;
5
+ }
6
+ declare const List: React.ForwardRefExoticComponent<Omit<ListProps, "ref"> & React.RefAttributes<HTMLUListElement>>;
7
+
8
+ interface ListItemProps extends React.HTMLProps<HTMLLIElement> {
9
+ children: React.ReactNode;
10
+ }
11
+ declare const ListItem: React.ForwardRefExoticComponent<Omit<ListItemProps, "ref"> & React.RefAttributes<HTMLLIElement>>;
12
+
13
+ export { List, ListItem, type ListItemProps, type ListProps };
@@ -0,0 +1,11 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { FlexProps } from '@ttoss/ui';
3
+ import { Options } from 'react-markdown';
4
+
5
+ type MarkdownProps = Options & {
6
+ children: string;
7
+ sx?: FlexProps['sx'];
8
+ };
9
+ declare const Markdown: ({ children, sx, ...props }: MarkdownProps) => react_jsx_runtime.JSX.Element;
10
+
11
+ export { Markdown, type MarkdownProps };
@@ -0,0 +1,32 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import { BoxProps } from '@ttoss/ui';
4
+ import { IconifyIcon } from '@ttoss/react-icons';
5
+
6
+ type MenuProps = {
7
+ onClose: () => void;
8
+ onOpen: () => void;
9
+ isOpen: boolean;
10
+ children: React.ReactNode;
11
+ srcLogo?: string;
12
+ sx?: BoxProps['sx'];
13
+ /**
14
+ * Default direction: `left`
15
+ */
16
+ direction?: 'left' | 'right';
17
+ /**
18
+ * Default size: `100%`
19
+ */
20
+ sizeOnMobile?: string | number;
21
+ /**
22
+ * Default size: `300px`
23
+ */
24
+ sizeOnDesktop?: string | number;
25
+ /**
26
+ * Default icon: `menu-open`
27
+ */
28
+ menuIcon?: IconifyIcon | string;
29
+ };
30
+ declare const Menu: ({ children, srcLogo, onClose, onOpen, isOpen, sx, direction, sizeOnDesktop, sizeOnMobile, menuIcon, }: MenuProps) => react_jsx_runtime.JSX.Element;
31
+
32
+ export { Menu, type MenuProps };
@@ -0,0 +1,10 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import ReactModal from 'react-modal';
3
+
4
+ type ModalProps = ReactModal.Props;
5
+ declare const Modal: {
6
+ (props: ModalProps): react_jsx_runtime.JSX.Element;
7
+ setAppElement: typeof ReactModal.setAppElement;
8
+ };
9
+
10
+ export { Modal, type ModalProps };
@@ -0,0 +1,11 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { InputProps } from '@ttoss/ui';
3
+
4
+ type SearchProps = Omit<InputProps, 'onChange'> & {
5
+ loading?: boolean;
6
+ debounce?: number;
7
+ onChange: (value?: InputProps['value']) => void;
8
+ };
9
+ declare const Search: ({ value, defaultValue, loading, onChange, ...props }: SearchProps) => react_jsx_runtime.JSX.Element;
10
+
11
+ export { Search, type SearchProps };
@@ -0,0 +1,14 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { BoxProps } from '@ttoss/ui';
3
+ export * from '@tanstack/react-table';
4
+
5
+ declare const Table: (props: BoxProps) => react_jsx_runtime.JSX.Element;
6
+ declare const TableHead: (props: BoxProps) => react_jsx_runtime.JSX.Element;
7
+ declare const TableBody: (props: BoxProps) => react_jsx_runtime.JSX.Element;
8
+ declare const TableRow: (props: BoxProps) => react_jsx_runtime.JSX.Element;
9
+ declare const TableCell: (props: BoxProps) => react_jsx_runtime.JSX.Element;
10
+ declare const TableHeader: (props: BoxProps) => react_jsx_runtime.JSX.Element;
11
+ declare const TableCaption: (props: BoxProps) => react_jsx_runtime.JSX.Element;
12
+ declare const TableFooter: (props: BoxProps) => react_jsx_runtime.JSX.Element;
13
+
14
+ export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ToastContainerProps } from 'react-toastify';
3
+ export { ToastContainerProps, toast } from 'react-toastify';
4
+
5
+ declare const ToastContainer: (props: ToastContainerProps) => react_jsx_runtime.JSX.Element;
6
+
7
+ export { ToastContainer };
@@ -0,0 +1,53 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+
3
+ // src/components/Accordion/Accordion.tsx
4
+ import * as React from "react";
5
+ import { AccordionItem, AccordionItemButton, AccordionItemHeading, AccordionItemPanel, Accordion as ReactAccessibleAccordion } from "react-accessible-accordion";
6
+ import { Box, useTheme } from "@ttoss/ui";
7
+ import { css as createClassName } from "@emotion/css";
8
+ import { css as transformStyleObject } from "@theme-ui/css";
9
+ import { jsx } from "react/jsx-runtime";
10
+ var Accordion = ({
11
+ children,
12
+ allowMultipleExpanded,
13
+ allowZeroExpanded,
14
+ preExpanded,
15
+ onChange,
16
+ ...boxProps
17
+ }) => {
18
+ const {
19
+ theme
20
+ } = useTheme();
21
+ const className = React.useMemo(() => {
22
+ const styles = transformStyleObject({
23
+ ".accordion__item": {
24
+ marginBottom: 3
25
+ },
26
+ ".accordion__heading": {
27
+ padding: "md",
28
+ border: "1px solid",
29
+ borderColor: "black"
30
+ },
31
+ ".accordion__button": {},
32
+ ".accordion__panel": {
33
+ padding: 2
34
+ }
35
+ })(theme);
36
+ return createClassName(styles);
37
+ }, [theme]);
38
+ return /* @__PURE__ */jsx(Box, {
39
+ variant: "accordion",
40
+ className,
41
+ ...boxProps,
42
+ children: /* @__PURE__ */jsx(ReactAccessibleAccordion, {
43
+ ...{
44
+ allowMultipleExpanded,
45
+ allowZeroExpanded,
46
+ preExpanded,
47
+ onChange
48
+ },
49
+ children
50
+ })
51
+ });
52
+ };
53
+ export { Accordion, AccordionItem, AccordionItemButton, AccordionItemHeading, AccordionItemPanel };
@@ -0,0 +1,53 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+
3
+ // src/components/Drawer/Drawer.tsx
4
+ import { Box } from "@ttoss/ui";
5
+ import { css as createClassName } from "@emotion/css";
6
+ import DrawerUi from "react-modern-drawer";
7
+ import { jsx } from "react/jsx-runtime";
8
+ var reactModernDrawerClassName = createClassName(`
9
+ .EZDrawer .EZDrawer__checkbox {
10
+ display: none;
11
+ }
12
+ .EZDrawer .EZDrawer__checkbox:checked ~ .EZDrawer__overlay {
13
+ display: block;
14
+ opacity: 1;
15
+ }
16
+ .EZDrawer .EZDrawer__checkbox:checked ~ .EZDrawer__container {
17
+ visibility: visible;
18
+ transform: translate3d(0, 0, 0) !important;
19
+ }
20
+ .EZDrawer .EZDrawer__overlay {
21
+ display: none;
22
+ height: 100vh;
23
+ left: 0;
24
+ position: fixed;
25
+ top: 0;
26
+ width: 100%;
27
+ }
28
+ .EZDrawer .EZDrawer__container {
29
+ position: fixed;
30
+ visibility: hidden;
31
+ background: white;
32
+ transition: all;
33
+ box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.1);
34
+ }`);
35
+ var Drawer = ({
36
+ children,
37
+ sx,
38
+ ...props
39
+ }) => {
40
+ return /* @__PURE__ */jsx(DrawerUi, {
41
+ ...props,
42
+ className: reactModernDrawerClassName,
43
+ children: /* @__PURE__ */jsx(Box, {
44
+ sx: {
45
+ width: "100%",
46
+ height: "100%",
47
+ ...sx
48
+ },
49
+ children
50
+ })
51
+ });
52
+ };
53
+ export { Drawer };
@@ -0,0 +1,66 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+
3
+ // src/components/InstallPwa/InstallPwa.tsx
4
+ import * as React from "react";
5
+ import { Button, Flex, Text } from "@ttoss/ui";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ var InstallPwaUi = ({
8
+ onInstall
9
+ }) => {
10
+ return /* @__PURE__ */jsx(Flex, {
11
+ sx: {
12
+ position: "absolute",
13
+ bottom: 4,
14
+ width: "100%",
15
+ justifyContent: "center"
16
+ },
17
+ children: /* @__PURE__ */jsxs(Flex, {
18
+ sx: {
19
+ backgroundColor: "background",
20
+ justifyContent: "center",
21
+ alignItems: "center",
22
+ gap: 3,
23
+ width: "auto",
24
+ border: "1px solid",
25
+ borderColor: "muted",
26
+ borderRadius: 1,
27
+ padding: 4
28
+ },
29
+ children: [/* @__PURE__ */jsx(Text, {
30
+ children: "Deseja instalar o nosso aplicativo?"
31
+ }), /* @__PURE__ */jsx(Button, {
32
+ onClick: onInstall,
33
+ children: "Instalar"
34
+ })]
35
+ })
36
+ });
37
+ };
38
+ var InstallPwa = () => {
39
+ const [supportsPwa, setSupportsPwa] = React.useState(false);
40
+ const [promptInstall, setPromptInstall] = React.useState(null);
41
+ React.useEffect(() => {
42
+ const handler = e => {
43
+ e.preventDefault();
44
+ setSupportsPwa(true);
45
+ setPromptInstall(e);
46
+ };
47
+ window.addEventListener("beforeinstallprompt", handler);
48
+ return () => {
49
+ return window.removeEventListener("transitionend", handler);
50
+ };
51
+ }, []);
52
+ const onInstall = e => {
53
+ e.preventDefault();
54
+ if (!promptInstall) {
55
+ return;
56
+ }
57
+ promptInstall.prompt();
58
+ };
59
+ if (!supportsPwa) {
60
+ return null;
61
+ }
62
+ return /* @__PURE__ */jsx(InstallPwaUi, {
63
+ onInstall
64
+ });
65
+ };
66
+ export { InstallPwa, InstallPwaUi };
@@ -0,0 +1,33 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+
3
+ // src/components/List/List.tsx
4
+ import * as React from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ var List = React.forwardRef(({
7
+ children,
8
+ ...props
9
+ }, ref) => {
10
+ return /* @__PURE__ */jsx("ul", {
11
+ ...props,
12
+ ref,
13
+ children
14
+ });
15
+ });
16
+ List.displayName = "List";
17
+
18
+ // src/components/List/ListItem.tsx
19
+ import * as React2 from "react";
20
+ import { jsx as jsx2 } from "react/jsx-runtime";
21
+ var ListItem = React2.forwardRef((props, ref) => {
22
+ const {
23
+ children,
24
+ ...rest
25
+ } = props;
26
+ return /* @__PURE__ */jsx2("li", {
27
+ ...rest,
28
+ ref,
29
+ children
30
+ });
31
+ });
32
+ ListItem.displayName = "ListItem";
33
+ export { List, ListItem };
@@ -0,0 +1,24 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+
3
+ // src/components/Markdown/Markdown.tsx
4
+ import { BaseStyles } from "@ttoss/ui";
5
+ import ReactMarkdown from "react-markdown";
6
+ import rehypeRaw from "rehype-raw";
7
+ import remarkGfm from "remark-gfm";
8
+ import { jsx } from "react/jsx-runtime";
9
+ var Markdown = ({
10
+ children,
11
+ sx,
12
+ ...props
13
+ }) => {
14
+ return /* @__PURE__ */jsx(BaseStyles, {
15
+ sx,
16
+ children: /* @__PURE__ */jsx(ReactMarkdown, {
17
+ rehypePlugins: [rehypeRaw],
18
+ remarkPlugins: [remarkGfm],
19
+ ...props,
20
+ children
21
+ })
22
+ });
23
+ };
24
+ export { Markdown };