@docusaurus/theme-classic 0.0.0-5284 → 0.0.0-5294
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/lib/getSwizzleConfig.js +127 -1
- package/lib/theme/Admonition/Icon/Caution.d.ts +9 -0
- package/lib/theme/Admonition/Icon/Caution.js +17 -0
- package/lib/theme/Admonition/Icon/Danger.d.ts +9 -0
- package/lib/theme/Admonition/Icon/Danger.js +17 -0
- package/lib/theme/Admonition/Icon/Info.d.ts +9 -0
- package/lib/theme/Admonition/Icon/Info.js +17 -0
- package/lib/theme/Admonition/Icon/Note.d.ts +9 -0
- package/lib/theme/Admonition/Icon/Note.js +17 -0
- package/lib/theme/Admonition/Icon/Tip.d.ts +9 -0
- package/lib/theme/Admonition/Icon/Tip.js +17 -0
- package/lib/theme/Admonition/Layout/index.d.ts +9 -0
- package/lib/theme/Admonition/Layout/index.js +43 -0
- package/lib/theme/Admonition/{styles.module.css → Layout/styles.module.css} +0 -0
- package/lib/theme/Admonition/Type/Caution.d.ts +9 -0
- package/lib/theme/Admonition/Type/Caution.js +32 -0
- package/lib/theme/Admonition/Type/Danger.d.ts +9 -0
- package/lib/theme/Admonition/Type/Danger.js +32 -0
- package/lib/theme/Admonition/Type/Info.d.ts +9 -0
- package/lib/theme/Admonition/Type/Info.js +32 -0
- package/lib/theme/Admonition/Type/Note.d.ts +9 -0
- package/lib/theme/Admonition/Type/Note.js +32 -0
- package/lib/theme/Admonition/Type/Tip.d.ts +9 -0
- package/lib/theme/Admonition/Type/Tip.js +32 -0
- package/lib/theme/Admonition/Types.d.ts +12 -0
- package/lib/theme/Admonition/Types.js +33 -0
- package/lib/theme/Admonition/index.d.ts +1 -1
- package/lib/theme/Admonition/index.js +12 -171
- package/package.json +14 -14
- package/src/getSwizzleConfig.ts +138 -1
- package/src/theme/Admonition/Icon/Caution.tsx +20 -0
- package/src/theme/Admonition/Icon/Danger.tsx +20 -0
- package/src/theme/Admonition/Icon/Info.tsx +20 -0
- package/src/theme/Admonition/Icon/Note.tsx +20 -0
- package/src/theme/Admonition/Icon/Tip.tsx +20 -0
- package/src/theme/Admonition/Layout/index.tsx +55 -0
- package/src/theme/Admonition/{styles.module.css → Layout/styles.module.css} +0 -0
- package/src/theme/Admonition/Type/Caution.tsx +37 -0
- package/src/theme/Admonition/Type/Danger.tsx +37 -0
- package/src/theme/Admonition/Type/Info.tsx +37 -0
- package/src/theme/Admonition/Type/Note.tsx +37 -0
- package/src/theme/Admonition/Type/Tip.tsx +37 -0
- package/src/theme/Admonition/Types.tsx +38 -0
- package/src/theme/Admonition/index.tsx +13 -194
- package/src/theme-classic.d.ts +102 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import Translate from '@docusaurus/Translate';
|
|
11
|
+
import type {Props} from '@theme/Admonition/Type/Info';
|
|
12
|
+
import AdmonitionLayout from '@theme/Admonition/Layout';
|
|
13
|
+
import IconInfo from '@theme/Admonition/Icon/Info';
|
|
14
|
+
|
|
15
|
+
const infimaClassName = 'alert alert--info';
|
|
16
|
+
|
|
17
|
+
const defaultProps = {
|
|
18
|
+
icon: <IconInfo />,
|
|
19
|
+
title: (
|
|
20
|
+
<Translate
|
|
21
|
+
id="theme.admonition.info"
|
|
22
|
+
description="The default label used for the Info admonition (:::info)">
|
|
23
|
+
info
|
|
24
|
+
</Translate>
|
|
25
|
+
),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default function AdmonitionTypeInfo(props: Props): JSX.Element {
|
|
29
|
+
return (
|
|
30
|
+
<AdmonitionLayout
|
|
31
|
+
{...defaultProps}
|
|
32
|
+
{...props}
|
|
33
|
+
className={clsx(infimaClassName, props.className)}>
|
|
34
|
+
{props.children}
|
|
35
|
+
</AdmonitionLayout>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import Translate from '@docusaurus/Translate';
|
|
11
|
+
import type {Props} from '@theme/Admonition/Type/Note';
|
|
12
|
+
import AdmonitionLayout from '@theme/Admonition/Layout';
|
|
13
|
+
import IconNote from '@theme/Admonition/Icon/Note';
|
|
14
|
+
|
|
15
|
+
const infimaClassName = 'alert alert--secondary';
|
|
16
|
+
|
|
17
|
+
const defaultProps = {
|
|
18
|
+
icon: <IconNote />,
|
|
19
|
+
title: (
|
|
20
|
+
<Translate
|
|
21
|
+
id="theme.admonition.note"
|
|
22
|
+
description="The default label used for the Note admonition (:::note)">
|
|
23
|
+
note
|
|
24
|
+
</Translate>
|
|
25
|
+
),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default function AdmonitionTypeNote(props: Props): JSX.Element {
|
|
29
|
+
return (
|
|
30
|
+
<AdmonitionLayout
|
|
31
|
+
{...defaultProps}
|
|
32
|
+
{...props}
|
|
33
|
+
className={clsx(infimaClassName, props.className)}>
|
|
34
|
+
{props.children}
|
|
35
|
+
</AdmonitionLayout>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import Translate from '@docusaurus/Translate';
|
|
11
|
+
import type {Props} from '@theme/Admonition/Type/Tip';
|
|
12
|
+
import AdmonitionLayout from '@theme/Admonition/Layout';
|
|
13
|
+
import IconTip from '@theme/Admonition/Icon/Tip';
|
|
14
|
+
|
|
15
|
+
const infimaClassName = 'alert alert--success';
|
|
16
|
+
|
|
17
|
+
const defaultProps = {
|
|
18
|
+
icon: <IconTip />,
|
|
19
|
+
title: (
|
|
20
|
+
<Translate
|
|
21
|
+
id="theme.admonition.tip"
|
|
22
|
+
description="The default label used for the Tip admonition (:::tip)">
|
|
23
|
+
tip
|
|
24
|
+
</Translate>
|
|
25
|
+
),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default function AdmonitionTypeTip(props: Props): JSX.Element {
|
|
29
|
+
return (
|
|
30
|
+
<AdmonitionLayout
|
|
31
|
+
{...defaultProps}
|
|
32
|
+
{...props}
|
|
33
|
+
className={clsx(infimaClassName, props.className)}>
|
|
34
|
+
{props.children}
|
|
35
|
+
</AdmonitionLayout>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import AdmonitionTypeNote from '@theme/Admonition/Type/Note';
|
|
10
|
+
import AdmonitionTypeTip from '@theme/Admonition/Type/Tip';
|
|
11
|
+
import AdmonitionTypeInfo from '@theme/Admonition/Type/Info';
|
|
12
|
+
import AdmonitionTypeCaution from '@theme/Admonition/Type/Caution';
|
|
13
|
+
import AdmonitionTypeDanger from '@theme/Admonition/Type/Danger';
|
|
14
|
+
import type AdmonitionTypes from '@theme/Admonition/Types';
|
|
15
|
+
|
|
16
|
+
const admonitionTypes: typeof AdmonitionTypes = {
|
|
17
|
+
note: AdmonitionTypeNote,
|
|
18
|
+
tip: AdmonitionTypeTip,
|
|
19
|
+
info: AdmonitionTypeInfo,
|
|
20
|
+
caution: AdmonitionTypeCaution,
|
|
21
|
+
danger: AdmonitionTypeDanger,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// Undocumented legacy admonition type aliases
|
|
25
|
+
// Provide hardcoded/untranslated retrocompatible label
|
|
26
|
+
// See also https://github.com/facebook/docusaurus/issues/7767
|
|
27
|
+
const admonitionAliases: typeof AdmonitionTypes = {
|
|
28
|
+
secondary: (props) => <AdmonitionTypeNote title="secondary" {...props} />,
|
|
29
|
+
important: (props) => <AdmonitionTypeInfo title="important" {...props} />,
|
|
30
|
+
success: (props) => <AdmonitionTypeTip title="success" {...props} />,
|
|
31
|
+
// TODO bad legacy mapping, warning is usually yellow, not red...
|
|
32
|
+
warning: (props) => <AdmonitionTypeDanger title="warning" {...props} />,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
...admonitionTypes,
|
|
37
|
+
...admonitionAliases,
|
|
38
|
+
};
|
|
@@ -5,205 +5,24 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import React, {type
|
|
9
|
-
import
|
|
10
|
-
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
11
|
-
import Translate from '@docusaurus/Translate';
|
|
8
|
+
import React, {type ComponentType} from 'react';
|
|
9
|
+
import {processAdmonitionProps} from '@docusaurus/theme-common';
|
|
12
10
|
import type {Props} from '@theme/Admonition';
|
|
11
|
+
import AdmonitionTypes from '@theme/Admonition/Types';
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<svg viewBox="0 0 14 16">
|
|
19
|
-
<path
|
|
20
|
-
fillRule="evenodd"
|
|
21
|
-
d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"
|
|
22
|
-
/>
|
|
23
|
-
</svg>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function TipIcon() {
|
|
28
|
-
return (
|
|
29
|
-
<svg viewBox="0 0 12 16">
|
|
30
|
-
<path
|
|
31
|
-
fillRule="evenodd"
|
|
32
|
-
d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"
|
|
33
|
-
/>
|
|
34
|
-
</svg>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function DangerIcon() {
|
|
39
|
-
return (
|
|
40
|
-
<svg viewBox="0 0 12 16">
|
|
41
|
-
<path
|
|
42
|
-
fillRule="evenodd"
|
|
43
|
-
d="M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"
|
|
44
|
-
/>
|
|
45
|
-
</svg>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function InfoIcon() {
|
|
50
|
-
return (
|
|
51
|
-
<svg viewBox="0 0 14 16">
|
|
52
|
-
<path
|
|
53
|
-
fillRule="evenodd"
|
|
54
|
-
d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"
|
|
55
|
-
/>
|
|
56
|
-
</svg>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function CautionIcon() {
|
|
61
|
-
return (
|
|
62
|
-
<svg viewBox="0 0 16 16">
|
|
63
|
-
<path
|
|
64
|
-
fillRule="evenodd"
|
|
65
|
-
d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"
|
|
66
|
-
/>
|
|
67
|
-
</svg>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
type AdmonitionConfig = {
|
|
72
|
-
iconComponent: React.ComponentType;
|
|
73
|
-
infimaClassName: string;
|
|
74
|
-
label: ReactNode;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
|
|
78
|
-
const AdmonitionConfigs: Record<Props['type'], AdmonitionConfig> = {
|
|
79
|
-
note: {
|
|
80
|
-
infimaClassName: 'secondary',
|
|
81
|
-
iconComponent: NoteIcon,
|
|
82
|
-
label: (
|
|
83
|
-
<Translate
|
|
84
|
-
id="theme.admonition.note"
|
|
85
|
-
description="The default label used for the Note admonition (:::note)">
|
|
86
|
-
note
|
|
87
|
-
</Translate>
|
|
88
|
-
),
|
|
89
|
-
},
|
|
90
|
-
tip: {
|
|
91
|
-
infimaClassName: 'success',
|
|
92
|
-
iconComponent: TipIcon,
|
|
93
|
-
label: (
|
|
94
|
-
<Translate
|
|
95
|
-
id="theme.admonition.tip"
|
|
96
|
-
description="The default label used for the Tip admonition (:::tip)">
|
|
97
|
-
tip
|
|
98
|
-
</Translate>
|
|
99
|
-
),
|
|
100
|
-
},
|
|
101
|
-
danger: {
|
|
102
|
-
infimaClassName: 'danger',
|
|
103
|
-
iconComponent: DangerIcon,
|
|
104
|
-
label: (
|
|
105
|
-
<Translate
|
|
106
|
-
id="theme.admonition.danger"
|
|
107
|
-
description="The default label used for the Danger admonition (:::danger)">
|
|
108
|
-
danger
|
|
109
|
-
</Translate>
|
|
110
|
-
),
|
|
111
|
-
},
|
|
112
|
-
info: {
|
|
113
|
-
infimaClassName: 'info',
|
|
114
|
-
iconComponent: InfoIcon,
|
|
115
|
-
label: (
|
|
116
|
-
<Translate
|
|
117
|
-
id="theme.admonition.info"
|
|
118
|
-
description="The default label used for the Info admonition (:::info)">
|
|
119
|
-
info
|
|
120
|
-
</Translate>
|
|
121
|
-
),
|
|
122
|
-
},
|
|
123
|
-
caution: {
|
|
124
|
-
infimaClassName: 'warning',
|
|
125
|
-
iconComponent: CautionIcon,
|
|
126
|
-
label: (
|
|
127
|
-
<Translate
|
|
128
|
-
id="theme.admonition.caution"
|
|
129
|
-
description="The default label used for the Caution admonition (:::caution)">
|
|
130
|
-
caution
|
|
131
|
-
</Translate>
|
|
132
|
-
),
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
// Legacy aliases, undocumented but kept for retro-compatibility
|
|
137
|
-
const aliases = {
|
|
138
|
-
secondary: 'note',
|
|
139
|
-
important: 'info',
|
|
140
|
-
success: 'tip',
|
|
141
|
-
warning: 'danger',
|
|
142
|
-
} as const;
|
|
143
|
-
|
|
144
|
-
function getAdmonitionConfig(unsafeType: string): AdmonitionConfig {
|
|
145
|
-
const type =
|
|
146
|
-
(aliases as {[key: string]: Props['type']})[unsafeType] ?? unsafeType;
|
|
147
|
-
const config = (AdmonitionConfigs as {[key: string]: AdmonitionConfig})[type];
|
|
148
|
-
if (config) {
|
|
149
|
-
return config;
|
|
13
|
+
function getAdmonitionTypeComponent(type: string): ComponentType<Props> {
|
|
14
|
+
const component = AdmonitionTypes[type];
|
|
15
|
+
if (component) {
|
|
16
|
+
return component;
|
|
150
17
|
}
|
|
151
18
|
console.warn(
|
|
152
|
-
`No admonition
|
|
19
|
+
`No admonition component found for admonition type "${type}". Using Info as fallback.`,
|
|
153
20
|
);
|
|
154
|
-
return
|
|
21
|
+
return AdmonitionTypes.info!;
|
|
155
22
|
}
|
|
156
23
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
rest: ReactNode;
|
|
162
|
-
} {
|
|
163
|
-
const items = React.Children.toArray(children);
|
|
164
|
-
const mdxAdmonitionTitle = items.find(
|
|
165
|
-
(item) =>
|
|
166
|
-
React.isValidElement(item) &&
|
|
167
|
-
(item.props as {mdxType: string} | null)?.mdxType ===
|
|
168
|
-
'mdxAdmonitionTitle',
|
|
169
|
-
);
|
|
170
|
-
const rest = <>{items.filter((item) => item !== mdxAdmonitionTitle)}</>;
|
|
171
|
-
return {
|
|
172
|
-
mdxAdmonitionTitle,
|
|
173
|
-
rest,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function processAdmonitionProps(props: Props): Props {
|
|
178
|
-
const {mdxAdmonitionTitle, rest} = extractMDXAdmonitionTitle(props.children);
|
|
179
|
-
return {
|
|
180
|
-
...props,
|
|
181
|
-
title: props.title ?? mdxAdmonitionTitle,
|
|
182
|
-
children: rest,
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export default function Admonition(props: Props): JSX.Element {
|
|
187
|
-
const {children, type, title, icon: iconProp} = processAdmonitionProps(props);
|
|
188
|
-
|
|
189
|
-
const typeConfig = getAdmonitionConfig(type);
|
|
190
|
-
const titleLabel = title ?? typeConfig.label;
|
|
191
|
-
const {iconComponent: IconComponent} = typeConfig;
|
|
192
|
-
const icon = iconProp ?? <IconComponent />;
|
|
193
|
-
return (
|
|
194
|
-
<div
|
|
195
|
-
className={clsx(
|
|
196
|
-
ThemeClassNames.common.admonition,
|
|
197
|
-
ThemeClassNames.common.admonitionType(props.type),
|
|
198
|
-
'alert',
|
|
199
|
-
`alert--${typeConfig.infimaClassName}`,
|
|
200
|
-
styles.admonition,
|
|
201
|
-
)}>
|
|
202
|
-
<div className={styles.admonitionHeading}>
|
|
203
|
-
<span className={styles.admonitionIcon}>{icon}</span>
|
|
204
|
-
{titleLabel}
|
|
205
|
-
</div>
|
|
206
|
-
<div className={styles.admonitionContent}>{children}</div>
|
|
207
|
-
</div>
|
|
208
|
-
);
|
|
24
|
+
export default function Admonition(unprocessedProps: Props): JSX.Element {
|
|
25
|
+
const props = processAdmonitionProps(unprocessedProps);
|
|
26
|
+
const AdmonitionTypeComponent = getAdmonitionTypeComponent(props.type);
|
|
27
|
+
return <AdmonitionTypeComponent {...props} />;
|
|
209
28
|
}
|
package/src/theme-classic.d.ts
CHANGED
|
@@ -44,13 +44,114 @@ declare module '@theme/Admonition' {
|
|
|
44
44
|
|
|
45
45
|
export interface Props {
|
|
46
46
|
readonly children: ReactNode;
|
|
47
|
-
readonly type:
|
|
47
|
+
readonly type: string;
|
|
48
48
|
readonly icon?: ReactNode;
|
|
49
49
|
readonly title?: ReactNode;
|
|
50
|
+
readonly className?: string;
|
|
50
51
|
}
|
|
52
|
+
|
|
51
53
|
export default function Admonition(props: Props): JSX.Element;
|
|
52
54
|
}
|
|
53
55
|
|
|
56
|
+
declare module '@theme/Admonition/Type/Note' {
|
|
57
|
+
import type {Props as AdmonitionProps} from '@theme/Admonition';
|
|
58
|
+
|
|
59
|
+
export interface Props extends AdmonitionProps {}
|
|
60
|
+
export default function AdmonitionTypeNote(props: Props): JSX.Element;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
declare module '@theme/Admonition/Type/Info' {
|
|
64
|
+
import type {Props as AdmonitionProps} from '@theme/Admonition';
|
|
65
|
+
|
|
66
|
+
export interface Props extends AdmonitionProps {}
|
|
67
|
+
export default function AdmonitionTypeInfo(props: Props): JSX.Element;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
declare module '@theme/Admonition/Type/Tip' {
|
|
71
|
+
import type {Props as AdmonitionProps} from '@theme/Admonition';
|
|
72
|
+
|
|
73
|
+
export interface Props extends AdmonitionProps {}
|
|
74
|
+
export default function AdmonitionTypeTip(props: Props): JSX.Element;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
declare module '@theme/Admonition/Type/Caution' {
|
|
78
|
+
import type {Props as AdmonitionProps} from '@theme/Admonition';
|
|
79
|
+
|
|
80
|
+
export interface Props extends AdmonitionProps {}
|
|
81
|
+
export default function AdmonitionTypeCaution(props: Props): JSX.Element;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare module '@theme/Admonition/Type/Danger' {
|
|
85
|
+
import type {Props as AdmonitionProps} from '@theme/Admonition';
|
|
86
|
+
|
|
87
|
+
export interface Props extends AdmonitionProps {}
|
|
88
|
+
export default function AdmonitionTypeDanger(props: Props): JSX.Element;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
declare module '@theme/Admonition/Types' {
|
|
92
|
+
import type {ComponentType} from 'react';
|
|
93
|
+
import type {Props} from '@theme/Admonition';
|
|
94
|
+
|
|
95
|
+
const AdmonitionTypes: {
|
|
96
|
+
[admonitionType: string]: ComponentType<Props>;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default AdmonitionTypes;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
declare module '@theme/Admonition/Layout' {
|
|
103
|
+
import type {ReactNode} from 'react';
|
|
104
|
+
|
|
105
|
+
export interface Props {
|
|
106
|
+
readonly children: ReactNode;
|
|
107
|
+
readonly type: string;
|
|
108
|
+
readonly icon?: ReactNode;
|
|
109
|
+
readonly title?: ReactNode;
|
|
110
|
+
readonly className?: string;
|
|
111
|
+
}
|
|
112
|
+
export default function AdmonitionLayout(props: Props): JSX.Element;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
declare module '@theme/Admonition/Icon/Note' {
|
|
116
|
+
import type {ComponentProps} from 'react';
|
|
117
|
+
|
|
118
|
+
export interface Props extends ComponentProps<'svg'> {}
|
|
119
|
+
|
|
120
|
+
export default function AdmonitionIconNote(props: Props): JSX.Element;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
declare module '@theme/Admonition/Icon/Tip' {
|
|
124
|
+
import type {ComponentProps} from 'react';
|
|
125
|
+
|
|
126
|
+
export interface Props extends ComponentProps<'svg'> {}
|
|
127
|
+
|
|
128
|
+
export default function AdmonitionIconTip(props: Props): JSX.Element;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
declare module '@theme/Admonition/Icon/Caution' {
|
|
132
|
+
import type {ComponentProps} from 'react';
|
|
133
|
+
|
|
134
|
+
export interface Props extends ComponentProps<'svg'> {}
|
|
135
|
+
|
|
136
|
+
export default function AdmonitionIconCaution(props: Props): JSX.Element;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
declare module '@theme/Admonition/Icon/Danger' {
|
|
140
|
+
import type {ComponentProps} from 'react';
|
|
141
|
+
|
|
142
|
+
export interface Props extends ComponentProps<'svg'> {}
|
|
143
|
+
|
|
144
|
+
export default function AdmonitionIconDanger(props: Props): JSX.Element;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
declare module '@theme/Admonition/Icon/Info' {
|
|
148
|
+
import type {ComponentProps} from 'react';
|
|
149
|
+
|
|
150
|
+
export interface Props extends ComponentProps<'svg'> {}
|
|
151
|
+
|
|
152
|
+
export default function AdmonitionIconInfo(props: Props): JSX.Element;
|
|
153
|
+
}
|
|
154
|
+
|
|
54
155
|
declare module '@theme/AnnouncementBar' {
|
|
55
156
|
export default function AnnouncementBar(): JSX.Element | null;
|
|
56
157
|
}
|