@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.
Files changed (45) hide show
  1. package/lib/getSwizzleConfig.js +127 -1
  2. package/lib/theme/Admonition/Icon/Caution.d.ts +9 -0
  3. package/lib/theme/Admonition/Icon/Caution.js +17 -0
  4. package/lib/theme/Admonition/Icon/Danger.d.ts +9 -0
  5. package/lib/theme/Admonition/Icon/Danger.js +17 -0
  6. package/lib/theme/Admonition/Icon/Info.d.ts +9 -0
  7. package/lib/theme/Admonition/Icon/Info.js +17 -0
  8. package/lib/theme/Admonition/Icon/Note.d.ts +9 -0
  9. package/lib/theme/Admonition/Icon/Note.js +17 -0
  10. package/lib/theme/Admonition/Icon/Tip.d.ts +9 -0
  11. package/lib/theme/Admonition/Icon/Tip.js +17 -0
  12. package/lib/theme/Admonition/Layout/index.d.ts +9 -0
  13. package/lib/theme/Admonition/Layout/index.js +43 -0
  14. package/lib/theme/Admonition/{styles.module.css → Layout/styles.module.css} +0 -0
  15. package/lib/theme/Admonition/Type/Caution.d.ts +9 -0
  16. package/lib/theme/Admonition/Type/Caution.js +32 -0
  17. package/lib/theme/Admonition/Type/Danger.d.ts +9 -0
  18. package/lib/theme/Admonition/Type/Danger.js +32 -0
  19. package/lib/theme/Admonition/Type/Info.d.ts +9 -0
  20. package/lib/theme/Admonition/Type/Info.js +32 -0
  21. package/lib/theme/Admonition/Type/Note.d.ts +9 -0
  22. package/lib/theme/Admonition/Type/Note.js +32 -0
  23. package/lib/theme/Admonition/Type/Tip.d.ts +9 -0
  24. package/lib/theme/Admonition/Type/Tip.js +32 -0
  25. package/lib/theme/Admonition/Types.d.ts +12 -0
  26. package/lib/theme/Admonition/Types.js +33 -0
  27. package/lib/theme/Admonition/index.d.ts +1 -1
  28. package/lib/theme/Admonition/index.js +12 -171
  29. package/package.json +14 -14
  30. package/src/getSwizzleConfig.ts +138 -1
  31. package/src/theme/Admonition/Icon/Caution.tsx +20 -0
  32. package/src/theme/Admonition/Icon/Danger.tsx +20 -0
  33. package/src/theme/Admonition/Icon/Info.tsx +20 -0
  34. package/src/theme/Admonition/Icon/Note.tsx +20 -0
  35. package/src/theme/Admonition/Icon/Tip.tsx +20 -0
  36. package/src/theme/Admonition/Layout/index.tsx +55 -0
  37. package/src/theme/Admonition/{styles.module.css → Layout/styles.module.css} +0 -0
  38. package/src/theme/Admonition/Type/Caution.tsx +37 -0
  39. package/src/theme/Admonition/Type/Danger.tsx +37 -0
  40. package/src/theme/Admonition/Type/Info.tsx +37 -0
  41. package/src/theme/Admonition/Type/Note.tsx +37 -0
  42. package/src/theme/Admonition/Type/Tip.tsx +37 -0
  43. package/src/theme/Admonition/Types.tsx +38 -0
  44. package/src/theme/Admonition/index.tsx +13 -194
  45. package/src/theme-classic.d.ts +102 -1
@@ -10,6 +10,105 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  function getSwizzleConfig() {
11
11
  return {
12
12
  components: {
13
+ 'Admonition/Icon': {
14
+ actions: {
15
+ eject: 'safe',
16
+ wrap: 'forbidden', // Can't wrap a folder
17
+ },
18
+ description: 'The folder containing all admonition icons',
19
+ },
20
+ 'Admonition/Icon/Caution': {
21
+ actions: {
22
+ eject: 'safe',
23
+ wrap: 'safe',
24
+ },
25
+ description: 'The admonition caution icon',
26
+ },
27
+ 'Admonition/Icon/Danger': {
28
+ actions: {
29
+ eject: 'safe',
30
+ wrap: 'safe',
31
+ },
32
+ description: 'The admonition danger icon',
33
+ },
34
+ 'Admonition/Icon/Info': {
35
+ actions: {
36
+ eject: 'safe',
37
+ wrap: 'safe',
38
+ },
39
+ description: 'The admonition info icon',
40
+ },
41
+ 'Admonition/Icon/Note': {
42
+ actions: {
43
+ eject: 'safe',
44
+ wrap: 'safe',
45
+ },
46
+ description: 'The admonition note icon',
47
+ },
48
+ 'Admonition/Icon/Tip': {
49
+ actions: {
50
+ eject: 'safe',
51
+ wrap: 'safe',
52
+ },
53
+ description: 'The admonition tip icon',
54
+ },
55
+ 'Admonition/Layout': {
56
+ actions: {
57
+ eject: 'safe',
58
+ wrap: 'safe',
59
+ },
60
+ description: 'The standard admonition layout applied to all default admonition types',
61
+ },
62
+ 'Admonition/Type': {
63
+ actions: {
64
+ eject: 'safe',
65
+ wrap: 'forbidden',
66
+ },
67
+ description: 'The folder containing all the admonition type components.',
68
+ },
69
+ 'Admonition/Type/Caution': {
70
+ actions: {
71
+ eject: 'safe',
72
+ wrap: 'safe',
73
+ },
74
+ description: 'The component responsible for rendering a :::caution admonition type',
75
+ },
76
+ 'Admonition/Type/Danger': {
77
+ actions: {
78
+ eject: 'safe',
79
+ wrap: 'safe',
80
+ },
81
+ description: 'The component responsible for rendering a :::danger admonition type',
82
+ },
83
+ 'Admonition/Type/Info': {
84
+ actions: {
85
+ eject: 'safe',
86
+ wrap: 'safe',
87
+ },
88
+ description: 'The component responsible for rendering a :::info admonition type',
89
+ },
90
+ 'Admonition/Type/Note': {
91
+ actions: {
92
+ eject: 'safe',
93
+ wrap: 'safe',
94
+ },
95
+ description: 'The component responsible for rendering a :::note admonition type',
96
+ },
97
+ 'Admonition/Type/Tip': {
98
+ actions: {
99
+ eject: 'safe',
100
+ wrap: 'safe',
101
+ },
102
+ description: 'The component responsible for rendering a :::tip admonition type',
103
+ },
104
+ 'Admonition/Types': {
105
+ actions: {
106
+ eject: 'safe',
107
+ // TODO the swizzle CLI should provide a way to wrap such objects
108
+ wrap: 'forbidden',
109
+ },
110
+ description: 'The object mapping admonition type to a React component.\nUse it to add custom admonition type components, or replace existing ones.\nCan be ejected or wrapped (only manually, see our documentation).',
111
+ },
13
112
  CodeBlock: {
14
113
  actions: {
15
114
  eject: 'safe',
@@ -17,6 +116,13 @@ function getSwizzleConfig() {
17
116
  },
18
117
  description: 'The component used to render multi-line code blocks, generally used in Markdown files.',
19
118
  },
119
+ 'CodeBlock/Content': {
120
+ actions: {
121
+ eject: 'unsafe',
122
+ wrap: 'forbidden',
123
+ },
124
+ description: 'The folder containing components responsible for rendering different types of CodeBlock content.',
125
+ },
20
126
  ColorModeToggle: {
21
127
  actions: {
22
128
  eject: 'safe',
@@ -31,6 +137,16 @@ function getSwizzleConfig() {
31
137
  },
32
138
  description: 'The component responsible for rendering a list of sidebar items cards.\nNotable used on the category generated-index pages.',
33
139
  },
140
+ 'DocItem/TOC': {
141
+ actions: {
142
+ // Forbidden because it's a parent folder, makes the CLI crash atm
143
+ // TODO the CLI should rather support --eject
144
+ // Subfolders can be swizzled
145
+ eject: 'forbidden',
146
+ wrap: 'forbidden',
147
+ },
148
+ description: 'The DocItem TOC is not directly swizzle-able, but you can swizzle its sub-components.',
149
+ },
34
150
  DocSidebar: {
35
151
  actions: {
36
152
  eject: 'unsafe',
@@ -94,6 +210,16 @@ function getSwizzleConfig() {
94
210
  },
95
211
  description: 'The footer logo',
96
212
  },
213
+ Icon: {
214
+ actions: {
215
+ // Forbidden because it's a parent folder, makes the CLI crash atm
216
+ // TODO the CLI should rather support --eject
217
+ // Subfolders can be swizzled
218
+ eject: 'forbidden',
219
+ wrap: 'forbidden',
220
+ },
221
+ description: 'The Icon folder is not directly swizzle-able, but you can swizzle its sub-components.',
222
+ },
97
223
  'Icon/Arrow': {
98
224
  actions: {
99
225
  eject: 'safe',
@@ -204,7 +330,7 @@ function getSwizzleConfig() {
204
330
  eject: 'safe',
205
331
  wrap: 'forbidden',
206
332
  },
207
- description: 'The Navbar item components mapping. Can be ejected to add custom navbar item types. See https://github.com/facebook/docusaurus/issues/7227.',
333
+ description: 'The Navbar item components mapping. Can be ejected to add custom navbar item types.\nSee https://github.com/facebook/docusaurus/issues/7227.',
208
334
  },
209
335
  NotFound: {
210
336
  actions: {
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ import type { Props } from '@theme/Admonition/Icon/Caution';
9
+ export default function AdmonitionIconCaution(props: Props): JSX.Element;
@@ -0,0 +1,17 @@
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
+ import React from 'react';
8
+ export default function AdmonitionIconCaution(props) {
9
+ return (
10
+ <svg viewBox="0 0 16 16" {...props}>
11
+ <path
12
+ fillRule="evenodd"
13
+ 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"
14
+ />
15
+ </svg>
16
+ );
17
+ }
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ import type { Props } from '@theme/Admonition/Icon/Danger';
9
+ export default function AdmonitionIconDanger(props: Props): JSX.Element;
@@ -0,0 +1,17 @@
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
+ import React from 'react';
8
+ export default function AdmonitionIconDanger(props) {
9
+ return (
10
+ <svg viewBox="0 0 12 16" {...props}>
11
+ <path
12
+ fillRule="evenodd"
13
+ 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"
14
+ />
15
+ </svg>
16
+ );
17
+ }
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ import type { Props } from '@theme/Admonition/Icon/Info';
9
+ export default function AdmonitionIconInfo(props: Props): JSX.Element;
@@ -0,0 +1,17 @@
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
+ import React from 'react';
8
+ export default function AdmonitionIconInfo(props) {
9
+ return (
10
+ <svg viewBox="0 0 14 16" {...props}>
11
+ <path
12
+ fillRule="evenodd"
13
+ 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"
14
+ />
15
+ </svg>
16
+ );
17
+ }
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ import type { Props } from '@theme/Admonition/Icon/Note';
9
+ export default function AdmonitionIconNote(props: Props): JSX.Element;
@@ -0,0 +1,17 @@
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
+ import React from 'react';
8
+ export default function AdmonitionIconNote(props) {
9
+ return (
10
+ <svg viewBox="0 0 14 16" {...props}>
11
+ <path
12
+ fillRule="evenodd"
13
+ 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"
14
+ />
15
+ </svg>
16
+ );
17
+ }
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ import type { Props } from '@theme/Admonition/Icon/Tip';
9
+ export default function AdmonitionIconTip(props: Props): JSX.Element;
@@ -0,0 +1,17 @@
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
+ import React from 'react';
8
+ export default function AdmonitionIconTip(props) {
9
+ return (
10
+ <svg viewBox="0 0 12 16" {...props}>
11
+ <path
12
+ fillRule="evenodd"
13
+ 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"
14
+ />
15
+ </svg>
16
+ );
17
+ }
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ import type { Props } from '@theme/Admonition/Layout';
9
+ export default function AdmonitionLayout(props: Props): JSX.Element;
@@ -0,0 +1,43 @@
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
+ import React from 'react';
8
+ import clsx from 'clsx';
9
+ import {ThemeClassNames} from '@docusaurus/theme-common';
10
+ import styles from './styles.module.css';
11
+ function AdmonitionContainer({type, className, children}) {
12
+ return (
13
+ <div
14
+ className={clsx(
15
+ ThemeClassNames.common.admonition,
16
+ ThemeClassNames.common.admonitionType(type),
17
+ styles.admonition,
18
+ className,
19
+ )}>
20
+ {children}
21
+ </div>
22
+ );
23
+ }
24
+ function AdmonitionHeading({icon, title}) {
25
+ return (
26
+ <div className={styles.admonitionHeading}>
27
+ <span className={styles.admonitionIcon}>{icon}</span>
28
+ {title}
29
+ </div>
30
+ );
31
+ }
32
+ function AdmonitionContent({children}) {
33
+ return <div className={styles.admonitionContent}>{children}</div>;
34
+ }
35
+ export default function AdmonitionLayout(props) {
36
+ const {type, icon, title, children, className} = props;
37
+ return (
38
+ <AdmonitionContainer type={type} className={className}>
39
+ <AdmonitionHeading title={title} icon={icon} />
40
+ <AdmonitionContent>{children}</AdmonitionContent>
41
+ </AdmonitionContainer>
42
+ );
43
+ }
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ import type { Props } from '@theme/Admonition/Type/Caution';
9
+ export default function AdmonitionTypeCaution(props: Props): JSX.Element;
@@ -0,0 +1,32 @@
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
+ import React from 'react';
8
+ import clsx from 'clsx';
9
+ import Translate from '@docusaurus/Translate';
10
+ import AdmonitionLayout from '@theme/Admonition/Layout';
11
+ import IconCaution from '@theme/Admonition/Icon/Caution';
12
+ const infimaClassName = 'alert alert--warning';
13
+ const defaultProps = {
14
+ icon: <IconCaution />,
15
+ title: (
16
+ <Translate
17
+ id="theme.admonition.caution"
18
+ description="The default label used for the Caution admonition (:::caution)">
19
+ caution
20
+ </Translate>
21
+ ),
22
+ };
23
+ export default function AdmonitionTypeCaution(props) {
24
+ return (
25
+ <AdmonitionLayout
26
+ {...defaultProps}
27
+ {...props}
28
+ className={clsx(infimaClassName, props.className)}>
29
+ {props.children}
30
+ </AdmonitionLayout>
31
+ );
32
+ }
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ import type { Props } from '@theme/Admonition/Type/Danger';
9
+ export default function AdmonitionTypeDanger(props: Props): JSX.Element;
@@ -0,0 +1,32 @@
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
+ import React from 'react';
8
+ import clsx from 'clsx';
9
+ import Translate from '@docusaurus/Translate';
10
+ import AdmonitionLayout from '@theme/Admonition/Layout';
11
+ import IconDanger from '@theme/Admonition/Icon/Danger';
12
+ const infimaClassName = 'alert alert--danger';
13
+ const defaultProps = {
14
+ icon: <IconDanger />,
15
+ title: (
16
+ <Translate
17
+ id="theme.admonition.danger"
18
+ description="The default label used for the Danger admonition (:::danger)">
19
+ danger
20
+ </Translate>
21
+ ),
22
+ };
23
+ export default function AdmonitionTypeDanger(props) {
24
+ return (
25
+ <AdmonitionLayout
26
+ {...defaultProps}
27
+ {...props}
28
+ className={clsx(infimaClassName, props.className)}>
29
+ {props.children}
30
+ </AdmonitionLayout>
31
+ );
32
+ }
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ import type { Props } from '@theme/Admonition/Type/Info';
9
+ export default function AdmonitionTypeInfo(props: Props): JSX.Element;
@@ -0,0 +1,32 @@
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
+ import React from 'react';
8
+ import clsx from 'clsx';
9
+ import Translate from '@docusaurus/Translate';
10
+ import AdmonitionLayout from '@theme/Admonition/Layout';
11
+ import IconInfo from '@theme/Admonition/Icon/Info';
12
+ const infimaClassName = 'alert alert--info';
13
+ const defaultProps = {
14
+ icon: <IconInfo />,
15
+ title: (
16
+ <Translate
17
+ id="theme.admonition.info"
18
+ description="The default label used for the Info admonition (:::info)">
19
+ info
20
+ </Translate>
21
+ ),
22
+ };
23
+ export default function AdmonitionTypeInfo(props) {
24
+ return (
25
+ <AdmonitionLayout
26
+ {...defaultProps}
27
+ {...props}
28
+ className={clsx(infimaClassName, props.className)}>
29
+ {props.children}
30
+ </AdmonitionLayout>
31
+ );
32
+ }
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ import type { Props } from '@theme/Admonition/Type/Note';
9
+ export default function AdmonitionTypeNote(props: Props): JSX.Element;
@@ -0,0 +1,32 @@
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
+ import React from 'react';
8
+ import clsx from 'clsx';
9
+ import Translate from '@docusaurus/Translate';
10
+ import AdmonitionLayout from '@theme/Admonition/Layout';
11
+ import IconNote from '@theme/Admonition/Icon/Note';
12
+ const infimaClassName = 'alert alert--secondary';
13
+ const defaultProps = {
14
+ icon: <IconNote />,
15
+ title: (
16
+ <Translate
17
+ id="theme.admonition.note"
18
+ description="The default label used for the Note admonition (:::note)">
19
+ note
20
+ </Translate>
21
+ ),
22
+ };
23
+ export default function AdmonitionTypeNote(props) {
24
+ return (
25
+ <AdmonitionLayout
26
+ {...defaultProps}
27
+ {...props}
28
+ className={clsx(infimaClassName, props.className)}>
29
+ {props.children}
30
+ </AdmonitionLayout>
31
+ );
32
+ }
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ import type { Props } from '@theme/Admonition/Type/Tip';
9
+ export default function AdmonitionTypeTip(props: Props): JSX.Element;
@@ -0,0 +1,32 @@
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
+ import React from 'react';
8
+ import clsx from 'clsx';
9
+ import Translate from '@docusaurus/Translate';
10
+ import AdmonitionLayout from '@theme/Admonition/Layout';
11
+ import IconTip from '@theme/Admonition/Icon/Tip';
12
+ const infimaClassName = 'alert alert--success';
13
+ const defaultProps = {
14
+ icon: <IconTip />,
15
+ title: (
16
+ <Translate
17
+ id="theme.admonition.tip"
18
+ description="The default label used for the Tip admonition (:::tip)">
19
+ tip
20
+ </Translate>
21
+ ),
22
+ };
23
+ export default function AdmonitionTypeTip(props) {
24
+ return (
25
+ <AdmonitionLayout
26
+ {...defaultProps}
27
+ {...props}
28
+ className={clsx(infimaClassName, props.className)}>
29
+ {props.children}
30
+ </AdmonitionLayout>
31
+ );
32
+ }
@@ -0,0 +1,12 @@
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
+ /// <reference path="../../../src/theme-classic.d.ts" />
8
+ import React from 'react';
9
+ declare const _default: {
10
+ [x: string]: React.ComponentType<import("@theme/Admonition").Props>;
11
+ };
12
+ export default _default;
@@ -0,0 +1,33 @@
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
+ import React from 'react';
8
+ import AdmonitionTypeNote from '@theme/Admonition/Type/Note';
9
+ import AdmonitionTypeTip from '@theme/Admonition/Type/Tip';
10
+ import AdmonitionTypeInfo from '@theme/Admonition/Type/Info';
11
+ import AdmonitionTypeCaution from '@theme/Admonition/Type/Caution';
12
+ import AdmonitionTypeDanger from '@theme/Admonition/Type/Danger';
13
+ const admonitionTypes = {
14
+ note: AdmonitionTypeNote,
15
+ tip: AdmonitionTypeTip,
16
+ info: AdmonitionTypeInfo,
17
+ caution: AdmonitionTypeCaution,
18
+ danger: AdmonitionTypeDanger,
19
+ };
20
+ // Undocumented legacy admonition type aliases
21
+ // Provide hardcoded/untranslated retrocompatible label
22
+ // See also https://github.com/facebook/docusaurus/issues/7767
23
+ const admonitionAliases = {
24
+ secondary: (props) => <AdmonitionTypeNote title="secondary" {...props} />,
25
+ important: (props) => <AdmonitionTypeInfo title="important" {...props} />,
26
+ success: (props) => <AdmonitionTypeTip title="success" {...props} />,
27
+ // TODO bad legacy mapping, warning is usually yellow, not red...
28
+ warning: (props) => <AdmonitionTypeDanger title="warning" {...props} />,
29
+ };
30
+ export default {
31
+ ...admonitionTypes,
32
+ ...admonitionAliases,
33
+ };
@@ -6,4 +6,4 @@
6
6
  */
7
7
  /// <reference types="react" />
8
8
  import type { Props } from '@theme/Admonition';
9
- export default function Admonition(props: Props): JSX.Element;
9
+ export default function Admonition(unprocessedProps: Props): JSX.Element;