@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
@@ -1,64 +0,0 @@
1
- import { css as transformStyleObject } from '@theme-ui/css';
2
- import { useResponsiveValue, useTheme } from '@ttoss/ui';
3
- import ReactModal from 'react-modal';
4
-
5
- ReactModal.defaultStyles = {
6
- overlay: {},
7
- content: {},
8
- };
9
-
10
- export type ModalProps = ReactModal.Props;
11
-
12
- export const Modal = (props: ModalProps) => {
13
- const { theme } = useTheme();
14
-
15
- const space = theme.space as Record<string, string>;
16
-
17
- const padding =
18
- useResponsiveValue([space?.['lg'], space?.['xl'], space?.['xl']]) || 0;
19
-
20
- const style: ReactModal.Styles = {
21
- overlay: transformStyleObject({
22
- position: 'fixed',
23
- top: 0,
24
- left: 0,
25
- right: 0,
26
- bottom: 0,
27
- backgroundColor: 'rgba(0, 0, 0, 0.5)',
28
- display: 'flex',
29
- justifyContent: 'center',
30
- alignItems: 'center',
31
- zIndex: 'modal',
32
- ...props.style?.overlay,
33
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
- })(theme) as any,
35
- content: transformStyleObject({
36
- /**
37
- * Theme
38
- */
39
- backgroundColor: 'surface',
40
- padding,
41
- border: 'default',
42
- borderColor: 'surface',
43
- borderRadius: 'default',
44
- /**
45
- * General
46
- */
47
- WebkitOverflowScrolling: 'touch',
48
- overflow: 'auto',
49
- position: 'relative',
50
- top: '0px',
51
- left: '0px',
52
- right: '0px',
53
- bottom: '0px',
54
- maxHeight: '90%',
55
- maxWidth: '90%',
56
- ...props.style?.content,
57
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
- })(theme) as any,
59
- };
60
-
61
- return <ReactModal {...props} style={style} />;
62
- };
63
-
64
- Modal.setAppElement = ReactModal.setAppElement;
@@ -1 +0,0 @@
1
- export * from './Modal';
@@ -1,36 +0,0 @@
1
- import * as React from 'react';
2
- import { Input, type InputProps } from '@ttoss/ui';
3
- import { useDebounce } from '@ttoss/react-hooks';
4
-
5
- export type SearchProps = Omit<InputProps, 'onChange'> & {
6
- loading?: boolean;
7
- debounce?: number;
8
- onChange: (value?: InputProps['value']) => void;
9
- };
10
-
11
- export const Search = ({
12
- value,
13
- defaultValue,
14
- loading,
15
- onChange,
16
- ...props
17
- }: SearchProps) => {
18
- const [text, setText] = React.useState(value ?? defaultValue);
19
-
20
- const debouncedValue = useDebounce(text, 500);
21
-
22
- React.useEffect(() => {
23
- onChange(debouncedValue);
24
- }, [debouncedValue, onChange]);
25
-
26
- return (
27
- <Input
28
- leadingIcon={loading ? 'loading' : 'search'}
29
- defaultValue={text}
30
- onChange={(e) => {
31
- return setText(e.target.value);
32
- }}
33
- {...props}
34
- />
35
- );
36
- };
@@ -1 +0,0 @@
1
- export * from './Search';
@@ -1,36 +0,0 @@
1
- import { Box, BoxProps } from '@ttoss/ui';
2
-
3
- // eslint-disable-next-line react-refresh/only-export-components
4
- export * from '@tanstack/react-table';
5
-
6
- export const Table = (props: BoxProps) => {
7
- return <Box as="table" {...props} />;
8
- };
9
-
10
- export const TableHead = (props: BoxProps) => {
11
- return <Box as="thead" {...props} />;
12
- };
13
-
14
- export const TableBody = (props: BoxProps) => {
15
- return <Box as="tbody" {...props} />;
16
- };
17
-
18
- export const TableRow = (props: BoxProps) => {
19
- return <Box as="tr" {...props} />;
20
- };
21
-
22
- export const TableCell = (props: BoxProps) => {
23
- return <Box as="td" {...props} />;
24
- };
25
-
26
- export const TableHeader = (props: BoxProps) => {
27
- return <Box as="th" {...props} />;
28
- };
29
-
30
- export const TableCaption = (props: BoxProps) => {
31
- return <Box as="caption" {...props} />;
32
- };
33
-
34
- export const TableFooter = (props: BoxProps) => {
35
- return <Box as="tfoot" {...props} />;
36
- };
@@ -1 +0,0 @@
1
- export * from './Table';
@@ -1,37 +0,0 @@
1
- import * as React from 'react';
2
- import { Box } from '@ttoss/ui';
3
- import {
4
- ToastContainer as ReactToastifyToastContainer,
5
- type ToastContainerProps,
6
- toast,
7
- } from 'react-toastify';
8
- import { injectStyle } from 'react-toastify/dist/inject-style';
9
-
10
- export { toast };
11
-
12
- export { type ToastContainerProps };
13
-
14
- export const ToastContainer = (props: ToastContainerProps) => {
15
- React.useEffect(() => {
16
- injectStyle();
17
- }, []);
18
-
19
- return (
20
- <Box
21
- sx={({ colors, fonts }) => {
22
- return {
23
- '--toastify-color-light': '#fff',
24
- '--toastify-color-dark': '#121212',
25
- '--toastify-color-info': colors?.info || '#3498db',
26
- '--toastify-color-success': colors?.success || '#07bc0c',
27
- '--toastify-color-warning': '#f1c40f',
28
- '--toastify-color-error': '#e74c3c',
29
- '--toastify-color-progress-light': `linear-gradient(to right, ${colors?.primary}, ${colors?.secondary})`,
30
- '--toastify-font-family': (fonts as { body: string }).body,
31
- };
32
- }}
33
- >
34
- <ReactToastifyToastContainer {...props} />
35
- </Box>
36
- );
37
- };
@@ -1 +0,0 @@
1
- export * from './Toast';