@mittwald/flow-react-components 0.2.0-alpha.859 → 0.2.0-alpha.860
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/CHANGELOG.md +6 -0
- package/dist/assets/doc-properties.json +2064 -2044
- package/dist/js/packages/components/src/components/Markdown/Markdown.mjs +7 -2
- package/dist/js/packages/components/src/components/Markdown/Markdown.mjs.map +1 -1
- package/dist/types/components/Markdown/Markdown.d.ts +7 -2
- package/dist/types/components/Markdown/Markdown.d.ts.map +1 -1
- package/dist/types/components/Markdown/stories/Default.stories.d.ts +1 -0
- package/dist/types/components/Markdown/stories/Default.stories.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -21,10 +21,11 @@ const Markdown = (props) => {
|
|
|
21
21
|
color = "default",
|
|
22
22
|
className,
|
|
23
23
|
headingOffset = 0,
|
|
24
|
+
components: customComponents,
|
|
24
25
|
ref,
|
|
25
26
|
...rest
|
|
26
27
|
} = props;
|
|
27
|
-
const
|
|
28
|
+
const defaultComponents = {
|
|
28
29
|
a: (props2) => /* @__PURE__ */ jsx(Link, { target: "_blank", color, href: props2.href, children: props2.children }),
|
|
29
30
|
p: (props2) => /* @__PURE__ */ jsx(Text, { elementType: "p", color, children: props2.children }),
|
|
30
31
|
code: (props2) => /* @__PURE__ */ jsx(InlineCode, { color, children: props2.children }),
|
|
@@ -98,7 +99,11 @@ const Markdown = (props) => {
|
|
|
98
99
|
blockquote: (props2) => /* @__PURE__ */ jsx(Text, { color, children: /* @__PURE__ */ jsx("blockquote", { children: props2.children }) })
|
|
99
100
|
};
|
|
100
101
|
const textContent = extractTextFromFirstChild(children);
|
|
101
|
-
|
|
102
|
+
const mergedComponents = {
|
|
103
|
+
...defaultComponents,
|
|
104
|
+
...customComponents
|
|
105
|
+
};
|
|
106
|
+
return /* @__PURE__ */ jsx("div", { className: clsx(styles.markdown, className), ...rest, ref, children: /* @__PURE__ */ jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], components: mergedComponents, children: textContent }) });
|
|
102
107
|
};
|
|
103
108
|
|
|
104
109
|
export { Markdown };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Markdown.mjs","sources":["../../../../../../../src/components/Markdown/Markdown.tsx"],"sourcesContent":["import { CodeBlock } from \"@/components/CodeBlock\";\nimport { Heading } from \"@/components/Heading\";\nimport { InlineCode } from \"@/components/InlineCode\";\nimport { Link } from \"@/components/Link\";\nimport { Separator } from \"@/components/Separator\";\nimport { Text } from \"@/components/Text\";\nimport type { CSSProperties, FC, ReactNode, Ref } from \"react\";\nimport { Children, isValidElement } from \"react\";\nimport type { Components, Options } from \"react-markdown\";\nimport ReactMarkdown from \"react-markdown\";\nimport styles from \"./Markdown.module.scss\";\nimport { extractTextFromFirstChild } from \"@/lib/react/remote\";\nimport type { AlphaColor, PropsWithClassName } from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport remarkGfm from \"remark-gfm\";\nimport { getHeadingLevelWithOffset } from \"@/components/Markdown/lib/getHeadingLevelWithOffset\";\nimport type { CodeEditorLanguage } from \"@/components/CodeEditor/languages\";\n\nexport interface MarkdownProps\n extends PropsWithClassName, Omit<Options, \"components\"> {\n /** The color schema of the markdown component. @default \"default\" */\n color?: \"default\" | AlphaColor;\n /** Shifts all heading levels by the given offset. @default 0 */\n headingOffset?: number;\n /** @internal */\n style?: CSSProperties;\n ref?: Ref<HTMLDivElement>;\n}\n\n
|
|
1
|
+
{"version":3,"file":"Markdown.mjs","sources":["../../../../../../../src/components/Markdown/Markdown.tsx"],"sourcesContent":["import { CodeBlock } from \"@/components/CodeBlock\";\nimport { Heading } from \"@/components/Heading\";\nimport { InlineCode } from \"@/components/InlineCode\";\nimport { Link } from \"@/components/Link\";\nimport { Separator } from \"@/components/Separator\";\nimport { Text } from \"@/components/Text\";\nimport type { CSSProperties, FC, ReactNode, Ref } from \"react\";\nimport { Children, isValidElement } from \"react\";\nimport type { Components, Options } from \"react-markdown\";\nimport ReactMarkdown from \"react-markdown\";\nimport styles from \"./Markdown.module.scss\";\nimport { extractTextFromFirstChild } from \"@/lib/react/remote\";\nimport type { AlphaColor, PropsWithClassName } from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport remarkGfm from \"remark-gfm\";\nimport { getHeadingLevelWithOffset } from \"@/components/Markdown/lib/getHeadingLevelWithOffset\";\nimport type { CodeEditorLanguage } from \"@/components/CodeEditor/languages\";\n\nexport interface MarkdownProps\n extends PropsWithClassName, Omit<Options, \"components\"> {\n /** The color schema of the markdown component. @default \"default\" */\n color?: \"default\" | AlphaColor;\n /** Shifts all heading levels by the given offset. @default 0 */\n headingOffset?: number;\n /** Allows overriding markdown element renderers from outside. */\n components?: Components;\n /** @internal */\n style?: CSSProperties;\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * @flr-generate all\n * @flr-ignore-props components\n */\nexport const Markdown: FC<MarkdownProps> = (props) => {\n const {\n children,\n color = \"default\",\n className,\n headingOffset = 0,\n components: customComponents,\n ref,\n ...rest\n } = props;\n\n const defaultComponents: Components = {\n a: (props) => (\n <Link target=\"_blank\" color={color} href={props.href}>\n {props.children}\n </Link>\n ),\n p: (props) => (\n <Text elementType=\"p\" color={color}>\n {props.children}\n </Text>\n ),\n code: (props) => <InlineCode color={color}>{props.children}</InlineCode>,\n h1: (props) => (\n <Heading\n level={getHeadingLevelWithOffset(1, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n h2: (props) => (\n <Heading\n level={getHeadingLevelWithOffset(2, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n h3: (props) => (\n <Heading\n level={getHeadingLevelWithOffset(3, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n h4: (props) => (\n <Heading\n level={getHeadingLevelWithOffset(4, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n h5: (props) => (\n <Heading\n level={getHeadingLevelWithOffset(5, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n h6: (props) => (\n <Heading\n level={getHeadingLevelWithOffset(6, headingOffset)}\n color={color}\n >\n {props.children}\n </Heading>\n ),\n hr: () => <Separator />,\n pre: (props) => {\n const preElementContent = Children.toArray(props.children)[0];\n\n return (\n <CodeBlock\n copyable={false}\n language={\n isValidElement<{ className?: string }>(preElementContent) &&\n preElementContent.props.className\n ? (preElementContent.props.className.replace(\n \"language-\",\n \"\",\n ) as CodeEditorLanguage)\n : undefined\n }\n code={String(\n isValidElement<{ children: string }>(preElementContent)\n ? preElementContent.props.children\n : preElementContent,\n ).trim()}\n />\n );\n },\n ul: (props) => (\n <Text color={color}>\n <ul>{props.children as ReactNode}</ul>\n </Text>\n ),\n ol: (props) => (\n <Text color={color}>\n <ol>{props.children as ReactNode}</ol>\n </Text>\n ),\n blockquote: (props) => (\n <Text color={color}>\n <blockquote>{props.children}</blockquote>\n </Text>\n ),\n };\n\n const textContent = extractTextFromFirstChild(children);\n const mergedComponents: Components = {\n ...defaultComponents,\n ...customComponents,\n };\n\n return (\n <div className={clsx(styles.markdown, className)} {...rest} ref={ref}>\n <ReactMarkdown remarkPlugins={[remarkGfm]} components={mergedComponents}>\n {textContent}\n </ReactMarkdown>\n </div>\n );\n};\n\nexport default Markdown;\n"],"names":["props"],"mappings":";;;;;;;;;;;;;;;AAmCO,MAAM,QAAA,GAA8B,CAAC,KAAA,KAAU;AACpD,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,KAAA,GAAQ,SAAA;AAAA,IACR,SAAA;AAAA,IACA,aAAA,GAAgB,CAAA;AAAA,IAChB,UAAA,EAAY,gBAAA;AAAA,IACZ,GAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,iBAAA,GAAgC;AAAA,IACpC,CAAA,EAAG,CAACA,MAAAA,qBACF,GAAA,CAAC,IAAA,EAAA,EAAK,MAAA,EAAO,QAAA,EAAS,KAAA,EAAc,IAAA,EAAMA,MAAAA,CAAM,IAAA,EA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AAC,IAAA,EAAA,EAAI,QAAA,EAAAA,MAAAA,CAAM,QAAA,EAAsB,CAAA,EACnC,CAAA;AAAA,IAEF,UAAA,EAAY,CAACA,MAAAA,qBACX,GAAA,CAAC,IAAA,EAAA,EAAK,KAAA,EACJ,QAAA,kBAAA,GAAA,CAAC,YAAA,EAAA,EAAY,QAAA,EAAAA,MAAAA,CAAM,QAAA,EAAS,CAAA,EAC9B;AAAA,GAEJ;AAEA,EAAA,MAAM,WAAA,GAAc,0BAA0B,QAAQ,CAAA;AACtD,EAAA,MAAM,gBAAA,GAA+B;AAAA,IACnC,GAAG,iBAAA;AAAA,IACH,GAAG;AAAA,GACL;AAEA,EAAA,uBACE,GAAA,CAAC,SAAI,SAAA,EAAW,IAAA,CAAK,OAAO,QAAA,EAAU,SAAS,GAAI,GAAG,IAAA,EAAM,KAC1D,QAAA,kBAAA,GAAA,CAAC,aAAA,EAAA,EAAc,eAAe,CAAC,SAAS,GAAG,UAAA,EAAY,gBAAA,EACpD,uBACH,CAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { FC, Ref } from 'react';
|
|
2
|
-
import { Options } from 'react-markdown';
|
|
2
|
+
import { Components, Options } from 'react-markdown';
|
|
3
3
|
import { AlphaColor, PropsWithClassName } from '../../lib/types/props';
|
|
4
4
|
export interface MarkdownProps extends PropsWithClassName, Omit<Options, "components"> {
|
|
5
5
|
/** The color schema of the markdown component. @default "default" */
|
|
6
6
|
color?: "default" | AlphaColor;
|
|
7
7
|
/** Shifts all heading levels by the given offset. @default 0 */
|
|
8
8
|
headingOffset?: number;
|
|
9
|
+
/** Allows overriding markdown element renderers from outside. */
|
|
10
|
+
components?: Components;
|
|
9
11
|
ref?: Ref<HTMLDivElement>;
|
|
10
12
|
}
|
|
11
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* @flr-generate all
|
|
15
|
+
* @flr-ignore-props components
|
|
16
|
+
*/
|
|
12
17
|
export declare const Markdown: FC<MarkdownProps>;
|
|
13
18
|
export default Markdown;
|
|
14
19
|
//# sourceMappingURL=Markdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Markdown/Markdown.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAiB,EAAE,EAAa,GAAG,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Markdown/Markdown.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAiB,EAAE,EAAa,GAAG,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAI1D,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAMxE,MAAM,WAAW,aACf,SAAQ,kBAAkB,EAAE,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC;IACvD,qEAAqE;IACrE,KAAK,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAC/B,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,UAAU,CAAC,EAAE,UAAU,CAAC;IAGxB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CA6HtC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Default.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Markdown/stories/Default.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAkC/B,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEvC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"Default.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Markdown/stories/Default.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAkC/B,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEvC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,gBAAgB,EAAE,KAoB9B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-react-components",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.860",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React implementation of Flow, mittwald’s design system",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"@internationalized/string": "^3.2.7",
|
|
64
64
|
"@internationalized/string-compiler": "^3.3.0",
|
|
65
65
|
"@lezer/highlight": "^1.2.3",
|
|
66
|
-
"@mittwald/flow-icons": "0.2.0-alpha.
|
|
66
|
+
"@mittwald/flow-icons": "0.2.0-alpha.860",
|
|
67
67
|
"@mittwald/password-tools-js": "3.0.0-alpha.30",
|
|
68
|
-
"@mittwald/react-tunnel": "0.2.0-alpha.
|
|
68
|
+
"@mittwald/react-tunnel": "0.2.0-alpha.860",
|
|
69
69
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
70
70
|
"@react-aria/form": "^3.1.5",
|
|
71
71
|
"@react-aria/i18n": "^3.12.16",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"@lezer/generator": "^1.8.0",
|
|
120
120
|
"@lezer/lr": "^1.4.8",
|
|
121
121
|
"@mittwald/flow-core": "",
|
|
122
|
-
"@mittwald/flow-design-tokens": "0.2.0-alpha.
|
|
122
|
+
"@mittwald/flow-design-tokens": "0.2.0-alpha.860",
|
|
123
123
|
"@mittwald/flow-icons-base": "",
|
|
124
124
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
125
125
|
"@mittwald/remote-dom-react": "1.2.2-mittwald.10",
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
},
|
|
175
175
|
"peerDependencies": {
|
|
176
176
|
"@internationalized/date": "^3.12.2",
|
|
177
|
-
"@mittwald/flow-icons-pro": "0.2.0-alpha.
|
|
177
|
+
"@mittwald/flow-icons-pro": "0.2.0-alpha.859",
|
|
178
178
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
179
179
|
"next": "^16.2.3",
|
|
180
180
|
"react": "^19.2.0",
|
|
@@ -195,5 +195,5 @@
|
|
|
195
195
|
"optional": true
|
|
196
196
|
}
|
|
197
197
|
},
|
|
198
|
-
"gitHead": "
|
|
198
|
+
"gitHead": "7cb427877f2fd133089045b3ebc5edde04e452af"
|
|
199
199
|
}
|