@redocly/theme 0.64.0-next.1 → 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/Banner/Banner.js +3 -3
- package/lib/components/Button/variables.dark.js +2 -2
- package/lib/components/Button/variables.js +3 -3
- package/lib/components/Catalog/CatalogActionsRow.d.ts +3 -3
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +4 -6
- package/lib/components/Catalog/CatalogEntities.d.ts +2 -2
- package/lib/components/Catalog/CatalogEntities.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +1 -8
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js +3 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +2 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.js +2 -6
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +5 -5
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.js +15 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.d.ts +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.d.ts +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.js +14 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.d.ts +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.d.ts +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +13 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +4 -3
- package/lib/components/Catalog/CatalogEntityTypeIcon.d.ts +3 -2
- package/lib/components/Catalog/CatalogEntityTypeIcon.js +9 -9
- package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.d.ts +2 -3
- package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.d.ts +2 -3
- package/lib/components/Catalog/CatalogPageDescription.js +1 -1
- package/lib/components/Catalog/CatalogSortButton.d.ts +4 -5
- package/lib/components/Catalog/CatalogTableView/CatalogDomainsCell.js +6 -2
- package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +2 -2
- package/lib/components/Catalog/CatalogTableView/CatalogLastUpdateCell.d.ts +5 -0
- package/lib/components/Catalog/CatalogTableView/CatalogLastUpdateCell.js +45 -0
- package/lib/components/Catalog/CatalogTableView/CatalogOwnersCell.js +5 -3
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.d.ts +2 -3
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +3 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +1 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +15 -5
- package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.js +3 -2
- package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.js +2 -2
- package/lib/components/Catalog/CatalogTags.d.ts +11 -0
- package/lib/components/Catalog/CatalogTags.js +62 -0
- package/lib/components/Catalog/variables.js +22 -14
- 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/Search/SearchDialog.js +118 -116
- 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/catalog.d.ts +1 -1
- package/lib/core/constants/catalog.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/catalog/use-catalog-entity-link.d.ts +8 -0
- package/lib/core/hooks/catalog/use-catalog-entity-link.js +42 -0
- package/lib/core/hooks/catalog/use-catalog-table-header-cell-actions.d.ts +2 -1
- package/lib/core/hooks/catalog/use-catalog-table-header-cell-actions.js +5 -3
- package/lib/core/hooks/index.d.ts +3 -0
- package/lib/core/hooks/index.js +3 -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.d.ts +3 -1
- package/lib/core/styles/dark.js +37 -33
- package/lib/core/styles/global.d.ts +6 -2
- package/lib/core/styles/global.js +56 -46
- package/lib/core/styles/palette.d.ts +6 -0
- package/lib/core/styles/palette.dark.d.ts +3 -0
- package/lib/core/styles/palette.dark.js +201 -0
- package/lib/core/styles/palette.js +175 -0
- package/lib/core/types/catalog.d.ts +23 -7
- package/lib/core/types/hooks.d.ts +6 -4
- 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 +5 -1
- package/lib/index.js +5 -1
- package/lib/markdoc/components/Heading/Heading.js +2 -2
- 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/Banner/Banner.tsx +7 -7
- package/src/components/Button/variables.dark.ts +2 -2
- package/src/components/Button/variables.ts +3 -3
- package/src/components/Catalog/CatalogActionsRow.tsx +3 -3
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +4 -6
- package/src/components/Catalog/CatalogEntities.tsx +3 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +3 -24
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +3 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +2 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +8 -10
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +13 -8
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.tsx +27 -15
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +2 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +9 -9
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +17 -9
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +4 -8
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.tsx +2 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +16 -10
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +4 -3
- package/src/components/Catalog/CatalogEntityTypeIcon.tsx +18 -11
- package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.tsx +3 -3
- package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.tsx +2 -3
- package/src/components/Catalog/CatalogPageDescription.tsx +1 -1
- package/src/components/Catalog/CatalogSortButton.tsx +5 -6
- package/src/components/Catalog/CatalogTableView/CatalogDomainsCell.tsx +6 -2
- package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +2 -2
- package/src/components/Catalog/CatalogTableView/CatalogLastUpdateCell.tsx +54 -0
- package/src/components/Catalog/CatalogTableView/CatalogOwnersCell.tsx +5 -2
- package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +4 -3
- package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +17 -7
- package/src/components/Catalog/CatalogTableView/CatalogTagsCell.tsx +3 -2
- package/src/components/Catalog/CatalogTableView/CatalogUserEntityCell.tsx +2 -2
- package/src/components/Catalog/CatalogTags.tsx +115 -0
- package/src/components/Catalog/variables.ts +22 -14
- 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/Search/SearchDialog.tsx +299 -293
- 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/catalog.ts +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/catalog/use-catalog-entity-link.ts +46 -0
- package/src/core/hooks/catalog/use-catalog-table-header-cell-actions.ts +10 -2
- package/src/core/hooks/index.ts +3 -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 +9 -4
- package/src/core/styles/global.ts +30 -20
- package/src/core/styles/palette.dark.ts +199 -0
- package/src/core/styles/palette.ts +173 -0
- package/src/core/types/catalog.ts +24 -8
- package/src/core/types/hooks.ts +5 -10
- 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 +5 -1
- package/src/markdoc/components/Heading/Heading.tsx +2 -1
- 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/components/Catalog/CatalogTagsWithTooltip.d.ts +0 -10
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +0 -57
- 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/components/Catalog/CatalogTagsWithTooltip.tsx +0 -101
- 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
|
@@ -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
|
|
@@ -43,6 +43,7 @@ const SearchInput_1 = require("../../components/Search/SearchInput");
|
|
|
43
43
|
const SearchShortcut_1 = require("../../components/Search/SearchShortcut");
|
|
44
44
|
const Button_1 = require("../../components/Button/Button");
|
|
45
45
|
const utils_1 = require("../../core/utils");
|
|
46
|
+
const Portal_1 = require("../../components/Portal/Portal");
|
|
46
47
|
const SearchItem_1 = require("../../components/Search/SearchItem");
|
|
47
48
|
const SearchRecent_1 = require("../../components/Search/SearchRecent");
|
|
48
49
|
const SearchSuggestedPages_1 = require("../../components/Search/SearchSuggestedPages");
|
|
@@ -169,71 +170,60 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
|
|
|
169
170
|
const showAiSearchButton = askAi && mode === 'search';
|
|
170
171
|
const showAiSearchItem = showAiSearchButton && query;
|
|
171
172
|
const showHeaderButtons = showSearchFilterButton || showAiSearchButton;
|
|
172
|
-
return (react_1.default.createElement(
|
|
173
|
-
react_1.default.createElement(
|
|
174
|
-
react_1.default.createElement(
|
|
175
|
-
|
|
176
|
-
product.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
react_1.default.createElement(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
aiQueryRef.current
|
|
185
|
-
|
|
186
|
-
else {
|
|
187
|
-
(_a = firstSearchResultRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
188
|
-
}
|
|
189
|
-
}, "data-translation-key": "search.label" }),
|
|
190
|
-
showHeaderButtons && (react_1.default.createElement(SearchHeaderButtons, null,
|
|
191
|
-
showAiSearchButton ? (react_1.default.createElement(SearchAiButton, { icon: react_1.default.createElement(AiStarsGradientIcon_1.AiStarsGradientIcon, { color: "var(--search-ai-button-icon-color)" }), onClick: () => {
|
|
192
|
-
setMode('ai-dialog');
|
|
193
|
-
if (query.trim()) {
|
|
194
|
-
aiSearch.askQuestion(query);
|
|
173
|
+
return (react_1.default.createElement(Portal_1.Portal, null,
|
|
174
|
+
react_1.default.createElement(SearchOverlay, { "data-component-name": "Search/SearchDialog", ref: modalRef, onClick: handleOverlayClick, className: (0, utils_1.concatClassNames)('overlay', className) },
|
|
175
|
+
react_1.default.createElement(SearchDialogWrapper, { className: "scroll-lock", role: "dialog" },
|
|
176
|
+
react_1.default.createElement(SearchDialogHeader, null,
|
|
177
|
+
product && (react_1.default.createElement(SearchProductTag, { color: "product" },
|
|
178
|
+
product.name,
|
|
179
|
+
react_1.default.createElement(CloseIcon_1.CloseIcon, { onClick: () => setProduct(undefined), color: "--icon-color-additional" }))),
|
|
180
|
+
mode === 'search' ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
181
|
+
react_1.default.createElement(SearchInput_1.SearchInput, { value: query, onChange: setQuery, placeholder: translate('search.label', 'Search docs...'), isLoading: isSearchLoading, inputRef: searchInputRef, onSubmit: () => {
|
|
182
|
+
var _a;
|
|
183
|
+
if (isSearchLoading)
|
|
184
|
+
return;
|
|
185
|
+
if (showAiSearchButton && aiQueryRef.current) {
|
|
186
|
+
aiQueryRef.current.focus();
|
|
195
187
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
react_1.default.createElement(
|
|
215
|
-
|
|
188
|
+
else {
|
|
189
|
+
(_a = firstSearchResultRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
190
|
+
}
|
|
191
|
+
}, "data-translation-key": "search.label" }),
|
|
192
|
+
showHeaderButtons && (react_1.default.createElement(SearchHeaderButtons, null,
|
|
193
|
+
showAiSearchButton ? (react_1.default.createElement(SearchAiButton, { icon: react_1.default.createElement(AiStarsGradientIcon_1.AiStarsGradientIcon, { color: "var(--search-ai-button-icon-color)" }), onClick: () => {
|
|
194
|
+
setMode('ai-dialog');
|
|
195
|
+
if (query.trim()) {
|
|
196
|
+
aiSearch.askQuestion(query);
|
|
197
|
+
}
|
|
198
|
+
telemetry.sendSearchAiOpenedMessage([
|
|
199
|
+
{
|
|
200
|
+
object: 'search',
|
|
201
|
+
method: 'ai_search_button',
|
|
202
|
+
},
|
|
203
|
+
]);
|
|
204
|
+
} }, translate('search.ai.button', 'Search with AI'))) : null,
|
|
205
|
+
showSearchFilterButton && (react_1.default.createElement(SearchFilterToggleButton, { icon: react_1.default.createElement(SettingsIcon_1.SettingsIcon, null), onClick: onFilterToggle })))))) : (react_1.default.createElement(AiDialogHeaderWrapper, null,
|
|
206
|
+
initialMode === 'ai-dialog' ? (react_1.default.createElement(AiDialogHeaderTitle, null,
|
|
207
|
+
react_1.default.createElement(AiStarsGradientIcon_1.AiStarsGradientIcon, { color: "var(--search-ai-button-icon-color)", size: "1.25rem" }),
|
|
208
|
+
translate('search.ai.assistant', 'Assistant'))) : (react_1.default.createElement(Button_1.Button, { variant: "secondary", onClick: () => {
|
|
209
|
+
setMode('search');
|
|
216
210
|
aiSearch.clearConversation();
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
},
|
|
234
|
-
]);
|
|
235
|
-
}, onKeyDown: (e) => {
|
|
236
|
-
if (e.key === 'Enter') {
|
|
211
|
+
focusSearchInput();
|
|
212
|
+
}, tabIndex: 0, icon: react_1.default.createElement(ChevronLeftIcon_1.ChevronLeftIcon, null) }, isMobile
|
|
213
|
+
? translate('search.ai.back', 'Back')
|
|
214
|
+
: translate('search.ai.backToSearch', 'Back to search'))),
|
|
215
|
+
react_1.default.createElement(AiDialogHeaderActionsWrapper, null,
|
|
216
|
+
react_1.default.createElement(Button_1.Button, { variant: "secondary", disabled: !aiSearch.conversation.length, onClick: () => {
|
|
217
|
+
refreshSearchSessionId();
|
|
218
|
+
aiSearch.clearConversation();
|
|
219
|
+
}, tabIndex: 0, icon: react_1.default.createElement(EditIcon_1.EditIcon, null) }, translate('search.ai.newConversation', 'New conversation')),
|
|
220
|
+
isMobile && react_1.default.createElement(Button_1.Button, { variant: "text", icon: react_1.default.createElement(CloseIcon_1.CloseIcon, null), onClick: handleClose }))))),
|
|
221
|
+
react_1.default.createElement(SearchDialogBody, null, mode === 'search' ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
222
|
+
advancedSearch && isFilterOpen && (react_1.default.createElement(SearchDialogBodyFilterView, null,
|
|
223
|
+
react_1.default.createElement(SearchFilter_1.SearchFilter, { facets: facets, filter: filter, query: query, quickFilterFields: [groupField], onFilterChange: onFilterChange, onFilterReset: onFilterReset, onFacetReset: onFacetReset }))),
|
|
224
|
+
react_1.default.createElement(SearchDialogBodyMainView, null,
|
|
225
|
+
react_1.default.createElement(SearchGroups_1.SearchGroups, { facets: facets, searchFilter: filter, onFilterChange: onFilterChange, onQuickFilterReset: onQuickFilterReset, groupField: groupField }),
|
|
226
|
+
showAiSearchItem && (react_1.default.createElement(SearchWithAI, { onClick: () => {
|
|
237
227
|
setMode('ai-dialog');
|
|
238
228
|
if (query.trim()) {
|
|
239
229
|
aiSearch.askQuestion(query);
|
|
@@ -244,60 +234,72 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
|
|
|
244
234
|
method: 'ai_search_input',
|
|
245
235
|
},
|
|
246
236
|
]);
|
|
237
|
+
}, onKeyDown: (e) => {
|
|
238
|
+
if (e.key === 'Enter') {
|
|
239
|
+
setMode('ai-dialog');
|
|
240
|
+
if (query.trim()) {
|
|
241
|
+
aiSearch.askQuestion(query);
|
|
242
|
+
}
|
|
243
|
+
telemetry.sendSearchAiOpenedMessage([
|
|
244
|
+
{
|
|
245
|
+
object: 'search',
|
|
246
|
+
method: 'ai_search_input',
|
|
247
|
+
},
|
|
248
|
+
]);
|
|
249
|
+
}
|
|
250
|
+
}, ref: aiQueryRef, tabIndex: 0, role: "option", "aria-selected": "true" },
|
|
251
|
+
react_1.default.createElement(AiStarsIcon_1.AiStarsIcon, { style: { flexShrink: 0 }, color: "var(--search-ai-icon-color)", size: "36px", background: "var(--search-ai-icon-bg-color)", margin: "0 var(--spacing-md) 0 0", borderRadius: "var(--border-radius-lg)" }),
|
|
252
|
+
react_1.default.createElement(QueryWrapper, null,
|
|
253
|
+
react_1.default.createElement(Typography_1.Typography, { fontWeight: "var(--font-weight-semibold)" }, query)),
|
|
254
|
+
react_1.default.createElement(Typography_1.Typography, null,
|
|
255
|
+
"- ",
|
|
256
|
+
translate('search.ai.label', 'Ask AI assistant')),
|
|
257
|
+
react_1.default.createElement(ReturnKeyIcon_1.ReturnKeyIcon, { color: "var(--search-item-text-color)" }))),
|
|
258
|
+
showResults ? (searchKeysWithResults.length ? (searchKeysWithResults.map((key, searchGroupKeyIdx) => {
|
|
259
|
+
const searchResultItems = items[key];
|
|
260
|
+
if (searchResultItems === null || searchResultItems === void 0 ? void 0 : searchResultItems.length) {
|
|
261
|
+
return (react_1.default.createElement(react_1.Fragment, { key: key },
|
|
262
|
+
react_1.default.createElement(SearchGroupTitle, { "data-testid": "search-group-title" }, key),
|
|
263
|
+
searchResultItems.map((item, idx, resultsArr) => mapItem(item, idx, resultsArr, searchGroupKeyIdx === 0 ? firstSearchResultRef : undefined)),
|
|
264
|
+
showLoadMore(key, searchResultItems.length || 0) && (react_1.default.createElement(SearchGroupFooter, { tabIndex: 0, "data-translation-key": "search.showMore", onKeyDown: (e) => {
|
|
265
|
+
if (e.key === 'Enter') {
|
|
266
|
+
setLoadMore({
|
|
267
|
+
groupKey: key,
|
|
268
|
+
offset: searchResultItems.length || 0,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}, onClick: () => setLoadMore({
|
|
272
|
+
groupKey: key,
|
|
273
|
+
offset: searchResultItems.length || 0,
|
|
274
|
+
}) }, translate('search.showMore', 'Show more')))));
|
|
247
275
|
}
|
|
248
|
-
|
|
249
|
-
react_1.default.createElement(
|
|
250
|
-
|
|
251
|
-
react_1.default.createElement(
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
})) : isSearchLoading ? (react_1.default.createElement(SearchMessage, { "data-translation-key": "search.loading" },
|
|
276
|
-
react_1.default.createElement(SpinnerLoader_1.SpinnerLoader, { size: "26px", color: "var(--search-input-icon-color)" }),
|
|
277
|
-
translate('search.loading', 'Loading...'))) : (react_1.default.createElement(SearchMessage, { "data-translation-key": "search.noResults" },
|
|
278
|
-
react_1.default.createElement("b", null, translate('search.noResults.title', 'No results'))))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
279
|
-
react_1.default.createElement(SearchRecent_1.SearchRecent, { onSelect: (query, index) => {
|
|
280
|
-
telemetry.sendSearchRecentClickedMessage([
|
|
281
|
-
{
|
|
282
|
-
object: 'search',
|
|
283
|
-
query,
|
|
284
|
-
index: index.toString(),
|
|
285
|
-
searchSessionId,
|
|
286
|
-
},
|
|
287
|
-
]);
|
|
288
|
-
setQuery(query);
|
|
289
|
-
focusSearchInput();
|
|
290
|
-
} }),
|
|
291
|
-
react_1.default.createElement(SearchSuggestedPages_1.SearchSuggestedPages, null)))))) : (react_1.default.createElement(SearchAiDialog_1.SearchAiDialog, { initialMessage: query, response: aiSearch.response, isGeneratingResponse: aiSearch.isGeneratingResponse, error: aiSearch.error, resources: aiSearch.resources, conversation: aiSearch.conversation, setConversation: aiSearch.setConversation, onMessageSent: aiSearch.askQuestion, toolCalls: aiSearch.toolCalls, contentSegments: aiSearch.contentSegments }))),
|
|
292
|
-
react_1.default.createElement(SearchDialogFooter, null, mode === 'ai-dialog' ? (react_1.default.createElement(AiDisclaimer, null, translate('search.ai.disclaimer', 'AI search might provide incomplete or incorrect results. Verify important information.'))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
293
|
-
react_1.default.createElement(SearchShortcuts, null,
|
|
294
|
-
react_1.default.createElement(SearchShortcut_1.SearchShortcut, { "data-translation-key": "search.keys.navigate", combination: "Tab", text: translate('search.keys.navigate', 'to navigate') }),
|
|
295
|
-
react_1.default.createElement(SearchShortcut_1.SearchShortcut, { "data-translation-key": "search.keys.select", combination: "\u23CE", text: translate('search.keys.select', 'to select') }),
|
|
296
|
-
react_1.default.createElement(SearchShortcut_1.SearchShortcut, { "data-translation-key": "search.keys.exit", combination: "Esc", text: translate('search.keys.exit', 'to exit') })),
|
|
297
|
-
isSearchLoading && (react_1.default.createElement(SearchLoading, null,
|
|
298
|
-
react_1.default.createElement(SpinnerLoader_1.SpinnerLoader, { size: "16px", color: "var(--search-input-icon-color)" }),
|
|
299
|
-
translate('search.loading', 'Loading...'))),
|
|
300
|
-
react_1.default.createElement(SearchCancelButton, { "data-translation-key": "search.cancel", variant: "secondary", size: "small", onClick: handleClose }, translate('search.cancel', 'Cancel'))))))));
|
|
276
|
+
return null;
|
|
277
|
+
})) : isSearchLoading ? (react_1.default.createElement(SearchMessage, { "data-translation-key": "search.loading" },
|
|
278
|
+
react_1.default.createElement(SpinnerLoader_1.SpinnerLoader, { size: "26px", color: "var(--search-input-icon-color)" }),
|
|
279
|
+
translate('search.loading', 'Loading...'))) : (react_1.default.createElement(SearchMessage, { "data-translation-key": "search.noResults" },
|
|
280
|
+
react_1.default.createElement("b", null, translate('search.noResults.title', 'No results'))))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
281
|
+
react_1.default.createElement(SearchRecent_1.SearchRecent, { onSelect: (query, index) => {
|
|
282
|
+
telemetry.sendSearchRecentClickedMessage([
|
|
283
|
+
{
|
|
284
|
+
object: 'search',
|
|
285
|
+
query,
|
|
286
|
+
index: index.toString(),
|
|
287
|
+
searchSessionId,
|
|
288
|
+
},
|
|
289
|
+
]);
|
|
290
|
+
setQuery(query);
|
|
291
|
+
focusSearchInput();
|
|
292
|
+
} }),
|
|
293
|
+
react_1.default.createElement(SearchSuggestedPages_1.SearchSuggestedPages, null)))))) : (react_1.default.createElement(SearchAiDialog_1.SearchAiDialog, { initialMessage: query, response: aiSearch.response, isGeneratingResponse: aiSearch.isGeneratingResponse, error: aiSearch.error, resources: aiSearch.resources, conversation: aiSearch.conversation, setConversation: aiSearch.setConversation, onMessageSent: aiSearch.askQuestion, toolCalls: aiSearch.toolCalls, contentSegments: aiSearch.contentSegments }))),
|
|
294
|
+
react_1.default.createElement(SearchDialogFooter, null, mode === 'ai-dialog' ? (react_1.default.createElement(AiDisclaimer, null, translate('search.ai.disclaimer', 'AI search might provide incomplete or incorrect results. Verify important information.'))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
295
|
+
react_1.default.createElement(SearchShortcuts, null,
|
|
296
|
+
react_1.default.createElement(SearchShortcut_1.SearchShortcut, { "data-translation-key": "search.keys.navigate", combination: "Tab", text: translate('search.keys.navigate', 'to navigate') }),
|
|
297
|
+
react_1.default.createElement(SearchShortcut_1.SearchShortcut, { "data-translation-key": "search.keys.select", combination: "\u23CE", text: translate('search.keys.select', 'to select') }),
|
|
298
|
+
react_1.default.createElement(SearchShortcut_1.SearchShortcut, { "data-translation-key": "search.keys.exit", combination: "Esc", text: translate('search.keys.exit', 'to exit') })),
|
|
299
|
+
isSearchLoading && (react_1.default.createElement(SearchLoading, null,
|
|
300
|
+
react_1.default.createElement(SpinnerLoader_1.SpinnerLoader, { size: "16px", color: "var(--search-input-icon-color)" }),
|
|
301
|
+
translate('search.loading', 'Loading...'))),
|
|
302
|
+
react_1.default.createElement(SearchCancelButton, { "data-translation-key": "search.cancel", variant: "secondary", size: "small", onClick: handleClose }, translate('search.cancel', 'Cancel')))))))));
|
|
301
303
|
}
|
|
302
304
|
const SearchOverlay = styled_components_1.default.div `
|
|
303
305
|
position: fixed;
|
|
@@ -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;
|