@mui/docs 7.0.0-alpha.0 → 7.0.0-alpha.1

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 (281) hide show
  1. package/Ad/Ad.d.ts +1 -1
  2. package/Ad/Ad.js +42 -33
  3. package/Ad/AdCarbon.d.ts +1 -1
  4. package/Ad/AdCarbon.js +31 -18
  5. package/Ad/AdDisplay.d.ts +10 -10
  6. package/Ad/AdDisplay.js +28 -21
  7. package/Ad/AdGuest.d.ts +6 -6
  8. package/Ad/AdGuest.js +15 -8
  9. package/Ad/AdInHouse.d.ts +3 -3
  10. package/Ad/AdInHouse.js +13 -5
  11. package/Ad/AdManager.d.ts +12 -9
  12. package/Ad/AdManager.js +17 -8
  13. package/Ad/AdProvider.d.ts +9 -9
  14. package/Ad/AdProvider.js +13 -5
  15. package/Ad/ad.styles.d.ts +4322 -4322
  16. package/Ad/ad.styles.js +13 -5
  17. package/Ad/index.d.ts +5 -5
  18. package/Ad/index.js +62 -6
  19. package/CHANGELOG.md +61 -0
  20. package/CodeCopy/CodeCopy.d.ts +5 -3
  21. package/CodeCopy/CodeCopy.js +19 -10
  22. package/CodeCopy/CodeCopyButton.d.ts +2 -2
  23. package/CodeCopy/CodeCopyButton.js +18 -10
  24. package/CodeCopy/index.d.ts +3 -3
  25. package/CodeCopy/index.js +40 -3
  26. package/CodeCopy/useClipboardCopy.d.ts +3 -3
  27. package/CodeCopy/useClipboardCopy.js +12 -4
  28. package/ComponentLinkHeader/ComponentLinkHeader.d.ts +5 -5
  29. package/ComponentLinkHeader/ComponentLinkHeader.js +48 -40
  30. package/ComponentLinkHeader/index.d.ts +2 -2
  31. package/ComponentLinkHeader/index.js +24 -2
  32. package/DocsProvider/DocsProvider.d.ts +19 -13
  33. package/DocsProvider/DocsProvider.js +17 -9
  34. package/DocsProvider/index.d.ts +1 -1
  35. package/DocsProvider/index.js +16 -1
  36. package/HighlightedCode/HighlightedCode.d.ts +9 -9
  37. package/HighlightedCode/HighlightedCode.js +26 -18
  38. package/HighlightedCode/index.d.ts +1 -1
  39. package/HighlightedCode/index.js +16 -1
  40. package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.d.ts +18 -18
  41. package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.js +31 -22
  42. package/HighlightedCodeWithTabs/index.d.ts +2 -2
  43. package/HighlightedCodeWithTabs/index.js +24 -2
  44. package/InfoCard/InfoCard.d.ts +15 -13
  45. package/InfoCard/InfoCard.js +29 -20
  46. package/InfoCard/index.d.ts +1 -1
  47. package/InfoCard/index.js +16 -1
  48. package/Link/Link.d.ts +14 -8
  49. package/Link/Link.js +26 -29
  50. package/Link/index.d.ts +1 -1
  51. package/Link/index.js +16 -1
  52. package/MarkdownElement/MarkdownElement.d.ts +4 -4
  53. package/MarkdownElement/MarkdownElement.js +186 -178
  54. package/MarkdownElement/index.d.ts +1 -1
  55. package/MarkdownElement/index.js +16 -1
  56. package/NProgressBar/NProgressBar.d.ts +1 -3
  57. package/NProgressBar/NProgressBar.js +23 -15
  58. package/NProgressBar/index.d.ts +2 -2
  59. package/NProgressBar/index.js +13 -1
  60. package/README.md +2 -2
  61. package/SectionTitle/SectionTitle.d.ts +4 -4
  62. package/SectionTitle/SectionTitle.js +15 -8
  63. package/SectionTitle/index.d.ts +1 -1
  64. package/SectionTitle/index.js +16 -1
  65. package/branding/BrandingProvider.d.ts +6 -6
  66. package/branding/BrandingProvider.js +15 -8
  67. package/branding/brandingTheme.d.ts +118 -119
  68. package/branding/brandingTheme.js +126 -115
  69. package/branding/index.d.ts +2 -2
  70. package/branding/index.js +27 -2
  71. package/esm/Ad/Ad.d.ts +6 -0
  72. package/{node → esm}/Ad/Ad.js +33 -42
  73. package/esm/Ad/AdCarbon.d.ts +3 -0
  74. package/{node → esm}/Ad/AdCarbon.js +22 -27
  75. package/esm/Ad/AdDisplay.d.ts +16 -0
  76. package/{node → esm}/Ad/AdDisplay.js +21 -28
  77. package/esm/Ad/AdGuest.d.ts +10 -0
  78. package/esm/Ad/AdGuest.js +29 -0
  79. package/esm/Ad/AdInHouse.d.ts +5 -0
  80. package/esm/Ad/AdInHouse.js +15 -0
  81. package/esm/Ad/AdManager.d.ts +19 -0
  82. package/esm/Ad/AdManager.js +36 -0
  83. package/esm/Ad/AdProvider.d.ts +15 -0
  84. package/esm/Ad/AdProvider.js +24 -0
  85. package/esm/Ad/ad.styles.d.ts +4329 -0
  86. package/{node → esm}/Ad/ad.styles.js +5 -13
  87. package/esm/Ad/index.d.ts +5 -0
  88. package/esm/Ad/index.js +7 -0
  89. package/esm/CodeCopy/CodeCopy.d.ts +22 -0
  90. package/{node → esm}/CodeCopy/CodeCopy.js +10 -19
  91. package/esm/CodeCopy/CodeCopyButton.d.ts +5 -0
  92. package/esm/CodeCopy/CodeCopyButton.js +41 -0
  93. package/esm/CodeCopy/index.d.ts +3 -0
  94. package/esm/CodeCopy/index.js +3 -0
  95. package/esm/CodeCopy/useClipboardCopy.d.ts +4 -0
  96. package/esm/CodeCopy/useClipboardCopy.js +21 -0
  97. package/esm/ComponentLinkHeader/ComponentLinkHeader.d.ts +9 -0
  98. package/{node → esm}/ComponentLinkHeader/ComponentLinkHeader.js +40 -48
  99. package/esm/ComponentLinkHeader/index.d.ts +2 -0
  100. package/esm/ComponentLinkHeader/index.js +2 -0
  101. package/esm/DocsProvider/DocsProvider.d.ts +24 -0
  102. package/esm/DocsProvider/DocsProvider.js +31 -0
  103. package/esm/DocsProvider/index.d.ts +1 -0
  104. package/esm/DocsProvider/index.js +1 -0
  105. package/esm/HighlightedCode/HighlightedCode.d.ts +14 -0
  106. package/esm/HighlightedCode/HighlightedCode.js +67 -0
  107. package/esm/HighlightedCode/index.d.ts +1 -0
  108. package/esm/HighlightedCode/index.js +1 -0
  109. package/esm/HighlightedCodeWithTabs/HighlightedCodeWithTabs.d.ts +29 -0
  110. package/{node → esm}/HighlightedCodeWithTabs/HighlightedCodeWithTabs.js +22 -31
  111. package/esm/HighlightedCodeWithTabs/index.d.ts +2 -0
  112. package/esm/HighlightedCodeWithTabs/index.js +2 -0
  113. package/esm/InfoCard/InfoCard.d.ts +22 -0
  114. package/esm/InfoCard/InfoCard.js +87 -0
  115. package/esm/InfoCard/index.d.ts +1 -0
  116. package/esm/InfoCard/index.js +1 -0
  117. package/esm/Link/Link.d.ts +22 -0
  118. package/{node → esm}/Link/Link.js +19 -37
  119. package/esm/Link/index.d.ts +1 -0
  120. package/esm/Link/index.js +1 -0
  121. package/esm/MarkdownElement/MarkdownElement.d.ts +7 -0
  122. package/{node → esm}/MarkdownElement/MarkdownElement.js +178 -186
  123. package/esm/MarkdownElement/index.d.ts +1 -0
  124. package/esm/MarkdownElement/index.js +1 -0
  125. package/esm/NProgressBar/NProgressBar.d.ts +6 -0
  126. package/{node → esm}/NProgressBar/NProgressBar.js +15 -23
  127. package/esm/NProgressBar/index.d.ts +2 -0
  128. package/esm/NProgressBar/index.js +1 -0
  129. package/esm/SectionTitle/SectionTitle.d.ts +7 -0
  130. package/esm/SectionTitle/SectionTitle.js +30 -0
  131. package/esm/SectionTitle/index.d.ts +1 -0
  132. package/esm/SectionTitle/index.js +1 -0
  133. package/esm/branding/BrandingProvider.d.ts +9 -0
  134. package/esm/branding/BrandingProvider.js +17 -0
  135. package/esm/branding/brandingTheme.d.ts +151 -0
  136. package/{node → esm}/branding/brandingTheme.js +115 -126
  137. package/esm/branding/index.d.ts +2 -0
  138. package/esm/branding/index.js +2 -0
  139. package/esm/i18n/i18n.d.ts +27 -0
  140. package/{node → esm}/i18n/i18n.js +17 -29
  141. package/esm/i18n/index.d.ts +1 -0
  142. package/esm/i18n/index.js +1 -0
  143. package/esm/package.json +1 -0
  144. package/esm/svgIcons/BundleSizeIcon.d.ts +4 -0
  145. package/esm/svgIcons/BundleSizeIcon.js +14 -0
  146. package/esm/svgIcons/FigmaIcon.d.ts +4 -0
  147. package/esm/svgIcons/FigmaIcon.js +23 -0
  148. package/esm/svgIcons/FileDownload.d.ts +7 -0
  149. package/esm/svgIcons/FileDownload.js +14 -0
  150. package/esm/svgIcons/JavaScript.d.ts +7 -0
  151. package/{node → esm}/svgIcons/JavaScript.js +6 -14
  152. package/esm/svgIcons/MaterialDesignIcon.d.ts +4 -0
  153. package/esm/svgIcons/MaterialDesignIcon.js +19 -0
  154. package/esm/svgIcons/SketchIcon.d.ts +4 -0
  155. package/esm/svgIcons/SketchIcon.js +28 -0
  156. package/esm/svgIcons/TypeScript.d.ts +7 -0
  157. package/esm/svgIcons/TypeScript.js +14 -0
  158. package/esm/svgIcons/W3CIcon.d.ts +4 -0
  159. package/{node → esm}/svgIcons/W3CIcon.js +7 -14
  160. package/esm/translations/index.d.ts +3 -0
  161. package/esm/translations/index.js +4 -0
  162. package/esm/utils/loadScript.d.ts +1 -0
  163. package/esm/utils/loadScript.js +7 -0
  164. package/i18n/i18n.d.ts +12 -14
  165. package/i18n/i18n.js +29 -17
  166. package/i18n/index.d.ts +1 -1
  167. package/i18n/index.js +16 -1
  168. package/modern/Ad/Ad.d.ts +6 -0
  169. package/modern/Ad/AdCarbon.d.ts +3 -0
  170. package/modern/Ad/AdDisplay.d.ts +16 -0
  171. package/modern/Ad/AdGuest.d.ts +10 -0
  172. package/modern/Ad/AdInHouse.d.ts +5 -0
  173. package/modern/Ad/AdManager.d.ts +19 -0
  174. package/modern/Ad/AdProvider.d.ts +15 -0
  175. package/modern/Ad/ad.styles.d.ts +4329 -0
  176. package/modern/Ad/index.d.ts +5 -0
  177. package/modern/CodeCopy/CodeCopy.d.ts +22 -0
  178. package/modern/CodeCopy/CodeCopyButton.d.ts +5 -0
  179. package/modern/CodeCopy/index.d.ts +3 -0
  180. package/modern/CodeCopy/useClipboardCopy.d.ts +4 -0
  181. package/modern/ComponentLinkHeader/ComponentLinkHeader.d.ts +9 -0
  182. package/modern/ComponentLinkHeader/index.d.ts +2 -0
  183. package/modern/DocsProvider/DocsProvider.d.ts +24 -0
  184. package/modern/DocsProvider/index.d.ts +1 -0
  185. package/modern/HighlightedCode/HighlightedCode.d.ts +14 -0
  186. package/modern/HighlightedCode/index.d.ts +1 -0
  187. package/modern/HighlightedCodeWithTabs/HighlightedCodeWithTabs.d.ts +29 -0
  188. package/modern/HighlightedCodeWithTabs/index.d.ts +2 -0
  189. package/modern/InfoCard/InfoCard.d.ts +22 -0
  190. package/modern/InfoCard/index.d.ts +1 -0
  191. package/modern/Link/Link.d.ts +22 -0
  192. package/modern/Link/index.d.ts +1 -0
  193. package/modern/MarkdownElement/MarkdownElement.d.ts +7 -0
  194. package/modern/MarkdownElement/index.d.ts +1 -0
  195. package/modern/NProgressBar/NProgressBar.d.ts +6 -0
  196. package/modern/NProgressBar/index.d.ts +2 -0
  197. package/modern/SectionTitle/SectionTitle.d.ts +7 -0
  198. package/modern/SectionTitle/index.d.ts +1 -0
  199. package/modern/branding/BrandingProvider.d.ts +9 -0
  200. package/modern/branding/brandingTheme.d.ts +151 -0
  201. package/modern/branding/index.d.ts +2 -0
  202. package/modern/i18n/i18n.d.ts +27 -0
  203. package/modern/i18n/index.d.ts +1 -0
  204. package/modern/svgIcons/BundleSizeIcon.d.ts +4 -0
  205. package/modern/svgIcons/FigmaIcon.d.ts +4 -0
  206. package/modern/svgIcons/FileDownload.d.ts +7 -0
  207. package/modern/svgIcons/JavaScript.d.ts +7 -0
  208. package/modern/svgIcons/MaterialDesignIcon.d.ts +4 -0
  209. package/modern/svgIcons/SketchIcon.d.ts +4 -0
  210. package/modern/svgIcons/TypeScript.d.ts +7 -0
  211. package/modern/svgIcons/W3CIcon.d.ts +4 -0
  212. package/modern/translations/index.d.ts +3 -0
  213. package/modern/utils/loadScript.d.ts +1 -0
  214. package/package.json +32 -2
  215. package/svgIcons/BundleSizeIcon.d.ts +2 -2
  216. package/svgIcons/BundleSizeIcon.js +13 -6
  217. package/svgIcons/FigmaIcon.d.ts +2 -2
  218. package/svgIcons/FigmaIcon.js +16 -9
  219. package/svgIcons/FileDownload.d.ts +2 -2
  220. package/svgIcons/FileDownload.js +14 -6
  221. package/svgIcons/JavaScript.d.ts +2 -2
  222. package/svgIcons/JavaScript.js +14 -6
  223. package/svgIcons/MaterialDesignIcon.d.ts +2 -2
  224. package/svgIcons/MaterialDesignIcon.js +14 -7
  225. package/svgIcons/SketchIcon.d.ts +2 -2
  226. package/svgIcons/SketchIcon.js +18 -11
  227. package/svgIcons/TypeScript.d.ts +2 -2
  228. package/svgIcons/TypeScript.js +14 -6
  229. package/svgIcons/W3CIcon.d.ts +2 -2
  230. package/svgIcons/W3CIcon.js +14 -7
  231. package/translations/index.d.ts +2 -2
  232. package/translations/index.js +10 -3
  233. package/tsconfig.build.tsbuildinfo +1 -1
  234. package/utils/loadScript.d.ts +1 -1
  235. package/utils/loadScript.js +8 -4
  236. package/Ad/package.json +0 -6
  237. package/CodeCopy/package.json +0 -6
  238. package/ComponentLinkHeader/package.json +0 -6
  239. package/DocsProvider/package.json +0 -6
  240. package/HighlightedCode/package.json +0 -6
  241. package/HighlightedCodeWithTabs/package.json +0 -6
  242. package/InfoCard/package.json +0 -6
  243. package/Link/package.json +0 -6
  244. package/MarkdownElement/package.json +0 -6
  245. package/NProgressBar/package.json +0 -6
  246. package/SectionTitle/package.json +0 -6
  247. package/branding/package.json +0 -6
  248. package/i18n/package.json +0 -6
  249. package/node/Ad/AdGuest.js +0 -36
  250. package/node/Ad/AdInHouse.js +0 -23
  251. package/node/Ad/AdManager.js +0 -45
  252. package/node/Ad/AdProvider.js +0 -32
  253. package/node/Ad/index.js +0 -63
  254. package/node/CodeCopy/CodeCopyButton.js +0 -49
  255. package/node/CodeCopy/index.js +0 -40
  256. package/node/CodeCopy/useClipboardCopy.js +0 -29
  257. package/node/ComponentLinkHeader/index.js +0 -24
  258. package/node/DocsProvider/DocsProvider.js +0 -39
  259. package/node/DocsProvider/index.js +0 -16
  260. package/node/HighlightedCode/HighlightedCode.js +0 -75
  261. package/node/HighlightedCode/index.js +0 -16
  262. package/node/HighlightedCodeWithTabs/index.js +0 -24
  263. package/node/InfoCard/InfoCard.js +0 -96
  264. package/node/InfoCard/index.js +0 -16
  265. package/node/Link/index.js +0 -16
  266. package/node/MarkdownElement/index.js +0 -16
  267. package/node/NProgressBar/index.js +0 -13
  268. package/node/SectionTitle/SectionTitle.js +0 -37
  269. package/node/SectionTitle/index.js +0 -16
  270. package/node/branding/BrandingProvider.js +0 -24
  271. package/node/branding/index.js +0 -27
  272. package/node/i18n/index.js +0 -16
  273. package/node/svgIcons/BundleSizeIcon.js +0 -21
  274. package/node/svgIcons/FigmaIcon.js +0 -30
  275. package/node/svgIcons/FileDownload.js +0 -22
  276. package/node/svgIcons/MaterialDesignIcon.js +0 -26
  277. package/node/svgIcons/SketchIcon.js +0 -35
  278. package/node/svgIcons/TypeScript.js +0 -22
  279. package/node/translations/index.js +0 -11
  280. package/node/utils/loadScript.js +0 -15
  281. package/translations/package.json +0 -6
@@ -1,2 +1,2 @@
1
- export * from './brandingTheme';
2
- export * from './BrandingProvider';
1
+ export * from "./brandingTheme.js";
2
+ export * from "./BrandingProvider.js";
package/branding/index.js CHANGED
@@ -1,2 +1,27 @@
1
- export * from "./brandingTheme.js";
2
- export * from "./BrandingProvider.js";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _brandingTheme = require("./brandingTheme");
7
+ Object.keys(_brandingTheme).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _brandingTheme[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _brandingTheme[key];
14
+ }
15
+ });
16
+ });
17
+ var _BrandingProvider = require("./BrandingProvider");
18
+ Object.keys(_BrandingProvider).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _BrandingProvider[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _BrandingProvider[key];
25
+ }
26
+ });
27
+ });
package/esm/Ad/Ad.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ export declare const AD_MARGIN_TOP = 3;
3
+ export declare const AD_MARGIN_BOTTOM = 3;
4
+ export declare const AD_HEIGHT = 126;
5
+ export declare const AD_HEIGHT_MOBILE: number;
6
+ export declare function Ad(): React.JSX.Element;
@@ -1,26 +1,17 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.AD_MARGIN_TOP = exports.AD_MARGIN_BOTTOM = exports.AD_HEIGHT_MOBILE = exports.AD_HEIGHT = void 0;
9
- exports.Ad = Ad;
10
- var React = _interopRequireWildcard(require("react"));
11
- var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
12
- var _Box = _interopRequireDefault(require("@mui/material/Box"));
13
- var _Paper = _interopRequireDefault(require("@mui/material/Paper"));
14
- var _i18n = require("../i18n");
15
- var _AdCarbon2 = _interopRequireDefault(require("./AdCarbon"));
16
- var _AdInHouse = _interopRequireDefault(require("./AdInHouse"));
17
- var _AdManager = require("./AdManager");
18
- var _AdProvider = require("./AdProvider");
19
- var _jsxRuntime = require("react/jsx-runtime");
20
1
  var _span, _PleaseDisableAdblock, _AdCarbon;
2
+ import * as React from 'react';
3
+ import Typography from '@mui/material/Typography';
4
+ import Box from '@mui/material/Box';
5
+ import Paper from '@mui/material/Paper';
6
+ import { useTranslate } from "../i18n/index.js";
7
+ import AdCarbon from "./AdCarbon.js";
8
+ import AdInHouse from "./AdInHouse.js";
9
+ import { AdContext, adShape } from "./AdManager.js";
10
+ import { useAdConfig } from "./AdProvider.js";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
12
  function PleaseDisableAdblock() {
22
- const t = (0, _i18n.useTranslate)();
23
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Paper.default, {
13
+ const t = useTranslate();
14
+ return /*#__PURE__*/_jsxs(Paper, {
24
15
  component: "span",
25
16
  elevation: 0,
26
17
  sx: {
@@ -29,7 +20,7 @@ function PleaseDisableAdblock() {
29
20
  border: '2px solid',
30
21
  borderColor: 'primary.main'
31
22
  },
32
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
23
+ children: [/*#__PURE__*/_jsx(Typography, {
33
24
  variant: "body2",
34
25
  component: "span",
35
26
  gutterBottom: true,
@@ -37,7 +28,7 @@ function PleaseDisableAdblock() {
37
28
  display: 'block'
38
29
  },
39
30
  children: t('likeMui')
40
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
31
+ }), /*#__PURE__*/_jsx(Typography, {
41
32
  variant: "body2",
42
33
  component: "span",
43
34
  gutterBottom: true,
@@ -45,13 +36,13 @@ function PleaseDisableAdblock() {
45
36
  display: 'block'
46
37
  },
47
38
  children: t('adblock')
48
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Typography.default, {
39
+ }), /*#__PURE__*/_jsxs(Typography, {
49
40
  variant: "body2",
50
41
  component: "span",
51
42
  sx: {
52
43
  display: 'block'
53
44
  },
54
- children: [t('thanks'), ' ', /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
45
+ children: [t('thanks'), ' ', /*#__PURE__*/_jsx("span", {
55
46
  role: "img",
56
47
  "aria-label": t('emojiLove'),
57
48
  children: "\u2764\uFE0F"
@@ -118,17 +109,17 @@ class AdErrorBoundary extends React.Component {
118
109
  return children;
119
110
  }
120
111
  }
121
- const AD_MARGIN_TOP = exports.AD_MARGIN_TOP = 3;
122
- const AD_MARGIN_BOTTOM = exports.AD_MARGIN_BOTTOM = 3;
123
- const AD_HEIGHT = exports.AD_HEIGHT = 126;
112
+ export const AD_MARGIN_TOP = 3;
113
+ export const AD_MARGIN_BOTTOM = 3;
114
+ export const AD_HEIGHT = 126;
124
115
  // Add more height on mobile as the text tends to wrap beyond the image height.
125
- const AD_HEIGHT_MOBILE = exports.AD_HEIGHT_MOBILE = 126 + 16;
116
+ export const AD_HEIGHT_MOBILE = 126 + 16;
126
117
 
127
118
  // https://stackoverflow.com/a/20084661
128
119
  function isBot() {
129
120
  return /bot|googlebot|crawler|spider|robot|crawling/i.test(navigator.userAgent);
130
121
  }
131
- function Ad() {
122
+ export function Ad() {
132
123
  const [adblock, setAdblock] = React.useState(null);
133
124
  const [carbonOut, setCarbonOut] = React.useState(null);
134
125
  const {
@@ -141,28 +132,28 @@ function Ad() {
141
132
  let label;
142
133
  // Hide the content to google bot to avoid its indexation.
143
134
  if (typeof window !== 'undefined' && isBot() || disableAd) {
144
- children = _span || (_span = /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {}));
135
+ children = _span || (_span = /*#__PURE__*/_jsx("span", {}));
145
136
  } else if (adblock) {
146
137
  if (randomAdblock < 0.2) {
147
- children = _PleaseDisableAdblock || (_PleaseDisableAdblock = /*#__PURE__*/(0, _jsxRuntime.jsx)(PleaseDisableAdblock, {}));
138
+ children = _PleaseDisableAdblock || (_PleaseDisableAdblock = /*#__PURE__*/_jsx(PleaseDisableAdblock, {}));
148
139
  label = 'in-house-adblock';
149
140
  } else {
150
- children = /*#__PURE__*/(0, _jsxRuntime.jsx)(_AdInHouse.default, {
141
+ children = /*#__PURE__*/_jsx(AdInHouse, {
151
142
  ad: inHouseAds[Math.floor(inHouseAds.length * randomInHouse)]
152
143
  });
153
144
  label = 'in-house';
154
145
  }
155
146
  } else if (carbonOut) {
156
- children = /*#__PURE__*/(0, _jsxRuntime.jsx)(_AdInHouse.default, {
147
+ children = /*#__PURE__*/_jsx(AdInHouse, {
157
148
  ad: inHouseAds[Math.floor(inHouseAds.length * randomInHouse)]
158
149
  });
159
150
  label = 'in-house-carbon';
160
151
  } else {
161
- children = _AdCarbon || (_AdCarbon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_AdCarbon2.default, {}));
152
+ children = _AdCarbon || (_AdCarbon = /*#__PURE__*/_jsx(AdCarbon, {}));
162
153
  label = 'carbon';
163
154
  }
164
- const ad = React.useContext(_AdManager.AdContext);
165
- const eventLabel = label ? `${label}-${ad.placement}-${_AdManager.adShape}` : null;
155
+ const ad = React.useContext(AdContext);
156
+ const eventLabel = label ? `${label}-${ad.placement}-${adShape}` : null;
166
157
  const timerAdblock = React.useRef(undefined);
167
158
  const checkAdblock = React.useCallback((attempt = 1) => {
168
159
  if (document.querySelector('.ea-placement') || document.querySelector('#carbonads') || document.querySelector('.carbonads') || carbonOut) {
@@ -192,7 +183,7 @@ function Ad() {
192
183
  }, [checkAdblock]);
193
184
  const {
194
185
  GADisplayRatio
195
- } = (0, _AdProvider.useAdConfig)();
186
+ } = useAdConfig();
196
187
  React.useEffect(() => {
197
188
  // Avoid an exceed on the Google Analytics quotas.
198
189
  if (Math.random() > (GADisplayRatio ?? 0.1) || !eventLabel) {
@@ -208,7 +199,7 @@ function Ad() {
208
199
  clearTimeout(delay);
209
200
  };
210
201
  }, [GADisplayRatio, eventLabel]);
211
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
202
+ return /*#__PURE__*/_jsx(Box, {
212
203
  component: "span",
213
204
  sx: theme => ({
214
205
  position: 'relative',
@@ -219,8 +210,8 @@ function Ad() {
219
210
  [theme.breakpoints.up('sm')]: {
220
211
  minHeight: AD_HEIGHT
221
212
  },
222
- ...(_AdManager.adShape === 'image' && {}),
223
- ...(_AdManager.adShape === 'inline' && {
213
+ ...(adShape === 'image' && {}),
214
+ ...(adShape === 'inline' && {
224
215
  display: 'flex',
225
216
  alignItems: 'flex-end'
226
217
  })
@@ -228,7 +219,7 @@ function Ad() {
228
219
  "data-ga-event-category": "ad",
229
220
  "data-ga-event-action": "click",
230
221
  "data-ga-event-label": eventLabel,
231
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(AdErrorBoundary, {
222
+ children: /*#__PURE__*/_jsx(AdErrorBoundary, {
232
223
  eventLabel: eventLabel,
233
224
  children: children
234
225
  })
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ export declare function AdCarbonInline(): React.JSX.Element;
3
+ export default function AdCarbon(): React.JSX.Element;
@@ -1,23 +1,14 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.AdCarbonInline = AdCarbonInline;
9
- exports.default = AdCarbon;
10
- var React = _interopRequireWildcard(require("react"));
11
- var _styles = require("@mui/material/styles");
12
- var _loadScript = _interopRequireDefault(require("../utils/loadScript"));
13
- var _AdDisplay = _interopRequireDefault(require("./AdDisplay"));
14
- var _ad = require("./ad.styles");
15
- var _jsxRuntime = require("react/jsx-runtime");
16
1
  var _AdCarbonImage;
17
- const CarbonRoot = (0, _styles.styled)('span')(({
2
+ import * as React from 'react';
3
+ import { styled } from '@mui/material/styles';
4
+ import loadScript from "../utils/loadScript.js";
5
+ import AdDisplay from "./AdDisplay.js";
6
+ import { adBodyImageStyles } from "./ad.styles.js";
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ const CarbonRoot = styled('span')(({
18
9
  theme
19
10
  }) => {
20
- const styles = (0, _ad.adBodyImageStyles)(theme);
11
+ const styles = adBodyImageStyles(theme);
21
12
  return {
22
13
  width: '100%',
23
14
  '& > div': {
@@ -47,18 +38,22 @@ function AdCarbonImage() {
47
38
  //
48
39
  // To solve the issue, for example StrictModel double effect execution, we debounce the load action.
49
40
  const load = setTimeout(() => {
50
- const script = (0, _loadScript.default)('https://cdn.carbonads.com/carbon.js?serve=CKYIL27L&placement=material-uicom', ref.current);
41
+ // The DOM node could have unmounted at this point.
42
+ if (!ref.current) {
43
+ return;
44
+ }
45
+ const script = loadScript('https://cdn.carbonads.com/carbon.js?serve=CKYIL27L&placement=material-uicom', ref.current);
51
46
  script.id = '_carbonads_js';
52
47
  });
53
48
  return () => {
54
49
  clearTimeout(load);
55
50
  };
56
51
  }, []);
57
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(CarbonRoot, {
52
+ return /*#__PURE__*/_jsx(CarbonRoot, {
58
53
  ref: ref
59
54
  });
60
55
  }
61
- function AdCarbonInline() {
56
+ export function AdCarbonInline() {
62
57
  const [ad, setAd] = React.useState(null);
63
58
  React.useEffect(() => {
64
59
  let active = true;
@@ -93,20 +88,20 @@ function AdCarbonInline() {
93
88
  active = false;
94
89
  };
95
90
  }, []);
96
- return ad ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
97
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
91
+ return ad ? /*#__PURE__*/_jsxs(React.Fragment, {
92
+ children: [/*#__PURE__*/_jsx("img", {
98
93
  src: ad.statimp,
99
94
  alt: "",
100
95
  style: {
101
96
  display: 'none'
102
97
  }
103
- }), ad.pixel && ad.pixel.split('||').map((pixel, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
98
+ }), ad.pixel && ad.pixel.split('||').map((pixel, i) => /*#__PURE__*/_jsx("img", {
104
99
  src: `${pixel.replace('[timestamp]', ad.timestamp)}`,
105
100
  style: {
106
101
  display: 'none'
107
102
  },
108
103
  alt: ""
109
- }, i)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AdDisplay.default, {
104
+ }, i)), /*#__PURE__*/_jsx(AdDisplay, {
110
105
  className: "carbonads",
111
106
  shape: "inline",
112
107
  ad: {
@@ -118,12 +113,12 @@ function AdCarbonInline() {
118
113
  label: 'carbon-demo-inline'
119
114
  }
120
115
  })]
121
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
116
+ }) : /*#__PURE__*/_jsx("div", {
122
117
  style: {
123
118
  minHeight: 52
124
119
  }
125
120
  });
126
121
  }
127
- function AdCarbon() {
128
- return _AdCarbonImage || (_AdCarbonImage = /*#__PURE__*/(0, _jsxRuntime.jsx)(AdCarbonImage, {}));
122
+ export default function AdCarbon() {
123
+ return _AdCarbonImage || (_AdCarbonImage = /*#__PURE__*/_jsx(AdCarbonImage, {}));
129
124
  }
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ export interface AdParameters {
3
+ name: string;
4
+ link: string;
5
+ img?: string;
6
+ description: string;
7
+ poweredby: string;
8
+ label: string;
9
+ }
10
+ interface AdDisplayProps {
11
+ ad: AdParameters;
12
+ className?: string;
13
+ shape?: 'auto' | 'inline' | 'image';
14
+ }
15
+ export default function AdDisplay(props: AdDisplayProps): React.JSX.Element;
16
+ export {};
@@ -1,21 +1,14 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = AdDisplay;
8
- var React = _interopRequireWildcard(require("react"));
9
- var _styles = require("@mui/material/styles");
10
- var _i18n = require("../i18n");
11
- var _AdManager = require("./AdManager");
12
- var _ad = require("./ad.styles");
13
- var _AdProvider = require("./AdProvider");
14
- var _jsxRuntime = require("react/jsx-runtime");
15
- const InlineShape = (0, _styles.styled)('span')(({
1
+ import * as React from 'react';
2
+ import { styled } from '@mui/material/styles';
3
+ import { useTranslate } from "../i18n/index.js";
4
+ import { adShape } from "./AdManager.js";
5
+ import { adBodyImageStyles, adBodyInlineStyles } from "./ad.styles.js";
6
+ import { useAdConfig } from "./AdProvider.js";
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ const InlineShape = styled('span')(({
16
9
  theme
17
10
  }) => {
18
- const styles = (0, _ad.adBodyInlineStyles)(theme);
11
+ const styles = adBodyInlineStyles(theme);
19
12
  return {
20
13
  ...styles.root,
21
14
  '& img': styles.img,
@@ -25,10 +18,10 @@ const InlineShape = (0, _styles.styled)('span')(({
25
18
  '& .AdDisplay-poweredby': styles.poweredby
26
19
  };
27
20
  });
28
- const ImageShape = (0, _styles.styled)('span')(({
21
+ const ImageShape = styled('span')(({
29
22
  theme
30
23
  }) => {
31
- const styles = (0, _ad.adBodyImageStyles)(theme);
24
+ const styles = adBodyImageStyles(theme);
32
25
  return {
33
26
  ...styles.root,
34
27
  '& img': styles.img,
@@ -38,16 +31,16 @@ const ImageShape = (0, _styles.styled)('span')(({
38
31
  '& .AdDisplay-poweredby': styles.poweredby
39
32
  };
40
33
  });
41
- function AdDisplay(props) {
34
+ export default function AdDisplay(props) {
42
35
  const {
43
36
  ad,
44
37
  className,
45
38
  shape: shapeProp = 'auto'
46
39
  } = props;
47
- const t = (0, _i18n.useTranslate)();
40
+ const t = useTranslate();
48
41
  const {
49
42
  GADisplayRatio
50
- } = (0, _AdProvider.useAdConfig)();
43
+ } = useAdConfig();
51
44
  React.useEffect(() => {
52
45
  // Avoid an exceed on the Google Analytics quotas.
53
46
  if (Math.random() > (GADisplayRatio ?? 0.1) || !ad.label) {
@@ -58,13 +51,13 @@ function AdDisplay(props) {
58
51
  eventLabel: ad.label
59
52
  });
60
53
  }, [GADisplayRatio, ad.label]);
61
- const shape = shapeProp === 'auto' ? _AdManager.adShape : shapeProp;
54
+ const shape = shapeProp === 'auto' ? adShape : shapeProp;
62
55
  const Root = shape === 'image' ? ImageShape : InlineShape;
63
56
 
64
57
  /* eslint-disable react/no-danger */
65
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Root, {
58
+ return /*#__PURE__*/_jsxs(Root, {
66
59
  className: className,
67
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("a", {
60
+ children: [/*#__PURE__*/_jsxs("a", {
68
61
  href: ad.link,
69
62
  target: "_blank",
70
63
  rel: "noopener sponsored",
@@ -73,21 +66,21 @@ function AdDisplay(props) {
73
66
  'data-ga-event-action': 'click',
74
67
  'data-ga-event-label': ad.label
75
68
  } : {}),
76
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
69
+ children: [/*#__PURE__*/_jsx("span", {
77
70
  className: "AdDisplay-imageWrapper",
78
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
71
+ children: /*#__PURE__*/_jsx("img", {
79
72
  height: "100",
80
73
  width: "130",
81
74
  src: ad.img,
82
75
  alt: ad.name
83
76
  })
84
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
77
+ }), /*#__PURE__*/_jsx("span", {
85
78
  className: "AdDisplay-description",
86
79
  dangerouslySetInnerHTML: {
87
80
  __html: ad.description
88
81
  }
89
82
  })]
90
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
83
+ }), /*#__PURE__*/_jsx("span", {
91
84
  className: "AdDisplay-poweredby",
92
85
  children: t('adPublisher').replace('{{publisher}}', ad.poweredby)
93
86
  })]
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ export interface AdGuestProps {
3
+ /**
4
+ * The querySelector use to target the element which will include the ad.
5
+ */
6
+ classSelector?: string;
7
+ children?: React.ReactNode | undefined;
8
+ }
9
+ declare function AdGuest(props: AdGuestProps): React.JSX.Element | null;
10
+ export { AdGuest };
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ import Portal from '@mui/material/Portal';
3
+ import { AdContext } from "./AdManager.js";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ function AdGuest(props) {
6
+ const {
7
+ classSelector = '.description',
8
+ children
9
+ } = props;
10
+ const ad = React.useContext(AdContext);
11
+ if (!ad.element) {
12
+ return null;
13
+ }
14
+ return /*#__PURE__*/_jsx(Portal, {
15
+ container: () => {
16
+ const element = document.querySelector(classSelector);
17
+ if (element) {
18
+ if (ad.element === element) {
19
+ element.classList.add('ad');
20
+ } else {
21
+ element.classList.remove('ad');
22
+ }
23
+ }
24
+ return ad.element;
25
+ },
26
+ children: children
27
+ });
28
+ }
29
+ export { AdGuest };
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import { AdParameters } from "./AdDisplay.js";
3
+ export default function AdInHouse(props: {
4
+ ad: Omit<AdParameters, 'poweredby' | 'label'>;
5
+ }): React.JSX.Element;
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import AdDisplay from "./AdDisplay.js";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ export default function AdInHouse(props) {
5
+ const {
6
+ ad
7
+ } = props;
8
+ return /*#__PURE__*/_jsx(AdDisplay, {
9
+ ad: {
10
+ poweredby: 'MUI',
11
+ label: `in-house-${ad.name}`,
12
+ ...ad
13
+ }
14
+ });
15
+ }
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ type AdPortal = {
3
+ placement: 'body-top';
4
+ element: Element | null;
5
+ };
6
+ interface AdManagerProps {
7
+ /**
8
+ * The querySelector use to target the element which will include the ad.
9
+ */
10
+ classSelector?: string;
11
+ children?: React.ReactNode | undefined;
12
+ }
13
+ export declare const AdContext: React.Context<AdPortal>;
14
+ export declare const adShape: string;
15
+ export declare function AdManager({
16
+ classSelector,
17
+ children
18
+ }: AdManagerProps): React.JSX.Element;
19
+ export {};
@@ -0,0 +1,36 @@
1
+ import * as React from 'react';
2
+ import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ export const AdContext = /*#__PURE__*/React.createContext({
5
+ placement: 'body-top',
6
+ element: null
7
+ });
8
+
9
+ // Persisted for the whole session.
10
+ // The state is used to use different ad placements.
11
+ const randomSession = Math.random();
12
+
13
+ // Distribution profile:
14
+ // 20% body-inline
15
+ // 80% body-image
16
+ export const adShape = randomSession < 0.2 ? 'inline' : 'image';
17
+ export function AdManager({
18
+ classSelector = '.description',
19
+ children
20
+ }) {
21
+ const [portal, setPortal] = React.useState({
22
+ placement: 'body-top',
23
+ element: null
24
+ });
25
+ useEnhancedEffect(() => {
26
+ const container = document.querySelector(classSelector);
27
+ setPortal({
28
+ placement: 'body-top',
29
+ element: container
30
+ });
31
+ }, [classSelector]);
32
+ return /*#__PURE__*/_jsx(AdContext.Provider, {
33
+ value: portal,
34
+ children: children
35
+ });
36
+ }
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ export interface AdConfig {
3
+ /**
4
+ * The ratio of "ad display" event sent to Google Analytics.
5
+ * Used to avoid an exceed on the Google Analytics quotas.
6
+ * @default 0.1
7
+ */
8
+ GADisplayRatio: number;
9
+ }
10
+ export interface AdProviderProps {
11
+ children: React.ReactNode;
12
+ config?: Partial<AdConfig>;
13
+ }
14
+ export declare function AdProvider(props: AdProviderProps): React.JSX.Element;
15
+ export declare function useAdConfig(): AdConfig;
@@ -0,0 +1,24 @@
1
+ import * as React from 'react';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ const AdConfigContext = /*#__PURE__*/React.createContext(null);
4
+ export function AdProvider(props) {
5
+ const {
6
+ children,
7
+ config
8
+ } = props;
9
+ const value = React.useMemo(() => ({
10
+ GADisplayRatio: 0.1,
11
+ ...config
12
+ }), [config]);
13
+ return /*#__PURE__*/_jsx(AdConfigContext.Provider, {
14
+ value: value,
15
+ children: children
16
+ });
17
+ }
18
+ export function useAdConfig() {
19
+ const config = React.useContext(AdConfigContext);
20
+ if (!config) {
21
+ throw new Error('Could not find docs ad config context value; please ensure the component is wrapped in a <AdProvider>');
22
+ }
23
+ return config;
24
+ }