@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.
- package/LICENSE +21 -674
- package/dist/Accordion/index.d.ts +16 -0
- package/dist/Drawer/index.d.ts +12 -0
- package/dist/InstallPwa/index.d.ts +10 -0
- package/dist/List/index.d.ts +13 -0
- package/dist/Markdown/index.d.ts +11 -0
- package/dist/Menu/index.d.ts +32 -0
- package/dist/Modal/index.d.ts +10 -0
- package/dist/Search/index.d.ts +11 -0
- package/dist/Table/index.d.ts +14 -0
- package/dist/Toast/index.d.ts +7 -0
- package/dist/esm/Accordion/index.js +53 -0
- package/dist/esm/Drawer/index.js +53 -0
- package/dist/esm/InstallPwa/index.js +66 -0
- package/dist/esm/List/index.js +33 -0
- package/dist/esm/Markdown/index.js +24 -0
- package/dist/esm/Menu/index.js +2298 -0
- package/dist/esm/Modal/index.js +65 -0
- package/dist/esm/Search/index.js +30 -0
- package/dist/esm/Table/index.js +84 -0
- package/dist/esm/Toast/index.js +35 -0
- package/dist/esm/chunk-XEYGFSK5.js +29 -0
- package/package.json +10 -10
- package/src/components/Accordion/Accordion.tsx +0 -75
- package/src/components/Accordion/index.ts +0 -1
- package/src/components/Drawer/Drawer.tsx +0 -57
- package/src/components/Drawer/index.ts +0 -1
- package/src/components/InstallPwa/InstallPwa.tsx +0 -70
- package/src/components/InstallPwa/index.ts +0 -1
- package/src/components/List/List.tsx +0 -17
- package/src/components/List/ListItem.tsx +0 -18
- package/src/components/List/index.ts +0 -2
- package/src/components/Markdown/Markdown.tsx +0 -23
- package/src/components/Markdown/index.ts +0 -1
- package/src/components/Menu/Menu.tsx +0 -107
- package/src/components/Menu/index.ts +0 -1
- package/src/components/Modal/Modal.tsx +0 -64
- package/src/components/Modal/index.ts +0 -1
- package/src/components/Search/Search.tsx +0 -36
- package/src/components/Search/index.ts +0 -1
- package/src/components/Table/Table.tsx +0 -36
- package/src/components/Table/index.ts +0 -1
- package/src/components/Toast/Toast.tsx +0 -37
- package/src/components/Toast/index.ts +0 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import "../chunk-XEYGFSK5.js";
|
|
3
|
+
|
|
4
|
+
// src/components/Modal/Modal.tsx
|
|
5
|
+
import { css as transformStyleObject } from "@theme-ui/css";
|
|
6
|
+
import { useResponsiveValue, useTheme } from "@ttoss/ui";
|
|
7
|
+
import ReactModal from "react-modal";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
ReactModal.defaultStyles = {
|
|
10
|
+
overlay: {},
|
|
11
|
+
content: {}
|
|
12
|
+
};
|
|
13
|
+
var Modal = props => {
|
|
14
|
+
const {
|
|
15
|
+
theme
|
|
16
|
+
} = useTheme();
|
|
17
|
+
const space = theme.space;
|
|
18
|
+
const padding = useResponsiveValue([space?.["lg"], space?.["xl"], space?.["xl"]]) || 0;
|
|
19
|
+
const style = {
|
|
20
|
+
overlay: transformStyleObject({
|
|
21
|
+
position: "fixed",
|
|
22
|
+
top: 0,
|
|
23
|
+
left: 0,
|
|
24
|
+
right: 0,
|
|
25
|
+
bottom: 0,
|
|
26
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
27
|
+
display: "flex",
|
|
28
|
+
justifyContent: "center",
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
zIndex: "modal",
|
|
31
|
+
...props.style?.overlay
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
+
})(theme),
|
|
34
|
+
content: transformStyleObject({
|
|
35
|
+
/**
|
|
36
|
+
* Theme
|
|
37
|
+
*/
|
|
38
|
+
backgroundColor: "surface",
|
|
39
|
+
padding,
|
|
40
|
+
border: "default",
|
|
41
|
+
borderColor: "surface",
|
|
42
|
+
borderRadius: "default",
|
|
43
|
+
/**
|
|
44
|
+
* General
|
|
45
|
+
*/
|
|
46
|
+
WebkitOverflowScrolling: "touch",
|
|
47
|
+
overflow: "auto",
|
|
48
|
+
position: "relative",
|
|
49
|
+
top: "0px",
|
|
50
|
+
left: "0px",
|
|
51
|
+
right: "0px",
|
|
52
|
+
bottom: "0px",
|
|
53
|
+
maxHeight: "90%",
|
|
54
|
+
maxWidth: "90%",
|
|
55
|
+
...props.style?.content
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
|
+
})(theme)
|
|
58
|
+
};
|
|
59
|
+
return /* @__PURE__ */jsx(ReactModal, {
|
|
60
|
+
...props,
|
|
61
|
+
style
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
Modal.setAppElement = ReactModal.setAppElement;
|
|
65
|
+
export { Modal };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import "../chunk-XEYGFSK5.js";
|
|
3
|
+
|
|
4
|
+
// src/components/Search/Search.tsx
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { Input } from "@ttoss/ui";
|
|
7
|
+
import { useDebounce } from "@ttoss/react-hooks";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
var Search = ({
|
|
10
|
+
value,
|
|
11
|
+
defaultValue,
|
|
12
|
+
loading,
|
|
13
|
+
onChange,
|
|
14
|
+
...props
|
|
15
|
+
}) => {
|
|
16
|
+
const [text, setText] = React.useState(value ?? defaultValue);
|
|
17
|
+
const debouncedValue = useDebounce(text, 500);
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
onChange(debouncedValue);
|
|
20
|
+
}, [debouncedValue, onChange]);
|
|
21
|
+
return /* @__PURE__ */jsx(Input, {
|
|
22
|
+
leadingIcon: loading ? "loading" : "search",
|
|
23
|
+
defaultValue: text,
|
|
24
|
+
onChange: e => {
|
|
25
|
+
return setText(e.target.value);
|
|
26
|
+
},
|
|
27
|
+
...props
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
export { Search };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import { __export, __reExport } from "../chunk-XEYGFSK5.js";
|
|
3
|
+
|
|
4
|
+
// src/components/Table/index.ts
|
|
5
|
+
var Table_exports2 = {};
|
|
6
|
+
__export(Table_exports2, {
|
|
7
|
+
Table: () => Table,
|
|
8
|
+
TableBody: () => TableBody,
|
|
9
|
+
TableCaption: () => TableCaption,
|
|
10
|
+
TableCell: () => TableCell,
|
|
11
|
+
TableFooter: () => TableFooter,
|
|
12
|
+
TableHead: () => TableHead,
|
|
13
|
+
TableHeader: () => TableHeader,
|
|
14
|
+
TableRow: () => TableRow
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// src/components/Table/Table.tsx
|
|
18
|
+
var Table_exports = {};
|
|
19
|
+
__export(Table_exports, {
|
|
20
|
+
Table: () => Table,
|
|
21
|
+
TableBody: () => TableBody,
|
|
22
|
+
TableCaption: () => TableCaption,
|
|
23
|
+
TableCell: () => TableCell,
|
|
24
|
+
TableFooter: () => TableFooter,
|
|
25
|
+
TableHead: () => TableHead,
|
|
26
|
+
TableHeader: () => TableHeader,
|
|
27
|
+
TableRow: () => TableRow
|
|
28
|
+
});
|
|
29
|
+
__reExport(Table_exports, react_table_star);
|
|
30
|
+
import { Box } from "@ttoss/ui";
|
|
31
|
+
import * as react_table_star from "@tanstack/react-table";
|
|
32
|
+
import { jsx } from "react/jsx-runtime";
|
|
33
|
+
var Table = props => {
|
|
34
|
+
return /* @__PURE__ */jsx(Box, {
|
|
35
|
+
as: "table",
|
|
36
|
+
...props
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
var TableHead = props => {
|
|
40
|
+
return /* @__PURE__ */jsx(Box, {
|
|
41
|
+
as: "thead",
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var TableBody = props => {
|
|
46
|
+
return /* @__PURE__ */jsx(Box, {
|
|
47
|
+
as: "tbody",
|
|
48
|
+
...props
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
var TableRow = props => {
|
|
52
|
+
return /* @__PURE__ */jsx(Box, {
|
|
53
|
+
as: "tr",
|
|
54
|
+
...props
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
var TableCell = props => {
|
|
58
|
+
return /* @__PURE__ */jsx(Box, {
|
|
59
|
+
as: "td",
|
|
60
|
+
...props
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
var TableHeader = props => {
|
|
64
|
+
return /* @__PURE__ */jsx(Box, {
|
|
65
|
+
as: "th",
|
|
66
|
+
...props
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
var TableCaption = props => {
|
|
70
|
+
return /* @__PURE__ */jsx(Box, {
|
|
71
|
+
as: "caption",
|
|
72
|
+
...props
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
var TableFooter = props => {
|
|
76
|
+
return /* @__PURE__ */jsx(Box, {
|
|
77
|
+
as: "tfoot",
|
|
78
|
+
...props
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// src/components/Table/index.ts
|
|
83
|
+
__reExport(Table_exports2, Table_exports);
|
|
84
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import "../chunk-XEYGFSK5.js";
|
|
3
|
+
|
|
4
|
+
// src/components/Toast/Toast.tsx
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { Box } from "@ttoss/ui";
|
|
7
|
+
import { ToastContainer as ReactToastifyToastContainer, toast } from "react-toastify";
|
|
8
|
+
import { injectStyle } from "react-toastify/dist/inject-style";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
var ToastContainer = props => {
|
|
11
|
+
React.useEffect(() => {
|
|
12
|
+
injectStyle();
|
|
13
|
+
}, []);
|
|
14
|
+
return /* @__PURE__ */jsx(Box, {
|
|
15
|
+
sx: ({
|
|
16
|
+
colors,
|
|
17
|
+
fonts
|
|
18
|
+
}) => {
|
|
19
|
+
return {
|
|
20
|
+
"--toastify-color-light": "#fff",
|
|
21
|
+
"--toastify-color-dark": "#121212",
|
|
22
|
+
"--toastify-color-info": colors?.info || "#3498db",
|
|
23
|
+
"--toastify-color-success": colors?.success || "#07bc0c",
|
|
24
|
+
"--toastify-color-warning": "#f1c40f",
|
|
25
|
+
"--toastify-color-error": "#e74c3c",
|
|
26
|
+
"--toastify-color-progress-light": `linear-gradient(to right, ${colors?.primary}, ${colors?.secondary})`,
|
|
27
|
+
"--toastify-font-family": fonts.body
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
children: /* @__PURE__ */jsx(ReactToastifyToastContainer, {
|
|
31
|
+
...props
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
export { ToastContainer, toast };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true,
|
|
10
|
+
value
|
|
11
|
+
}) : obj[key] = value;
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name in all) __defProp(target, name, {
|
|
14
|
+
get: all[name],
|
|
15
|
+
enumerable: true
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
21
|
+
get: () => from[key],
|
|
22
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return to;
|
|
26
|
+
};
|
|
27
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
28
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
29
|
+
export { __export, __reExport, __publicField };
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/components",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"description": "React components for ttoss ecosystem.",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"author": "ttoss",
|
|
6
7
|
"contributors": [
|
|
7
8
|
"Pedro Arantes <pedro@arantespp.com> (https://arantespp.com/contact)"
|
|
@@ -55,8 +56,7 @@
|
|
|
55
56
|
}
|
|
56
57
|
},
|
|
57
58
|
"files": [
|
|
58
|
-
"dist"
|
|
59
|
-
"src"
|
|
59
|
+
"dist"
|
|
60
60
|
],
|
|
61
61
|
"sideEffects": false,
|
|
62
62
|
"dependencies": {
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"react": ">=16.8.0",
|
|
77
|
-
"@ttoss/react-hooks": "^2.0.
|
|
78
|
-
"@ttoss/ui": "^5.0.
|
|
77
|
+
"@ttoss/react-hooks": "^2.0.4",
|
|
78
|
+
"@ttoss/ui": "^5.0.8"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@types/jest": "^29.5.13",
|
|
@@ -84,11 +84,11 @@
|
|
|
84
84
|
"react": "^18.3.1",
|
|
85
85
|
"tsup": "^8.3.0",
|
|
86
86
|
"tsx": "^4.6.2",
|
|
87
|
-
"@ttoss/config": "^1.
|
|
88
|
-
"@ttoss/react-icons": "^0.4.
|
|
89
|
-
"@ttoss/react-hooks": "^2.0.
|
|
90
|
-
"@ttoss/test-utils": "^2.1.
|
|
91
|
-
"@ttoss/ui": "^5.0.
|
|
87
|
+
"@ttoss/config": "^1.34.1",
|
|
88
|
+
"@ttoss/react-icons": "^0.4.4",
|
|
89
|
+
"@ttoss/react-hooks": "^2.0.4",
|
|
90
|
+
"@ttoss/test-utils": "^2.1.17",
|
|
91
|
+
"@ttoss/ui": "^5.0.8"
|
|
92
92
|
},
|
|
93
93
|
"keywords": [
|
|
94
94
|
"React",
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
AccordionItem,
|
|
4
|
-
AccordionItemButton,
|
|
5
|
-
AccordionItemHeading,
|
|
6
|
-
AccordionItemPanel,
|
|
7
|
-
Accordion as ReactAccessibleAccordion,
|
|
8
|
-
} from 'react-accessible-accordion';
|
|
9
|
-
import { Box, BoxProps, useTheme } from '@ttoss/ui';
|
|
10
|
-
import { css as createClassName } from '@emotion/css';
|
|
11
|
-
import { css as transformStyleObject } from '@theme-ui/css';
|
|
12
|
-
|
|
13
|
-
export type AccordionProps = BoxProps & {
|
|
14
|
-
// https://github.com/springload/react-accessible-accordion#accordion
|
|
15
|
-
allowMultipleExpanded?: boolean;
|
|
16
|
-
allowZeroExpanded?: boolean;
|
|
17
|
-
preExpanded?: string[];
|
|
18
|
-
/**
|
|
19
|
-
* Callback which is invoked when items are expanded or collapsed. Gets passed uuids of the currently expanded AccordionItems.
|
|
20
|
-
*/
|
|
21
|
-
onChange?: (args: string[]) => void;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const Accordion = ({
|
|
25
|
-
children,
|
|
26
|
-
allowMultipleExpanded,
|
|
27
|
-
allowZeroExpanded,
|
|
28
|
-
preExpanded,
|
|
29
|
-
onChange,
|
|
30
|
-
...boxProps
|
|
31
|
-
}: AccordionProps) => {
|
|
32
|
-
const { theme } = useTheme();
|
|
33
|
-
|
|
34
|
-
const className = React.useMemo(() => {
|
|
35
|
-
const styles = transformStyleObject({
|
|
36
|
-
'.accordion__item': {
|
|
37
|
-
marginBottom: 3,
|
|
38
|
-
},
|
|
39
|
-
'.accordion__heading': {
|
|
40
|
-
padding: 'md',
|
|
41
|
-
border: '1px solid',
|
|
42
|
-
borderColor: 'black',
|
|
43
|
-
},
|
|
44
|
-
'.accordion__button': {},
|
|
45
|
-
'.accordion__panel': {
|
|
46
|
-
padding: 2,
|
|
47
|
-
},
|
|
48
|
-
})(theme);
|
|
49
|
-
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
|
-
return createClassName(styles as any);
|
|
52
|
-
}, [theme]);
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<Box variant="accordion" className={className} {...boxProps}>
|
|
56
|
-
<ReactAccessibleAccordion
|
|
57
|
-
{...{
|
|
58
|
-
allowMultipleExpanded,
|
|
59
|
-
allowZeroExpanded,
|
|
60
|
-
preExpanded,
|
|
61
|
-
onChange,
|
|
62
|
-
}}
|
|
63
|
-
>
|
|
64
|
-
{children}
|
|
65
|
-
</ReactAccessibleAccordion>
|
|
66
|
-
</Box>
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export {
|
|
71
|
-
AccordionItem,
|
|
72
|
-
AccordionItemButton,
|
|
73
|
-
AccordionItemHeading,
|
|
74
|
-
AccordionItemPanel,
|
|
75
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Accordion';
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Box, type BoxProps } from '@ttoss/ui';
|
|
3
|
-
import { css as createClassName } from '@emotion/css';
|
|
4
|
-
import DrawerUi from 'react-modern-drawer';
|
|
5
|
-
|
|
6
|
-
type DrawerUiProps = React.ComponentProps<typeof DrawerUi>;
|
|
7
|
-
|
|
8
|
-
export type DrawerProps = DrawerUiProps & {
|
|
9
|
-
sx?: BoxProps['sx'];
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* https://github.com/Farzin-Firoozi/react-modern-drawer/blob/master/src/styles.css
|
|
14
|
-
*/
|
|
15
|
-
const reactModernDrawerClassName = createClassName(`
|
|
16
|
-
.EZDrawer .EZDrawer__checkbox {
|
|
17
|
-
display: none;
|
|
18
|
-
}
|
|
19
|
-
.EZDrawer .EZDrawer__checkbox:checked ~ .EZDrawer__overlay {
|
|
20
|
-
display: block;
|
|
21
|
-
opacity: 1;
|
|
22
|
-
}
|
|
23
|
-
.EZDrawer .EZDrawer__checkbox:checked ~ .EZDrawer__container {
|
|
24
|
-
visibility: visible;
|
|
25
|
-
transform: translate3d(0, 0, 0) !important;
|
|
26
|
-
}
|
|
27
|
-
.EZDrawer .EZDrawer__overlay {
|
|
28
|
-
display: none;
|
|
29
|
-
height: 100vh;
|
|
30
|
-
left: 0;
|
|
31
|
-
position: fixed;
|
|
32
|
-
top: 0;
|
|
33
|
-
width: 100%;
|
|
34
|
-
}
|
|
35
|
-
.EZDrawer .EZDrawer__container {
|
|
36
|
-
position: fixed;
|
|
37
|
-
visibility: hidden;
|
|
38
|
-
background: white;
|
|
39
|
-
transition: all;
|
|
40
|
-
box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.1);
|
|
41
|
-
}`);
|
|
42
|
-
|
|
43
|
-
export const Drawer = ({ children, sx, ...props }: DrawerProps) => {
|
|
44
|
-
return (
|
|
45
|
-
<DrawerUi {...props} className={reactModernDrawerClassName}>
|
|
46
|
-
<Box
|
|
47
|
-
sx={{
|
|
48
|
-
width: '100%',
|
|
49
|
-
height: '100%',
|
|
50
|
-
...sx,
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
53
|
-
{children}
|
|
54
|
-
</Box>
|
|
55
|
-
</DrawerUi>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Drawer';
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Button, Flex, Text } from '@ttoss/ui';
|
|
4
|
-
|
|
5
|
-
export type InstallPwaUiProps = {
|
|
6
|
-
onInstall: React.MouseEventHandler<HTMLButtonElement>;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const InstallPwaUi = ({ onInstall }: InstallPwaUiProps) => {
|
|
10
|
-
return (
|
|
11
|
-
<Flex
|
|
12
|
-
sx={{
|
|
13
|
-
position: 'absolute',
|
|
14
|
-
bottom: 4,
|
|
15
|
-
width: '100%',
|
|
16
|
-
justifyContent: 'center',
|
|
17
|
-
}}
|
|
18
|
-
>
|
|
19
|
-
<Flex
|
|
20
|
-
sx={{
|
|
21
|
-
backgroundColor: 'background',
|
|
22
|
-
justifyContent: 'center',
|
|
23
|
-
alignItems: 'center',
|
|
24
|
-
gap: 3,
|
|
25
|
-
width: 'auto',
|
|
26
|
-
border: '1px solid',
|
|
27
|
-
borderColor: 'muted',
|
|
28
|
-
borderRadius: 1,
|
|
29
|
-
padding: 4,
|
|
30
|
-
}}
|
|
31
|
-
>
|
|
32
|
-
<Text>Deseja instalar o nosso aplicativo?</Text>
|
|
33
|
-
<Button onClick={onInstall}>Instalar</Button>
|
|
34
|
-
</Flex>
|
|
35
|
-
</Flex>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const InstallPwa = () => {
|
|
40
|
-
const [supportsPwa, setSupportsPwa] = React.useState(false);
|
|
41
|
-
const [promptInstall, setPromptInstall] = React.useState<any>(null);
|
|
42
|
-
|
|
43
|
-
React.useEffect(() => {
|
|
44
|
-
const handler = (e: any) => {
|
|
45
|
-
e.preventDefault();
|
|
46
|
-
setSupportsPwa(true);
|
|
47
|
-
setPromptInstall(e);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
window.addEventListener('beforeinstallprompt', handler);
|
|
51
|
-
|
|
52
|
-
return () => {
|
|
53
|
-
return window.removeEventListener('transitionend', handler);
|
|
54
|
-
};
|
|
55
|
-
}, []);
|
|
56
|
-
|
|
57
|
-
const onInstall = (e: any) => {
|
|
58
|
-
e.preventDefault();
|
|
59
|
-
if (!promptInstall) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
promptInstall.prompt();
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
if (!supportsPwa) {
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return <InstallPwaUi onInstall={onInstall} />;
|
|
70
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './InstallPwa';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
export interface ListProps extends React.HTMLProps<HTMLUListElement> {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const List = React.forwardRef<HTMLUListElement, ListProps>(
|
|
8
|
-
({ children, ...props }, ref) => {
|
|
9
|
-
return (
|
|
10
|
-
<ul {...props} ref={ref}>
|
|
11
|
-
{children}
|
|
12
|
-
</ul>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
List.displayName = 'List';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
export interface ListItemProps extends React.HTMLProps<HTMLLIElement> {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const ListItem = React.forwardRef<HTMLLIElement, ListItemProps>(
|
|
8
|
-
(props, ref) => {
|
|
9
|
-
const { children, ...rest } = props;
|
|
10
|
-
return (
|
|
11
|
-
<li {...rest} ref={ref}>
|
|
12
|
-
{children}
|
|
13
|
-
</li>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
ListItem.displayName = 'ListItem';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { BaseStyles, FlexProps } from '@ttoss/ui';
|
|
2
|
-
import ReactMarkdown, { Options } from 'react-markdown';
|
|
3
|
-
import rehypeRaw from 'rehype-raw';
|
|
4
|
-
import remarkGfm from 'remark-gfm';
|
|
5
|
-
|
|
6
|
-
export type MarkdownProps = Options & {
|
|
7
|
-
children: string;
|
|
8
|
-
sx?: FlexProps['sx'];
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const Markdown = ({ children, sx, ...props }: MarkdownProps) => {
|
|
12
|
-
return (
|
|
13
|
-
<BaseStyles sx={sx}>
|
|
14
|
-
<ReactMarkdown
|
|
15
|
-
rehypePlugins={[rehypeRaw]}
|
|
16
|
-
remarkPlugins={[remarkGfm]}
|
|
17
|
-
{...props}
|
|
18
|
-
>
|
|
19
|
-
{children}
|
|
20
|
-
</ReactMarkdown>
|
|
21
|
-
</BaseStyles>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Markdown';
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Box,
|
|
4
|
-
BoxProps,
|
|
5
|
-
Flex,
|
|
6
|
-
Image,
|
|
7
|
-
Text,
|
|
8
|
-
useResponsiveValue,
|
|
9
|
-
} from '@ttoss/ui';
|
|
10
|
-
import { Drawer } from '../Drawer';
|
|
11
|
-
import { Icon, IconifyIcon } from '@ttoss/react-icons';
|
|
12
|
-
|
|
13
|
-
export type MenuProps = {
|
|
14
|
-
onClose: () => void;
|
|
15
|
-
onOpen: () => void;
|
|
16
|
-
isOpen: boolean;
|
|
17
|
-
children: React.ReactNode;
|
|
18
|
-
srcLogo?: string;
|
|
19
|
-
sx?: BoxProps['sx'];
|
|
20
|
-
/**
|
|
21
|
-
* Default direction: `left`
|
|
22
|
-
*/
|
|
23
|
-
direction?: 'left' | 'right';
|
|
24
|
-
/**
|
|
25
|
-
* Default size: `100%`
|
|
26
|
-
*/
|
|
27
|
-
sizeOnMobile?: string | number;
|
|
28
|
-
/**
|
|
29
|
-
* Default size: `300px`
|
|
30
|
-
*/
|
|
31
|
-
sizeOnDesktop?: string | number;
|
|
32
|
-
/**
|
|
33
|
-
* Default icon: `menu-open`
|
|
34
|
-
*/
|
|
35
|
-
menuIcon?: IconifyIcon | string;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const Menu = ({
|
|
39
|
-
children,
|
|
40
|
-
srcLogo,
|
|
41
|
-
onClose,
|
|
42
|
-
onOpen,
|
|
43
|
-
isOpen,
|
|
44
|
-
sx,
|
|
45
|
-
direction = 'left',
|
|
46
|
-
sizeOnDesktop = '300px',
|
|
47
|
-
sizeOnMobile = '100%',
|
|
48
|
-
menuIcon = 'menu-open',
|
|
49
|
-
}: MenuProps) => {
|
|
50
|
-
const responsiveSize = useResponsiveValue([sizeOnMobile, sizeOnDesktop]);
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<>
|
|
54
|
-
<Text sx={{ cursor: 'pointer' }} onClick={onOpen}>
|
|
55
|
-
<Icon icon={menuIcon} />
|
|
56
|
-
</Text>
|
|
57
|
-
|
|
58
|
-
<Drawer size={responsiveSize} direction={direction} open={isOpen}>
|
|
59
|
-
<Box
|
|
60
|
-
sx={{
|
|
61
|
-
position: 'fixed',
|
|
62
|
-
height: '100%',
|
|
63
|
-
backgroundColor: 'background',
|
|
64
|
-
width: '100%',
|
|
65
|
-
maxWidth: 'md',
|
|
66
|
-
right: 0,
|
|
67
|
-
boxShadow: 'lg',
|
|
68
|
-
paddingX: 'xl',
|
|
69
|
-
paddingTop: 'lg',
|
|
70
|
-
paddingBottom: '2xl',
|
|
71
|
-
...sx,
|
|
72
|
-
}}
|
|
73
|
-
>
|
|
74
|
-
<Flex sx={{ justifyContent: 'space-between' }}>
|
|
75
|
-
<Image
|
|
76
|
-
src={srcLogo}
|
|
77
|
-
sx={{
|
|
78
|
-
maxWidth: '200px',
|
|
79
|
-
height: '44px',
|
|
80
|
-
objectFit: 'cover',
|
|
81
|
-
}}
|
|
82
|
-
/>
|
|
83
|
-
|
|
84
|
-
<Text
|
|
85
|
-
sx={{
|
|
86
|
-
marginLeft: 'auto',
|
|
87
|
-
fontSize: '2xl',
|
|
88
|
-
alignSelf: 'center',
|
|
89
|
-
flexShrink: 0,
|
|
90
|
-
cursor: 'pointer',
|
|
91
|
-
lineHeight: 0,
|
|
92
|
-
}}
|
|
93
|
-
role="button"
|
|
94
|
-
onClick={onClose}
|
|
95
|
-
>
|
|
96
|
-
<Icon icon="close" />
|
|
97
|
-
</Text>
|
|
98
|
-
</Flex>
|
|
99
|
-
|
|
100
|
-
<Box sx={{ paddingTop: '3xl' }} as="nav">
|
|
101
|
-
{children}
|
|
102
|
-
</Box>
|
|
103
|
-
</Box>
|
|
104
|
-
</Drawer>
|
|
105
|
-
</>
|
|
106
|
-
);
|
|
107
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Menu';
|