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

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 (162) 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/Catalog/CatalogTags.js +5 -2
  9. package/lib/components/Filter/variables.js +1 -1
  10. package/lib/components/LanguagePicker/LanguagePicker.js +5 -6
  11. package/lib/components/Link/Link.js +2 -2
  12. package/lib/components/Menu/MenuItem.js +1 -0
  13. package/lib/components/Menu/variables.dark.js +2 -0
  14. package/lib/components/Menu/variables.js +4 -3
  15. package/lib/components/Search/SearchAiMessage.js +9 -6
  16. package/lib/components/SvgViewer/SvgViewer.js +0 -3
  17. package/lib/components/SvgViewer/variables.js +1 -1
  18. package/lib/components/Switch/variables.dark.js +2 -2
  19. package/lib/components/Switch/variables.js +1 -1
  20. package/lib/components/TableOfContent/TableOfContent.js +1 -0
  21. package/lib/components/TableOfContent/variables.js +3 -2
  22. package/lib/components/Toast/Toast.d.ts +14 -0
  23. package/lib/components/Toast/Toast.js +239 -0
  24. package/lib/components/Toast/variables.d.ts +1 -0
  25. package/lib/components/Toast/variables.js +64 -0
  26. package/lib/components/Tooltip/JsTooltip.js +1 -1
  27. package/lib/core/constants/search.d.ts +3 -3
  28. package/lib/core/constants/toast.d.ts +1 -0
  29. package/lib/core/constants/toast.js +5 -0
  30. package/lib/core/contexts/MarkdownLinkContext.d.ts +5 -0
  31. package/lib/core/contexts/MarkdownLinkContext.js +6 -0
  32. package/lib/core/contexts/Toast/ToastContext.d.ts +2 -0
  33. package/lib/core/contexts/Toast/ToastContext.js +6 -0
  34. package/lib/core/contexts/Toast/ToastProvider.d.ts +3 -0
  35. package/lib/core/contexts/Toast/ToastProvider.js +156 -0
  36. package/lib/core/contexts/index.d.ts +3 -0
  37. package/lib/core/contexts/index.js +3 -0
  38. package/lib/core/hooks/index.d.ts +2 -0
  39. package/lib/core/hooks/index.js +2 -0
  40. package/lib/core/hooks/use-toast-logic.d.ts +18 -0
  41. package/lib/core/hooks/use-toast-logic.js +141 -0
  42. package/lib/core/hooks/use-toast.d.ts +11 -0
  43. package/lib/core/hooks/use-toast.js +17 -0
  44. package/lib/core/styles/dark.js +33 -40
  45. package/lib/core/styles/global.js +56 -54
  46. package/lib/core/styles/palette.dark.js +15 -30
  47. package/lib/core/styles/palette.js +130 -134
  48. package/lib/core/types/hooks.d.ts +2 -9
  49. package/lib/core/types/index.d.ts +1 -0
  50. package/lib/core/types/l10n.d.ts +1 -1
  51. package/lib/core/types/search.d.ts +2 -1
  52. package/lib/core/types/toast.d.ts +23 -0
  53. package/lib/core/types/toast.js +3 -0
  54. package/lib/core/utils/get-auto-dismiss-duration.d.ts +2 -0
  55. package/lib/core/utils/get-auto-dismiss-duration.js +15 -0
  56. package/lib/core/utils/index.d.ts +1 -0
  57. package/lib/core/utils/index.js +1 -0
  58. package/lib/icons/CheckboxIcon/CheckboxIcon.js +6 -4
  59. package/lib/icons/CheckboxIcon/variables.dark.js +2 -1
  60. package/lib/icons/CheckboxIcon/variables.js +3 -3
  61. package/lib/icons/IdeaIcon/IdeaIcon.d.ts +9 -0
  62. package/lib/icons/IdeaIcon/IdeaIcon.js +24 -0
  63. package/lib/icons/NewChatIcon/NewChatIcon.d.ts +11 -0
  64. package/lib/icons/NewChatIcon/NewChatIcon.js +25 -0
  65. package/lib/index.d.ts +4 -0
  66. package/lib/index.js +4 -0
  67. package/lib/markdoc/attributes/diagram-file.d.ts +5 -0
  68. package/lib/markdoc/attributes/diagram-file.js +16 -0
  69. package/lib/markdoc/components/Diagram/Diagram.d.ts +15 -0
  70. package/lib/markdoc/components/Diagram/Diagram.js +135 -0
  71. package/lib/markdoc/components/Diagram/variables.d.ts +1 -0
  72. package/lib/markdoc/components/Diagram/variables.js +15 -0
  73. package/lib/markdoc/components/MarkdownLink/MarkdownLink.d.ts +7 -0
  74. package/lib/markdoc/components/MarkdownLink/MarkdownLink.js +61 -0
  75. package/lib/markdoc/components/Tabs/variables.js +3 -3
  76. package/lib/markdoc/components/default.d.ts +2 -2
  77. package/lib/markdoc/components/default.js +2 -2
  78. package/lib/markdoc/default.d.ts +7 -0
  79. package/lib/markdoc/default.js +3 -0
  80. package/lib/markdoc/tags/admonition.js +1 -1
  81. package/lib/markdoc/tags/diagram.d.ts +2 -0
  82. package/lib/markdoc/tags/diagram.js +63 -0
  83. package/package.json +3 -3
  84. package/src/components/Admonition/Admonition.tsx +3 -1
  85. package/src/components/Admonition/variables.dark.ts +3 -0
  86. package/src/components/Admonition/variables.ts +13 -0
  87. package/src/components/Button/variables.dark.ts +2 -2
  88. package/src/components/Button/variables.ts +3 -3
  89. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +3 -1
  90. package/src/components/Catalog/CatalogTags.tsx +6 -1
  91. package/src/components/Filter/variables.ts +1 -1
  92. package/src/components/LanguagePicker/LanguagePicker.tsx +5 -5
  93. package/src/components/Link/Link.tsx +1 -1
  94. package/src/components/Menu/MenuItem.tsx +5 -1
  95. package/src/components/Menu/variables.dark.ts +2 -0
  96. package/src/components/Menu/variables.ts +4 -3
  97. package/src/components/Search/SearchAiMessage.tsx +15 -10
  98. package/src/components/SvgViewer/SvgViewer.tsx +0 -4
  99. package/src/components/SvgViewer/variables.ts +1 -1
  100. package/src/components/Switch/variables.dark.ts +2 -2
  101. package/src/components/Switch/variables.ts +1 -1
  102. package/src/components/TableOfContent/TableOfContent.tsx +1 -0
  103. package/src/components/TableOfContent/variables.ts +3 -2
  104. package/src/components/Toast/Toast.tsx +289 -0
  105. package/src/components/Toast/variables.ts +61 -0
  106. package/src/components/Tooltip/JsTooltip.tsx +1 -1
  107. package/src/core/constants/search.ts +2 -3
  108. package/src/core/constants/toast.ts +1 -0
  109. package/src/core/contexts/MarkdownLinkContext.tsx +9 -0
  110. package/src/core/contexts/Toast/ToastContext.tsx +5 -0
  111. package/src/core/contexts/Toast/ToastProvider.tsx +206 -0
  112. package/src/core/contexts/index.ts +3 -0
  113. package/src/core/hooks/index.ts +2 -0
  114. package/src/core/hooks/use-toast-logic.ts +203 -0
  115. package/src/core/hooks/use-toast.ts +47 -0
  116. package/src/core/styles/dark.ts +5 -12
  117. package/src/core/styles/global.ts +28 -26
  118. package/src/core/styles/palette.dark.ts +15 -30
  119. package/src/core/styles/palette.ts +130 -134
  120. package/src/core/types/hooks.ts +2 -7
  121. package/src/core/types/index.ts +1 -0
  122. package/src/core/types/l10n.ts +9 -9
  123. package/src/core/types/search.ts +2 -1
  124. package/src/core/types/toast.ts +28 -0
  125. package/src/core/utils/get-auto-dismiss-duration.ts +20 -0
  126. package/src/core/utils/index.ts +1 -0
  127. package/src/icons/CheckboxIcon/CheckboxIcon.tsx +26 -17
  128. package/src/icons/CheckboxIcon/variables.dark.ts +2 -1
  129. package/src/icons/CheckboxIcon/variables.ts +3 -3
  130. package/src/icons/IdeaIcon/IdeaIcon.tsx +32 -0
  131. package/src/icons/NewChatIcon/NewChatIcon.tsx +39 -0
  132. package/src/index.ts +4 -0
  133. package/src/markdoc/attributes/diagram-file.ts +9 -0
  134. package/src/markdoc/components/Diagram/Diagram.tsx +173 -0
  135. package/src/markdoc/components/Diagram/variables.ts +12 -0
  136. package/src/markdoc/components/MarkdownLink/MarkdownLink.tsx +21 -0
  137. package/src/markdoc/components/Tabs/variables.ts +3 -3
  138. package/src/markdoc/components/default.ts +2 -2
  139. package/src/markdoc/default.ts +3 -0
  140. package/src/markdoc/tags/admonition.ts +1 -1
  141. package/src/markdoc/tags/diagram.ts +73 -0
  142. package/lib/components/SvgViewer/variables.dark.d.ts +0 -1
  143. package/lib/components/SvgViewer/variables.dark.js +0 -8
  144. package/lib/markdoc/components/ExcalidrawDiagram/ExcalidrawDiagram.d.ts +0 -7
  145. package/lib/markdoc/components/ExcalidrawDiagram/ExcalidrawDiagram.js +0 -95
  146. package/lib/markdoc/components/ExcalidrawDiagram/variables.d.ts +0 -1
  147. package/lib/markdoc/components/ExcalidrawDiagram/variables.dark.d.ts +0 -1
  148. package/lib/markdoc/components/ExcalidrawDiagram/variables.dark.js +0 -8
  149. package/lib/markdoc/components/ExcalidrawDiagram/variables.js +0 -15
  150. package/lib/markdoc/components/Mermaid/Mermaid.d.ts +0 -9
  151. package/lib/markdoc/components/Mermaid/Mermaid.js +0 -96
  152. package/lib/markdoc/components/Mermaid/variables.d.ts +0 -1
  153. package/lib/markdoc/components/Mermaid/variables.dark.d.ts +0 -1
  154. package/lib/markdoc/components/Mermaid/variables.dark.js +0 -8
  155. package/lib/markdoc/components/Mermaid/variables.js +0 -16
  156. package/src/components/SvgViewer/variables.dark.ts +0 -5
  157. package/src/markdoc/components/ExcalidrawDiagram/ExcalidrawDiagram.tsx +0 -85
  158. package/src/markdoc/components/ExcalidrawDiagram/variables.dark.ts +0 -5
  159. package/src/markdoc/components/ExcalidrawDiagram/variables.ts +0 -12
  160. package/src/markdoc/components/Mermaid/Mermaid.tsx +0 -95
  161. package/src/markdoc/components/Mermaid/variables.dark.ts +0 -5
  162. package/src/markdoc/components/Mermaid/variables.ts +0 -13
@@ -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
- `;
@@ -1,95 +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 MermaidProps = {
11
- diagramHtml: string;
12
- 'data-source'?: string;
13
- 'data-hash'?: string;
14
- className?: string;
15
- };
16
-
17
- export function Mermaid({
18
- diagramHtml,
19
- 'data-source': dataSource,
20
- 'data-hash': dataHash,
21
- className,
22
- }: MermaidProps): JSX.Element {
23
- const { useTranslate } = useThemeHooks();
24
- const { translate } = useTranslate();
25
- const [isOpen, setIsOpen] = useState(false);
26
-
27
- const open = () => setIsOpen(true);
28
- const close = () => setIsOpen(false);
29
-
30
- return (
31
- <>
32
- <Wrapper
33
- className={concatClassNames('mermaid-wrapper', className)}
34
- dangerouslySetInnerHTML={{ __html: diagramHtml }}
35
- data-component-name="Markdoc/Mermaid/Mermaid"
36
- data-source={dataSource}
37
- data-hash={dataHash}
38
- onClick={open}
39
- onKeyDown={(e) => e.key === 'Enter' || (e.key === ' ' && open())}
40
- role="button"
41
- tabIndex={0}
42
- aria-label={translate('mermaid.openFullscreen', 'Click to open diagram in fullscreen')}
43
- />
44
- <SvgViewer
45
- isOpen={isOpen}
46
- onClose={close}
47
- labels={{
48
- zoomIn: translate('mermaid.zoomIn', 'Zoom in'),
49
- zoomOut: translate('mermaid.zoomOut', 'Zoom out'),
50
- fitToView: translate('mermaid.reset', 'Fit to view'),
51
- close: translate('mermaid.close', 'Close'),
52
- dialogLabel: translate('mermaid.viewer', 'Mermaid diagram viewer'),
53
- }}
54
- >
55
- <ViewerContent dangerouslySetInnerHTML={{ __html: diagramHtml }} />
56
- </SvgViewer>
57
- </>
58
- );
59
- }
60
-
61
- const Wrapper = styled.div`
62
- background-color: var(--mermaid-bg-color);
63
- border-radius: var(--mermaid-border-radius);
64
- cursor: pointer;
65
- transition: box-shadow 0.2s ease;
66
-
67
- &:hover,
68
- &:focus {
69
- outline: none;
70
- box-shadow: 0 0 0 2px var(--border-color-input-focus);
71
- }
72
-
73
- * {
74
- font-family: var(--mermaid-font-family) !important;
75
- }
76
-
77
- .mermaid > svg {
78
- font-size: var(--font-size-base) !important;
79
- max-width: 100%;
80
- }
81
- `;
82
-
83
- const ViewerContent = styled.div`
84
- background-color: var(--mermaid-bg-color);
85
-
86
- * {
87
- font-family: var(--mermaid-font-family) !important;
88
- }
89
-
90
- .mermaid > svg {
91
- font-size: var(--font-size-base) !important;
92
- display: block;
93
- max-width: none !important;
94
- }
95
- `;
@@ -1,5 +0,0 @@
1
- import { css } from "styled-components";
2
-
3
- export const mermaidDarkMode = css`
4
- --mermaid-bg-color: var(--color-warm-grey-8); // @presenter Color
5
- `;
@@ -1,13 +0,0 @@
1
- import { css } from "styled-components";
2
-
3
- export const mermaid = css`
4
- /**
5
- * @tokens Mermaid
6
- */
7
-
8
- --mermaid-bg-color: var(--bg-color-raised); // @presenter Color
9
- --mermaid-border-radius: var(--border-radius-lg); // @presenter BorderRadius
10
- --mermaid-font-family: var(--font-family-base); // @presenter FontFamily
11
-
12
- // @tokens End
13
- `;