@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.
- package/lib/components/Admonition/Admonition.d.ts +1 -1
- package/lib/components/Admonition/Admonition.js +2 -0
- package/lib/components/Admonition/variables.dark.js +3 -0
- package/lib/components/Admonition/variables.js +13 -0
- package/lib/components/Button/variables.dark.js +2 -2
- package/lib/components/Button/variables.js +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js +3 -1
- package/lib/components/Filter/variables.js +1 -1
- package/lib/components/Link/Link.js +2 -2
- package/lib/components/Menu/MenuItem.js +1 -0
- package/lib/components/Menu/variables.dark.js +2 -0
- package/lib/components/Menu/variables.js +4 -3
- package/lib/components/SvgViewer/variables.dark.js +1 -1
- package/lib/components/Switch/variables.dark.js +2 -2
- package/lib/components/Switch/variables.js +1 -1
- package/lib/components/TableOfContent/TableOfContent.js +1 -0
- package/lib/components/TableOfContent/variables.js +3 -2
- package/lib/components/Toast/Toast.d.ts +14 -0
- package/lib/components/Toast/Toast.js +239 -0
- package/lib/components/Toast/variables.d.ts +1 -0
- package/lib/components/Toast/variables.js +64 -0
- package/lib/components/Tooltip/JsTooltip.js +1 -1
- package/lib/core/constants/toast.d.ts +1 -0
- package/lib/core/constants/toast.js +5 -0
- package/lib/core/contexts/Toast/ToastContext.d.ts +2 -0
- package/lib/core/contexts/Toast/ToastContext.js +6 -0
- package/lib/core/contexts/Toast/ToastProvider.d.ts +3 -0
- package/lib/core/contexts/Toast/ToastProvider.js +156 -0
- package/lib/core/contexts/index.d.ts +2 -0
- package/lib/core/contexts/index.js +2 -0
- package/lib/core/hooks/index.d.ts +2 -0
- package/lib/core/hooks/index.js +2 -0
- package/lib/core/hooks/use-toast-logic.d.ts +18 -0
- package/lib/core/hooks/use-toast-logic.js +141 -0
- package/lib/core/hooks/use-toast.d.ts +11 -0
- package/lib/core/hooks/use-toast.js +17 -0
- package/lib/core/styles/dark.js +35 -38
- package/lib/core/styles/global.js +54 -52
- package/lib/core/styles/palette.dark.js +15 -30
- package/lib/core/styles/palette.js +130 -134
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/search.d.ts +1 -0
- package/lib/core/types/toast.d.ts +23 -0
- package/lib/core/types/toast.js +3 -0
- package/lib/core/utils/get-auto-dismiss-duration.d.ts +2 -0
- package/lib/core/utils/get-auto-dismiss-duration.js +15 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/icons/CheckboxIcon/CheckboxIcon.js +6 -4
- package/lib/icons/CheckboxIcon/variables.dark.js +2 -1
- package/lib/icons/CheckboxIcon/variables.js +3 -3
- package/lib/icons/IdeaIcon/IdeaIcon.d.ts +9 -0
- package/lib/icons/IdeaIcon/IdeaIcon.js +24 -0
- package/lib/icons/NewChatIcon/NewChatIcon.d.ts +11 -0
- package/lib/icons/NewChatIcon/NewChatIcon.js +25 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +4 -0
- package/lib/markdoc/components/Mermaid/Mermaid.js +0 -2
- package/lib/markdoc/components/Tabs/variables.js +3 -3
- package/lib/markdoc/components/default.d.ts +0 -1
- package/lib/markdoc/components/default.js +0 -1
- package/lib/markdoc/tags/admonition.js +1 -1
- package/package.json +2 -2
- package/src/components/Admonition/Admonition.tsx +3 -1
- package/src/components/Admonition/variables.dark.ts +3 -0
- package/src/components/Admonition/variables.ts +13 -0
- package/src/components/Button/variables.dark.ts +2 -2
- package/src/components/Button/variables.ts +3 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +3 -1
- package/src/components/Filter/variables.ts +1 -1
- package/src/components/Link/Link.tsx +1 -1
- package/src/components/Menu/MenuItem.tsx +5 -1
- package/src/components/Menu/variables.dark.ts +2 -0
- package/src/components/Menu/variables.ts +4 -3
- package/src/components/SvgViewer/variables.dark.ts +1 -1
- package/src/components/Switch/variables.dark.ts +2 -2
- package/src/components/Switch/variables.ts +1 -1
- package/src/components/TableOfContent/TableOfContent.tsx +1 -0
- package/src/components/TableOfContent/variables.ts +3 -2
- package/src/components/Toast/Toast.tsx +289 -0
- package/src/components/Toast/variables.ts +61 -0
- package/src/components/Tooltip/JsTooltip.tsx +1 -1
- package/src/core/constants/toast.ts +1 -0
- package/src/core/contexts/Toast/ToastContext.tsx +5 -0
- package/src/core/contexts/Toast/ToastProvider.tsx +206 -0
- package/src/core/contexts/index.ts +2 -0
- package/src/core/hooks/index.ts +2 -0
- package/src/core/hooks/use-toast-logic.ts +203 -0
- package/src/core/hooks/use-toast.ts +47 -0
- package/src/core/styles/dark.ts +5 -8
- package/src/core/styles/global.ts +26 -24
- package/src/core/styles/palette.dark.ts +15 -30
- package/src/core/styles/palette.ts +130 -134
- package/src/core/types/index.ts +1 -0
- package/src/core/types/search.ts +1 -0
- package/src/core/types/toast.ts +28 -0
- package/src/core/utils/get-auto-dismiss-duration.ts +20 -0
- package/src/core/utils/index.ts +1 -0
- package/src/icons/CheckboxIcon/CheckboxIcon.tsx +26 -17
- package/src/icons/CheckboxIcon/variables.dark.ts +2 -1
- package/src/icons/CheckboxIcon/variables.ts +3 -3
- package/src/icons/IdeaIcon/IdeaIcon.tsx +32 -0
- package/src/icons/NewChatIcon/NewChatIcon.tsx +39 -0
- package/src/index.ts +4 -0
- package/src/markdoc/components/Mermaid/Mermaid.tsx +0 -2
- package/src/markdoc/components/Tabs/variables.ts +3 -3
- package/src/markdoc/components/default.ts +0 -1
- package/src/markdoc/tags/admonition.ts +1 -1
- package/lib/markdoc/components/ExcalidrawDiagram/ExcalidrawDiagram.d.ts +0 -7
- package/lib/markdoc/components/ExcalidrawDiagram/ExcalidrawDiagram.js +0 -95
- package/lib/markdoc/components/ExcalidrawDiagram/variables.d.ts +0 -1
- package/lib/markdoc/components/ExcalidrawDiagram/variables.dark.d.ts +0 -1
- package/lib/markdoc/components/ExcalidrawDiagram/variables.dark.js +0 -8
- package/lib/markdoc/components/ExcalidrawDiagram/variables.js +0 -15
- package/src/markdoc/components/ExcalidrawDiagram/ExcalidrawDiagram.tsx +0 -85
- package/src/markdoc/components/ExcalidrawDiagram/variables.dark.ts +0 -5
- package/src/markdoc/components/ExcalidrawDiagram/variables.ts +0 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { JSX } from 'react';
|
|
3
3
|
type AdmonitionTypeProps = {
|
|
4
|
-
type: 'warning' | 'success' | 'danger' | 'info';
|
|
4
|
+
type: 'warning' | 'success' | 'danger' | 'info' | 'default';
|
|
5
5
|
};
|
|
6
6
|
export type AdmonitionProps = Partial<AdmonitionTypeProps> & {
|
|
7
7
|
name?: string;
|
|
@@ -43,11 +43,13 @@ const WarningCycleIcon_1 = require("../../icons/WarningCycleIcon/WarningCycleIco
|
|
|
43
43
|
const CheckmarkOutlineIcon_1 = require("../../icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon");
|
|
44
44
|
const ErrorIcon_1 = require("../../icons/ErrorIcon/ErrorIcon");
|
|
45
45
|
const InformationIcon_1 = require("../../icons/InformationIcon/InformationIcon");
|
|
46
|
+
const IdeaIcon_1 = require("../../icons/IdeaIcon/IdeaIcon");
|
|
46
47
|
const IconsMap = {
|
|
47
48
|
warning: WarningCycleIcon_1.WarningCycleIcon,
|
|
48
49
|
success: CheckmarkOutlineIcon_1.CheckmarkOutlineIcon,
|
|
49
50
|
danger: ErrorIcon_1.ErrorIcon,
|
|
50
51
|
info: InformationIcon_1.InformationIcon,
|
|
52
|
+
default: IdeaIcon_1.IdeaIcon,
|
|
51
53
|
};
|
|
52
54
|
function Admonition({ type = 'info', name, children, className, 'data-source': dataSource, 'data-hash': dataHash, }) {
|
|
53
55
|
const Icon = IconsMap[type] || IconsMap['info'];
|
|
@@ -14,5 +14,8 @@ exports.admonitionDarkMode = (0, styled_components_1.css) `
|
|
|
14
14
|
|
|
15
15
|
--admonition-success-bg-color: color-mix(in srgb, var(--color-green-1) 40%, transparent); // @presenter Color
|
|
16
16
|
--admonition-success-border: var(--admonition-border-width) var(--admonition-border-style) color-mix(in srgb, var(--color-green-3) 40%, transparent); // @presenter Border
|
|
17
|
+
|
|
18
|
+
--admonition-default-bg-color: color-mix(in srgb, var(--color-primary-bg, var(--admonition-default-bg-color-legacy)) 40%, transparent); // @presenter Color
|
|
19
|
+
--admonition-default-border: var(--admonition-border-width) var(--admonition-border-style) color-mix(in srgb, var(--color-primary-border, var(--admonition-default-border-color-legacy)) 40%, transparent); // @presenter Border
|
|
17
20
|
`;
|
|
18
21
|
//# sourceMappingURL=variables.dark.js.map
|
|
@@ -91,6 +91,19 @@ exports.admonition = (0, styled_components_1.css) `
|
|
|
91
91
|
--admonition-success-border-width: var(--admonition-border-width); // @presenter Color
|
|
92
92
|
--admonition-success-border: var(--admonition-success-border-width) var(--admonition-success-border-style) var(--admonition-success-border-color); // @presenter Border
|
|
93
93
|
|
|
94
|
+
/**
|
|
95
|
+
* @tokens Admonition type primary
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
--admonition-default-bg-color: var(--color-primary-bg, var(--admonition-default-bg-color-legacy)); // @presenter Color
|
|
99
|
+
--admonition-default-text-color: var(--admonition-heading-text-color); // @presenter Color
|
|
100
|
+
--admonition-default-heading-text-color: var(--admonition-heading-text-color); // @presenter Color
|
|
101
|
+
--admonition-default-icon-color: var(--color-primary-base, var(--admonition-default-icon-color-legacy)); // @presenter Color
|
|
102
|
+
--admonition-default-border-color: var(--color-primary-border, var(--admonition-default-border-color-legacy)); // @presenter Color
|
|
103
|
+
--admonition-default-border-style: var(--admonition-border-style); // @presenter Color
|
|
104
|
+
--admonition-default-border-width: var(--admonition-border-width); // @presenter Color
|
|
105
|
+
--admonition-default-border: var(--admonition-default-border-width) var(--admonition-default-border-style) var(--admonition-default-border-color); // @presenter Border
|
|
106
|
+
|
|
94
107
|
// @tokens End
|
|
95
108
|
`;
|
|
96
109
|
//# sourceMappingURL=variables.js.map
|
|
@@ -19,8 +19,8 @@ exports.buttonDarkMode = (0, styled_components_1.css) `
|
|
|
19
19
|
--button-bg-color-secondary-hover: var(--color-warm-grey-5);
|
|
20
20
|
--button-bg-color-secondary-pressed: var(--color-warm-grey-6);
|
|
21
21
|
--button-bg-color-secondary-danger-pressed: var(--color-raspberry-9);
|
|
22
|
-
--button-bg-color-primary-hover: var(--color-
|
|
23
|
-
--button-bg-color-primary-pressed: var(--color-
|
|
22
|
+
--button-bg-color-primary-hover: var(--color-primary-hover, var(--button-bg-color-primary-hover-legacy));
|
|
23
|
+
--button-bg-color-primary-pressed: var(--color-primary-active, var(--button-bg-color-primary-pressed-legacy));
|
|
24
24
|
--button-bg-color-primary-danger-hover: var(--color-raspberry-5);
|
|
25
25
|
--button-bg-color-primary-danger-pressed: var(--color-raspberry-4);
|
|
26
26
|
--button-bg-color-disabled: var(--color-warm-grey-3);
|
|
@@ -26,9 +26,9 @@ exports.button = (0, styled_components_1.css) `
|
|
|
26
26
|
--button-content-color-primary-hover: var(--color-blue-7); // @presenter Color
|
|
27
27
|
--button-content-color-primary-pressed: var(--color-blue-8); // @presenter Color
|
|
28
28
|
|
|
29
|
-
--button-bg-color-primary: var(--color-
|
|
30
|
-
--button-bg-color-primary-hover: var(--color-
|
|
31
|
-
--button-bg-color-primary-pressed: var(--color-
|
|
29
|
+
--button-bg-color-primary: var(--color-primary-base, var(--button-bg-color-primary-legacy)); // @presenter Color
|
|
30
|
+
--button-bg-color-primary-hover: var(--color-primary-hover, var(--button-bg-color-primary-hover-legacy)); // @presenter Color
|
|
31
|
+
--button-bg-color-primary-pressed: var(--color-primary-active, var(--button-bg-color-primary-pressed-legacy)); // @presenter Color
|
|
32
32
|
|
|
33
33
|
--button-bg-color-primary-danger: var(--color-raspberry-6); // @presenter Color
|
|
34
34
|
--button-bg-color-primary-danger-hover: var(--color-raspberry-7); // @presenter Color
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js
CHANGED
|
@@ -130,7 +130,9 @@ const VersionIcon = styled_components_1.default.div `
|
|
|
130
130
|
height: var(--catalog-history-sidebar-version-icon-size);
|
|
131
131
|
flex-shrink: 0;
|
|
132
132
|
border-radius: 50%;
|
|
133
|
-
background-color: ${({ $isCurrent }) => $isCurrent
|
|
133
|
+
background-color: ${({ $isCurrent }) => $isCurrent
|
|
134
|
+
? 'var(--color-primary-base, var(--color-blueberry-6))'
|
|
135
|
+
: 'var(--catalog-avatar-bg-color)'};
|
|
134
136
|
transition: background-color 0.2s ease;
|
|
135
137
|
margin-right: var(--catalog-history-sidebar-version-icon-margin-right);
|
|
136
138
|
|
|
@@ -24,7 +24,7 @@ exports.filter = (0, styled_components_1.css) `
|
|
|
24
24
|
--filter-option-margin: 0;
|
|
25
25
|
|
|
26
26
|
--filter-option-label-font-size: var(--font-size-base);
|
|
27
|
-
--filter-option-label-color: var(--text-color-
|
|
27
|
+
--filter-option-label-color: var(--text-color-primary);
|
|
28
28
|
|
|
29
29
|
--filter-option-checkbox-padding-left: var(--spacing-xs);
|
|
30
30
|
|
|
@@ -48,9 +48,9 @@ exports.Link = Link;
|
|
|
48
48
|
const React = __importStar(require("react"));
|
|
49
49
|
const react_1 = require("react");
|
|
50
50
|
const react_router_dom_1 = require("react-router-dom");
|
|
51
|
-
const
|
|
51
|
+
const ThemeDataContext_1 = require("../../core/contexts/ThemeDataContext");
|
|
52
52
|
function Link(props) {
|
|
53
|
-
const context = (0, react_1.useContext)(
|
|
53
|
+
const context = (0, react_1.useContext)(ThemeDataContext_1.ThemeDataContext);
|
|
54
54
|
if (context === null || context === void 0 ? void 0 : context.components) {
|
|
55
55
|
const { LinkComponent } = context.components;
|
|
56
56
|
return React.createElement(LinkComponent, Object.assign({}, props));
|
|
@@ -200,6 +200,7 @@ const MenuItemLabelWrapper = styled_components_1.default.li `
|
|
|
200
200
|
(0, styled_components_1.css) `
|
|
201
201
|
color: ${deprecated ? 'var(--menu-content-color-disabled)' : 'var(--menu-item-color-active)'};
|
|
202
202
|
background-color: var(--menu-item-bg-color-active);
|
|
203
|
+
font-weight: var(--menu-item-font-weight-active);
|
|
203
204
|
|
|
204
205
|
${ChevronDownIcon_1.ChevronDownIcon} path {
|
|
205
206
|
fill: var(--menu-item-color-active);
|
|
@@ -7,5 +7,7 @@ exports.menuDarkMode = (0, styled_components_1.css) `
|
|
|
7
7
|
--menu-content-title-color: var(--text-color-secondary); // @presenter Color
|
|
8
8
|
--menu-content-color-active: var(--text-color-primary); // @presenter Color
|
|
9
9
|
--menu-content-color-disabled: var(--text-color-disabled); // @presenter Color
|
|
10
|
+
|
|
11
|
+
--menu-item-bg-color-active: var(--color-primary-bg, var(--menu-item-bg-color-active-legacy)); // @presenter Color
|
|
10
12
|
`;
|
|
11
13
|
//# sourceMappingURL=variables.dark.js.map
|
|
@@ -21,6 +21,7 @@ exports.menu = (0, styled_components_1.css) `
|
|
|
21
21
|
--menu-item-font-family: var(--sidebar-font-family); // @presenter FontFamily
|
|
22
22
|
--menu-item-font-size: var(--sidebar-font-size); // @presenter FontSize
|
|
23
23
|
--menu-item-font-weight: var(--font-weight-regular); // @presenter FontSize
|
|
24
|
+
--menu-item-font-weight-active: var(--font-weight-medium); // @presenter FontWeight
|
|
24
25
|
--menu-item-line-height: var(--line-height-base); // @presenter LineHeight
|
|
25
26
|
|
|
26
27
|
/**
|
|
@@ -30,11 +31,11 @@ exports.menu = (0, styled_components_1.css) `
|
|
|
30
31
|
--menu-item-text-color: var(--sidebar-text-color); // @presenter Color
|
|
31
32
|
--menu-item-bg-color: transparent; // @presenter Color
|
|
32
33
|
--menu-item-bg-color-hover: var(--color-hover-base); // @presenter Color
|
|
33
|
-
--menu-item-bg-color-active: var(--
|
|
34
|
+
--menu-item-bg-color-active: var(--color-primary-bg, var(--menu-item-bg-color-active-legacy)); // @presenter Color
|
|
34
35
|
|
|
35
36
|
--menu-item-color-hover: var(--tree-content-color-hover); // @presenter Color
|
|
36
|
-
--menu-item-color-active: var(--
|
|
37
|
-
|
|
37
|
+
--menu-item-color-active: var(--color-primary-text, var(--menu-item-color-active-legacy)); // @presenter Color
|
|
38
|
+
|
|
38
39
|
/**
|
|
39
40
|
* @tokens Menu item spacing
|
|
40
41
|
* @presenter Spacing
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.svgViewerDarkMode = void 0;
|
|
4
4
|
const styled_components_1 = require("styled-components");
|
|
5
5
|
exports.svgViewerDarkMode = (0, styled_components_1.css) `
|
|
6
|
-
--svg-viewer-bg-color: var(--color-warm-grey-
|
|
6
|
+
--svg-viewer-bg-color: var(--color-warm-grey-9);
|
|
7
7
|
`;
|
|
8
8
|
//# sourceMappingURL=variables.dark.js.map
|
|
@@ -4,7 +4,7 @@ exports.switcherDarkMode = void 0;
|
|
|
4
4
|
const styled_components_1 = require("styled-components");
|
|
5
5
|
exports.switcherDarkMode = (0, styled_components_1.css) `
|
|
6
6
|
--switch-bg-color: transparent; // @presenter Color
|
|
7
|
-
--switch-bg-color-selected: var(--color-
|
|
7
|
+
--switch-bg-color-selected: var(--color-primary-base, var(--switch-bg-color-selected-legacy)); // @presenter Color
|
|
8
8
|
--switch-bg-color-hover: transparent; // @presenter Color
|
|
9
9
|
--switch-bg-color-pressed: transparent; // @presenter Color
|
|
10
10
|
--switch-bg-color-disabled: transparent; // @presenter Color
|
|
@@ -14,7 +14,7 @@ exports.switcherDarkMode = (0, styled_components_1.css) `
|
|
|
14
14
|
--switch-border-color-hover: var(--color-warm-grey-7); // @presenter Color
|
|
15
15
|
--switch-border-color-pressed: var(--color-warm-grey-8); // @presenter Color
|
|
16
16
|
--switch-border-color-disabled: var(--color-warm-grey-5); // @presenter Color
|
|
17
|
-
--switch-border-color-selected: var(--color-
|
|
17
|
+
--switch-border-color-selected: var(--color-primary-base, var(--switch-border-color-selected-legacy)); // @presenter Color
|
|
18
18
|
--switch-border-width: var(--border-width); // @presenter Border
|
|
19
19
|
--switch-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
20
20
|
|
|
@@ -4,7 +4,7 @@ exports.switcher = void 0;
|
|
|
4
4
|
const styled_components_1 = require("styled-components");
|
|
5
5
|
exports.switcher = (0, styled_components_1.css) `
|
|
6
6
|
--switch-bg-color: var(--color-warm-grey-4); // @presenter Color
|
|
7
|
-
--switch-bg-color-selected: var(--color-
|
|
7
|
+
--switch-bg-color-selected: var(--color-primary-base, var(--switch-bg-color-selected-legacy)); // @presenter Color
|
|
8
8
|
--switch-bg-color-hover: var(--color-warm-grey-5); // @presenter Color
|
|
9
9
|
--switch-bg-color-pressed: var(--color-warm-grey-6); // @presenter Color
|
|
10
10
|
--switch-bg-color-disabled: var(--color-warm-grey-3); // @presenter Color
|
|
@@ -122,6 +122,7 @@ const TableOfContentMenuItem = styled_components_1.default.a `
|
|
|
122
122
|
&.active {
|
|
123
123
|
color: var(--toc-item-text-color-active);
|
|
124
124
|
border-left: solid 2px var(--toc-item-border-color-active);
|
|
125
|
+
font-weight: var(--toc-item-font-weight-active);
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
:empty {
|
|
@@ -26,12 +26,13 @@ exports.toc = (0, styled_components_1.css) `
|
|
|
26
26
|
|
|
27
27
|
--toc-item-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
28
28
|
--toc-item-text-color: var(--text-color-description); // @presenter Color
|
|
29
|
-
--toc-item-text-color-active: var(--text-color-
|
|
29
|
+
--toc-item-text-color-active: var(--color-primary-text, var(--toc-item-text-color-active-legacy)); // @presenter Color
|
|
30
30
|
--toc-item-bg-color: transparent; // @presenter Color
|
|
31
31
|
--toc-item-nested-offset: calc(var(--toc-spacing-unit) * 2); // @presenter Spacing
|
|
32
32
|
--toc-item-padding-vertical: calc(var(--toc-spacing-unit) / 2); // @presenter Spacing
|
|
33
33
|
--toc-item-padding-horizontal: calc(var(--toc-spacing-unit) * 2); // @presenter Spacing
|
|
34
|
-
--toc-item-border-color-active: var(--border-color-
|
|
34
|
+
--toc-item-border-color-active: var(--color-primary-base, var(--toc-item-border-color-active-legacy));
|
|
35
|
+
--toc-item-font-weight-active: var(--font-weight-medium); // @presenter FontWeight
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
38
|
* @tokens TOC header
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
import type { ToastItem } from '../../core/types';
|
|
4
|
+
export interface ToastComponentProps {
|
|
5
|
+
toast: ToastItem;
|
|
6
|
+
onDismiss: (id: string) => void;
|
|
7
|
+
stackIndex: number;
|
|
8
|
+
stackZIndex?: number;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
declare function ToastComponent({ toast, onDismiss, stackIndex, stackZIndex, className, }: ToastComponentProps): ReactElement;
|
|
12
|
+
export declare const Toast: React.MemoExoticComponent<typeof ToastComponent>;
|
|
13
|
+
export declare const spin: import("styled-components").Keyframes;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,239 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.spin = exports.Toast = void 0;
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
38
|
+
const styled_components_1 = __importStar(require("styled-components"));
|
|
39
|
+
const CheckmarkFilledIcon_1 = require("../../icons/CheckmarkFilledIcon/CheckmarkFilledIcon");
|
|
40
|
+
const CircleDashIcon_1 = require("../../icons/CircleDashIcon/CircleDashIcon");
|
|
41
|
+
const CloseIcon_1 = require("../../icons/CloseIcon/CloseIcon");
|
|
42
|
+
const ErrorFilledIcon_1 = require("../../icons/ErrorFilledIcon/ErrorFilledIcon");
|
|
43
|
+
const InformationFilledIcon_1 = require("../../icons/InformationFilledIcon/InformationFilledIcon");
|
|
44
|
+
const WarningFilledIcon_1 = require("../../icons/WarningFilledIcon/WarningFilledIcon");
|
|
45
|
+
const hooks_1 = require("../../core/hooks");
|
|
46
|
+
const Button_1 = require("../../components/Button/Button");
|
|
47
|
+
const toast_1 = require("../../core/constants/toast");
|
|
48
|
+
function renderToastIcon(type) {
|
|
49
|
+
switch (type) {
|
|
50
|
+
case 'success':
|
|
51
|
+
return react_1.default.createElement(CheckmarkFilledIcon_1.CheckmarkFilledIcon, { size: "--toast-icon-size", color: "--toast-icon-color-success" });
|
|
52
|
+
case 'warning':
|
|
53
|
+
return react_1.default.createElement(WarningFilledIcon_1.WarningFilledIcon, { size: "--toast-icon-size", color: "--toast-icon-color-warning" });
|
|
54
|
+
case 'error':
|
|
55
|
+
return react_1.default.createElement(ErrorFilledIcon_1.ErrorFilledIcon, { size: "--toast-icon-size", color: "--toast-icon-color-error" });
|
|
56
|
+
case 'loading':
|
|
57
|
+
return react_1.default.createElement(CircleDashIcon_1.CircleDashIcon, { size: "--toast-icon-size", color: "--toast-icon-color-loading" });
|
|
58
|
+
case 'info':
|
|
59
|
+
default:
|
|
60
|
+
return react_1.default.createElement(InformationFilledIcon_1.InformationFilledIcon, { size: "--toast-icon-size", color: "--toast-icon-color-info" });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function renderDismissButton(onClick) {
|
|
64
|
+
return (react_1.default.createElement(CloseButton, { "aria-label": "Dismiss notification", title: "Dismiss notification", icon: react_1.default.createElement(CloseIcon_1.CloseIcon, { size: "--toast-close-button-icon-size", color: "--toast-close-button-icon-color" }), onClick: onClick }));
|
|
65
|
+
}
|
|
66
|
+
function ToastComponent({ toast, onDismiss, stackIndex, stackZIndex = 1, className, }) {
|
|
67
|
+
const { wrapperRef, hasDetails, dismissToast, handleMouseEnter, handleMouseLeave, ariaRole, ariaLive, } = (0, hooks_1.useToastLogic)({
|
|
68
|
+
toast,
|
|
69
|
+
onDismiss,
|
|
70
|
+
stackIndex,
|
|
71
|
+
});
|
|
72
|
+
const icon = renderToastIcon(toast.type);
|
|
73
|
+
const content = !hasDetails ? (react_1.default.createElement(SimpleToastSurface, { "$isExiting": toast.isExiting, "aria-live": ariaLive, role: ariaRole },
|
|
74
|
+
react_1.default.createElement(ContentWrapper, null,
|
|
75
|
+
react_1.default.createElement(IconWrapper, null, icon),
|
|
76
|
+
react_1.default.createElement(SimpleContent, null,
|
|
77
|
+
react_1.default.createElement(SimpleText, null, toast.title))),
|
|
78
|
+
renderDismissButton(dismissToast))) : (react_1.default.createElement(DetailedToastSurface, { "$isExiting": toast.isExiting, "aria-live": ariaLive, role: ariaRole },
|
|
79
|
+
react_1.default.createElement(ContentWrapper, null,
|
|
80
|
+
react_1.default.createElement(IconWrapper, null, icon),
|
|
81
|
+
react_1.default.createElement(Body, null,
|
|
82
|
+
react_1.default.createElement(TitleRow, null,
|
|
83
|
+
react_1.default.createElement(TitleText, null, toast.title),
|
|
84
|
+
renderDismissButton(dismissToast)),
|
|
85
|
+
toast.description ? (react_1.default.createElement(DescriptionRow, null,
|
|
86
|
+
react_1.default.createElement(DescriptionText, null, toast.description))) : null))));
|
|
87
|
+
return (react_1.default.createElement(ToastWrapper, { ref: wrapperRef, "$stackZIndex": stackZIndex, className: className, "data-component-name": "Toast/Toast", "data-testid": `toast-${toast.type}`, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }, content));
|
|
88
|
+
}
|
|
89
|
+
exports.Toast = (0, react_1.memo)(ToastComponent);
|
|
90
|
+
const slideIn = (0, styled_components_1.keyframes) `
|
|
91
|
+
from {
|
|
92
|
+
opacity: 0;
|
|
93
|
+
transform: translateX(100%);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
to {
|
|
97
|
+
opacity: 1;
|
|
98
|
+
transform: translateX(0);
|
|
99
|
+
}
|
|
100
|
+
`;
|
|
101
|
+
const slideOut = (0, styled_components_1.keyframes) `
|
|
102
|
+
from {
|
|
103
|
+
opacity: 1;
|
|
104
|
+
transform: translateX(0);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
to {
|
|
108
|
+
opacity: 0;
|
|
109
|
+
transform: translateX(100%);
|
|
110
|
+
}
|
|
111
|
+
`;
|
|
112
|
+
exports.spin = (0, styled_components_1.keyframes) `
|
|
113
|
+
from {
|
|
114
|
+
transform: rotate(0deg);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
to {
|
|
118
|
+
transform: rotate(360deg);
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
const ToastWrapper = styled_components_1.default.div `
|
|
122
|
+
position: relative;
|
|
123
|
+
z-index: ${({ $stackZIndex }) => $stackZIndex};
|
|
124
|
+
width: 100%;
|
|
125
|
+
pointer-events: auto;
|
|
126
|
+
will-change: transform;
|
|
127
|
+
`;
|
|
128
|
+
const ToastSurface = styled_components_1.default.div `
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: flex-start;
|
|
131
|
+
width: 100%;
|
|
132
|
+
min-width: var(--toast-min-width);
|
|
133
|
+
max-width: var(--toast-max-width);
|
|
134
|
+
background-color: var(--toast-bg-color);
|
|
135
|
+
border: var(--toast-border);
|
|
136
|
+
border-radius: var(--toast-border-radius);
|
|
137
|
+
box-shadow: var(--toast-box-shadow);
|
|
138
|
+
color: var(--toast-text-color);
|
|
139
|
+
font-family: var(--toast-font-family);
|
|
140
|
+
animation: ${({ $isExiting }) => $isExiting
|
|
141
|
+
? (0, styled_components_1.css) `
|
|
142
|
+
${slideOut} ${toast_1.TOAST_SLIDE_DURATION_MS}ms ease-in forwards
|
|
143
|
+
`
|
|
144
|
+
: (0, styled_components_1.css) `
|
|
145
|
+
${slideIn} ${toast_1.TOAST_SLIDE_DURATION_MS}ms ease-out
|
|
146
|
+
`};
|
|
147
|
+
|
|
148
|
+
@media (max-width: 480px) {
|
|
149
|
+
min-width: 0;
|
|
150
|
+
max-width: none;
|
|
151
|
+
}
|
|
152
|
+
`;
|
|
153
|
+
const SimpleToastSurface = (0, styled_components_1.default)(ToastSurface) `
|
|
154
|
+
gap: var(--toast-simple-gap);
|
|
155
|
+
padding: var(--toast-simple-padding);
|
|
156
|
+
`;
|
|
157
|
+
const DetailedToastSurface = (0, styled_components_1.default)(ToastSurface) `
|
|
158
|
+
padding: var(--toast-detailed-padding);
|
|
159
|
+
`;
|
|
160
|
+
const ContentWrapper = styled_components_1.default.div `
|
|
161
|
+
display: flex;
|
|
162
|
+
flex: 1 1 auto;
|
|
163
|
+
gap: var(--toast-content-gap);
|
|
164
|
+
min-width: 0;
|
|
165
|
+
`;
|
|
166
|
+
const IconWrapper = styled_components_1.default.div `
|
|
167
|
+
display: flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
justify-content: center;
|
|
170
|
+
width: var(--toast-icon-size);
|
|
171
|
+
min-width: var(--toast-icon-size);
|
|
172
|
+
height: var(--toast-icon-line-height);
|
|
173
|
+
|
|
174
|
+
${CircleDashIcon_1.CircleDashIcon} {
|
|
175
|
+
animation: ${exports.spin} var(--toast-loading-animation-duration) linear infinite;
|
|
176
|
+
}
|
|
177
|
+
`;
|
|
178
|
+
const flexItemStyles = (0, styled_components_1.css) `
|
|
179
|
+
flex: 1 1 auto;
|
|
180
|
+
min-width: 0;
|
|
181
|
+
`;
|
|
182
|
+
const SimpleContent = styled_components_1.default.div `
|
|
183
|
+
${flexItemStyles}
|
|
184
|
+
`;
|
|
185
|
+
const Body = styled_components_1.default.div `
|
|
186
|
+
display: flex;
|
|
187
|
+
${flexItemStyles}
|
|
188
|
+
flex-direction: column;
|
|
189
|
+
`;
|
|
190
|
+
const TitleRow = styled_components_1.default.div `
|
|
191
|
+
display: flex;
|
|
192
|
+
align-items: center;
|
|
193
|
+
gap: var(--toast-title-gap);
|
|
194
|
+
min-width: 0;
|
|
195
|
+
`;
|
|
196
|
+
const DescriptionRow = styled_components_1.default.div `
|
|
197
|
+
display: flex;
|
|
198
|
+
flex-wrap: wrap;
|
|
199
|
+
align-items: center;
|
|
200
|
+
gap: var(--toast-description-gap);
|
|
201
|
+
min-width: 0;
|
|
202
|
+
`;
|
|
203
|
+
const textStyles = (0, styled_components_1.css) `
|
|
204
|
+
margin: 0;
|
|
205
|
+
font-size: var(--toast-text-font-size);
|
|
206
|
+
line-height: var(--toast-text-line-height);
|
|
207
|
+
color: var(--toast-text-color);
|
|
208
|
+
overflow-wrap: anywhere;
|
|
209
|
+
`;
|
|
210
|
+
const TitleText = styled_components_1.default.p `
|
|
211
|
+
${textStyles}
|
|
212
|
+
${flexItemStyles}
|
|
213
|
+
font-weight: var(--toast-title-font-weight);
|
|
214
|
+
`;
|
|
215
|
+
const SimpleText = styled_components_1.default.p `
|
|
216
|
+
${textStyles}
|
|
217
|
+
font-weight: var(--toast-body-font-weight);
|
|
218
|
+
`;
|
|
219
|
+
const DescriptionText = styled_components_1.default.p `
|
|
220
|
+
${textStyles}
|
|
221
|
+
${flexItemStyles}
|
|
222
|
+
font-weight: var(--toast-body-font-weight);
|
|
223
|
+
`;
|
|
224
|
+
const CloseButton = (0, styled_components_1.default)(Button_1.Button).attrs({
|
|
225
|
+
variant: 'ghost',
|
|
226
|
+
size: 'small',
|
|
227
|
+
}) `
|
|
228
|
+
flex: 0 0 auto;
|
|
229
|
+
min-height: unset;
|
|
230
|
+
margin: 0;
|
|
231
|
+
padding: var(--toast-close-button-padding);
|
|
232
|
+
color: var(--toast-close-button-icon-color);
|
|
233
|
+
|
|
234
|
+
&:hover,
|
|
235
|
+
&:focus-visible {
|
|
236
|
+
border: none;
|
|
237
|
+
}
|
|
238
|
+
`;
|
|
239
|
+
//# sourceMappingURL=Toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const toast: import("styled-components").FlattenSimpleInterpolation;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toast = void 0;
|
|
4
|
+
const styled_components_1 = require("styled-components");
|
|
5
|
+
/* eslint-disable theme/no-raw-colors-in-styles */
|
|
6
|
+
exports.toast = (0, styled_components_1.css) `
|
|
7
|
+
/**
|
|
8
|
+
* @tokens Toast
|
|
9
|
+
* @presenter BoxShadow
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
--toast-box-shadow: 2px 2px 12px 0 rgba(0, 0, 0, 0.04), 2px 2px 24px 8px rgba(0, 0, 0, 0.04);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @tokens Toast surface
|
|
16
|
+
*/
|
|
17
|
+
--toast-min-width: 240px;
|
|
18
|
+
--toast-max-width: 360px;
|
|
19
|
+
--toast-bg-color: var(--layer-color); // @presenter Color
|
|
20
|
+
--toast-border: var(--border-width) var(--border-style) var(--border-color-secondary); // @presenter Border
|
|
21
|
+
--toast-border-radius: var(--border-radius-md); // @presenter BorderRadius
|
|
22
|
+
--toast-font-family: var(--font-family-base); // @presenter FontFamily
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @tokens Toast spacing
|
|
26
|
+
*/
|
|
27
|
+
--toast-simple-gap: var(--spacing-unit);
|
|
28
|
+
--toast-simple-padding: var(--spacing-xs) var(--spacing-sm);
|
|
29
|
+
--toast-detailed-padding: var(--spacing-sm);
|
|
30
|
+
--toast-content-gap: var(--spacing-xs);
|
|
31
|
+
--toast-title-gap: var(--spacing-xs);
|
|
32
|
+
--toast-description-gap: var(--spacing-xs);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @tokens Toast icon
|
|
36
|
+
*/
|
|
37
|
+
--toast-icon-size: 14px;
|
|
38
|
+
--toast-icon-line-height: var(--line-height-base); // @presenter LineHeight
|
|
39
|
+
--toast-icon-color-info: var(--color-info-base); // @presenter Color
|
|
40
|
+
--toast-icon-color-success: var(--color-success-base); // @presenter Color
|
|
41
|
+
--toast-icon-color-warning: var(--color-warning-base); // @presenter Color
|
|
42
|
+
--toast-icon-color-error: var(--color-error-base); // @presenter Color
|
|
43
|
+
--toast-icon-color-loading: var(--loading-spinner-color); // @presenter Color
|
|
44
|
+
--toast-loading-animation-duration: 3s;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @tokens Toast typography
|
|
48
|
+
*/
|
|
49
|
+
--toast-text-font-size: var(--font-size-base); // @presenter FontSize
|
|
50
|
+
--toast-text-line-height: var(--line-height-base); // @presenter LineHeight
|
|
51
|
+
--toast-text-color: var(--text-color-primary); // @presenter Color
|
|
52
|
+
--toast-title-font-weight: var(--font-weight-semibold); // @presenter FontWeight
|
|
53
|
+
--toast-body-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @tokens Toast close button
|
|
57
|
+
*/
|
|
58
|
+
--toast-close-button-padding: 3px;
|
|
59
|
+
--toast-close-button-icon-size: 14px;
|
|
60
|
+
--toast-close-button-icon-color: var(--icon-color-secondary); // @presenter Color
|
|
61
|
+
|
|
62
|
+
// @tokens End
|
|
63
|
+
`;
|
|
64
|
+
//# sourceMappingURL=variables.js.map
|
|
@@ -269,7 +269,7 @@ const TooltipBody = styled_components_1.default.span `
|
|
|
269
269
|
var(--tooltip-border-color, transparent);
|
|
270
270
|
box-shadow: var(--bg-raised-shadow);
|
|
271
271
|
|
|
272
|
-
width: ${({ width }) => width || '
|
|
272
|
+
width: ${({ width }) => width || 'max-content'};
|
|
273
273
|
${({ placement }) => (0, styled_components_1.css) `
|
|
274
274
|
${PLACEMENTS[placement]};
|
|
275
275
|
`}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TOAST_SLIDE_DURATION_MS = 300;
|