@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,150 @@
|
|
|
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 {
|
|
17
|
+
PauseOutline,
|
|
18
|
+
PauseOutlineFilled,
|
|
19
|
+
PlayOutline,
|
|
20
|
+
PlayOutlineFilled,
|
|
21
|
+
} from "@octaviaflow/icons-react";
|
|
22
|
+
import { clsx } from "clsx";
|
|
23
|
+
import PropTypes from "prop-types";
|
|
24
|
+
import React, { Children, ReactNode, useState } from "react";
|
|
25
|
+
|
|
26
|
+
import { MdxComponent } from "../interfaces";
|
|
27
|
+
import { withPrefix } from "../utils";
|
|
28
|
+
|
|
29
|
+
type Color = "light" | "dark";
|
|
30
|
+
|
|
31
|
+
interface GifPlayerProps {
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
className?: string | null;
|
|
34
|
+
color?: Color | null;
|
|
35
|
+
isInDialog?: boolean | null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const Pause = ({ hovering }: { hovering: boolean }) =>
|
|
39
|
+
hovering ? <PauseOutlineFilled size={24} /> : <PauseOutline size={24} />;
|
|
40
|
+
|
|
41
|
+
const Play = ({ hovering }: { hovering: boolean }) =>
|
|
42
|
+
hovering ? <PlayOutlineFilled size={24} /> : <PlayOutline size={24} />;
|
|
43
|
+
|
|
44
|
+
const ToggleIcon = ({
|
|
45
|
+
paused,
|
|
46
|
+
hovering,
|
|
47
|
+
}: {
|
|
48
|
+
hovering: boolean;
|
|
49
|
+
paused: boolean;
|
|
50
|
+
}) => (paused ? <Play hovering={hovering} /> : <Pause hovering={hovering} />);
|
|
51
|
+
/**
|
|
52
|
+
* The `<GifPlayer>` component is used to pause and play images that are gif’s.
|
|
53
|
+
* It works by replacing the gif with a static image on pause.
|
|
54
|
+
*/
|
|
55
|
+
export const GifPlayer: MdxComponent<GifPlayerProps> = ({
|
|
56
|
+
children,
|
|
57
|
+
color,
|
|
58
|
+
className,
|
|
59
|
+
isInDialog,
|
|
60
|
+
}) => {
|
|
61
|
+
const [paused, setPaused] = useState(false);
|
|
62
|
+
|
|
63
|
+
const [hovering, setHovering] = useState(false);
|
|
64
|
+
const onClick = (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
65
|
+
e.stopPropagation();
|
|
66
|
+
setPaused(!paused);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const controlsClassNames = clsx(withPrefix("controls"), {
|
|
70
|
+
[withPrefix("dark")]: color === "dark",
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const containerClassNames = clsx(
|
|
74
|
+
className,
|
|
75
|
+
withPrefix("gif-player-container"),
|
|
76
|
+
{
|
|
77
|
+
[withPrefix("gif-in-dialog")]: isInDialog,
|
|
78
|
+
},
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const staticImageClassNames = clsx(withPrefix("img-hidden"), {
|
|
82
|
+
[withPrefix("img-displayed")]: paused,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const gifClassNames = clsx(withPrefix("gif-displayed"), {
|
|
86
|
+
[withPrefix("gif-hidden")]: paused,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const childrenArray = Children.toArray(children);
|
|
90
|
+
|
|
91
|
+
const labelText = paused
|
|
92
|
+
? "Toggleable animation paused"
|
|
93
|
+
: "Toggleable animation playing";
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<div className={containerClassNames}>
|
|
97
|
+
<div className={gifClassNames} aria-hidden={paused ? "true" : false}>
|
|
98
|
+
{childrenArray[0]}
|
|
99
|
+
</div>
|
|
100
|
+
<div
|
|
101
|
+
className={staticImageClassNames}
|
|
102
|
+
aria-hidden={paused ? false : "true"}
|
|
103
|
+
>
|
|
104
|
+
{childrenArray[1]}
|
|
105
|
+
</div>
|
|
106
|
+
<button
|
|
107
|
+
aria-pressed={paused ? "true" : "false"}
|
|
108
|
+
type="button"
|
|
109
|
+
aria-label={labelText}
|
|
110
|
+
className={controlsClassNames}
|
|
111
|
+
onMouseEnter={() => setHovering(true)}
|
|
112
|
+
onMouseLeave={() => setHovering(false)}
|
|
113
|
+
onClick={onClick}
|
|
114
|
+
onKeyDown={(e) => {
|
|
115
|
+
// Stop keyDown event from propagating to ImageGalleryImage component.
|
|
116
|
+
e.stopPropagation();
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
<ToggleIcon hovering={hovering} paused={paused} />
|
|
120
|
+
</button>
|
|
121
|
+
</div>
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
GifPlayer.propTypes = {
|
|
126
|
+
/**
|
|
127
|
+
* Only pass in the 2 images to be rendered, first must be gif, second must be static image
|
|
128
|
+
*/
|
|
129
|
+
children: PropTypes.oneOfType([
|
|
130
|
+
PropTypes.element.isRequired,
|
|
131
|
+
PropTypes.arrayOf(PropTypes.element.isRequired),
|
|
132
|
+
]).isRequired,
|
|
133
|
+
/**
|
|
134
|
+
* Specify optional className
|
|
135
|
+
*/
|
|
136
|
+
className: PropTypes.string,
|
|
137
|
+
/**
|
|
138
|
+
* Specify if icon color should be "dark" or "light"
|
|
139
|
+
*/
|
|
140
|
+
color: PropTypes.oneOf<Color>(["light", "dark"]),
|
|
141
|
+
/**
|
|
142
|
+
* Specify if the gifPlayer is inside the expanded ImageGallery
|
|
143
|
+
*/
|
|
144
|
+
isInDialog: PropTypes.bool,
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
GifPlayer.defaultProps = {
|
|
148
|
+
color: "light",
|
|
149
|
+
isInDialog: false,
|
|
150
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
@use '@carbon/react/scss/spacing' as spacing;
|
|
8
|
+
|
|
9
|
+
@use '../utils' as *;
|
|
10
|
+
|
|
11
|
+
.#{with-prefix('grid')} {
|
|
12
|
+
margin-block-start: spacing.$spacing-06;
|
|
13
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
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 as CarbonColumn } 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 ColumnProps {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
className?: string | null;
|
|
28
|
+
colSm?: number | null;
|
|
29
|
+
colMd?: number | null;
|
|
30
|
+
colLg?: number | null;
|
|
31
|
+
colXl?: number | null;
|
|
32
|
+
colMax?: number | null;
|
|
33
|
+
offsetSm?: number | null;
|
|
34
|
+
offsetMd?: number | null;
|
|
35
|
+
offsetLg?: number | null;
|
|
36
|
+
offsetXl?: number | null;
|
|
37
|
+
offsetMax?: number | null;
|
|
38
|
+
[otherProp: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const Column: MdxComponent<ColumnProps> = ({
|
|
42
|
+
children,
|
|
43
|
+
className,
|
|
44
|
+
colSm,
|
|
45
|
+
colMd,
|
|
46
|
+
colLg,
|
|
47
|
+
colXl,
|
|
48
|
+
colMax,
|
|
49
|
+
offsetSm,
|
|
50
|
+
offsetMd,
|
|
51
|
+
offsetLg,
|
|
52
|
+
offsetXl,
|
|
53
|
+
offsetMax,
|
|
54
|
+
...props
|
|
55
|
+
}) => {
|
|
56
|
+
const colSizes = {
|
|
57
|
+
sm: offsetSm ? { span: colSm, offset: offsetSm } : colSm,
|
|
58
|
+
md: offsetMd ? { span: colMd, offset: offsetMd } : colMd,
|
|
59
|
+
lg: offsetLg ? { span: colLg, offset: offsetLg } : colLg,
|
|
60
|
+
xlg: offsetXl ? { span: colXl, offset: offsetXl } : colXl,
|
|
61
|
+
max: offsetMax ? { span: colMax, offset: offsetMax } : colMax,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// remove 'noGutter' props to avoid react console error
|
|
65
|
+
for (const key in Object.keys(props)) {
|
|
66
|
+
if (key.startsWith("noGutter")) {
|
|
67
|
+
delete props[key];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
// @ts-ignore -- TS thinks this is null
|
|
73
|
+
<CarbonColumn
|
|
74
|
+
{...colSizes}
|
|
75
|
+
{...props}
|
|
76
|
+
className={clsx(withPrefix("column"), className)}
|
|
77
|
+
>
|
|
78
|
+
{children}
|
|
79
|
+
</CarbonColumn>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
Column.defaultProps = {
|
|
84
|
+
colSm: 4,
|
|
85
|
+
colMd: 8,
|
|
86
|
+
colLg: 12,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
Column.propTypes = {
|
|
90
|
+
children: PropTypes.node as unknown as React.Validator<React.ReactNode>,
|
|
91
|
+
className: PropTypes.string,
|
|
92
|
+
colLg: PropTypes.number.isRequired,
|
|
93
|
+
colMax: PropTypes.number,
|
|
94
|
+
colMd: PropTypes.number.isRequired,
|
|
95
|
+
colSm: PropTypes.number.isRequired,
|
|
96
|
+
colXl: PropTypes.number,
|
|
97
|
+
offsetLg: PropTypes.number,
|
|
98
|
+
offsetMax: PropTypes.number,
|
|
99
|
+
offsetMd: PropTypes.number,
|
|
100
|
+
offsetSm: PropTypes.number,
|
|
101
|
+
offsetXl: PropTypes.number,
|
|
102
|
+
};
|
|
@@ -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 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 } from "./column";
|
|
19
|
+
import { Grid } from "./grid";
|
|
20
|
+
import { Row } from "./row";
|
|
21
|
+
|
|
22
|
+
export default {
|
|
23
|
+
title: "Components/MDX Components/Grid",
|
|
24
|
+
component: Grid,
|
|
25
|
+
argTypes: {
|
|
26
|
+
children: {
|
|
27
|
+
control: false,
|
|
28
|
+
},
|
|
29
|
+
className: {
|
|
30
|
+
control: false,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const Template = () => (
|
|
36
|
+
<Grid>
|
|
37
|
+
<Column sm={4} md={4} lg={4}>
|
|
38
|
+
Span 4
|
|
39
|
+
</Column>
|
|
40
|
+
<Column sm={4} md={4} lg={4}>
|
|
41
|
+
Span 4
|
|
42
|
+
</Column>
|
|
43
|
+
<Column sm={4} md={4} lg={4}>
|
|
44
|
+
Span 4
|
|
45
|
+
</Column>
|
|
46
|
+
<Column sm={4} md={4} lg={4}>
|
|
47
|
+
Span 4
|
|
48
|
+
</Column>
|
|
49
|
+
</Grid>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const GatsbyTemplate = () => (
|
|
53
|
+
<Row>
|
|
54
|
+
<Column sm={4} md={4} lg={4}>
|
|
55
|
+
Span 4
|
|
56
|
+
</Column>
|
|
57
|
+
<Column sm={4} md={4} lg={4}>
|
|
58
|
+
Span 4
|
|
59
|
+
</Column>
|
|
60
|
+
<Column sm={4} md={4} lg={4}>
|
|
61
|
+
Span 4
|
|
62
|
+
</Column>
|
|
63
|
+
<Column sm={4} md={4} lg={4}>
|
|
64
|
+
Span 4
|
|
65
|
+
</Column>
|
|
66
|
+
</Row>
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
export const Default = Template.bind({});
|
|
70
|
+
Default.args = {};
|
|
71
|
+
|
|
72
|
+
export const Gatsby = GatsbyTemplate.bind({});
|
|
@@ -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 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 { Grid as CarbonGrid } 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 GridProps {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
className?: string | null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The carbon-labs MDX package allows for easy use of the Carbon `<Grid>` and `<Column>`
|
|
32
|
+
* components. See full docs in the Carbon React Storybook.
|
|
33
|
+
* https://react.carbondesignsystem.com/?path=/story/elements-grid--default
|
|
34
|
+
*
|
|
35
|
+
* Additionally, this package also supports the Gatsby theme's `<Row>` and `<Column>`.
|
|
36
|
+
* See full docs in the Carbon theme Gatsby website.
|
|
37
|
+
* https://gatsby.carbondesignsystem.com/components/Grid/
|
|
38
|
+
*/
|
|
39
|
+
export const Grid: MdxComponent<GridProps> = ({
|
|
40
|
+
children,
|
|
41
|
+
className,
|
|
42
|
+
...props
|
|
43
|
+
}) => (
|
|
44
|
+
<CarbonGrid {...props} className={clsx(withPrefix("grid"), className)}>
|
|
45
|
+
{children}
|
|
46
|
+
</CarbonGrid>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
Grid.propTypes = {
|
|
50
|
+
children: PropTypes.node as unknown as React.Validator<React.ReactNode>,
|
|
51
|
+
className: PropTypes.string,
|
|
52
|
+
};
|
|
@@ -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
|
+
|
|
17
|
+
import { Grid } from "@octaviaflow/react";
|
|
18
|
+
import { clsx } from "clsx";
|
|
19
|
+
import PropTypes from "prop-types";
|
|
20
|
+
import React, { Children, ReactNode } from "react";
|
|
21
|
+
|
|
22
|
+
import { MdxComponent } from "../interfaces";
|
|
23
|
+
import { mediaQueries, useMatchMedia, withPrefix } from "../utils";
|
|
24
|
+
|
|
25
|
+
interface RowProps {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
className?: string | null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const Row: MdxComponent<RowProps> = ({ children, className }) => {
|
|
31
|
+
const arrayChildren = Children.toArray(children);
|
|
32
|
+
|
|
33
|
+
const isSm = useMatchMedia(mediaQueries.sm);
|
|
34
|
+
const isMd = useMatchMedia(mediaQueries.md);
|
|
35
|
+
const isLg = useMatchMedia(mediaQueries.lg);
|
|
36
|
+
const isXlg = useMatchMedia(mediaQueries.xlg);
|
|
37
|
+
const isMax = useMatchMedia(mediaQueries.max);
|
|
38
|
+
|
|
39
|
+
const sizeMappings = {
|
|
40
|
+
Sm: isSm,
|
|
41
|
+
Md: isMd,
|
|
42
|
+
Lg: isLg,
|
|
43
|
+
Xl: isXlg,
|
|
44
|
+
Max: isMax,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
let narrow = false;
|
|
48
|
+
let condensed = false;
|
|
49
|
+
|
|
50
|
+
Children.map(arrayChildren, (child) => {
|
|
51
|
+
if (typeof child === "string") {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (typeof child === "number") {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (!("props" in child)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const condensedProps = Object.keys(child.props).filter(
|
|
61
|
+
(prop) => prop.startsWith("noGutter") && !prop.endsWith("Left"),
|
|
62
|
+
);
|
|
63
|
+
condensedProps.forEach((prop) => {
|
|
64
|
+
const size = prop.replace("noGutter", "") as keyof typeof sizeMappings;
|
|
65
|
+
condensed = sizeMappings[size] ?? false;
|
|
66
|
+
});
|
|
67
|
+
const narrowProps = Object.keys(child.props).filter(
|
|
68
|
+
(prop) => prop.startsWith("noGutter") && prop.endsWith("Left"),
|
|
69
|
+
);
|
|
70
|
+
narrowProps.forEach((prop) => {
|
|
71
|
+
const size = prop
|
|
72
|
+
.replace("noGutter", "")
|
|
73
|
+
.replace("Left", "") as keyof typeof sizeMappings;
|
|
74
|
+
narrow = sizeMappings[size] ?? false;
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<Grid
|
|
80
|
+
narrow={narrow}
|
|
81
|
+
condensed={condensed}
|
|
82
|
+
className={clsx(withPrefix("grid"), className)}
|
|
83
|
+
>
|
|
84
|
+
{children}
|
|
85
|
+
</Grid>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
Row.propTypes = {
|
|
90
|
+
children: PropTypes.node as unknown as React.Validator<React.ReactNode>,
|
|
91
|
+
className: PropTypes.string,
|
|
92
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
/* stylelint-disable declaration-no-important */
|
|
8
|
+
@use '@carbon/react/scss/theme' as theme;
|
|
9
|
+
@use '@carbon/react/scss/spacing' as spacing;
|
|
10
|
+
@use '@carbon/react/scss/utilities/convert' as convert;
|
|
11
|
+
|
|
12
|
+
@use '../utils' as *;
|
|
13
|
+
|
|
14
|
+
.#{with-prefix('fixed')},
|
|
15
|
+
.image--fixed {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
background: theme.$layer-01;
|
|
21
|
+
margin-block-start: spacing.$spacing-07;
|
|
22
|
+
|
|
23
|
+
div {
|
|
24
|
+
display: flex;
|
|
25
|
+
inline-size: initial !important;
|
|
26
|
+
max-inline-size: 100%;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
span {
|
|
30
|
+
inline-size: convert.rem(736px) !important;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { ImageWrapper } from "./image-wrapper";
|
|
19
|
+
import accordionStyle3Png from "./accordion-style-3.png";
|
|
20
|
+
|
|
21
|
+
const stories = {
|
|
22
|
+
title: "Components/MDX Components/Images & Video/ImageWrapper",
|
|
23
|
+
component: ImageWrapper,
|
|
24
|
+
argTypes: {
|
|
25
|
+
children: {
|
|
26
|
+
control: false,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default stories;
|
|
32
|
+
|
|
33
|
+
const Template = (args) => (
|
|
34
|
+
<ImageWrapper type="fixed" {...args}>
|
|
35
|
+
<img alt="fixed demo" src={accordionStyle3Png} />
|
|
36
|
+
</ImageWrapper>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
export const Default = Template.bind({});
|
|
40
|
+
Default.args = {};
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { 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
|
+
type ImageType = "fixed";
|
|
25
|
+
|
|
26
|
+
interface ImageWrapperProps {
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
className?: string | null;
|
|
29
|
+
type: ImageType;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The `<ImageWrapper>` component allows the user to set a `type='fixed'`
|
|
34
|
+
* which forces a fixed max width inside the container, and scales down
|
|
35
|
+
* to smaller sizes at tablet and mobile.
|
|
36
|
+
*/
|
|
37
|
+
export const ImageWrapper: MdxComponent<ImageWrapperProps> = ({
|
|
38
|
+
children,
|
|
39
|
+
className,
|
|
40
|
+
type,
|
|
41
|
+
}) => {
|
|
42
|
+
const wrapperClassNames = clsx(className, {
|
|
43
|
+
[withPrefix("fixed")]: type === "fixed",
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return <div className={wrapperClassNames}>{children}</div>;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
ImageWrapper.propTypes = {
|
|
50
|
+
/** set children */
|
|
51
|
+
children: PropTypes.node as unknown as React.Validator<React.ReactNode>,
|
|
52
|
+
/** set optional custom class */
|
|
53
|
+
className: PropTypes.string,
|
|
54
|
+
/** set type */
|
|
55
|
+
type: PropTypes.oneOf<ImageType>(["fixed"]).isRequired,
|
|
56
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
// Putting this at the inset-block-start allows individual components to override markdown-specific styles
|
|
8
|
+
@use './markdown/markdown';
|
|
9
|
+
|
|
10
|
+
@use './accordion/accordion';
|
|
11
|
+
@use './anchor-links/anchor-links';
|
|
12
|
+
@use './article-card/article-card';
|
|
13
|
+
@use './aside/aside';
|
|
14
|
+
@use './caption/caption';
|
|
15
|
+
@use './card-group/card-group';
|
|
16
|
+
@use './code/code';
|
|
17
|
+
@use './divider/divider';
|
|
18
|
+
@use './do-dont/do-dont';
|
|
19
|
+
@use './gif-player/gif-player';
|
|
20
|
+
@use './grid-transform/grid';
|
|
21
|
+
@use './image-wrapper/image-wrapper';
|
|
22
|
+
@use './inline-notification/inline-notification';
|
|
23
|
+
@use './link/link';
|
|
24
|
+
@use './mini-card/mini-card';
|
|
25
|
+
@use './preview/preview';
|
|
26
|
+
@use './page-description/page-description';
|
|
27
|
+
@use './page-table/page-table';
|
|
28
|
+
@use './resource-card/resource-card';
|
|
29
|
+
@use './storybook-demo/storybook-demo';
|
|
30
|
+
@use './tabs/tabs';
|
|
31
|
+
@use './video/video';
|
|
@@ -0,0 +1,29 @@
|
|
|
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/type' as type;
|
|
9
|
+
@use '@carbon/react/scss/spacing' as spacing;
|
|
10
|
+
|
|
11
|
+
@use '../utils' as *;
|
|
12
|
+
|
|
13
|
+
.#{with-prefix('notification')} {
|
|
14
|
+
margin-block-start: spacing.$spacing-05;
|
|
15
|
+
|
|
16
|
+
// override carbon, notification inline-size
|
|
17
|
+
&.#{with-prefix('notification')} .ods--inline-notification {
|
|
18
|
+
max-inline-size: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.#{with-prefix('content')} div {
|
|
22
|
+
margin-block-start: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.#{with-prefix('content')},
|
|
26
|
+
.#{with-prefix('content')} p {
|
|
27
|
+
@include type.type-style('body-compact-01');
|
|
28
|
+
}
|
|
29
|
+
}
|