@octaviaflow/mdx-components 1.1.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.
- package/README.md +215 -0
- package/components/_utils.scss +18 -0
- package/components/accordion/_accordion.scss +35 -0
- package/components/accordion/accordion.stories.jsx +33 -0
- package/components/accordion/accordion.tsx +55 -0
- package/components/anchor-links/_anchor-links.scss +67 -0
- package/components/anchor-links/anchor-link.tsx +50 -0
- package/components/anchor-links/anchor-links.stories.jsx +51 -0
- package/components/anchor-links/anchor-links.tsx +73 -0
- package/components/art-direction/art-direction.stories.jsx +44 -0
- package/components/art-direction/art-direction.tsx +63 -0
- package/components/art-direction/desktop.jpg +0 -0
- package/components/art-direction/mobile.jpg +0 -0
- package/components/art-direction/tablet.jpg +0 -0
- package/components/article-card/_article-card.scss +98 -0
- package/components/article-card/article-card.stories.jsx +59 -0
- package/components/article-card/article-card.tsx +208 -0
- package/components/article-card/article06.png +0 -0
- package/components/aside/_aside.scss +56 -0
- package/components/aside/aside.stories.jsx +50 -0
- package/components/aside/aside.tsx +72 -0
- package/components/caption/_caption.scss +30 -0
- package/components/caption/caption.stories.jsx +33 -0
- package/components/caption/caption.tsx +47 -0
- package/components/card-group/_card-group.scss +44 -0
- package/components/card-group/card-group.stories.jsx +85 -0
- package/components/card-group/card-group.tsx +65 -0
- package/components/card-group/sketch-icon.png +0 -0
- package/components/code/_code.scss +110 -0
- package/components/code/code.stories.jsx +32 -0
- package/components/code/code.tsx +71 -0
- package/components/code/inline-code.tsx +55 -0
- package/components/code/path.tsx +56 -0
- package/components/divider/_divider.scss +67 -0
- package/components/divider/divider.stories.jsx +74 -0
- package/components/divider/divider.tsx +54 -0
- package/components/do-dont/_do-dont.scss +191 -0
- package/components/do-dont/do-dont-row.tsx +51 -0
- package/components/do-dont/do-dont.stories.jsx +53 -0
- package/components/do-dont/do-dont.tsx +161 -0
- package/components/do-dont/light-theme.jpg +0 -0
- package/components/gif-player/_gif-player.scss +64 -0
- package/components/gif-player/cloud.gif +0 -0
- package/components/gif-player/cloud.jpg +0 -0
- package/components/gif-player/gif-player.stories.jsx +45 -0
- package/components/gif-player/gif-player.tsx +150 -0
- package/components/grid-transform/_grid.scss +13 -0
- package/components/grid-transform/column.tsx +102 -0
- package/components/grid-transform/grid.stories.jsx +72 -0
- package/components/grid-transform/grid.tsx +52 -0
- package/components/grid-transform/row.tsx +92 -0
- package/components/image-wrapper/_image-wrapper.scss +32 -0
- package/components/image-wrapper/accordion-style-3.png +0 -0
- package/components/image-wrapper/image-wrapper.stories.jsx +40 -0
- package/components/image-wrapper/image-wrapper.tsx +56 -0
- package/components/index.scss +31 -0
- package/components/inline-notification/_inline-notification.scss +29 -0
- package/components/inline-notification/inline-notification.stories.jsx +67 -0
- package/components/inline-notification/inline-notification.tsx +98 -0
- package/components/interfaces.ts +31 -0
- package/components/link/_link.scss +13 -0
- package/components/link/link.stories.jsx +36 -0
- package/components/link/link.tsx +51 -0
- package/components/markdown/_markdown.scss +140 -0
- package/components/markdown/autolink-header/_autolink-header.scss +57 -0
- package/components/markdown/autolink-header/autolink-header.tsx +107 -0
- package/components/markdown/blockquote.stories.jsx +38 -0
- package/components/markdown/blockquote.tsx +53 -0
- package/components/markdown/h1.tsx +92 -0
- package/components/markdown/h2.tsx +85 -0
- package/components/markdown/h3.tsx +72 -0
- package/components/markdown/h4.tsx +73 -0
- package/components/markdown/h5.tsx +59 -0
- package/components/markdown/h6.tsx +59 -0
- package/components/markdown/headings.stories.jsx +52 -0
- package/components/markdown/li.tsx +55 -0
- package/components/markdown/ol.stories.jsx +47 -0
- package/components/markdown/ol.tsx +93 -0
- package/components/markdown/p.stories.jsx +36 -0
- package/components/markdown/p.tsx +65 -0
- package/components/markdown/ul.stories.jsx +46 -0
- package/components/markdown/ul.tsx +93 -0
- package/components/mini-card/_mini-card.scss +55 -0
- package/components/mini-card/mini-card.stories.jsx +72 -0
- package/components/mini-card/mini-card.tsx +132 -0
- package/components/page-description/_page-description.scss +38 -0
- package/components/page-description/page-description.stories.jsx +36 -0
- package/components/page-description/page-description.tsx +61 -0
- package/components/page-table/_page-table.scss +51 -0
- package/components/page-table/page-table.stories.jsx +56 -0
- package/components/page-table/page-table.tsx +88 -0
- package/components/preview/_preview.scss +16 -0
- package/components/preview/preview.stories.jsx +41 -0
- package/components/preview/preview.tsx +80 -0
- package/components/resource-card/_resource-card.scss +165 -0
- package/components/resource-card/resource-card.stories.jsx +100 -0
- package/components/resource-card/resource-card.tsx +201 -0
- package/components/storybook-demo/_storybook-demo.scss +57 -0
- package/components/storybook-demo/storybook-demo.stories.jsx +70 -0
- package/components/storybook-demo/storybook-demo.tsx +190 -0
- package/components/tabs/_tabs.scss +98 -0
- package/components/tabs/select.tsx +60 -0
- package/components/tabs/tab-list.tsx +48 -0
- package/components/tabs/tab.tsx +125 -0
- package/components/tabs/tabs.stories.jsx +54 -0
- package/components/tabs/tabs.tsx +78 -0
- package/components/title/title.stories.jsx +43 -0
- package/components/title/title.tsx +47 -0
- package/components/utils.ts +102 -0
- package/components/video/_video.scss +89 -0
- package/components/video/local-poster.jpeg +0 -0
- package/components/video/local-video.mp4 +0 -0
- package/components/video/video.stories.jsx +45 -0
- package/components/video/video.tsx +255 -0
- package/es/index.js +71714 -0
- package/index.ts +59 -0
- package/lib/index.js +71767 -0
- package/package.json +64 -0
- package/telemetry.yml +21 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow
|
|
3
|
+
* Author: Vishal Kumar
|
|
4
|
+
* Created: 11/November/2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright OctaviaFlow 2022, 2025
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
import { Column, Grid } from "@octaviaflow/react";
|
|
17
|
+
import { clsx } from "clsx";
|
|
18
|
+
import PropTypes from "prop-types";
|
|
19
|
+
import React, { ReactNode } from "react";
|
|
20
|
+
|
|
21
|
+
import { MdxComponent } from "../interfaces";
|
|
22
|
+
import { withPrefix } from "../utils";
|
|
23
|
+
import AutolinkHeader from "./autolink-header/autolink-header";
|
|
24
|
+
|
|
25
|
+
interface H1Props {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
className?: string | null;
|
|
28
|
+
headingClassName?: string | null;
|
|
29
|
+
[otherProp: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* For MDX files, steer away from using JSX components
|
|
34
|
+
* for headings in favor of standard markdown syntax.
|
|
35
|
+
*
|
|
36
|
+
* It’s generally considered
|
|
37
|
+
* <a href="https://webaim.org/techniques/semanticstructure/#contentstructure">best practice</a>
|
|
38
|
+
* to include just one h1 heading per page.
|
|
39
|
+
* This heading signals the title or primary subject matter of the content to your audience.
|
|
40
|
+
* Because the title component generated at the top of each page already uses an h1 heading,
|
|
41
|
+
* we recommend using h2 tags for section headings within your content.
|
|
42
|
+
*
|
|
43
|
+
*```
|
|
44
|
+
* # This is a heading 1
|
|
45
|
+
* ## This is a heading 2
|
|
46
|
+
* ### This is a heading 3
|
|
47
|
+
* #### This is a heading 4
|
|
48
|
+
* ##### This is a heading 5
|
|
49
|
+
* ###### This is a heading 6
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export const H1: MdxComponent<H1Props> = ({
|
|
53
|
+
children,
|
|
54
|
+
className,
|
|
55
|
+
headingClassName,
|
|
56
|
+
...rest
|
|
57
|
+
}) => {
|
|
58
|
+
return (
|
|
59
|
+
<Grid
|
|
60
|
+
className={clsx(
|
|
61
|
+
withPrefix("header"),
|
|
62
|
+
withPrefix("h2-container"),
|
|
63
|
+
className,
|
|
64
|
+
)}
|
|
65
|
+
{...rest}
|
|
66
|
+
>
|
|
67
|
+
<Column sm={4} md={8} lg={8}>
|
|
68
|
+
<AutolinkHeader
|
|
69
|
+
is="h1"
|
|
70
|
+
className={clsx(withPrefix("h1"), headingClassName)}
|
|
71
|
+
>
|
|
72
|
+
{children}
|
|
73
|
+
</AutolinkHeader>
|
|
74
|
+
</Column>
|
|
75
|
+
</Grid>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
H1.propTypes = {
|
|
80
|
+
/**
|
|
81
|
+
* String title for Header
|
|
82
|
+
*/
|
|
83
|
+
children: PropTypes.node as unknown as React.Validator<React.ReactNode>,
|
|
84
|
+
/**
|
|
85
|
+
* Specify optional className for container element
|
|
86
|
+
*/
|
|
87
|
+
className: PropTypes.string,
|
|
88
|
+
/**
|
|
89
|
+
* Specify optional className for header element
|
|
90
|
+
*/
|
|
91
|
+
headingClassName: PropTypes.string,
|
|
92
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow
|
|
3
|
+
* Author: Vishal Kumar
|
|
4
|
+
* Created: 11/November/2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright OctaviaFlow 2022, 2025
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
import { Column, Grid } from "@octaviaflow/react";
|
|
17
|
+
import { clsx } from "clsx";
|
|
18
|
+
import PropTypes from "prop-types";
|
|
19
|
+
import React, { ReactNode } from "react";
|
|
20
|
+
|
|
21
|
+
import { MdxComponent } from "../interfaces";
|
|
22
|
+
import { withPrefix } from "../utils";
|
|
23
|
+
import AutolinkHeader from "./autolink-header/autolink-header";
|
|
24
|
+
|
|
25
|
+
interface H2Props {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
className?: string | null;
|
|
28
|
+
headingClassName?: string | null;
|
|
29
|
+
noAnchor?: boolean | null;
|
|
30
|
+
[otherProp: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const H2: MdxComponent<H2Props> = ({
|
|
34
|
+
children,
|
|
35
|
+
className,
|
|
36
|
+
headingClassName,
|
|
37
|
+
noAnchor,
|
|
38
|
+
...rest
|
|
39
|
+
}) => {
|
|
40
|
+
return (
|
|
41
|
+
<Grid
|
|
42
|
+
className={clsx(
|
|
43
|
+
withPrefix("header"),
|
|
44
|
+
withPrefix("h2-container"),
|
|
45
|
+
className,
|
|
46
|
+
)}
|
|
47
|
+
{...rest}
|
|
48
|
+
>
|
|
49
|
+
<Column sm={4} md={8} lg={8}>
|
|
50
|
+
{noAnchor && (
|
|
51
|
+
<h2 className={clsx(withPrefix("h2"), headingClassName)}>
|
|
52
|
+
{children}
|
|
53
|
+
</h2>
|
|
54
|
+
)}
|
|
55
|
+
{!noAnchor && (
|
|
56
|
+
<AutolinkHeader
|
|
57
|
+
is="h2"
|
|
58
|
+
className={clsx(withPrefix("h2"), headingClassName)}
|
|
59
|
+
>
|
|
60
|
+
{children}
|
|
61
|
+
</AutolinkHeader>
|
|
62
|
+
)}
|
|
63
|
+
</Column>
|
|
64
|
+
</Grid>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
H2.propTypes = {
|
|
69
|
+
/**
|
|
70
|
+
* String title for Header
|
|
71
|
+
*/
|
|
72
|
+
children: PropTypes.node as unknown as React.Validator<React.ReactNode>,
|
|
73
|
+
/**
|
|
74
|
+
* Specify optional className for container element
|
|
75
|
+
*/
|
|
76
|
+
className: PropTypes.string,
|
|
77
|
+
/**
|
|
78
|
+
* Specify optional className for header element
|
|
79
|
+
*/
|
|
80
|
+
headingClassName: PropTypes.string,
|
|
81
|
+
/**
|
|
82
|
+
* Do not render the autolink anchor
|
|
83
|
+
*/
|
|
84
|
+
noAnchor: PropTypes.bool,
|
|
85
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow
|
|
3
|
+
* Author: Vishal Kumar
|
|
4
|
+
* Created: 11/November/2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright OctaviaFlow 2022, 2025
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
import { Column, Grid } from "@octaviaflow/react";
|
|
17
|
+
import { clsx } from "clsx";
|
|
18
|
+
import PropTypes from "prop-types";
|
|
19
|
+
import React, { ReactNode } from "react";
|
|
20
|
+
|
|
21
|
+
import { MdxComponent } from "../interfaces";
|
|
22
|
+
import { withPrefix } from "../utils";
|
|
23
|
+
import AutolinkHeader from "./autolink-header/autolink-header";
|
|
24
|
+
|
|
25
|
+
interface H3Props {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
className?: string | null;
|
|
28
|
+
headingClassName?: string | null;
|
|
29
|
+
[otherProp: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const H3: MdxComponent<H3Props> = ({
|
|
33
|
+
children,
|
|
34
|
+
className,
|
|
35
|
+
headingClassName,
|
|
36
|
+
...rest
|
|
37
|
+
}) => {
|
|
38
|
+
return (
|
|
39
|
+
<Grid
|
|
40
|
+
className={clsx(
|
|
41
|
+
withPrefix("header"),
|
|
42
|
+
withPrefix("h3-container"),
|
|
43
|
+
className,
|
|
44
|
+
)}
|
|
45
|
+
{...rest}
|
|
46
|
+
>
|
|
47
|
+
<Column sm={4} md={8} lg={8}>
|
|
48
|
+
<AutolinkHeader
|
|
49
|
+
is="h3"
|
|
50
|
+
className={clsx(withPrefix("h3"), headingClassName)}
|
|
51
|
+
>
|
|
52
|
+
{children}
|
|
53
|
+
</AutolinkHeader>
|
|
54
|
+
</Column>
|
|
55
|
+
</Grid>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
H3.propTypes = {
|
|
60
|
+
/**
|
|
61
|
+
* String title for Header
|
|
62
|
+
*/
|
|
63
|
+
children: PropTypes.node as unknown as React.Validator<React.ReactNode>,
|
|
64
|
+
/**
|
|
65
|
+
* Specify optional className for container element
|
|
66
|
+
*/
|
|
67
|
+
className: PropTypes.string,
|
|
68
|
+
/**
|
|
69
|
+
* Specify optional className for header element
|
|
70
|
+
*/
|
|
71
|
+
headingClassName: PropTypes.string,
|
|
72
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow
|
|
3
|
+
* Author: Vishal Kumar
|
|
4
|
+
* Created: 11/November/2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright OctaviaFlow 2022, 2025
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
import { Column, Grid } from "@octaviaflow/react";
|
|
17
|
+
import { clsx } from "clsx";
|
|
18
|
+
import PropTypes from "prop-types";
|
|
19
|
+
import React, { ReactNode } from "react";
|
|
20
|
+
|
|
21
|
+
import { MdxComponent } from "../interfaces";
|
|
22
|
+
import { withPrefix } from "../utils";
|
|
23
|
+
|
|
24
|
+
interface H4Props {
|
|
25
|
+
autolink?: boolean | null;
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
className?: string | null;
|
|
28
|
+
headingClassName?: string | null;
|
|
29
|
+
[otherProp: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const H4: MdxComponent<H4Props> = ({
|
|
33
|
+
autolink = true,
|
|
34
|
+
children,
|
|
35
|
+
className,
|
|
36
|
+
headingClassName,
|
|
37
|
+
...rest
|
|
38
|
+
}) => {
|
|
39
|
+
const Component = autolink ? "h4" : "p";
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Grid
|
|
43
|
+
className={clsx(
|
|
44
|
+
withPrefix("header"),
|
|
45
|
+
withPrefix("h4-container"),
|
|
46
|
+
className,
|
|
47
|
+
)}
|
|
48
|
+
{...rest}
|
|
49
|
+
>
|
|
50
|
+
<Column sm={4} md={8} lg={8}>
|
|
51
|
+
<Component className={clsx(withPrefix("h4"), headingClassName)}>
|
|
52
|
+
{children}
|
|
53
|
+
</Component>
|
|
54
|
+
</Column>
|
|
55
|
+
</Grid>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
H4.propTypes = {
|
|
60
|
+
autolink: PropTypes.bool,
|
|
61
|
+
/**
|
|
62
|
+
* String title for Header
|
|
63
|
+
*/
|
|
64
|
+
children: PropTypes.node as unknown as React.Validator<React.ReactNode>,
|
|
65
|
+
/**
|
|
66
|
+
* Specify optional className for container element
|
|
67
|
+
*/
|
|
68
|
+
className: PropTypes.string,
|
|
69
|
+
/**
|
|
70
|
+
* Specify optional className for header element
|
|
71
|
+
*/
|
|
72
|
+
headingClassName: PropTypes.string,
|
|
73
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow
|
|
3
|
+
* Author: Vishal Kumar
|
|
4
|
+
* Created: 11/November/2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright OctaviaFlow 2022, 2025
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
import { Column, Grid } from "@octaviaflow/react";
|
|
17
|
+
import { clsx } from "clsx";
|
|
18
|
+
import PropTypes from "prop-types";
|
|
19
|
+
import React, { ReactNode } from "react";
|
|
20
|
+
|
|
21
|
+
import { MdxComponent } from "../interfaces";
|
|
22
|
+
import { withPrefix } from "../utils";
|
|
23
|
+
|
|
24
|
+
interface H5Props {
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
className?: string | null;
|
|
27
|
+
headingClassName?: string | null;
|
|
28
|
+
[otherProp: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const H5: MdxComponent<H5Props> = ({
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
headingClassName,
|
|
35
|
+
...rest
|
|
36
|
+
}) => {
|
|
37
|
+
return (
|
|
38
|
+
<Grid className={clsx(withPrefix("h5-container"), className)} {...rest}>
|
|
39
|
+
<Column sm={4} md={8} lg={8}>
|
|
40
|
+
<h5 className={clsx(withPrefix("h5"), headingClassName)}>{children}</h5>
|
|
41
|
+
</Column>
|
|
42
|
+
</Grid>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
H5.propTypes = {
|
|
47
|
+
/**
|
|
48
|
+
* String title for Header
|
|
49
|
+
*/
|
|
50
|
+
children: PropTypes.node as unknown as React.Validator<React.ReactNode>,
|
|
51
|
+
/**
|
|
52
|
+
* Specify optional className for container element
|
|
53
|
+
*/
|
|
54
|
+
className: PropTypes.string,
|
|
55
|
+
/**
|
|
56
|
+
* Specify optional className for header element
|
|
57
|
+
*/
|
|
58
|
+
headingClassName: PropTypes.string,
|
|
59
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow
|
|
3
|
+
* Author: Vishal Kumar
|
|
4
|
+
* Created: 11/November/2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright OctaviaFlow 2022, 2025
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
import { Column, Grid } from "@octaviaflow/react";
|
|
17
|
+
import { clsx } from "clsx";
|
|
18
|
+
import PropTypes from "prop-types";
|
|
19
|
+
import React, { ReactNode } from "react";
|
|
20
|
+
|
|
21
|
+
import { MdxComponent } from "../interfaces";
|
|
22
|
+
import { withPrefix } from "../utils";
|
|
23
|
+
|
|
24
|
+
interface H6Props {
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
className?: string | null;
|
|
27
|
+
headingClassName?: string | null;
|
|
28
|
+
[otherProp: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const H6: MdxComponent<H6Props> = ({
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
headingClassName,
|
|
35
|
+
...rest
|
|
36
|
+
}) => {
|
|
37
|
+
return (
|
|
38
|
+
<Grid className={clsx(withPrefix("h6-container"), className)} {...rest}>
|
|
39
|
+
<Column sm={4} md={8} lg={8}>
|
|
40
|
+
<h6 className={clsx(withPrefix("h6"), headingClassName)}>{children}</h6>
|
|
41
|
+
</Column>
|
|
42
|
+
</Grid>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
H6.propTypes = {
|
|
47
|
+
/**
|
|
48
|
+
* String title for Header
|
|
49
|
+
*/
|
|
50
|
+
children: PropTypes.node as unknown as React.Validator<React.ReactNode>,
|
|
51
|
+
/**
|
|
52
|
+
* Specify optional className for container element
|
|
53
|
+
*/
|
|
54
|
+
className: PropTypes.string,
|
|
55
|
+
/**
|
|
56
|
+
* Specify optional className for header element
|
|
57
|
+
*/
|
|
58
|
+
headingClassName: PropTypes.string,
|
|
59
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow
|
|
3
|
+
* Author: Vishal Kumar
|
|
4
|
+
* Created: 11/November/2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright IBM Corp. 2022, 2025
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
import React from "react";
|
|
17
|
+
import { H1 } from "./h1";
|
|
18
|
+
import { H2 } from "./h2";
|
|
19
|
+
import { H3 } from "./h3";
|
|
20
|
+
import { H4 } from "./h4";
|
|
21
|
+
import { H5 } from "./h5";
|
|
22
|
+
import { H6 } from "./h6";
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
title: "Components/MDX Components/Markdown/Headings",
|
|
26
|
+
component: H1,
|
|
27
|
+
argTypes: {
|
|
28
|
+
children: {
|
|
29
|
+
control: false,
|
|
30
|
+
},
|
|
31
|
+
className: {
|
|
32
|
+
control: false,
|
|
33
|
+
},
|
|
34
|
+
headingClassName: {
|
|
35
|
+
control: false,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const H1Template = (args) => (
|
|
41
|
+
<>
|
|
42
|
+
<H1 {...args}>This is a Heading 1</H1>
|
|
43
|
+
<H2 {...args}>This is a Heading 2</H2>
|
|
44
|
+
<H3 {...args}>This is a Heading 3</H3>
|
|
45
|
+
<H4 {...args}>This is a Heading 4</H4>
|
|
46
|
+
<H5 {...args}>This is a Heading 5</H5>
|
|
47
|
+
<H6 {...args}>This is a Heading 6</H6>
|
|
48
|
+
</>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export const Default = H1Template.bind({});
|
|
52
|
+
Default.args = {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow
|
|
3
|
+
* Author: Vishal Kumar
|
|
4
|
+
* Created: 11/November/2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright OctaviaFlow 2022, 2025
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
import { ListItem } from "@octaviaflow/react";
|
|
17
|
+
import { clsx } from "clsx";
|
|
18
|
+
import PropTypes from "prop-types";
|
|
19
|
+
import React, { ReactNode } from "react";
|
|
20
|
+
|
|
21
|
+
import { MdxComponent } from "../interfaces";
|
|
22
|
+
import { withPrefix } from "../utils";
|
|
23
|
+
const { Provider, Consumer: LiConsumer } = React.createContext<LiContext>({
|
|
24
|
+
hasListItemParent: false,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
interface LiProps {
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
className?: string | null;
|
|
30
|
+
[otherProp: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface LiContext {
|
|
34
|
+
hasListItemParent: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const LI: MdxComponent<LiProps> = ({ children, className, ...rest }) => (
|
|
38
|
+
<ListItem className={clsx(className, withPrefix("list-item"))} {...rest}>
|
|
39
|
+
<Provider value={{ hasListItemParent: true }}>{children}</Provider>
|
|
40
|
+
</ListItem>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
LI.propTypes = {
|
|
44
|
+
/**
|
|
45
|
+
* String title for Header
|
|
46
|
+
*/
|
|
47
|
+
children: PropTypes.node as unknown as React.Validator<React.ReactNode>,
|
|
48
|
+
/**
|
|
49
|
+
* Specify optional className for container element
|
|
50
|
+
*/
|
|
51
|
+
className: PropTypes.string,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type { LiProps };
|
|
55
|
+
export { LiConsumer };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow
|
|
3
|
+
* Author: Vishal Kumar
|
|
4
|
+
* Created: 11/November/2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright IBM Corp. 2022, 2025
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import React from "react";
|
|
18
|
+
import { LI } from "./li";
|
|
19
|
+
import { OL } from "./ol";
|
|
20
|
+
|
|
21
|
+
const stories = {
|
|
22
|
+
title: "Components/MDX Components/Markdown/OL",
|
|
23
|
+
component: OL,
|
|
24
|
+
argTypes: {
|
|
25
|
+
children: {
|
|
26
|
+
control: false,
|
|
27
|
+
},
|
|
28
|
+
className: {
|
|
29
|
+
control: false,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default stories;
|
|
35
|
+
|
|
36
|
+
const Template = (args) => (
|
|
37
|
+
<div style={{ paddingLeft: "1rem" }}>
|
|
38
|
+
<OL {...args}>
|
|
39
|
+
<LI>list item 1</LI>
|
|
40
|
+
<LI>list item 2</LI>
|
|
41
|
+
<LI>list item 3</LI>
|
|
42
|
+
</OL>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
export const Default = Template.bind({});
|
|
47
|
+
Default.args = {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow
|
|
3
|
+
* Author: Vishal Kumar
|
|
4
|
+
* Created: 11/November/2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright OctaviaFlow 2022, 2025
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
import { Column, Grid, OrderedList } from "@octaviaflow/react";
|
|
17
|
+
import { clsx } from "clsx";
|
|
18
|
+
import PropTypes from "prop-types";
|
|
19
|
+
import React, { ReactElement } from "react";
|
|
20
|
+
|
|
21
|
+
import { MdxComponent } from "../interfaces";
|
|
22
|
+
import { withPrefix } from "../utils";
|
|
23
|
+
import { LiConsumer, LiProps } from "./li";
|
|
24
|
+
|
|
25
|
+
interface OlProps {
|
|
26
|
+
children: ReactElement | ReactElement[]; // This is how the types would be in TypeScript
|
|
27
|
+
className?: string | null;
|
|
28
|
+
[otherProp: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* For MDX files, steer away from using JSX components
|
|
33
|
+
* for lists in favor of standard markdown syntax.
|
|
34
|
+
*
|
|
35
|
+
*```
|
|
36
|
+
* 1. First ordered list item
|
|
37
|
+
* 1. In markdown, the actual numbers don’t matter, just that it’s a number
|
|
38
|
+
* 2. In markdown, the actual numbers don’t matter, just that it’s a number
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export const OL: MdxComponent<OlProps> = ({ children, className, ...rest }) => {
|
|
42
|
+
return (
|
|
43
|
+
<LiConsumer>
|
|
44
|
+
{(value) => {
|
|
45
|
+
if (value.hasListItemParent) {
|
|
46
|
+
return (
|
|
47
|
+
<OrderedList
|
|
48
|
+
isExpressive
|
|
49
|
+
className={clsx(className, withPrefix("list"), withPrefix("ol"))}
|
|
50
|
+
nested
|
|
51
|
+
{...rest}
|
|
52
|
+
>
|
|
53
|
+
{children}
|
|
54
|
+
</OrderedList>
|
|
55
|
+
);
|
|
56
|
+
} else {
|
|
57
|
+
return (
|
|
58
|
+
<Grid className={withPrefix("list-container")}>
|
|
59
|
+
<Column sm={4} md={8} lg={8}>
|
|
60
|
+
<OrderedList
|
|
61
|
+
isExpressive
|
|
62
|
+
className={clsx(
|
|
63
|
+
className,
|
|
64
|
+
withPrefix("list"),
|
|
65
|
+
withPrefix("ol"),
|
|
66
|
+
)}
|
|
67
|
+
{...rest}
|
|
68
|
+
>
|
|
69
|
+
{children}
|
|
70
|
+
</OrderedList>
|
|
71
|
+
</Column>
|
|
72
|
+
</Grid>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}}
|
|
76
|
+
</LiConsumer>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
OL.propTypes = {
|
|
81
|
+
/**
|
|
82
|
+
* Child LI elements
|
|
83
|
+
*/
|
|
84
|
+
children: PropTypes.oneOfType([
|
|
85
|
+
PropTypes.arrayOf(PropTypes.element.isRequired).isRequired,
|
|
86
|
+
PropTypes.element.isRequired,
|
|
87
|
+
]).isRequired,
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Specify optional className for container element
|
|
91
|
+
*/
|
|
92
|
+
className: PropTypes.string,
|
|
93
|
+
};
|