@redocly/theme 0.64.0-next.2 → 0.64.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/lib/components/Admonition/Admonition.d.ts +1 -1
  2. package/lib/components/Admonition/Admonition.js +2 -0
  3. package/lib/components/Admonition/variables.dark.js +3 -0
  4. package/lib/components/Admonition/variables.js +13 -0
  5. package/lib/components/Button/variables.dark.js +2 -2
  6. package/lib/components/Button/variables.js +3 -3
  7. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js +3 -1
  8. package/lib/components/Filter/variables.js +1 -1
  9. package/lib/components/Link/Link.js +2 -2
  10. package/lib/components/Menu/MenuItem.js +1 -0
  11. package/lib/components/Menu/variables.dark.js +2 -0
  12. package/lib/components/Menu/variables.js +4 -3
  13. package/lib/components/SvgViewer/variables.dark.js +1 -1
  14. package/lib/components/Switch/variables.dark.js +2 -2
  15. package/lib/components/Switch/variables.js +1 -1
  16. package/lib/components/TableOfContent/TableOfContent.js +1 -0
  17. package/lib/components/TableOfContent/variables.js +3 -2
  18. package/lib/components/Toast/Toast.d.ts +14 -0
  19. package/lib/components/Toast/Toast.js +239 -0
  20. package/lib/components/Toast/variables.d.ts +1 -0
  21. package/lib/components/Toast/variables.js +64 -0
  22. package/lib/components/Tooltip/JsTooltip.js +1 -1
  23. package/lib/core/constants/toast.d.ts +1 -0
  24. package/lib/core/constants/toast.js +5 -0
  25. package/lib/core/contexts/Toast/ToastContext.d.ts +2 -0
  26. package/lib/core/contexts/Toast/ToastContext.js +6 -0
  27. package/lib/core/contexts/Toast/ToastProvider.d.ts +3 -0
  28. package/lib/core/contexts/Toast/ToastProvider.js +156 -0
  29. package/lib/core/contexts/index.d.ts +2 -0
  30. package/lib/core/contexts/index.js +2 -0
  31. package/lib/core/hooks/index.d.ts +2 -0
  32. package/lib/core/hooks/index.js +2 -0
  33. package/lib/core/hooks/use-toast-logic.d.ts +18 -0
  34. package/lib/core/hooks/use-toast-logic.js +141 -0
  35. package/lib/core/hooks/use-toast.d.ts +11 -0
  36. package/lib/core/hooks/use-toast.js +17 -0
  37. package/lib/core/styles/dark.js +35 -38
  38. package/lib/core/styles/global.js +54 -52
  39. package/lib/core/styles/palette.dark.js +15 -30
  40. package/lib/core/styles/palette.js +130 -134
  41. package/lib/core/types/index.d.ts +1 -0
  42. package/lib/core/types/search.d.ts +1 -0
  43. package/lib/core/types/toast.d.ts +23 -0
  44. package/lib/core/types/toast.js +3 -0
  45. package/lib/core/utils/get-auto-dismiss-duration.d.ts +2 -0
  46. package/lib/core/utils/get-auto-dismiss-duration.js +15 -0
  47. package/lib/core/utils/index.d.ts +1 -0
  48. package/lib/core/utils/index.js +1 -0
  49. package/lib/icons/CheckboxIcon/CheckboxIcon.js +6 -4
  50. package/lib/icons/CheckboxIcon/variables.dark.js +2 -1
  51. package/lib/icons/CheckboxIcon/variables.js +3 -3
  52. package/lib/icons/IdeaIcon/IdeaIcon.d.ts +9 -0
  53. package/lib/icons/IdeaIcon/IdeaIcon.js +24 -0
  54. package/lib/icons/NewChatIcon/NewChatIcon.d.ts +11 -0
  55. package/lib/icons/NewChatIcon/NewChatIcon.js +25 -0
  56. package/lib/index.d.ts +4 -0
  57. package/lib/index.js +4 -0
  58. package/lib/markdoc/components/Mermaid/Mermaid.js +0 -2
  59. package/lib/markdoc/components/Tabs/variables.js +3 -3
  60. package/lib/markdoc/components/default.d.ts +0 -1
  61. package/lib/markdoc/components/default.js +0 -1
  62. package/lib/markdoc/tags/admonition.js +1 -1
  63. package/package.json +2 -2
  64. package/src/components/Admonition/Admonition.tsx +3 -1
  65. package/src/components/Admonition/variables.dark.ts +3 -0
  66. package/src/components/Admonition/variables.ts +13 -0
  67. package/src/components/Button/variables.dark.ts +2 -2
  68. package/src/components/Button/variables.ts +3 -3
  69. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +3 -1
  70. package/src/components/Filter/variables.ts +1 -1
  71. package/src/components/Link/Link.tsx +1 -1
  72. package/src/components/Menu/MenuItem.tsx +5 -1
  73. package/src/components/Menu/variables.dark.ts +2 -0
  74. package/src/components/Menu/variables.ts +4 -3
  75. package/src/components/SvgViewer/variables.dark.ts +1 -1
  76. package/src/components/Switch/variables.dark.ts +2 -2
  77. package/src/components/Switch/variables.ts +1 -1
  78. package/src/components/TableOfContent/TableOfContent.tsx +1 -0
  79. package/src/components/TableOfContent/variables.ts +3 -2
  80. package/src/components/Toast/Toast.tsx +289 -0
  81. package/src/components/Toast/variables.ts +61 -0
  82. package/src/components/Tooltip/JsTooltip.tsx +1 -1
  83. package/src/core/constants/toast.ts +1 -0
  84. package/src/core/contexts/Toast/ToastContext.tsx +5 -0
  85. package/src/core/contexts/Toast/ToastProvider.tsx +206 -0
  86. package/src/core/contexts/index.ts +2 -0
  87. package/src/core/hooks/index.ts +2 -0
  88. package/src/core/hooks/use-toast-logic.ts +203 -0
  89. package/src/core/hooks/use-toast.ts +47 -0
  90. package/src/core/styles/dark.ts +5 -8
  91. package/src/core/styles/global.ts +26 -24
  92. package/src/core/styles/palette.dark.ts +15 -30
  93. package/src/core/styles/palette.ts +130 -134
  94. package/src/core/types/index.ts +1 -0
  95. package/src/core/types/search.ts +1 -0
  96. package/src/core/types/toast.ts +28 -0
  97. package/src/core/utils/get-auto-dismiss-duration.ts +20 -0
  98. package/src/core/utils/index.ts +1 -0
  99. package/src/icons/CheckboxIcon/CheckboxIcon.tsx +26 -17
  100. package/src/icons/CheckboxIcon/variables.dark.ts +2 -1
  101. package/src/icons/CheckboxIcon/variables.ts +3 -3
  102. package/src/icons/IdeaIcon/IdeaIcon.tsx +32 -0
  103. package/src/icons/NewChatIcon/NewChatIcon.tsx +39 -0
  104. package/src/index.ts +4 -0
  105. package/src/markdoc/components/Mermaid/Mermaid.tsx +0 -2
  106. package/src/markdoc/components/Tabs/variables.ts +3 -3
  107. package/src/markdoc/components/default.ts +0 -1
  108. package/src/markdoc/tags/admonition.ts +1 -1
  109. package/lib/markdoc/components/ExcalidrawDiagram/ExcalidrawDiagram.d.ts +0 -7
  110. package/lib/markdoc/components/ExcalidrawDiagram/ExcalidrawDiagram.js +0 -95
  111. package/lib/markdoc/components/ExcalidrawDiagram/variables.d.ts +0 -1
  112. package/lib/markdoc/components/ExcalidrawDiagram/variables.dark.d.ts +0 -1
  113. package/lib/markdoc/components/ExcalidrawDiagram/variables.dark.js +0 -8
  114. package/lib/markdoc/components/ExcalidrawDiagram/variables.js +0 -15
  115. package/src/markdoc/components/ExcalidrawDiagram/ExcalidrawDiagram.tsx +0 -85
  116. package/src/markdoc/components/ExcalidrawDiagram/variables.dark.ts +0 -5
  117. package/src/markdoc/components/ExcalidrawDiagram/variables.ts +0 -12
@@ -1,95 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.ExcalidrawDiagram = ExcalidrawDiagram;
40
- const react_1 = __importStar(require("react"));
41
- const styled_components_1 = __importDefault(require("styled-components"));
42
- const utils_1 = require("../../../core/utils");
43
- const hooks_1 = require("../../../core/hooks");
44
- const SvgViewer_1 = require("../../../components/SvgViewer/SvgViewer");
45
- function ExcalidrawDiagram({ diagramHtml, className }) {
46
- const { useTranslate } = (0, hooks_1.useThemeHooks)();
47
- const { translate } = useTranslate();
48
- const [isOpen, setIsOpen] = (0, react_1.useState)(false);
49
- const open = () => setIsOpen(true);
50
- const close = () => setIsOpen(false);
51
- return (react_1.default.createElement(react_1.default.Fragment, null,
52
- react_1.default.createElement(Wrapper, { className: (0, utils_1.concatClassNames)('excalidraw-wrapper', className), dangerouslySetInnerHTML: { __html: diagramHtml }, "data-component-name": "Markdoc/ExcalidrawDiagram/ExcalidrawDiagram", onClick: open, onKeyDown: (e) => (e.key === 'Enter' || e.key === ' ') && open(), role: "button", tabIndex: 0, "aria-label": translate('excalidraw.openFullscreen', 'Click to open diagram in fullscreen') }),
53
- react_1.default.createElement(SvgViewer_1.SvgViewer, { isOpen: isOpen, onClose: close, labels: {
54
- zoomIn: translate('excalidraw.zoomIn', 'Zoom in'),
55
- zoomOut: translate('excalidraw.zoomOut', 'Zoom out'),
56
- fitToView: translate('excalidraw.reset', 'Fit to view'),
57
- close: translate('excalidraw.close', 'Close'),
58
- dialogLabel: translate('excalidraw.viewer', 'Excalidraw diagram viewer'),
59
- } },
60
- react_1.default.createElement(ViewerContent, { dangerouslySetInnerHTML: { __html: diagramHtml } }))));
61
- }
62
- const Wrapper = styled_components_1.default.div `
63
- background-color: var(--excalidraw-bg-color);
64
- border-radius: var(--excalidraw-border-radius);
65
- cursor: pointer;
66
- transition: box-shadow 0.2s ease;
67
- overflow: hidden;
68
-
69
- &:hover,
70
- &:focus {
71
- outline: none;
72
- box-shadow: 0 0 0 2px var(--border-color-input-focus);
73
- }
74
-
75
- svg {
76
- max-width: 100%;
77
- height: auto;
78
- display: block;
79
-
80
- > rect {
81
- fill: var(--excalidraw-bg-color);
82
- }
83
- }
84
-
85
- & + & {
86
- margin-top: var(--spacing-md);
87
- }
88
- `;
89
- const ViewerContent = styled_components_1.default.div `
90
- svg {
91
- display: block;
92
- max-width: none !important;
93
- }
94
- `;
95
- //# sourceMappingURL=ExcalidrawDiagram.js.map
@@ -1 +0,0 @@
1
- export declare const excalidraw: import("styled-components").FlattenSimpleInterpolation;
@@ -1 +0,0 @@
1
- export declare const excalidrawDarkMode: import("styled-components").FlattenSimpleInterpolation;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.excalidrawDarkMode = void 0;
4
- const styled_components_1 = require("styled-components");
5
- exports.excalidrawDarkMode = (0, styled_components_1.css) `
6
- --excalidraw-bg-color: var(--bg-color); // @presenter Color
7
- `;
8
- //# sourceMappingURL=variables.dark.js.map
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.excalidraw = void 0;
4
- const styled_components_1 = require("styled-components");
5
- exports.excalidraw = (0, styled_components_1.css) `
6
- /**
7
- * @tokens Excalidraw
8
- */
9
-
10
- --excalidraw-bg-color: var(--bg-color); // @presenter Color
11
- --excalidraw-border-radius: var(--border-radius-lg); // @presenter BorderRadius
12
-
13
- // @tokens End
14
- `;
15
- //# sourceMappingURL=variables.js.map
@@ -1,85 +0,0 @@
1
- import React, { useState } from 'react';
2
- import styled from 'styled-components';
3
-
4
- import type { JSX } from 'react';
5
-
6
- import { concatClassNames } from '@redocly/theme/core/utils';
7
- import { useThemeHooks } from '@redocly/theme/core/hooks';
8
- import { SvgViewer } from '@redocly/theme/components/SvgViewer/SvgViewer';
9
-
10
- type ExcalidrawDiagramProps = {
11
- diagramHtml: string;
12
- className?: string;
13
- };
14
-
15
- export function ExcalidrawDiagram({ diagramHtml, className }: ExcalidrawDiagramProps): JSX.Element {
16
- const { useTranslate } = useThemeHooks();
17
- const { translate } = useTranslate();
18
- const [isOpen, setIsOpen] = useState(false);
19
-
20
- const open = () => setIsOpen(true);
21
- const close = () => setIsOpen(false);
22
-
23
- return (
24
- <>
25
- <Wrapper
26
- className={concatClassNames('excalidraw-wrapper', className)}
27
- dangerouslySetInnerHTML={{ __html: diagramHtml }}
28
- data-component-name="Markdoc/ExcalidrawDiagram/ExcalidrawDiagram"
29
- onClick={open}
30
- onKeyDown={(e) => (e.key === 'Enter' || e.key === ' ') && open()}
31
- role="button"
32
- tabIndex={0}
33
- aria-label={translate('excalidraw.openFullscreen', 'Click to open diagram in fullscreen')}
34
- />
35
- <SvgViewer
36
- isOpen={isOpen}
37
- onClose={close}
38
- labels={{
39
- zoomIn: translate('excalidraw.zoomIn', 'Zoom in'),
40
- zoomOut: translate('excalidraw.zoomOut', 'Zoom out'),
41
- fitToView: translate('excalidraw.reset', 'Fit to view'),
42
- close: translate('excalidraw.close', 'Close'),
43
- dialogLabel: translate('excalidraw.viewer', 'Excalidraw diagram viewer'),
44
- }}
45
- >
46
- <ViewerContent dangerouslySetInnerHTML={{ __html: diagramHtml }} />
47
- </SvgViewer>
48
- </>
49
- );
50
- }
51
-
52
- const Wrapper = styled.div`
53
- background-color: var(--excalidraw-bg-color);
54
- border-radius: var(--excalidraw-border-radius);
55
- cursor: pointer;
56
- transition: box-shadow 0.2s ease;
57
- overflow: hidden;
58
-
59
- &:hover,
60
- &:focus {
61
- outline: none;
62
- box-shadow: 0 0 0 2px var(--border-color-input-focus);
63
- }
64
-
65
- svg {
66
- max-width: 100%;
67
- height: auto;
68
- display: block;
69
-
70
- > rect {
71
- fill: var(--excalidraw-bg-color);
72
- }
73
- }
74
-
75
- & + & {
76
- margin-top: var(--spacing-md);
77
- }
78
- `;
79
-
80
- const ViewerContent = styled.div`
81
- svg {
82
- display: block;
83
- max-width: none !important;
84
- }
85
- `;
@@ -1,5 +0,0 @@
1
- import { css } from "styled-components";
2
-
3
- export const excalidrawDarkMode = css`
4
- --excalidraw-bg-color: var(--bg-color); // @presenter Color
5
- `;
@@ -1,12 +0,0 @@
1
- import { css } from "styled-components";
2
-
3
- export const excalidraw = css`
4
- /**
5
- * @tokens Excalidraw
6
- */
7
-
8
- --excalidraw-bg-color: var(--bg-color); // @presenter Color
9
- --excalidraw-border-radius: var(--border-radius-lg); // @presenter BorderRadius
10
-
11
- // @tokens End
12
- `;