@ttoss/components 1.29.10 → 1.29.12
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/README.md +40 -0
- package/dist/esm/index.js +19 -1
- package/dist/index.d.mts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +20 -0
- package/package.json +7 -6
- package/src/components/Markdown.tsx +15 -0
- package/src/index.ts +1 -0
package/README.md
CHANGED
|
@@ -77,3 +77,43 @@ const Component = () => {
|
|
|
77
77
|
);
|
|
78
78
|
};
|
|
79
79
|
```
|
|
80
|
+
|
|
81
|
+
### Markdown
|
|
82
|
+
|
|
83
|
+
Markdown uses [react-markdown](https://remarkjs.github.io/react-markdown/) under the hood, so the props are the same. You can update the elements as you want. Ex:
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
const MARKDOWN_CONTENT = `
|
|
87
|
+
# Heading 1
|
|
88
|
+
## Heading 2
|
|
89
|
+
### Heading 3
|
|
90
|
+
#### Heading 4
|
|
91
|
+
##### Heading 5
|
|
92
|
+
|
|
93
|
+
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Odit quasi dolorum aperiam fugiat earum expedita non eligendi similique id minus explicabo, eum facere nihil aspernatur libero! Sapiente aliquid tenetur dolor.
|
|
94
|
+
|
|
95
|
+
- Item 1
|
|
96
|
+
- Item 2
|
|
97
|
+
- Item 3
|
|
98
|
+
|
|
99
|
+

|
|
100
|
+
|
|
101
|
+
[Google](https://google.com)
|
|
102
|
+
`;
|
|
103
|
+
|
|
104
|
+
const Component = () => {
|
|
105
|
+
return (
|
|
106
|
+
<Markdown
|
|
107
|
+
components={{
|
|
108
|
+
a: ({ children, ...props }) => (
|
|
109
|
+
<Link {...props} quiet>
|
|
110
|
+
{children}
|
|
111
|
+
</Link>
|
|
112
|
+
),
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
115
|
+
{MARKDOWN_CONTENT}
|
|
116
|
+
</Markdown>
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
```
|
package/dist/esm/index.js
CHANGED
|
@@ -210,4 +210,22 @@ var ToastContainer = props => {
|
|
|
210
210
|
})
|
|
211
211
|
});
|
|
212
212
|
};
|
|
213
|
-
|
|
213
|
+
|
|
214
|
+
// src/components/Markdown.tsx
|
|
215
|
+
import { BaseStyles } from "@ttoss/ui";
|
|
216
|
+
import ReactMarkdown from "react-markdown";
|
|
217
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
218
|
+
var Markdown = ({
|
|
219
|
+
children,
|
|
220
|
+
sx,
|
|
221
|
+
...props
|
|
222
|
+
}) => {
|
|
223
|
+
return /* @__PURE__ */jsx5(BaseStyles, {
|
|
224
|
+
sx,
|
|
225
|
+
children: /* @__PURE__ */jsx5(ReactMarkdown, {
|
|
226
|
+
...props,
|
|
227
|
+
children
|
|
228
|
+
})
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
export { Accordion, InstallPwa, InstallPwaUi, Markdown, Modal, ToastContainer, toast };
|
package/dist/index.d.mts
CHANGED
|
@@ -3,10 +3,11 @@ import * as react_accessible_accordion_dist_types_components_ItemContext from 'r
|
|
|
3
3
|
import * as react_accessible_accordion_dist_types_helpers_types from 'react-accessible-accordion/dist/types/helpers/types';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import { BoxProps } from '@ttoss/ui';
|
|
6
|
+
import { BoxProps, FlexProps } from '@ttoss/ui';
|
|
7
7
|
import ReactModal from 'react-modal';
|
|
8
8
|
import { ToastContainerProps } from 'react-toastify';
|
|
9
9
|
export { ToastContainerProps, toast } from 'react-toastify';
|
|
10
|
+
import { Options } from 'react-markdown';
|
|
10
11
|
|
|
11
12
|
type AccordionProps = BoxProps & {
|
|
12
13
|
allowMultipleExpanded?: boolean;
|
|
@@ -312,4 +313,10 @@ declare const Modal: {
|
|
|
312
313
|
|
|
313
314
|
declare const ToastContainer: (props: ToastContainerProps) => react_jsx_runtime.JSX.Element;
|
|
314
315
|
|
|
315
|
-
|
|
316
|
+
type MarkdownProps = Options & {
|
|
317
|
+
children: string;
|
|
318
|
+
sx?: FlexProps['sx'];
|
|
319
|
+
};
|
|
320
|
+
declare const Markdown: ({ children, sx, ...props }: MarkdownProps) => react_jsx_runtime.JSX.Element;
|
|
321
|
+
|
|
322
|
+
export { Accordion, AccordionProps, InstallPwa, InstallPwaUi, InstallPwaUiProps, Markdown, MarkdownProps, Modal, ModalProps, ToastContainer };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,10 +3,11 @@ import * as react_accessible_accordion_dist_types_components_ItemContext from 'r
|
|
|
3
3
|
import * as react_accessible_accordion_dist_types_helpers_types from 'react-accessible-accordion/dist/types/helpers/types';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import { BoxProps } from '@ttoss/ui';
|
|
6
|
+
import { BoxProps, FlexProps } from '@ttoss/ui';
|
|
7
7
|
import ReactModal from 'react-modal';
|
|
8
8
|
import { ToastContainerProps } from 'react-toastify';
|
|
9
9
|
export { ToastContainerProps, toast } from 'react-toastify';
|
|
10
|
+
import { Options } from 'react-markdown';
|
|
10
11
|
|
|
11
12
|
type AccordionProps = BoxProps & {
|
|
12
13
|
allowMultipleExpanded?: boolean;
|
|
@@ -312,4 +313,10 @@ declare const Modal: {
|
|
|
312
313
|
|
|
313
314
|
declare const ToastContainer: (props: ToastContainerProps) => react_jsx_runtime.JSX.Element;
|
|
314
315
|
|
|
315
|
-
|
|
316
|
+
type MarkdownProps = Options & {
|
|
317
|
+
children: string;
|
|
318
|
+
sx?: FlexProps['sx'];
|
|
319
|
+
};
|
|
320
|
+
declare const Markdown: ({ children, sx, ...props }: MarkdownProps) => react_jsx_runtime.JSX.Element;
|
|
321
|
+
|
|
322
|
+
export { Accordion, AccordionProps, InstallPwa, InstallPwaUi, InstallPwaUiProps, Markdown, MarkdownProps, Modal, ModalProps, ToastContainer };
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,7 @@ __export(src_exports, {
|
|
|
41
41
|
Accordion: () => Accordion,
|
|
42
42
|
InstallPwa: () => InstallPwa,
|
|
43
43
|
InstallPwaUi: () => InstallPwaUi,
|
|
44
|
+
Markdown: () => Markdown,
|
|
44
45
|
Modal: () => Modal,
|
|
45
46
|
ToastContainer: () => ToastContainer,
|
|
46
47
|
toast: () => import_react_toastify.toast
|
|
@@ -257,11 +258,30 @@ var ToastContainer = props => {
|
|
|
257
258
|
})
|
|
258
259
|
});
|
|
259
260
|
};
|
|
261
|
+
|
|
262
|
+
// src/components/Markdown.tsx
|
|
263
|
+
var import_ui5 = require("@ttoss/ui");
|
|
264
|
+
var import_react_markdown = __toESM(require("react-markdown"));
|
|
265
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
266
|
+
var Markdown = ({
|
|
267
|
+
children,
|
|
268
|
+
sx,
|
|
269
|
+
...props
|
|
270
|
+
}) => {
|
|
271
|
+
return /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_ui5.BaseStyles, {
|
|
272
|
+
sx,
|
|
273
|
+
children: /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_react_markdown.default, {
|
|
274
|
+
...props,
|
|
275
|
+
children
|
|
276
|
+
})
|
|
277
|
+
});
|
|
278
|
+
};
|
|
260
279
|
// Annotate the CommonJS export names for ESM import in node:
|
|
261
280
|
0 && (module.exports = {
|
|
262
281
|
Accordion,
|
|
263
282
|
InstallPwa,
|
|
264
283
|
InstallPwaUi,
|
|
284
|
+
Markdown,
|
|
265
285
|
Modal,
|
|
266
286
|
ToastContainer,
|
|
267
287
|
toast
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/components",
|
|
3
|
-
"version": "1.29.
|
|
3
|
+
"version": "1.29.12",
|
|
4
4
|
"description": "React components for ttoss ecosystem.",
|
|
5
5
|
"author": "ttoss",
|
|
6
6
|
"contributors": [
|
|
@@ -24,21 +24,22 @@
|
|
|
24
24
|
"@theme-ui/css": "^0.15.7",
|
|
25
25
|
"@types/react-modal": "^3.16.0",
|
|
26
26
|
"react-accessible-accordion": "^5.0.0",
|
|
27
|
+
"react-markdown": "^8.0.7",
|
|
27
28
|
"react-modal": "^3.16.1",
|
|
28
29
|
"react-toastify": "^9.1.3"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
31
32
|
"react": ">=16.8.0",
|
|
32
|
-
"@ttoss/ui": "^3.1.
|
|
33
|
+
"@ttoss/ui": "^3.1.1"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@types/jest": "^29.5.3",
|
|
36
37
|
"@types/react": "^18.2.12",
|
|
37
|
-
"jest": "^29.6.
|
|
38
|
+
"jest": "^29.6.2",
|
|
38
39
|
"tsup": "^7.1.0",
|
|
39
|
-
"@ttoss/config": "^1.30.
|
|
40
|
-
"@ttoss/test-utils": "^1.23.
|
|
41
|
-
"@ttoss/ui": "^3.1.
|
|
40
|
+
"@ttoss/config": "^1.30.6",
|
|
41
|
+
"@ttoss/test-utils": "^1.23.7",
|
|
42
|
+
"@ttoss/ui": "^3.1.1"
|
|
42
43
|
},
|
|
43
44
|
"keywords": [
|
|
44
45
|
"React",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseStyles, FlexProps } from '@ttoss/ui';
|
|
2
|
+
import ReactMarkdown, { Options } from 'react-markdown';
|
|
3
|
+
|
|
4
|
+
export type MarkdownProps = Options & {
|
|
5
|
+
children: string;
|
|
6
|
+
sx?: FlexProps['sx'];
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const Markdown = ({ children, sx, ...props }: MarkdownProps) => {
|
|
10
|
+
return (
|
|
11
|
+
<BaseStyles sx={sx}>
|
|
12
|
+
<ReactMarkdown {...props}>{children}</ReactMarkdown>
|
|
13
|
+
</BaseStyles>
|
|
14
|
+
);
|
|
15
|
+
};
|
package/src/index.ts
CHANGED