@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.
Files changed (119) hide show
  1. package/README.md +215 -0
  2. package/components/_utils.scss +18 -0
  3. package/components/accordion/_accordion.scss +35 -0
  4. package/components/accordion/accordion.stories.jsx +33 -0
  5. package/components/accordion/accordion.tsx +55 -0
  6. package/components/anchor-links/_anchor-links.scss +67 -0
  7. package/components/anchor-links/anchor-link.tsx +50 -0
  8. package/components/anchor-links/anchor-links.stories.jsx +51 -0
  9. package/components/anchor-links/anchor-links.tsx +73 -0
  10. package/components/art-direction/art-direction.stories.jsx +44 -0
  11. package/components/art-direction/art-direction.tsx +63 -0
  12. package/components/art-direction/desktop.jpg +0 -0
  13. package/components/art-direction/mobile.jpg +0 -0
  14. package/components/art-direction/tablet.jpg +0 -0
  15. package/components/article-card/_article-card.scss +98 -0
  16. package/components/article-card/article-card.stories.jsx +59 -0
  17. package/components/article-card/article-card.tsx +208 -0
  18. package/components/article-card/article06.png +0 -0
  19. package/components/aside/_aside.scss +56 -0
  20. package/components/aside/aside.stories.jsx +50 -0
  21. package/components/aside/aside.tsx +72 -0
  22. package/components/caption/_caption.scss +30 -0
  23. package/components/caption/caption.stories.jsx +33 -0
  24. package/components/caption/caption.tsx +47 -0
  25. package/components/card-group/_card-group.scss +44 -0
  26. package/components/card-group/card-group.stories.jsx +85 -0
  27. package/components/card-group/card-group.tsx +65 -0
  28. package/components/card-group/sketch-icon.png +0 -0
  29. package/components/code/_code.scss +110 -0
  30. package/components/code/code.stories.jsx +32 -0
  31. package/components/code/code.tsx +71 -0
  32. package/components/code/inline-code.tsx +55 -0
  33. package/components/code/path.tsx +56 -0
  34. package/components/divider/_divider.scss +67 -0
  35. package/components/divider/divider.stories.jsx +74 -0
  36. package/components/divider/divider.tsx +54 -0
  37. package/components/do-dont/_do-dont.scss +191 -0
  38. package/components/do-dont/do-dont-row.tsx +51 -0
  39. package/components/do-dont/do-dont.stories.jsx +53 -0
  40. package/components/do-dont/do-dont.tsx +161 -0
  41. package/components/do-dont/light-theme.jpg +0 -0
  42. package/components/gif-player/_gif-player.scss +64 -0
  43. package/components/gif-player/cloud.gif +0 -0
  44. package/components/gif-player/cloud.jpg +0 -0
  45. package/components/gif-player/gif-player.stories.jsx +45 -0
  46. package/components/gif-player/gif-player.tsx +150 -0
  47. package/components/grid-transform/_grid.scss +13 -0
  48. package/components/grid-transform/column.tsx +102 -0
  49. package/components/grid-transform/grid.stories.jsx +72 -0
  50. package/components/grid-transform/grid.tsx +52 -0
  51. package/components/grid-transform/row.tsx +92 -0
  52. package/components/image-wrapper/_image-wrapper.scss +32 -0
  53. package/components/image-wrapper/accordion-style-3.png +0 -0
  54. package/components/image-wrapper/image-wrapper.stories.jsx +40 -0
  55. package/components/image-wrapper/image-wrapper.tsx +56 -0
  56. package/components/index.scss +31 -0
  57. package/components/inline-notification/_inline-notification.scss +29 -0
  58. package/components/inline-notification/inline-notification.stories.jsx +67 -0
  59. package/components/inline-notification/inline-notification.tsx +98 -0
  60. package/components/interfaces.ts +31 -0
  61. package/components/link/_link.scss +13 -0
  62. package/components/link/link.stories.jsx +36 -0
  63. package/components/link/link.tsx +51 -0
  64. package/components/markdown/_markdown.scss +140 -0
  65. package/components/markdown/autolink-header/_autolink-header.scss +57 -0
  66. package/components/markdown/autolink-header/autolink-header.tsx +107 -0
  67. package/components/markdown/blockquote.stories.jsx +38 -0
  68. package/components/markdown/blockquote.tsx +53 -0
  69. package/components/markdown/h1.tsx +92 -0
  70. package/components/markdown/h2.tsx +85 -0
  71. package/components/markdown/h3.tsx +72 -0
  72. package/components/markdown/h4.tsx +73 -0
  73. package/components/markdown/h5.tsx +59 -0
  74. package/components/markdown/h6.tsx +59 -0
  75. package/components/markdown/headings.stories.jsx +52 -0
  76. package/components/markdown/li.tsx +55 -0
  77. package/components/markdown/ol.stories.jsx +47 -0
  78. package/components/markdown/ol.tsx +93 -0
  79. package/components/markdown/p.stories.jsx +36 -0
  80. package/components/markdown/p.tsx +65 -0
  81. package/components/markdown/ul.stories.jsx +46 -0
  82. package/components/markdown/ul.tsx +93 -0
  83. package/components/mini-card/_mini-card.scss +55 -0
  84. package/components/mini-card/mini-card.stories.jsx +72 -0
  85. package/components/mini-card/mini-card.tsx +132 -0
  86. package/components/page-description/_page-description.scss +38 -0
  87. package/components/page-description/page-description.stories.jsx +36 -0
  88. package/components/page-description/page-description.tsx +61 -0
  89. package/components/page-table/_page-table.scss +51 -0
  90. package/components/page-table/page-table.stories.jsx +56 -0
  91. package/components/page-table/page-table.tsx +88 -0
  92. package/components/preview/_preview.scss +16 -0
  93. package/components/preview/preview.stories.jsx +41 -0
  94. package/components/preview/preview.tsx +80 -0
  95. package/components/resource-card/_resource-card.scss +165 -0
  96. package/components/resource-card/resource-card.stories.jsx +100 -0
  97. package/components/resource-card/resource-card.tsx +201 -0
  98. package/components/storybook-demo/_storybook-demo.scss +57 -0
  99. package/components/storybook-demo/storybook-demo.stories.jsx +70 -0
  100. package/components/storybook-demo/storybook-demo.tsx +190 -0
  101. package/components/tabs/_tabs.scss +98 -0
  102. package/components/tabs/select.tsx +60 -0
  103. package/components/tabs/tab-list.tsx +48 -0
  104. package/components/tabs/tab.tsx +125 -0
  105. package/components/tabs/tabs.stories.jsx +54 -0
  106. package/components/tabs/tabs.tsx +78 -0
  107. package/components/title/title.stories.jsx +43 -0
  108. package/components/title/title.tsx +47 -0
  109. package/components/utils.ts +102 -0
  110. package/components/video/_video.scss +89 -0
  111. package/components/video/local-poster.jpeg +0 -0
  112. package/components/video/local-video.mp4 +0 -0
  113. package/components/video/video.stories.jsx +45 -0
  114. package/components/video/video.tsx +255 -0
  115. package/es/index.js +71714 -0
  116. package/index.ts +59 -0
  117. package/lib/index.js +71767 -0
  118. package/package.json +64 -0
  119. package/telemetry.yml +21 -0
@@ -0,0 +1,74 @@
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 { Divider } from "./divider";
21
+
22
+ export default {
23
+ title: "Components/MDX Components/Divider",
24
+ component: Divider,
25
+ argTypes: {
26
+ children: {
27
+ control: false,
28
+ },
29
+ className: {
30
+ control: false,
31
+ },
32
+ },
33
+ };
34
+
35
+ const Template = (args) => (
36
+ <>
37
+ <Divider {...args}>
38
+ <Grid>
39
+ <Column sm={4} md={2} lg={4}>
40
+ <h2>Heading</h2>
41
+ </Column>
42
+ <Column sm={4} md={6} lg={8}>
43
+ <p>
44
+ The sites first major release will help system users discover and
45
+ learn about all the assets and libraries in the system with
46
+ confidence in their completeness, who maintains them, and how to use
47
+ them. System users can access documentation for all indexed assets
48
+ and libraries without leaving the platform.
49
+ </p>
50
+ </Column>
51
+ </Grid>
52
+ </Divider>
53
+ <Divider {...args}>
54
+ <Grid>
55
+ <Column sm={4} md={2} lg={4}>
56
+ <h2>Heading</h2>
57
+ </Column>
58
+ <Column sm={4} md={6} lg={8}>
59
+ <p>
60
+ The sites first major release will help system users discover and
61
+ learn about all the assets and libraries in the system with
62
+ confidence in their completeness, who maintains them, and how to use
63
+ them. System users can access documentation for all indexed assets
64
+ and libraries without leaving the platform.
65
+ </p>
66
+ </Column>
67
+ </Grid>
68
+ </Divider>
69
+ <Divider />
70
+ </>
71
+ );
72
+
73
+ export const Default = Template.bind({});
74
+ Default.args = {};
@@ -0,0 +1,54 @@
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
+ interface DividerProps {
25
+ children: ReactNode;
26
+ className?: string | null;
27
+ }
28
+
29
+ /**
30
+ * The `<Divider>` component is a wrapper that adds a top border
31
+ * and spacing to divide sections of content. It can a also be
32
+ * used without children `<Divider />` to provide a horizontal
33
+ * rule with correct spacing.
34
+ */
35
+ export const Divider: MdxComponent<DividerProps> = ({
36
+ children,
37
+ className,
38
+ }) => {
39
+ const classNames = clsx(className, withPrefix("divider"), {
40
+ [withPrefix("divider--empty")]: children === undefined,
41
+ });
42
+ return <div className={classNames}>{children}</div>;
43
+ };
44
+
45
+ Divider.propTypes = {
46
+ /**
47
+ * Pass in the children that will be rendered within the divider
48
+ */
49
+ children: PropTypes.node as unknown as React.Validator<React.ReactNode>,
50
+ /**
51
+ * Optional class name on the divider.
52
+ */
53
+ className: PropTypes.string,
54
+ };
@@ -0,0 +1,191 @@
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/breakpoint' as breakpoint;
10
+ @use '@carbon/react/scss/type' as type;
11
+ @use '@carbon/react/scss/theme' as theme;
12
+ @use '@carbon/react/scss/utilities/convert' as convert;
13
+
14
+ @use '../utils' as *;
15
+
16
+ // Row
17
+ .#{with-prefix('do-dont-row')} {
18
+ margin-block-start: spacing.$spacing-07;
19
+ }
20
+
21
+ .#{with-prefix('do-dont-row')} [class*='grid'] {
22
+ @include breakpoint.breakpoint('md') {
23
+ margin-block-end: 0;
24
+ }
25
+ }
26
+
27
+ .#{with-prefix('do-dont-row')} [class*='markdown_paragraph-container'] {
28
+ margin-block-start: 0;
29
+ }
30
+
31
+ .#{with-prefix('do-dont')} {
32
+ // Caption and title
33
+ .#{with-prefix('caption')} {
34
+ padding: spacing.$spacing-05 0 0 0;
35
+ color: theme.$text-primary;
36
+ inline-size: 100%;
37
+
38
+ @include breakpoint.breakpoint('md') {
39
+ inline-size: 75%;
40
+ margin-block-end: 0;
41
+ }
42
+ }
43
+
44
+ .#{with-prefix('title')} {
45
+ @include type.type-style('body-compact-01');
46
+
47
+ margin: 0;
48
+ color: theme.$text-primary;
49
+ font-weight: 600;
50
+
51
+ @media (orientation: landscape) {
52
+ padding: 0 25% 0 0;
53
+ }
54
+
55
+ @include breakpoint.breakpoint('md') {
56
+ padding: 0 25% 0 0;
57
+ }
58
+ }
59
+
60
+ .#{with-prefix('description')} {
61
+ @include type.type-style('body-compact-01');
62
+
63
+ padding: 0;
64
+ margin: 0;
65
+ }
66
+
67
+ // Icons
68
+ .#{with-prefix('icon')} {
69
+ position: absolute;
70
+ z-index: 10;
71
+ display: block;
72
+ block-size: convert.rem(24px);
73
+ inline-size: convert.rem(24px);
74
+ inset-block-start: calc(1rem - 1px);
75
+ inset-inline-start: calc(1rem - 1px);
76
+ }
77
+
78
+ .#{with-prefix('icon-correct')} {
79
+ fill: theme.$support-success;
80
+ }
81
+
82
+ .#{with-prefix('icon-incorrect')} {
83
+ fill: theme.$support-error;
84
+ }
85
+
86
+ .#{with-prefix('icon')} path[dataIconPath='inner-path'],
87
+ .#{with-prefix('icon')}path[data-icon-path='inner-path'] {
88
+ fill: theme.$icon-on-color;
89
+ opacity: 1;
90
+ }
91
+
92
+ // Example
93
+ .#{with-prefix('example')} {
94
+ inline-size: 100%;
95
+ }
96
+
97
+ // Example card
98
+ .#{with-prefix('card')} {
99
+ position: relative;
100
+ background: theme.$layer-01;
101
+ color: theme.$text-primary;
102
+ inline-size: 100%;
103
+ }
104
+
105
+ .#{with-prefix('ratio1x1')} .#{with-prefix('card')} {
106
+ padding-block-start: 100%;
107
+ }
108
+
109
+ .#{with-prefix('ratio4x3')} .#{with-prefix('card')} {
110
+ padding-block-start: 75%;
111
+ }
112
+
113
+ .#{with-prefix('ratio3x4')} .#{with-prefix('card')} {
114
+ padding-block-start: 133.3333%;
115
+ }
116
+
117
+ .#{with-prefix('ratio2x1')} .#{with-prefix('card')} {
118
+ padding-block-start: 50%;
119
+ }
120
+
121
+ .#{with-prefix('ratio1x2')} .#{with-prefix('card')} {
122
+ padding-block-start: 150%;
123
+ }
124
+
125
+ .#{with-prefix('ratio9x16')} .#{with-prefix('card')} {
126
+ padding-block-start: 177.7778%;
127
+ }
128
+
129
+ .#{with-prefix('ratio16x9')} .#{with-prefix('card')} {
130
+ padding-block-start: 56.25%;
131
+ }
132
+
133
+ .#{with-prefix('card')}::before {
134
+ position: absolute;
135
+ z-index: 1;
136
+ block-size: convert.rem(3px);
137
+ content: '';
138
+ inline-size: 100%;
139
+ inset-block-start: convert.rem(-1px);
140
+ inset-inline-start: 0;
141
+ }
142
+
143
+ .#{with-prefix('correct')} .#{with-prefix('card')}::before {
144
+ background: theme.$support-success;
145
+ }
146
+
147
+ .#{with-prefix('incorrect')} .#{with-prefix('card')}::before {
148
+ background: theme.$support-error;
149
+ }
150
+
151
+ // Example content
152
+ .#{with-prefix('content')} {
153
+ font-size: 1.25rem;
154
+ font-weight: 300;
155
+ inline-size: 100%;
156
+ }
157
+
158
+ .#{with-prefix('text')} {
159
+ padding: 10%;
160
+ font-size: 1.5rem;
161
+ font-weight: 300;
162
+ line-height: 1.25;
163
+ }
164
+
165
+ .#{with-prefix('example')} .#{with-prefix('card-content')} {
166
+ position: relative;
167
+ }
168
+
169
+ .#{with-prefix('ratio')} .#{with-prefix('card-content')} {
170
+ position: absolute;
171
+ display: flex;
172
+ align-items: center;
173
+ justify-content: center;
174
+ inset-block: 0 0;
175
+ inset-inline: 0 0;
176
+ }
177
+
178
+ // Images
179
+ .#{with-prefix('content')} img {
180
+ display: block;
181
+ inline-size: 100%;
182
+ margin-block-end: 0;
183
+ }
184
+
185
+ .#{with-prefix('image')} {
186
+ display: block;
187
+ padding: 0;
188
+ margin: 0;
189
+ inline-size: 100%;
190
+ }
191
+ }
@@ -0,0 +1,51 @@
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, { ReactNode } from "react";
21
+
22
+ import { MdxComponent } from "../interfaces";
23
+ import { withPrefix } from "../utils";
24
+
25
+ interface DoDontRowProps {
26
+ children: ReactNode;
27
+ className?: string | null;
28
+ }
29
+
30
+ /**
31
+ * The `<DoDont>` component includes built in columns and is used within
32
+ * the `<DoDontRow>` component. You can provide an image or video as children,
33
+ * or text using the `text` prop.
34
+ */
35
+ export const DoDontRow: MdxComponent<DoDontRowProps> = ({
36
+ children,
37
+ className,
38
+ }) => {
39
+ return (
40
+ <Grid className={clsx(className, withPrefix("do-dont-row"))}>
41
+ {children}
42
+ </Grid>
43
+ );
44
+ };
45
+
46
+ DoDontRow.propTypes = {
47
+ /** set children */
48
+ children: PropTypes.node as unknown as React.Validator<React.ReactNode>,
49
+ /** set optional custom class */
50
+ className: PropTypes.string,
51
+ };
@@ -0,0 +1,53 @@
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 { DoDont } from "./do-dont";
19
+ import { DoDontRow } from "./do-dont-row";
20
+ import lightTheme from "./light-theme.jpg";
21
+
22
+ export default {
23
+ title: "Components/MDX Components/DoDont",
24
+ component: DoDontRow,
25
+ subcomponents: { DoDont },
26
+ argTypes: {
27
+ children: {
28
+ control: false,
29
+ },
30
+ className: {
31
+ control: false,
32
+ },
33
+ },
34
+ };
35
+
36
+ const Template = (args) => (
37
+ <DoDontRow>
38
+ <DoDont
39
+ aspectRatio="1:1"
40
+ text="DoDont example"
41
+ captionTitle="Caption title"
42
+ caption="This is a caption."
43
+ type="do"
44
+ {...args}
45
+ ></DoDont>
46
+ <DoDont aspectRatio="1:1" type="dont" {...args}>
47
+ <img alt="Use markdown in mdx files. ![](dodont.png)" src={lightTheme} />
48
+ </DoDont>
49
+ </DoDontRow>
50
+ );
51
+
52
+ export const Default = Template.bind({});
53
+ Default.args = {};
@@ -0,0 +1,161 @@
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, Theme } from "@octaviaflow/react";
18
+ import { CheckmarkFilled, Misuse } from "@octaviaflow/icons-react";
19
+ import { clsx } from "clsx";
20
+ import PropTypes from "prop-types";
21
+ import React, { ReactNode } from "react";
22
+
23
+ import { MdxComponent } from "../interfaces";
24
+ import { withPrefix } from "../utils";
25
+
26
+ interface DoDontProps {
27
+ children: ReactNode;
28
+ caption?: string | null;
29
+ captionTitle?: string | null;
30
+ text?: string | null;
31
+ aspectRatio?: string | null;
32
+ color?: string | null;
33
+ type: "do" | "dont";
34
+ className?: string | null;
35
+ colLg?: number | null;
36
+ colMd?: number | null;
37
+ }
38
+
39
+ /**
40
+ * The `<DoDont>` component includes built in columns and is used within
41
+ * the `<DoDontRow>` component. You can provide an image or video as children,
42
+ * or text using the `text` prop.
43
+ */
44
+ export const DoDont: MdxComponent<DoDontProps> = ({
45
+ children,
46
+ caption,
47
+ captionTitle,
48
+ text,
49
+ aspectRatio,
50
+ color,
51
+ type,
52
+ className,
53
+ colLg,
54
+ colMd,
55
+ }) => {
56
+ const iconClassNames = clsx(withPrefix("icon"), {
57
+ [withPrefix("icon-correct")]: type === "do",
58
+ [withPrefix("icon-incorrect")]: type === "dont",
59
+ });
60
+
61
+ const aspectRatios = ["1:1", "2:1", "1:2", "4:3", "3:4", "9:16", "16:9"];
62
+
63
+ const wrapperClassNames = clsx(className, withPrefix("example"), {
64
+ [withPrefix("correct")]: type === "do",
65
+ [withPrefix("incorrect")]: type === "dont",
66
+ [withPrefix("ratio")]: aspectRatio && aspectRatios.includes(aspectRatio),
67
+ [withPrefix("ratio1x1")]: aspectRatio === "1:1",
68
+ [withPrefix("ratio2x1")]: aspectRatio === "2:1",
69
+ [withPrefix("ratio1x2")]: aspectRatio === "1:2",
70
+ [withPrefix("ratio4x3")]: aspectRatio === "4:3",
71
+ [withPrefix("ratio3x4")]: aspectRatio === "3:4",
72
+ [withPrefix("ratio9x16")]: aspectRatio === "9:16",
73
+ [withPrefix("ratio16x9")]: aspectRatio === "16:9",
74
+ });
75
+
76
+ let colLarge = 4;
77
+ if (colLg) colLarge = Number(colLg);
78
+
79
+ let colMedium = 4;
80
+ if (colMd) colMedium = Number(colMd);
81
+
82
+ const renderCaption = (
83
+ caption?: string | null,
84
+ captionTitle?: string | null,
85
+ ) => {
86
+ if (caption || captionTitle) {
87
+ return (
88
+ <div className={withPrefix("caption")}>
89
+ {captionTitle && (
90
+ <p className={withPrefix("title")}>{captionTitle}</p>
91
+ )}
92
+ {caption && <p className={withPrefix("description")}>{caption}</p>}
93
+ </div>
94
+ );
95
+ }
96
+ return null;
97
+ };
98
+
99
+ return (
100
+ <Column sm={4} md={colMedium} lg={colLarge}>
101
+ <Theme theme={color === "dark" ? "g100" : undefined}>
102
+ <div className={withPrefix("do-dont")}>
103
+ <div className={wrapperClassNames}>
104
+ <div className={withPrefix("card")}>
105
+ <div className={withPrefix("card-content")}>
106
+ {type === "do" && (
107
+ <CheckmarkFilled size={24} className={iconClassNames} />
108
+ )}
109
+ {type !== "do" && (
110
+ <Misuse size={24} className={iconClassNames} />
111
+ )}
112
+ <div className={withPrefix("content")}>
113
+ {children}
114
+ {text ? <p className={withPrefix("text")}>{text}</p> : null}
115
+ </div>
116
+ </div>
117
+ </div>
118
+ {renderCaption(caption, captionTitle)}
119
+ </div>
120
+ </div>
121
+ </Theme>
122
+ </Column>
123
+ );
124
+ };
125
+
126
+ DoDont.defaultProps = {
127
+ colLg: 4,
128
+ colMd: 4,
129
+ color: "light",
130
+ };
131
+
132
+ DoDont.propTypes = {
133
+ /** Set the aspect ratio */
134
+ aspectRatio: PropTypes.oneOf([
135
+ "2:1",
136
+ "1:1",
137
+ "1:2",
138
+ "16:9",
139
+ "9:16",
140
+ "4:3",
141
+ "3:4",
142
+ ]),
143
+ /** caption (optional) */
144
+ caption: PropTypes.string,
145
+ /** title for the card caption (optional) */
146
+ captionTitle: PropTypes.string,
147
+ /** Provide the contents of the DoDont, can be an image or video */
148
+ children: PropTypes.node as unknown as React.Validator<React.ReactNode>,
149
+ /** set optional custom class */
150
+ className: PropTypes.string,
151
+ /** set how many columns wide at large breakpoint */
152
+ colLg: PropTypes.number,
153
+ /** set how many columns wide at medium breakpoint */
154
+ colMd: PropTypes.number,
155
+ /** set to "dark" for dark background card */
156
+ color: PropTypes.oneOf(["light", "dark"]),
157
+ /** text displayed in the example card */
158
+ text: PropTypes.string,
159
+ /** set card type */
160
+ type: PropTypes.oneOf<DoDontProps["type"]>(["do", "dont"]).isRequired,
161
+ };
@@ -0,0 +1,64 @@
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/theme' as theme;
9
+ @use '@carbon/react/scss/spacing' as spacing;
10
+
11
+ @use '../utils' as *;
12
+
13
+ .#{with-prefix('gif-player-container')} {
14
+ position: relative;
15
+
16
+ .#{with-prefix('controls')} {
17
+ position: absolute;
18
+ padding: 0;
19
+ border: none;
20
+ background: transparent;
21
+ block-size: 1.5rem;
22
+ inline-size: 1.5rem;
23
+ inset-block-end: spacing.$spacing-05;
24
+ inset-inline-start: spacing.$spacing-05;
25
+ outline: none;
26
+ }
27
+
28
+ .#{with-prefix('controls')} svg {
29
+ fill: theme.$icon-inverse;
30
+ }
31
+
32
+ .#{with-prefix('dark')} svg {
33
+ fill: theme.$icon-primary;
34
+ }
35
+
36
+ .#{with-prefix('controls')}:focus svg {
37
+ outline: 2px solid theme.$focus;
38
+ outline-offset: -2px;
39
+ }
40
+
41
+ //toggle static image
42
+ .#{with-prefix('img-hidden')} {
43
+ display: none;
44
+ }
45
+
46
+ .#{with-prefix('img-displayed')} {
47
+ display: block;
48
+ }
49
+
50
+ //toggle gif
51
+ .#{with-prefix('gif-displayed')} {
52
+ display: block;
53
+ }
54
+
55
+ .#{with-prefix('gif-hidden')} {
56
+ display: none;
57
+ }
58
+
59
+ //styles for gif player in image gallery
60
+ &.#{with-prefix('gif-in-dialog')} {
61
+ inset-block-start: 50%;
62
+ transform: translateY(-50%);
63
+ }
64
+ }
Binary file
Binary file
@@ -0,0 +1,45 @@
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 { GifPlayer } from "./gif-player";
19
+ import cloudGif from "./cloud.gif";
20
+ import cloudJpg from "./cloud.jpg";
21
+
22
+ const stories = {
23
+ title: "Components/MDX Components/Images & Video/GifPlayer",
24
+ component: GifPlayer,
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
+ <GifPlayer {...args}>
39
+ <img alt="animated" src={cloudGif} />
40
+ <img alt="static" src={cloudJpg} />
41
+ </GifPlayer>
42
+ );
43
+
44
+ export const Default = Template.bind({});
45
+ Default.args = {};