@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
@@ -0,0 +1,156 @@
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.ToastProvider = ToastProvider;
40
+ const styled_components_1 = __importDefault(require("styled-components"));
41
+ const react_1 = __importStar(require("react"));
42
+ const Portal_1 = require("../../../components/Portal/Portal");
43
+ const Toast_1 = require("../../../components/Toast/Toast");
44
+ const ToastContext_1 = require("../../../core/contexts/Toast/ToastContext");
45
+ const toast_1 = require("../../../core/constants/toast");
46
+ function toastReducer(state, action) {
47
+ switch (action.type) {
48
+ case 'add':
49
+ return [action.payload, ...state];
50
+ case 'startExit':
51
+ return state.map((toast) => toast.id === action.payload.id ? Object.assign(Object.assign({}, toast), { isExiting: true }) : toast);
52
+ case 'remove':
53
+ return state.filter((toast) => toast.id !== action.payload.id);
54
+ case 'update':
55
+ return state.map((toast) => {
56
+ var _a;
57
+ return toast.id === action.payload.id
58
+ ? Object.assign(Object.assign(Object.assign({}, toast), action.payload.updates), { type: (_a = action.payload.updates.type) !== null && _a !== void 0 ? _a : toast.type }) : toast;
59
+ });
60
+ default:
61
+ return state;
62
+ }
63
+ }
64
+ function getToastType(type) {
65
+ return type !== null && type !== void 0 ? type : 'info';
66
+ }
67
+ function createToastId() {
68
+ if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
69
+ return crypto.randomUUID();
70
+ }
71
+ return `toast-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
72
+ }
73
+ function ToastProvider({ children, mountId }) {
74
+ const [toasts, dispatch] = (0, react_1.useReducer)(toastReducer, []);
75
+ const toastsRef = (0, react_1.useRef)([]);
76
+ const removeTimeoutsRef = (0, react_1.useRef)(new Map());
77
+ (0, react_1.useEffect)(() => {
78
+ toastsRef.current = toasts;
79
+ }, [toasts]);
80
+ (0, react_1.useEffect)(() => {
81
+ const timeoutsMap = removeTimeoutsRef.current;
82
+ return () => {
83
+ timeoutsMap.forEach((timeoutId) => {
84
+ clearTimeout(timeoutId);
85
+ });
86
+ timeoutsMap.clear();
87
+ };
88
+ }, []);
89
+ const dismissToast = (0, react_1.useCallback)((id) => {
90
+ var _a;
91
+ const currentToast = toastsRef.current.find((toast) => toast.id === id);
92
+ if (!currentToast || currentToast.isExiting) {
93
+ return;
94
+ }
95
+ (_a = currentToast.onClose) === null || _a === void 0 ? void 0 : _a.call(currentToast);
96
+ dispatch({ type: 'startExit', payload: { id } });
97
+ const existingTimeout = removeTimeoutsRef.current.get(id);
98
+ if (existingTimeout) {
99
+ clearTimeout(existingTimeout);
100
+ }
101
+ const timeoutId = setTimeout(() => {
102
+ dispatch({ type: 'remove', payload: { id } });
103
+ removeTimeoutsRef.current.delete(id);
104
+ }, toast_1.TOAST_SLIDE_DURATION_MS);
105
+ removeTimeoutsRef.current.set(id, timeoutId);
106
+ }, []);
107
+ const showToast = (0, react_1.useCallback)((options) => {
108
+ const id = createToastId();
109
+ dispatch({
110
+ type: 'add',
111
+ payload: Object.assign(Object.assign({}, options), { id, type: getToastType(options.type), isExiting: false }),
112
+ });
113
+ return id;
114
+ }, []);
115
+ const updateToast = (0, react_1.useCallback)((id, updates) => {
116
+ dispatch({
117
+ type: 'update',
118
+ payload: {
119
+ id,
120
+ updates,
121
+ },
122
+ });
123
+ }, []);
124
+ const contextValue = (0, react_1.useMemo)(() => ({
125
+ showToast,
126
+ dismissToast,
127
+ updateToast,
128
+ }), [dismissToast, showToast, updateToast]);
129
+ return (react_1.default.createElement(ToastContext_1.ToastContext.Provider, { value: contextValue },
130
+ children,
131
+ toasts.length > 0 ? (react_1.default.createElement(Portal_1.Portal, { mountId: mountId },
132
+ react_1.default.createElement(ToastViewport, { "aria-label": "Notifications" }, toasts.map((toast, index) => (react_1.default.createElement(Toast_1.Toast, { key: toast.id, stackIndex: index, stackZIndex: toasts.length - index, toast: toast, onDismiss: dismissToast })))))) : null));
133
+ }
134
+ const ToastViewport = styled_components_1.default.div `
135
+ position: fixed;
136
+ right: var(--spacing-md);
137
+ bottom: var(--spacing-md);
138
+ z-index: 1100;
139
+ display: flex;
140
+ flex-direction: column-reverse;
141
+ gap: var(--spacing-sm);
142
+ width: 320px;
143
+ min-width: 240px;
144
+ max-width: 360px;
145
+ pointer-events: none;
146
+
147
+ @media (max-width: 480px) {
148
+ left: 50%;
149
+ right: auto;
150
+ transform: translateX(-50%);
151
+ width: calc(100vw - var(--spacing-md) * 2);
152
+ min-width: 0;
153
+ max-width: none;
154
+ }
155
+ `;
156
+ //# sourceMappingURL=ToastProvider.js.map
@@ -3,3 +3,5 @@ export * from './CodeWalkthrough/CodeWalkthroughControlsContext';
3
3
  export * from './CodeWalkthrough/CodeWalkthroughStepsContext';
4
4
  export * from './CodeSnippetContext';
5
5
  export * from './SearchContext';
6
+ export * from './Toast/ToastContext';
7
+ export * from './Toast/ToastProvider';
@@ -19,4 +19,6 @@ __exportStar(require("./CodeWalkthrough/CodeWalkthroughControlsContext"), export
19
19
  __exportStar(require("./CodeWalkthrough/CodeWalkthroughStepsContext"), exports);
20
20
  __exportStar(require("./CodeSnippetContext"), exports);
21
21
  __exportStar(require("./SearchContext"), exports);
22
+ __exportStar(require("./Toast/ToastContext"), exports);
23
+ __exportStar(require("./Toast/ToastProvider"), exports);
22
24
  //# sourceMappingURL=index.js.map
@@ -51,3 +51,5 @@ export * from './catalog/use-catalog-entity-schema';
51
51
  export * from './catalog/use-catalog-table-header-cell-actions';
52
52
  export * from './use-store';
53
53
  export * from './use-is-truncated';
54
+ export * from './use-toast';
55
+ export * from './use-toast-logic';
@@ -67,4 +67,6 @@ __exportStar(require("./catalog/use-catalog-entity-schema"), exports);
67
67
  __exportStar(require("./catalog/use-catalog-table-header-cell-actions"), exports);
68
68
  __exportStar(require("./use-store"), exports);
69
69
  __exportStar(require("./use-is-truncated"), exports);
70
+ __exportStar(require("./use-toast"), exports);
71
+ __exportStar(require("./use-toast-logic"), exports);
70
72
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,18 @@
1
+ import type { RefObject } from 'react';
2
+ import type { ToastItem } from '../types/toast';
3
+ interface UseToastLogicOptions {
4
+ toast: ToastItem;
5
+ onDismiss: (id: string) => void;
6
+ stackIndex: number;
7
+ }
8
+ interface UseToastLogicReturn {
9
+ wrapperRef: RefObject<HTMLDivElement | null>;
10
+ hasDetails: boolean;
11
+ dismissToast: () => void;
12
+ handleMouseEnter: () => void;
13
+ handleMouseLeave: () => void;
14
+ ariaRole: 'alert' | 'status';
15
+ ariaLive: 'assertive' | 'polite';
16
+ }
17
+ export declare function useToastLogic({ toast, onDismiss, stackIndex, }: UseToastLogicOptions): UseToastLogicReturn;
18
+ export {};
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useToastLogic = useToastLogic;
4
+ const react_1 = require("react");
5
+ const utils_1 = require("../utils");
6
+ const STACK_SHIFT_ENTER_DURATION_MS = 280;
7
+ const STACK_SHIFT_EXIT_DURATION_MS = 200;
8
+ function useToastLogic({ toast, onDismiss, stackIndex, }) {
9
+ const wrapperRef = (0, react_1.useRef)(null);
10
+ const previousTopRef = (0, react_1.useRef)(null);
11
+ const previousStackIndexRef = (0, react_1.useRef)(null);
12
+ const timerRef = (0, react_1.useRef)(null);
13
+ const startedAtRef = (0, react_1.useRef)(null);
14
+ const remainingTimeRef = (0, react_1.useRef)(0);
15
+ const animationFrameRef = (0, react_1.useRef)(null);
16
+ const isHoveredRef = (0, react_1.useRef)(false);
17
+ const hasDetails = Boolean(toast.description);
18
+ const resolvedDuration = (0, react_1.useMemo)(() => (0, utils_1.getAutoDismissDuration)(hasDetails, toast.type, toast.duration), [hasDetails, toast.duration, toast.type]);
19
+ const ariaRole = toast.type === 'error' ? 'alert' : 'status';
20
+ const ariaLive = toast.type === 'error' ? 'assertive' : 'polite';
21
+ const clearTimer = (0, react_1.useCallback)(() => {
22
+ if (timerRef.current) {
23
+ clearTimeout(timerRef.current);
24
+ timerRef.current = null;
25
+ }
26
+ startedAtRef.current = null;
27
+ }, []);
28
+ const dismissToast = (0, react_1.useCallback)(() => {
29
+ onDismiss(toast.id);
30
+ }, [onDismiss, toast.id]);
31
+ const startTimer = (0, react_1.useCallback)((delay) => {
32
+ clearTimer();
33
+ if (delay <= 0) {
34
+ dismissToast();
35
+ return;
36
+ }
37
+ remainingTimeRef.current = delay;
38
+ startedAtRef.current = Date.now();
39
+ timerRef.current = setTimeout(() => {
40
+ dismissToast();
41
+ }, delay);
42
+ }, [clearTimer, dismissToast]);
43
+ (0, react_1.useEffect)(() => {
44
+ if (toast.isExiting || resolvedDuration === null) {
45
+ clearTimer();
46
+ return undefined;
47
+ }
48
+ if (!isHoveredRef.current) {
49
+ startTimer(resolvedDuration);
50
+ }
51
+ return () => {
52
+ clearTimer();
53
+ };
54
+ }, [
55
+ clearTimer,
56
+ resolvedDuration,
57
+ startTimer,
58
+ toast.description,
59
+ toast.isExiting,
60
+ toast.title,
61
+ toast.type,
62
+ ]);
63
+ (0, react_1.useLayoutEffect)(() => {
64
+ const node = wrapperRef.current;
65
+ if (!node) {
66
+ return undefined;
67
+ }
68
+ node.style.transition = 'none';
69
+ node.style.transform = '';
70
+ const currentTop = node.getBoundingClientRect().top;
71
+ const previousTop = previousTopRef.current;
72
+ const previousStackIndex = previousStackIndexRef.current;
73
+ if (toast.isExiting) {
74
+ previousTopRef.current = currentTop;
75
+ previousStackIndexRef.current = stackIndex;
76
+ return () => {
77
+ if (animationFrameRef.current !== null) {
78
+ window.cancelAnimationFrame(animationFrameRef.current);
79
+ animationFrameRef.current = null;
80
+ }
81
+ };
82
+ }
83
+ const didStackIndexChange = previousStackIndex !== null && previousStackIndex !== stackIndex;
84
+ if (didStackIndexChange && previousTop !== null && previousTop !== currentTop) {
85
+ const delta = previousTop - currentTop;
86
+ const shiftDuration = delta > 0 ? STACK_SHIFT_ENTER_DURATION_MS : STACK_SHIFT_EXIT_DURATION_MS;
87
+ node.style.transform = `translateY(${delta}px)`;
88
+ node.getBoundingClientRect();
89
+ animationFrameRef.current = window.requestAnimationFrame(() => {
90
+ animationFrameRef.current = null;
91
+ if (!wrapperRef.current) {
92
+ return;
93
+ }
94
+ wrapperRef.current.style.transition = `transform ${shiftDuration}ms ease-out`;
95
+ wrapperRef.current.style.transform = 'translateY(0)';
96
+ });
97
+ }
98
+ previousTopRef.current = currentTop;
99
+ previousStackIndexRef.current = stackIndex;
100
+ return () => {
101
+ if (animationFrameRef.current !== null) {
102
+ window.cancelAnimationFrame(animationFrameRef.current);
103
+ animationFrameRef.current = null;
104
+ }
105
+ };
106
+ });
107
+ (0, react_1.useEffect)(() => {
108
+ return () => {
109
+ clearTimer();
110
+ if (animationFrameRef.current !== null) {
111
+ window.cancelAnimationFrame(animationFrameRef.current);
112
+ }
113
+ };
114
+ }, [clearTimer]);
115
+ const handleMouseEnter = (0, react_1.useCallback)(() => {
116
+ isHoveredRef.current = true;
117
+ if (resolvedDuration === null || startedAtRef.current === null) {
118
+ return;
119
+ }
120
+ const elapsed = Date.now() - startedAtRef.current;
121
+ remainingTimeRef.current = Math.max(remainingTimeRef.current - elapsed, 0);
122
+ clearTimer();
123
+ }, [clearTimer, resolvedDuration]);
124
+ const handleMouseLeave = (0, react_1.useCallback)(() => {
125
+ isHoveredRef.current = false;
126
+ if (toast.isExiting || resolvedDuration === null) {
127
+ return;
128
+ }
129
+ startTimer(remainingTimeRef.current || resolvedDuration);
130
+ }, [resolvedDuration, startTimer, toast.isExiting]);
131
+ return {
132
+ wrapperRef,
133
+ hasDetails,
134
+ dismissToast,
135
+ handleMouseEnter,
136
+ handleMouseLeave,
137
+ ariaRole,
138
+ ariaLive,
139
+ };
140
+ }
141
+ //# sourceMappingURL=use-toast-logic.js.map
@@ -0,0 +1,11 @@
1
+ import type { ToastContextValue, ToastOptions } from '../types/toast';
2
+ type TypedToastOptions = Omit<ToastOptions, 'title' | 'type'>;
3
+ interface UseToastReturn extends ToastContextValue {
4
+ info: (title: string, options?: TypedToastOptions) => string;
5
+ success: (title: string, options?: TypedToastOptions) => string;
6
+ warning: (title: string, options?: TypedToastOptions) => string;
7
+ error: (title: string, options?: TypedToastOptions) => string;
8
+ loading: (title: string, options?: TypedToastOptions) => string;
9
+ }
10
+ export declare function useToast(): UseToastReturn;
11
+ export {};
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useToast = useToast;
4
+ const react_1 = require("react");
5
+ const ToastContext_1 = require("../contexts/Toast/ToastContext");
6
+ function createTypedToast(showToast, type) {
7
+ return (title, options) => showToast(Object.assign(Object.assign({}, options), { title,
8
+ type }));
9
+ }
10
+ function useToast() {
11
+ const context = (0, react_1.useContext)(ToastContext_1.ToastContext);
12
+ if (!context) {
13
+ throw new Error('useToast must be used within a ToastProvider');
14
+ }
15
+ return (0, react_1.useMemo)(() => (Object.assign(Object.assign({}, context), { info: createTypedToast(context.showToast, 'info'), success: createTypedToast(context.showToast, 'success'), warning: createTypedToast(context.showToast, 'warning'), error: createTypedToast(context.showToast, 'error'), loading: createTypedToast(context.showToast, 'loading') })), [context]);
16
+ }
17
+ //# sourceMappingURL=use-toast.js.map
@@ -4,22 +4,21 @@ exports.darkMode = void 0;
4
4
  const styled_components_1 = require("styled-components");
5
5
  const variables_dark_1 = require("../../components/Scorecard/variables.dark");
6
6
  const variables_dark_2 = require("../../markdoc/components/Mermaid/variables.dark");
7
- const variables_dark_3 = require("../../markdoc/components/ExcalidrawDiagram/variables.dark");
8
- const variables_dark_4 = require("../../components/Menu/variables.dark");
9
- const variables_dark_5 = require("../../components/Button/variables.dark");
10
- const variables_dark_6 = require("../../components/Buttons/variables.dark");
11
- const variables_dark_7 = require("../../components/Segmented/variables.dark");
12
- const variables_dark_8 = require("../../icons/CheckboxIcon/variables.dark");
13
- const variables_dark_9 = require("../../components/Tag/variables.dark");
14
- const variables_dark_10 = require("../../components/StatusCode/variables.dark");
15
- const variables_dark_11 = require("../../components/Switch/variables.dark");
16
- const variables_dark_12 = require("../../markdoc/components/Cards/variables.dark");
17
- const variables_dark_13 = require("../../components/Catalog/variables.dark");
18
- const variables_dark_14 = require("../../components/PageActions/variables.dark");
19
- const variables_dark_15 = require("../../components/Tooltip/variables.dark");
20
- const variables_dark_16 = require("../../components/Banner/variables.dark");
21
- const variables_dark_17 = require("../../components/Admonition/variables.dark");
22
- const variables_dark_18 = require("../../components/SvgViewer/variables.dark");
7
+ const variables_dark_3 = require("../../components/Menu/variables.dark");
8
+ const variables_dark_4 = require("../../components/Button/variables.dark");
9
+ const variables_dark_5 = require("../../components/Buttons/variables.dark");
10
+ const variables_dark_6 = require("../../components/Segmented/variables.dark");
11
+ const variables_dark_7 = require("../../icons/CheckboxIcon/variables.dark");
12
+ const variables_dark_8 = require("../../components/Tag/variables.dark");
13
+ const variables_dark_9 = require("../../components/StatusCode/variables.dark");
14
+ const variables_dark_10 = require("../../components/Switch/variables.dark");
15
+ const variables_dark_11 = require("../../markdoc/components/Cards/variables.dark");
16
+ const variables_dark_12 = require("../../components/Catalog/variables.dark");
17
+ const variables_dark_13 = require("../../components/PageActions/variables.dark");
18
+ const variables_dark_14 = require("../../components/Tooltip/variables.dark");
19
+ const variables_dark_15 = require("../../components/Banner/variables.dark");
20
+ const variables_dark_16 = require("../../components/Admonition/variables.dark");
21
+ const variables_dark_17 = require("../../components/SvgViewer/variables.dark");
23
22
  const palette_dark_1 = require("./palette.dark");
24
23
  const replayDarkMode = (0, styled_components_1.css) `
25
24
  /**
@@ -243,12 +242,6 @@ exports.darkMode = (0, styled_components_1.css) `
243
242
  --color-black: #ffffff;
244
243
  --color-white: #000000;
245
244
 
246
-
247
- --color-brand-pink-subtle-bg: var(--color-brand-subtle-1);
248
- --color-brand-pink-subtle-bg-hover: var(--color-brand-subtle-2);
249
- --color-brand-pink-subtle-border: var(--color-brand-subtle-3);
250
- --color-brand-pink-subtle-border-hover: var(--color-brand-subtle-4);
251
-
252
245
  --color-hover-base: #32343E;
253
246
 
254
247
  --bg-color: var(--color-warm-grey-2);
@@ -272,6 +265,11 @@ exports.darkMode = (0, styled_components_1.css) `
272
265
  --layer-accent-hover: var(--color-warm-grey-10);
273
266
  --layer-color-raised: var(--color-warm-grey-3);
274
267
 
268
+ --color-brand-subtle-bg: var(--color-brand-subtle-1);
269
+ --color-brand-subtle-bg-hover: var(--color-brand-subtle-2);
270
+ --color-brand-subtle-border: var(--color-brand-subtle-3);
271
+ --color-brand-subtle-border-hover: var(--color-brand-subtle-4);
272
+
275
273
  /**
276
274
  * @tokens Border Colors
277
275
  * @presenter Color
@@ -335,25 +333,24 @@ exports.darkMode = (0, styled_components_1.css) `
335
333
  --plus-square-outlined-icon: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 10 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.20312 5.3125H4.6875V6.79687C4.6875 6.83984 4.72266 6.875 4.76562 6.875H5.23438C5.27734 6.875 5.3125 6.83984 5.3125 6.79687V5.3125H6.79688C6.83984 5.3125 6.875 5.27734 6.875 5.23437V4.76562C6.875 4.72266 6.83984 4.6875 6.79688 4.6875H5.3125V3.20312C5.3125 3.16016 5.27734 3.125 5.23438 3.125H4.76562C4.72266 3.125 4.6875 3.16016 4.6875 3.20312V4.6875H3.20312C3.16016 4.6875 3.125 4.72266 3.125 4.76562V5.23437C3.125 5.27734 3.16016 5.3125 3.20312 5.3125Z' fill='%239B9CA8'/%3E%3Cpath d='M8.59375 1.09375H1.40625C1.2334 1.09375 1.09375 1.2334 1.09375 1.40625V8.59375C1.09375 8.7666 1.2334 8.90625 1.40625 8.90625H8.59375C8.7666 8.90625 8.90625 8.7666 8.90625 8.59375V1.40625C8.90625 1.2334 8.7666 1.09375 8.59375 1.09375ZM8.20312 8.20312H1.79688V1.79687H8.20312V8.20312Z' fill='%239B9CA8'/%3E%3C/svg%3E%0A");
336
334
  --minus-square-outlined-icon: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 10 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.20312 5.3125H6.79688C6.83984 5.3125 6.875 5.27734 6.875 5.23437V4.76562C6.875 4.72266 6.83984 4.6875 6.79688 4.6875H3.20312C3.16016 4.6875 3.125 4.72266 3.125 4.76562V5.23437C3.125 5.27734 3.16016 5.3125 3.20312 5.3125Z' fill='%239B9CA8'/%3E%3Cpath d='M8.59375 1.09375H1.40625C1.2334 1.09375 1.09375 1.2334 1.09375 1.40625V8.59375C1.09375 8.7666 1.2334 8.90625 1.40625 8.90625H8.59375C8.7666 8.90625 8.90625 8.7666 8.90625 8.59375V1.40625C8.90625 1.2334 8.7666 1.09375 8.59375 1.09375ZM8.20312 8.20312H1.79688V1.79687H8.20312V8.20312Z' fill='%239B9CA8'/%3E%3C/svg%3E%0A");
337
335
 
338
- ${variables_dark_7.segmentedButtonsDarkMode}
339
- ${variables_dark_5.buttonDarkMode}
340
- ${variables_dark_6.aiAssistantButtonDarkMode}
341
- ${variables_dark_8.checkboxDarkMode}
342
- ${variables_dark_9.tagDarkMode}
343
- ${variables_dark_10.statusCodeDarkMode}
344
- ${variables_dark_4.menuDarkMode}
336
+ ${variables_dark_6.segmentedButtonsDarkMode}
337
+ ${variables_dark_4.buttonDarkMode}
338
+ ${variables_dark_5.aiAssistantButtonDarkMode}
339
+ ${variables_dark_7.checkboxDarkMode}
340
+ ${variables_dark_8.tagDarkMode}
341
+ ${variables_dark_9.statusCodeDarkMode}
342
+ ${variables_dark_3.menuDarkMode}
345
343
  ${variables_dark_2.mermaidDarkMode}
346
- ${variables_dark_3.excalidrawDarkMode}
347
344
  ${variables_dark_1.scorecardDarkMode}
348
345
  ${replayDarkMode}
349
- ${variables_dark_11.switcherDarkMode}
350
- ${variables_dark_12.cardsDarkMode}
351
- ${variables_dark_13.catalogDarkMode}
352
- ${variables_dark_14.pageActionsDarkMode}
353
- ${variables_dark_15.tooltipDarkMode}
354
- ${variables_dark_16.bannerDarkMode}
355
- ${variables_dark_17.admonitionDarkMode}
356
- ${variables_dark_18.svgViewerDarkMode}
346
+ ${variables_dark_10.switcherDarkMode}
347
+ ${variables_dark_11.cardsDarkMode}
348
+ ${variables_dark_12.catalogDarkMode}
349
+ ${variables_dark_13.pageActionsDarkMode}
350
+ ${variables_dark_14.tooltipDarkMode}
351
+ ${variables_dark_15.bannerDarkMode}
352
+ ${variables_dark_16.admonitionDarkMode}
353
+ ${variables_dark_17.svgViewerDarkMode}
357
354
  ${badgesDarkMode}
358
355
  ${palette_dark_1.activeBrandPaletteDark}
359
356
  /**