@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,63 @@
|
|
|
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
|
+
|
|
17
|
+
import PropTypes from "prop-types";
|
|
18
|
+
import React, { Children, ReactNode } from "react";
|
|
19
|
+
|
|
20
|
+
import { MdxComponent } from "../interfaces";
|
|
21
|
+
import { mediaQueries, useMatchMedia } from "../utils";
|
|
22
|
+
|
|
23
|
+
interface ArtDirectionProps {
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* On the web, art direction refers to changing the image rendered at different
|
|
29
|
+
* display sizes. The `ArtDirection `component allows you to provide multiple images
|
|
30
|
+
* achieve this goal.
|
|
31
|
+
*
|
|
32
|
+
* You can place up to three images inside of the ArtDirection component. The first
|
|
33
|
+
* will be used for mobile, the second for tablet, and the third for desktop. If only
|
|
34
|
+
* two images are provided, the second image will be used for both tablet and desktop.
|
|
35
|
+
*/
|
|
36
|
+
export const ArtDirection: MdxComponent<ArtDirectionProps> = ({ children }) => {
|
|
37
|
+
const isMd = useMatchMedia(mediaQueries.md);
|
|
38
|
+
const isLg = useMatchMedia(mediaQueries.lg);
|
|
39
|
+
|
|
40
|
+
const childrenArray = Children.toArray(children);
|
|
41
|
+
|
|
42
|
+
if ((!isMd && !isLg) || !childrenArray[1]) {
|
|
43
|
+
return <div>{childrenArray[0]}</div>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if ((isMd && !isLg) || !childrenArray[2]) {
|
|
47
|
+
return <div>{childrenArray[1]}</div>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return <div>{childrenArray[2]}</div>;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
ArtDirection.propTypes = {
|
|
54
|
+
/**
|
|
55
|
+
* You can place up to three images inside of the ArtDirection component. The first
|
|
56
|
+
* will be used for mobile, the second for tablet, and the third for desktop. If only
|
|
57
|
+
* two images are provided, the second image will be used for both tablet and desktop.
|
|
58
|
+
*/
|
|
59
|
+
children: PropTypes.oneOfType([
|
|
60
|
+
PropTypes.element.isRequired,
|
|
61
|
+
PropTypes.arrayOf(PropTypes.element).isRequired,
|
|
62
|
+
]).isRequired,
|
|
63
|
+
};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright OctaviaFlow 2022, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
@use '@carbon/react/scss/spacing' as spacing;
|
|
9
|
+
@use '@carbon/react/scss/theme' as theme;
|
|
10
|
+
@use '@carbon/react/scss/type' as type;
|
|
11
|
+
@use '@carbon/react/scss/motion' as motion;
|
|
12
|
+
|
|
13
|
+
@use '../utils' as *;
|
|
14
|
+
|
|
15
|
+
.#{with-prefix('article-card')} {
|
|
16
|
+
background: theme.$layer-01;
|
|
17
|
+
transition: background motion.$duration-fast-01;
|
|
18
|
+
|
|
19
|
+
&:hover {
|
|
20
|
+
background: theme.$layer-hover-01;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@media screen and (prefers-reduced-motion: reduce) {
|
|
24
|
+
transition: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.ods--tile {
|
|
28
|
+
position: relative;
|
|
29
|
+
padding: 0;
|
|
30
|
+
background: transparent;
|
|
31
|
+
block-size: 100%;
|
|
32
|
+
margin-block-end: spacing.$spacing-06;
|
|
33
|
+
text-decoration: none;
|
|
34
|
+
|
|
35
|
+
img {
|
|
36
|
+
max-inline-size: 100%;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.#{with-prefix('tile')} {
|
|
41
|
+
padding: spacing.$spacing-05 25% spacing.$spacing-05 spacing.$spacing-05;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.#{with-prefix('title')} {
|
|
45
|
+
@include type.type-style('body-compact-02');
|
|
46
|
+
|
|
47
|
+
color: theme.$text-primary;
|
|
48
|
+
text-decoration: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.#{with-prefix('subtitle')} {
|
|
52
|
+
@include type.type-style('heading-01');
|
|
53
|
+
|
|
54
|
+
color: theme.$text-primary;
|
|
55
|
+
font-weight: 400;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.#{with-prefix('info')} {
|
|
59
|
+
position: absolute;
|
|
60
|
+
color: theme.$text-secondary;
|
|
61
|
+
inset-block-end: spacing.$spacing-05;
|
|
62
|
+
inset-inline-start: spacing.$spacing-05;
|
|
63
|
+
@include type.type-style('label-01');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.#{with-prefix('icon-action')} {
|
|
67
|
+
position: absolute;
|
|
68
|
+
inset-block-end: spacing.$spacing-05;
|
|
69
|
+
inset-inline-end: spacing.$spacing-05;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.#{with-prefix('icon-action')} svg {
|
|
73
|
+
fill: theme.$icon-primary;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// carbon override, disabled state
|
|
78
|
+
.#{with-prefix('disabled')}.#{with-prefix('article-card')},
|
|
79
|
+
.#{with-prefix('disabled')} .ods--tile {
|
|
80
|
+
cursor: not-allowed;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.#{with-prefix('disabled')}:hover {
|
|
84
|
+
background: theme.$layer-01;
|
|
85
|
+
cursor: not-allowed;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.#{with-prefix('disabled')} .#{with-prefix('title')},
|
|
89
|
+
.#{with-prefix('disabled')} .#{with-prefix('subtitle')},
|
|
90
|
+
.#{with-prefix('disabled')} .#{with-prefix('info')} {
|
|
91
|
+
color: theme.$text-on-color-disabled;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.#{with-prefix('disabled')}
|
|
95
|
+
.#{with-prefix('action-icon')}
|
|
96
|
+
.#{with-prefix('svg')} {
|
|
97
|
+
fill: theme.$icon-on-color-disabled;
|
|
98
|
+
}
|
|
@@ -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 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 { Column, Grid } from "@carbon/react";
|
|
18
|
+
|
|
19
|
+
import { ArticleCard } from "./article-card";
|
|
20
|
+
import article06 from "./article06.png";
|
|
21
|
+
|
|
22
|
+
const stories = {
|
|
23
|
+
title: "Components/MDX Components/Cards/ArticleCard",
|
|
24
|
+
component: ArticleCard,
|
|
25
|
+
argTypes: {
|
|
26
|
+
children: {
|
|
27
|
+
control: false,
|
|
28
|
+
},
|
|
29
|
+
className: {
|
|
30
|
+
control: false,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default stories;
|
|
36
|
+
|
|
37
|
+
const Template = (args) => (
|
|
38
|
+
<Grid narrow>
|
|
39
|
+
<Column lg={4}>
|
|
40
|
+
<ArticleCard
|
|
41
|
+
subTitle="Sub title"
|
|
42
|
+
title="Title"
|
|
43
|
+
author="Author"
|
|
44
|
+
date="July 4, 1975"
|
|
45
|
+
readTime="Read time: 5 min"
|
|
46
|
+
href="/"
|
|
47
|
+
{...args}
|
|
48
|
+
>
|
|
49
|
+
<img
|
|
50
|
+
src={article06}
|
|
51
|
+
alt="Use markdown for images in mdx files. "
|
|
52
|
+
/>
|
|
53
|
+
</ArticleCard>
|
|
54
|
+
</Column>
|
|
55
|
+
</Grid>
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
export const Default = Template.bind({});
|
|
59
|
+
Default.args = {};
|
|
@@ -0,0 +1,208 @@
|
|
|
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
|
+
|
|
17
|
+
import { Theme } from "@octaviaflow/react";
|
|
18
|
+
import {
|
|
19
|
+
ArrowRight,
|
|
20
|
+
Download,
|
|
21
|
+
Email,
|
|
22
|
+
Error,
|
|
23
|
+
Launch,
|
|
24
|
+
} from "@octaviaflow/icons-react";
|
|
25
|
+
import { clsx } from "clsx";
|
|
26
|
+
import PropTypes from "prop-types";
|
|
27
|
+
import React, { ReactNode } from "react";
|
|
28
|
+
|
|
29
|
+
import { MdxComponent } from "../interfaces";
|
|
30
|
+
import { withPrefix } from "../utils";
|
|
31
|
+
|
|
32
|
+
type Color = "light" | "dark";
|
|
33
|
+
type ActionIcon = "launch" | "arrowRight" | "download" | "email" | "disabled";
|
|
34
|
+
|
|
35
|
+
interface ArticleCardProps {
|
|
36
|
+
children?: ReactNode;
|
|
37
|
+
href?: string | null;
|
|
38
|
+
title?: string | null;
|
|
39
|
+
subTitle?: string | null;
|
|
40
|
+
author?: string | null;
|
|
41
|
+
date?: string | null;
|
|
42
|
+
readTime?: string | null;
|
|
43
|
+
color?: Color;
|
|
44
|
+
disabled?: boolean | null;
|
|
45
|
+
actionIcon?: ActionIcon | null;
|
|
46
|
+
className?: string | null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The `<ArticleCard>` component should generally be used inside of
|
|
51
|
+
* `<Grid narrow>` and`<Column>` components.
|
|
52
|
+
*
|
|
53
|
+
* ```
|
|
54
|
+
* <Grid narrow>
|
|
55
|
+
* <Column lg={4}>
|
|
56
|
+
* <ArticleCard props>
|
|
57
|
+
*
|
|
58
|
+
* 
|
|
59
|
+
*
|
|
60
|
+
* </ArticleCard>
|
|
61
|
+
* </Column>
|
|
62
|
+
* </Grid>
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export const ArticleCard: MdxComponent<ArticleCardProps> = (props) => {
|
|
66
|
+
const {
|
|
67
|
+
children,
|
|
68
|
+
href,
|
|
69
|
+
title,
|
|
70
|
+
subTitle,
|
|
71
|
+
author,
|
|
72
|
+
date,
|
|
73
|
+
readTime,
|
|
74
|
+
color,
|
|
75
|
+
disabled,
|
|
76
|
+
actionIcon,
|
|
77
|
+
className,
|
|
78
|
+
...rest
|
|
79
|
+
} = props;
|
|
80
|
+
|
|
81
|
+
const ArticleCardClassNames = clsx(className, withPrefix("article-card"), {
|
|
82
|
+
[withPrefix("disabled")]: disabled,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const aspectRatioClassNames = clsx(
|
|
86
|
+
"ods--aspect-ratio",
|
|
87
|
+
"ods--aspect-ratio--2x1",
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const cardContentClassNames = clsx("ods--tile", "ods--tile--clickable");
|
|
91
|
+
|
|
92
|
+
const cardContent = (
|
|
93
|
+
<>
|
|
94
|
+
<div className={withPrefix("img")}>{children}</div>
|
|
95
|
+
<div className={aspectRatioClassNames}>
|
|
96
|
+
<div className={clsx("ods--aspect-ratio--object", withPrefix("tile"))}>
|
|
97
|
+
{subTitle && <h5 className={withPrefix("subtitle")}>{subTitle}</h5>}
|
|
98
|
+
{title && <h4 className={withPrefix("title")}>{title}</h4>}
|
|
99
|
+
<div className={withPrefix("info")}>
|
|
100
|
+
{author && <p>{author}</p>}
|
|
101
|
+
{date && <p>{date}</p>}
|
|
102
|
+
{readTime && <p>{readTime}</p>}
|
|
103
|
+
</div>
|
|
104
|
+
<div className={withPrefix("icon-action")}>
|
|
105
|
+
{actionIcon === "launch" && !disabled && (
|
|
106
|
+
<Launch size={20} aria-label="Open" />
|
|
107
|
+
)}
|
|
108
|
+
{actionIcon === "arrowRight" && !disabled && (
|
|
109
|
+
<ArrowRight size={20} aria-label="Open" />
|
|
110
|
+
)}
|
|
111
|
+
{actionIcon === "download" && !disabled && (
|
|
112
|
+
<Download size={20} aria-label="Download" />
|
|
113
|
+
)}
|
|
114
|
+
{actionIcon === "email" && !disabled && (
|
|
115
|
+
<Email size={20} aria-label="Email" />
|
|
116
|
+
)}
|
|
117
|
+
{actionIcon === "disabled" ||
|
|
118
|
+
(disabled === true && <Error size={20} aria-label="disabled" />)}
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</>
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
let cardContainer;
|
|
126
|
+
if (disabled === true) {
|
|
127
|
+
cardContainer = <div className={cardContentClassNames}>{cardContent}</div>;
|
|
128
|
+
} else {
|
|
129
|
+
cardContainer = (
|
|
130
|
+
<a href={href!} className={cardContentClassNames} {...rest}>
|
|
131
|
+
{cardContent}
|
|
132
|
+
</a>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<Theme theme={color === "dark" ? "g100" : undefined}>
|
|
138
|
+
<div className={ArticleCardClassNames}>{cardContainer}</div>
|
|
139
|
+
</Theme>
|
|
140
|
+
);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
ArticleCard.defaultProps = {
|
|
144
|
+
color: "light",
|
|
145
|
+
disabled: false,
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
ArticleCard.propTypes = {
|
|
149
|
+
/**
|
|
150
|
+
* Action icon
|
|
151
|
+
*/
|
|
152
|
+
actionIcon: PropTypes.oneOf<ActionIcon>([
|
|
153
|
+
"launch",
|
|
154
|
+
"arrowRight",
|
|
155
|
+
"download",
|
|
156
|
+
"email",
|
|
157
|
+
"disabled",
|
|
158
|
+
]),
|
|
159
|
+
/**
|
|
160
|
+
* Author
|
|
161
|
+
*/
|
|
162
|
+
author: PropTypes.string,
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Provide an image to display above card
|
|
166
|
+
*/
|
|
167
|
+
children: PropTypes.element,
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Specify a custom class
|
|
171
|
+
*/
|
|
172
|
+
className: PropTypes.string,
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* set to "dark" for dark background card
|
|
176
|
+
*/
|
|
177
|
+
color: PropTypes.oneOf<Color>(["light", "dark"]).isRequired,
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* date
|
|
181
|
+
*/
|
|
182
|
+
date: PropTypes.string,
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Use for disabled card
|
|
186
|
+
*/
|
|
187
|
+
disabled: PropTypes.bool,
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Set url for card
|
|
191
|
+
*/
|
|
192
|
+
href: PropTypes.string,
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Reat time of article
|
|
196
|
+
*/
|
|
197
|
+
readTime: PropTypes.string,
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* sub title
|
|
201
|
+
*/
|
|
202
|
+
subTitle: PropTypes.string,
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Title
|
|
206
|
+
*/
|
|
207
|
+
title: PropTypes.string,
|
|
208
|
+
};
|
|
Binary file
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright OctaviaFlow 2022, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
@use '@carbon/react/scss/breakpoint' as breakpoint;
|
|
9
|
+
@use '@carbon/react/scss/spacing' as spacing;
|
|
10
|
+
@use '@carbon/react/scss/theme' as theme;
|
|
11
|
+
@use '@carbon/react/scss/type' as type;
|
|
12
|
+
|
|
13
|
+
@use '../utils' as *;
|
|
14
|
+
|
|
15
|
+
.#{with-prefix('aside')} {
|
|
16
|
+
@include type.type-style('body-01');
|
|
17
|
+
|
|
18
|
+
position: relative;
|
|
19
|
+
color: theme.$text-primary;
|
|
20
|
+
inset-block-start: -(spacing.$spacing-04);
|
|
21
|
+
|
|
22
|
+
@include breakpoint.breakpoint('lg') {
|
|
23
|
+
padding-block-start: spacing.$spacing-04;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@include breakpoint.breakpoint('lg') {
|
|
27
|
+
//spacing values came from IDL site design
|
|
28
|
+
padding-inline-end: 26%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
> div,
|
|
32
|
+
> div ol:first-child {
|
|
33
|
+
margin-block-start: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
p,
|
|
37
|
+
li {
|
|
38
|
+
@include type.type-style('body-01');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@include breakpoint.breakpoint('md') {
|
|
42
|
+
&::before {
|
|
43
|
+
position: absolute;
|
|
44
|
+
background: theme.$border-inverse;
|
|
45
|
+
block-size: 1px;
|
|
46
|
+
content: '';
|
|
47
|
+
inline-size: 40%;
|
|
48
|
+
inset-block-start: 0;
|
|
49
|
+
inset-inline-start: -(spacing.$spacing-05);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.#{with-prefix('aside--no-rule')}::before {
|
|
55
|
+
content: none;
|
|
56
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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 { Column, Grid } from "@carbon/react";
|
|
19
|
+
|
|
20
|
+
import { Aside } from "./aside";
|
|
21
|
+
|
|
22
|
+
export default {
|
|
23
|
+
title: "Components/MDX Components/Aside",
|
|
24
|
+
component: Aside,
|
|
25
|
+
argTypes: {
|
|
26
|
+
children: {
|
|
27
|
+
control: false,
|
|
28
|
+
},
|
|
29
|
+
className: {
|
|
30
|
+
control: false,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const Template = (args) => (
|
|
36
|
+
<Grid>
|
|
37
|
+
<Column lg={4}>
|
|
38
|
+
<Aside aria-label="Example aside" {...args}>
|
|
39
|
+
Lorem ipsum: dolor sit amet, elit. Curabitur ac odio arcu. Vestibulum
|
|
40
|
+
egestas eleifend porttitor. Quisque malesuada pulvinar pellentesque.
|
|
41
|
+
Nunc dictum odio eu enim venenatis fringilla. Nunc finibus enim dui, a
|
|
42
|
+
tempus quam commodo vitae. Donec non eros gravida dolor porta suscipit
|
|
43
|
+
non vel quam.
|
|
44
|
+
</Aside>
|
|
45
|
+
</Column>
|
|
46
|
+
</Grid>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
export const Default = Template.bind({});
|
|
50
|
+
Default.args = {};
|
|
@@ -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
|
+
|
|
17
|
+
import { Column, Grid } from "@octaviaflow/react";
|
|
18
|
+
import { clsx } from "clsx";
|
|
19
|
+
import PropTypes from "prop-types";
|
|
20
|
+
import React, { ReactNode } from "react";
|
|
21
|
+
|
|
22
|
+
import { MdxComponent } from "../interfaces";
|
|
23
|
+
import { withPrefix } from "../utils";
|
|
24
|
+
|
|
25
|
+
interface AsideProps {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
className?: string | null;
|
|
28
|
+
hideRule?: boolean | null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The `<Aside>` component is a wrapper component that adds styling to make the text display
|
|
33
|
+
* smaller than the default body text with a one column offset. It is designed to be used on
|
|
34
|
+
* the side of the page within grid components. Add an aria-label for a11y.
|
|
35
|
+
*/
|
|
36
|
+
export const Aside: MdxComponent<AsideProps> = ({
|
|
37
|
+
children,
|
|
38
|
+
className,
|
|
39
|
+
hideRule,
|
|
40
|
+
...rest
|
|
41
|
+
}) => {
|
|
42
|
+
const asideClasses = clsx(withPrefix("aside"), className, {
|
|
43
|
+
[withPrefix("aside--no-rule")]: !!hideRule,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Grid>
|
|
48
|
+
<Column sm={4} md={{ span: 2, offset: 1 }} lg={{ span: 4, offset: 1 }}>
|
|
49
|
+
<aside className={asideClasses} {...rest}>
|
|
50
|
+
{children}
|
|
51
|
+
</aside>
|
|
52
|
+
</Column>
|
|
53
|
+
</Grid>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
Aside.propTypes = {
|
|
58
|
+
/**
|
|
59
|
+
* Child of the Aside.
|
|
60
|
+
*/
|
|
61
|
+
children: PropTypes.node as unknown as React.Validator<React.ReactNode>,
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Optional class name.
|
|
65
|
+
*/
|
|
66
|
+
className: PropTypes.string,
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Hide the rule above the text.
|
|
70
|
+
*/
|
|
71
|
+
hideRule: PropTypes.bool,
|
|
72
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright OctaviaFlow 2022, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
@use '@carbon/react/scss/spacing' as spacing;
|
|
9
|
+
@use '@carbon/react/scss/type' as type;
|
|
10
|
+
@use '@carbon/react/scss/theme' as theme;
|
|
11
|
+
|
|
12
|
+
@use '../utils' as *;
|
|
13
|
+
|
|
14
|
+
.#{with-prefix('caption-container')} {
|
|
15
|
+
margin-block-start: spacing.$spacing-05;
|
|
16
|
+
|
|
17
|
+
.#{with-prefix('header')} + & {
|
|
18
|
+
margin-block-start: spacing.$spacing-06;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.#{with-prefix('caption')},
|
|
23
|
+
.#{with-prefix('caption')} p,
|
|
24
|
+
.#{with-prefix('caption')} div {
|
|
25
|
+
@include type.type-style('body-short-01');
|
|
26
|
+
|
|
27
|
+
color: theme.$text-primary;
|
|
28
|
+
|
|
29
|
+
margin-block-start: 0;
|
|
30
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { Caption } from "./caption";
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
title: "Components/MDX Components/Caption",
|
|
22
|
+
component: Caption,
|
|
23
|
+
argTypes: {},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const Template = (args) => (
|
|
27
|
+
<Caption {...args}>
|
|
28
|
+
Lorem ipsum dolor sit amet Lorem Lorem Lorem Lorem Lorem Lorem ipsum.
|
|
29
|
+
</Caption>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const Default = Template.bind({});
|
|
33
|
+
Default.args = {};
|