@redocly/theme 0.69.0-next.1 → 0.69.0-next.11
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/Accordion/Accordion.js +5 -1
- package/lib/components/Accordion/variables.js +1 -1
- package/lib/components/Admonition/Admonition.d.ts +1 -1
- package/lib/components/Admonition/Admonition.js +1 -1
- package/lib/components/Admonition/variables.dark.js +2 -2
- package/lib/components/Admonition/variables.js +10 -10
- package/lib/components/Badge/Badge.d.ts +3 -1
- package/lib/components/Badge/Badge.js +7 -2
- package/lib/components/Banner/variables.dark.js +2 -0
- package/lib/components/Banner/variables.js +3 -1
- package/lib/components/Breadcrumbs/Breadcrumb.js +1 -1
- package/lib/components/Breadcrumbs/variables.js +1 -1
- package/lib/components/Button/ButtonGroup.d.ts +3 -5
- package/lib/components/Button/ButtonGroup.js +25 -5
- package/lib/components/Button/variables.js +27 -4
- package/lib/components/Buttons/ConnectMCPButton.js +39 -123
- package/lib/components/Buttons/CopyButton.js +12 -1
- package/lib/components/Buttons/variables.d.ts +0 -1
- package/lib/components/Buttons/variables.js +3 -44
- package/lib/components/Catalog/CatalogEntities.js +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +5 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +1 -1
- package/lib/components/Catalog/CatalogFilter/CatalogFilterSelect.js +1 -0
- package/lib/components/Catalog/CatalogViewModeToggle.d.ts +1 -1
- package/lib/components/Catalog/CatalogViewModeToggle.js +2 -43
- package/lib/components/Catalog/variables.js +5 -5
- package/lib/components/CatalogClassic/variables.js +2 -2
- package/lib/components/CodeBlock/CodeBlock.js +2 -1
- package/lib/components/CodeBlock/CodeBlockContainer.js +1 -0
- package/lib/components/Dropdown/Dropdown.d.ts +10 -20
- package/lib/components/Dropdown/Dropdown.js +13 -2
- package/lib/components/Dropdown/DropdownMenuItemContent.d.ts +9 -0
- package/lib/components/Dropdown/DropdownMenuItemContent.js +56 -0
- package/lib/components/Dropdown/variables.js +19 -2
- package/lib/components/Feedback/Mood.js +18 -14
- package/lib/components/Feedback/Rating.js +18 -13
- package/lib/components/Feedback/Scale.js +27 -22
- package/lib/components/Feedback/Sentiment.js +17 -13
- package/lib/components/Filter/FilterInput.js +4 -2
- package/lib/components/Filter/FilterSelect.js +1 -0
- package/lib/components/Filter/variables.js +2 -2
- package/lib/components/Image/variables.js +5 -3
- package/lib/components/JsonViewer/Helpers.js +12 -42
- package/lib/components/LanguagePicker/variables.js +1 -1
- package/lib/components/MCP/McpConnectionTabs.d.ts +7 -0
- package/lib/components/MCP/McpConnectionTabs.js +161 -0
- package/lib/components/Markdown/styles/base-table.js +8 -0
- package/lib/components/Markdown/variables.js +1 -1
- package/lib/components/Menu/MenuItem.js +1 -1
- package/lib/components/Menu/variables.js +1 -1
- package/lib/components/Navbar/variables.js +1 -1
- package/lib/components/PageActions/PageActions.js +4 -6
- package/lib/components/PageActions/PageActionsMenuItem.d.ts +4 -4
- package/lib/components/PageActions/PageActionsMenuItem.js +27 -43
- package/lib/components/Panel/Panel.js +5 -1
- package/lib/components/Panel/variables.js +1 -1
- package/lib/components/Product/variables.js +2 -1
- package/lib/components/ReplayGate/ReplayGate.d.ts +1 -0
- package/lib/components/Search/FilterFields/SearchFilterFieldSelect.js +22 -32
- package/lib/components/Search/SearchAiDialog.js +4 -1
- package/lib/components/Search/SearchAiMessage.js +1 -1
- package/lib/components/Search/SearchAiNegativeFeedbackForm.js +2 -2
- package/lib/components/Search/SearchDialog.js +2 -2
- package/lib/components/Search/SearchItem.js +6 -3
- package/lib/components/Search/SearchRecent.js +1 -0
- package/lib/components/Search/SearchSuggestedPages.js +1 -0
- package/lib/components/Search/variables.js +9 -5
- package/lib/components/Segmented/Segmented.js +3 -3
- package/lib/components/Select/Select.js +30 -23
- package/lib/components/Select/variables.js +3 -3
- package/lib/components/Sidebar/Sidebar.js +2 -38
- package/lib/components/SplitButton/SplitButton.d.ts +21 -0
- package/lib/components/SplitButton/SplitButton.js +37 -0
- package/lib/components/Switch/variables.dark.js +2 -2
- package/lib/components/Switch/variables.js +2 -2
- package/lib/components/Tag/variables.js +2 -2
- package/lib/components/Tags/variables.js +1 -1
- package/lib/components/Toast/variables.js +1 -1
- package/lib/components/Tooltip/AnchorTooltip.js +2 -2
- package/lib/components/Tooltip/JsTooltip.js +2 -2
- package/lib/components/UserMenu/variables.js +1 -1
- package/lib/core/constants/mcp.d.ts +4 -0
- package/lib/core/constants/mcp.js +10 -1
- package/lib/core/constants/search.js +2 -2
- package/lib/core/contexts/AccordionGroupContext.d.ts +1 -0
- package/lib/core/contexts/AccordionGroupContext.js +6 -0
- package/lib/core/contexts/PageActionsContext.d.ts +5 -0
- package/lib/core/contexts/PageActionsContext.js +10 -0
- package/lib/core/contexts/index.d.ts +2 -0
- package/lib/core/contexts/index.js +2 -0
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +5 -17
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.js +2 -0
- package/lib/core/hooks/menu/use-menu-item-expanded.js +1 -0
- package/lib/core/hooks/use-active-heading.js +63 -15
- package/lib/core/hooks/use-active-section-id.js +3 -1
- package/lib/core/hooks/use-connect-mcp-button.d.ts +1 -1
- package/lib/core/hooks/use-connect-mcp-button.js +23 -15
- package/lib/core/hooks/use-control.js +3 -0
- package/lib/core/hooks/use-local-state.js +1 -0
- package/lib/core/hooks/use-mcp-config.d.ts +2 -0
- package/lib/core/hooks/use-mcp-config.js +14 -4
- package/lib/core/hooks/use-mobile-menu.js +10 -2
- package/lib/core/hooks/use-tabs.js +4 -2
- package/lib/core/hooks/use-telemetry-fallback.d.ts +2 -0
- package/lib/core/hooks/use-telemetry-fallback.js +2 -0
- package/lib/core/styles/global.js +16 -11
- package/lib/core/styles/palette.js +2 -0
- package/lib/core/types/button-group.d.ts +2 -0
- package/lib/core/types/button-group.js +3 -0
- package/lib/core/types/catalog.d.ts +2 -4
- package/lib/core/types/common.d.ts +2 -0
- package/lib/core/types/hooks.d.ts +1 -0
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/mcp.d.ts +1 -1
- package/lib/core/utils/RenderWithLink.d.ts +2 -0
- package/lib/core/utils/RenderWithLink.js +20 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/core/utils/mcp.d.ts +5 -0
- package/lib/core/utils/mcp.js +35 -0
- package/lib/icons/CodexIcon/CodexIcon.d.ts +25 -0
- package/lib/icons/CodexIcon/CodexIcon.js +22 -0
- package/lib/icons/LinkIcon/LinkIcon.js +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/layouts/McpNotAllowed.js +10 -10
- package/lib/markdoc/components/Accordion/Accordion.js +6 -6
- package/lib/markdoc/components/Accordion/AccordionGroup.d.ts +2 -1
- package/lib/markdoc/components/Accordion/AccordionGroup.js +39 -3
- package/lib/markdoc/components/Cards/Card.d.ts +8 -1
- package/lib/markdoc/components/Cards/Card.js +55 -16
- package/lib/markdoc/components/Cards/CardBadge.d.ts +9 -0
- package/lib/markdoc/components/Cards/CardBadge.js +30 -0
- package/lib/markdoc/components/Cards/CardIcon.d.ts +5 -4
- package/lib/markdoc/components/Cards/CardIcon.js +6 -3
- package/lib/markdoc/components/Cards/variables.dark.js +32 -0
- package/lib/markdoc/components/Cards/variables.js +81 -7
- package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +1 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +1 -1
- package/lib/markdoc/components/CodeWalkthrough/variables.js +2 -1
- package/lib/markdoc/components/Heading/Heading.js +5 -2
- package/lib/markdoc/components/Tabs/TabList.js +6 -2
- package/lib/markdoc/components/Tabs/Tabs.js +4 -2
- package/lib/markdoc/components/Tabs/variables.js +4 -4
- package/lib/markdoc/tags/accordion-group.js +3 -0
- package/lib/markdoc/tags/admonition.js +1 -1
- package/lib/markdoc/tags/card.js +14 -0
- package/lib/markdoc/tags/connect-mcp.js +2 -1
- package/package.json +19 -10
- package/src/components/Accordion/Accordion.tsx +7 -3
- package/src/components/Accordion/variables.ts +1 -1
- package/src/components/Admonition/Admonition.tsx +2 -2
- package/src/components/Admonition/variables.dark.ts +2 -2
- package/src/components/Admonition/variables.ts +10 -10
- package/src/components/Badge/Badge.tsx +16 -2
- package/src/components/Banner/variables.dark.ts +2 -0
- package/src/components/Banner/variables.ts +3 -1
- package/src/components/Breadcrumbs/Breadcrumb.tsx +1 -1
- package/src/components/Breadcrumbs/variables.ts +1 -1
- package/src/components/Button/ButtonGroup.tsx +28 -10
- package/src/components/Button/variables.ts +27 -4
- package/src/components/Buttons/ConnectMCPButton.tsx +88 -145
- package/src/components/Buttons/CopyButton.tsx +14 -2
- package/src/components/Buttons/variables.ts +2 -44
- package/src/components/Catalog/CatalogEntities.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +6 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +1 -1
- package/src/components/Catalog/CatalogFilter/CatalogFilterSelect.tsx +1 -0
- package/src/components/Catalog/CatalogViewModeToggle.tsx +2 -17
- package/src/components/Catalog/variables.ts +5 -5
- package/src/components/CatalogClassic/variables.ts +2 -2
- package/src/components/CodeBlock/CodeBlock.tsx +2 -1
- package/src/components/CodeBlock/CodeBlockContainer.tsx +1 -0
- package/src/components/Dropdown/Dropdown.tsx +25 -4
- package/src/components/Dropdown/DropdownMenuItemContent.tsx +72 -0
- package/src/components/Dropdown/variables.ts +19 -2
- package/src/components/Feedback/Mood.tsx +22 -15
- package/src/components/Feedback/Rating.tsx +22 -14
- package/src/components/Feedback/Scale.tsx +40 -32
- package/src/components/Feedback/Sentiment.tsx +21 -14
- package/src/components/Filter/FilterInput.tsx +5 -3
- package/src/components/Filter/FilterSelect.tsx +1 -0
- package/src/components/Filter/variables.ts +2 -2
- package/src/components/Image/variables.ts +5 -3
- package/src/components/JsonViewer/Helpers.tsx +13 -9
- package/src/components/LanguagePicker/variables.ts +1 -1
- package/src/components/MCP/McpConnectionTabs.tsx +285 -0
- package/src/components/Markdown/styles/base-table.ts +8 -0
- package/src/components/Markdown/variables.ts +1 -1
- package/src/components/Menu/MenuItem.tsx +2 -2
- package/src/components/Menu/variables.ts +1 -1
- package/src/components/Navbar/variables.ts +1 -1
- package/src/components/PageActions/PageActions.tsx +22 -23
- package/src/components/PageActions/PageActionsMenuItem.tsx +41 -55
- package/src/components/Panel/Panel.tsx +7 -3
- package/src/components/Panel/variables.ts +1 -1
- package/src/components/Product/variables.ts +2 -1
- package/src/components/ReplayGate/ReplayGate.tsx +3 -0
- package/src/components/Search/FilterFields/SearchFilterFieldSelect.tsx +32 -40
- package/src/components/Search/SearchAiDialog.tsx +4 -1
- package/src/components/Search/SearchAiMessage.tsx +1 -1
- package/src/components/Search/SearchAiNegativeFeedbackForm.tsx +2 -2
- package/src/components/Search/SearchDialog.tsx +2 -2
- package/src/components/Search/SearchItem.tsx +7 -1
- package/src/components/Search/SearchRecent.tsx +1 -0
- package/src/components/Search/SearchSuggestedPages.tsx +1 -0
- package/src/components/Search/variables.ts +9 -5
- package/src/components/Segmented/Segmented.tsx +6 -3
- package/src/components/Select/Select.tsx +36 -22
- package/src/components/Select/variables.ts +3 -3
- package/src/components/Sidebar/Sidebar.tsx +2 -6
- package/src/components/SplitButton/SplitButton.tsx +95 -0
- package/src/components/Switch/variables.dark.ts +2 -2
- package/src/components/Switch/variables.ts +2 -2
- package/src/components/Tag/variables.ts +2 -2
- package/src/components/Tags/variables.ts +1 -1
- package/src/components/Toast/variables.ts +1 -1
- package/src/components/Tooltip/AnchorTooltip.tsx +2 -2
- package/src/components/Tooltip/JsTooltip.tsx +2 -2
- package/src/components/UserMenu/variables.ts +1 -1
- package/src/core/constants/mcp.ts +14 -0
- package/src/core/constants/search.ts +2 -2
- package/src/core/contexts/AccordionGroupContext.tsx +3 -0
- package/src/core/contexts/PageActionsContext.tsx +7 -0
- package/src/core/contexts/index.ts +2 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +2 -0
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +6 -20
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +2 -0
- package/src/core/hooks/menu/use-menu-item-expanded.ts +1 -0
- package/src/core/hooks/use-active-heading.ts +83 -15
- package/src/core/hooks/use-active-section-id.ts +3 -1
- package/src/core/hooks/use-connect-mcp-button.ts +31 -17
- package/src/core/hooks/use-control.ts +5 -1
- package/src/core/hooks/use-local-state.ts +1 -0
- package/src/core/hooks/use-mcp-config.ts +15 -4
- package/src/core/hooks/use-mobile-menu.ts +11 -3
- package/src/core/hooks/use-tabs.ts +4 -2
- package/src/core/hooks/use-telemetry-fallback.ts +2 -0
- package/src/core/openapi/index.ts +1 -1
- package/src/core/styles/global.ts +17 -12
- package/src/core/styles/palette.ts +2 -0
- package/src/core/types/button-group.ts +2 -0
- package/src/core/types/catalog.ts +2 -4
- package/src/core/types/common.ts +3 -0
- package/src/core/types/hooks.ts +1 -0
- package/src/core/types/index.ts +1 -0
- package/src/core/types/l10n.ts +29 -1
- package/src/core/types/mcp.ts +1 -1
- package/src/core/utils/RenderWithLink.tsx +19 -0
- package/src/core/utils/index.ts +1 -0
- package/src/core/utils/mcp.ts +39 -0
- package/src/icons/CodexIcon/CodexIcon.tsx +23 -0
- package/src/icons/LinkIcon/LinkIcon.tsx +1 -1
- package/src/index.ts +2 -0
- package/src/layouts/McpNotAllowed.tsx +37 -11
- package/src/markdoc/components/Accordion/Accordion.tsx +8 -2
- package/src/markdoc/components/Accordion/AccordionGroup.tsx +9 -2
- package/src/markdoc/components/Cards/Card.tsx +79 -14
- package/src/markdoc/components/Cards/CardBadge.tsx +39 -0
- package/src/markdoc/components/Cards/CardIcon.tsx +16 -5
- package/src/markdoc/components/Cards/variables.dark.ts +32 -0
- package/src/markdoc/components/Cards/variables.ts +81 -7
- package/src/markdoc/components/CodeWalkthrough/CodePanel.tsx +1 -0
- package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +1 -1
- package/src/markdoc/components/CodeWalkthrough/variables.ts +2 -1
- package/src/markdoc/components/Heading/Heading.tsx +7 -4
- package/src/markdoc/components/Tabs/TabList.tsx +6 -2
- package/src/markdoc/components/Tabs/Tabs.tsx +4 -2
- package/src/markdoc/components/Tabs/variables.ts +4 -4
- package/src/markdoc/tags/accordion-group.ts +3 -0
- package/src/markdoc/tags/admonition.ts +1 -1
- package/src/markdoc/tags/card.ts +14 -0
- package/src/markdoc/tags/connect-mcp.ts +3 -1
|
@@ -34,7 +34,7 @@ const PathLabel = styled_components_1.default.label `
|
|
|
34
34
|
const LinksWrapper = styled_components_1.default.div `
|
|
35
35
|
display: flex;
|
|
36
36
|
flex-direction: column;
|
|
37
|
-
border-radius: var(--border-radius);
|
|
37
|
+
border-radius: var(--border-radius-xl);
|
|
38
38
|
background-color: var(--catalog-metadata-bg-color);
|
|
39
39
|
transition: all 0.2s ease-in-out;
|
|
40
40
|
margin: 0 0 var(--spacing-base) 0;
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js
CHANGED
|
@@ -48,9 +48,11 @@ function CatalogEntityRelations({ entity, entitiesCatalogConfig, initialRelation
|
|
|
48
48
|
const { useCatalogSort, useFetchCatalogEntitiesRelations } = (0, hooks_1.useThemeHooks)();
|
|
49
49
|
const { sortOption, setSortOption, handleSortClick, isColumnSorted } = useCatalogSort();
|
|
50
50
|
const [filter, setFilter] = (0, react_1.useState)(ENTITY_DEFAULT_FILTERS[entity.type]);
|
|
51
|
-
(0, react_1.
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
const [prevEntityKey, setPrevEntityKey] = (0, react_1.useState)(entity.key);
|
|
52
|
+
if (prevEntityKey !== entity.key) {
|
|
53
|
+
setPrevEntityKey(entity.key);
|
|
54
|
+
setFilter(ENTITY_DEFAULT_FILTERS[entity.type]);
|
|
55
|
+
}
|
|
54
56
|
const combinedFilter = (0, react_1.useMemo)(() => {
|
|
55
57
|
const baseFilter = filter !== null && filter !== void 0 ? filter : ENTITY_DEFAULT_FILTERS[entity.type];
|
|
56
58
|
if (entity.version && entity.revision) {
|
|
@@ -68,7 +68,7 @@ function CatalogEntitySchema({ entity, relatedEntity, RedocSchema, StoreProvider
|
|
|
68
68
|
const MetadataWrapper = styled_components_1.default.div `
|
|
69
69
|
display: flex;
|
|
70
70
|
flex-direction: column;
|
|
71
|
-
border-radius: var(--border-radius);
|
|
71
|
+
border-radius: var(--border-radius-xl);
|
|
72
72
|
background-color: var(--catalog-metadata-bg-color);
|
|
73
73
|
margin-bottom: var(--spacing-lg);
|
|
74
74
|
`;
|
|
@@ -116,6 +116,7 @@ const StyledSelect = (0, styled_components_1.default)(Select_1.Select) `
|
|
|
116
116
|
--select-text-color: var(--filter-select-color);
|
|
117
117
|
border: 1px solid var(--filter-select-border-color);
|
|
118
118
|
--select-border-radius: var(--filter-select-border-radius);
|
|
119
|
+
--select-input-border-radius: var(--filter-select-border-radius);
|
|
119
120
|
padding: var(--filter-select-padding);
|
|
120
121
|
|
|
121
122
|
&:hover {
|
|
@@ -4,4 +4,4 @@ export type CatalogViewModeToggleProps = {
|
|
|
4
4
|
viewMode: CatalogViewMode;
|
|
5
5
|
onViewModeChange: (mode: CatalogViewMode) => void;
|
|
6
6
|
};
|
|
7
|
-
export declare function CatalogViewModeToggle({ viewMode
|
|
7
|
+
export declare function CatalogViewModeToggle({ viewMode, onViewModeChange }: CatalogViewModeToggleProps): React.JSX.Element;
|
|
@@ -1,55 +1,14 @@
|
|
|
1
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
38
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
6
|
exports.CatalogViewModeToggle = CatalogViewModeToggle;
|
|
40
|
-
const react_1 =
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
41
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
42
9
|
const TableIcon_1 = require("../../icons/TableIcon/TableIcon");
|
|
43
10
|
const CardsIcon_1 = require("../../icons/CardsIcon/CardsIcon");
|
|
44
|
-
function
|
|
45
|
-
const [viewMode, setViewMode] = (0, react_1.useState)(null);
|
|
46
|
-
(0, react_1.useEffect)(() => {
|
|
47
|
-
setViewMode(initialViewMode);
|
|
48
|
-
}, [initialViewMode]);
|
|
49
|
-
return viewMode;
|
|
50
|
-
}
|
|
51
|
-
function CatalogViewModeToggle({ viewMode: initialViewMode, onViewModeChange, }) {
|
|
52
|
-
const viewMode = useViewMode(initialViewMode);
|
|
11
|
+
function CatalogViewModeToggle({ viewMode, onViewModeChange }) {
|
|
53
12
|
return (react_1.default.createElement(ViewModeToggleWrapper, { "data-component-name": "Catalog/CatalogViewModeToggle" },
|
|
54
13
|
react_1.default.createElement(ViewModeButton, { className: viewMode === 'table' ? 'active' : '', onClick: () => onViewModeChange('table') },
|
|
55
14
|
react_1.default.createElement(TableIcon_1.TableIcon, { size: "var(--catalog-view-mode-table-icon-size)" })),
|
|
@@ -192,7 +192,7 @@ exports.catalog = (0, styled_components_1.css) `
|
|
|
192
192
|
*/
|
|
193
193
|
--catalog-sort-trigger-gap: var(--spacing-xs);
|
|
194
194
|
--catalog-sort-trigger-padding: 6px 8px;
|
|
195
|
-
--catalog-sort-trigger-border-radius: var(--border-radius-
|
|
195
|
+
--catalog-sort-trigger-border-radius: var(--border-radius-lg);
|
|
196
196
|
--catalog-sort-trigger-hover-bg-color: var(--button-bg-color-secondary-hover);
|
|
197
197
|
--catalog-sort-icon-color: var(--text-color-secondary);
|
|
198
198
|
--catalog-sort-text-font-size: var(--font-size-sm);
|
|
@@ -222,7 +222,7 @@ exports.catalog = (0, styled_components_1.css) `
|
|
|
222
222
|
--catalog-card-border-width: var(--border-width);
|
|
223
223
|
--catalog-card-border-style: var(--border-style);
|
|
224
224
|
--catalog-card-border-color-hover: var(--border-color-primary);
|
|
225
|
-
--catalog-card-border-radius: var(--border-radius-
|
|
225
|
+
--catalog-card-border-radius: var(--border-radius-xl);
|
|
226
226
|
--catalog-cards-group-margin: 0 0 var(--spacing-base) 0;
|
|
227
227
|
--catalog-cards-group-gap: var(--spacing-lg);
|
|
228
228
|
|
|
@@ -231,7 +231,7 @@ exports.catalog = (0, styled_components_1.css) `
|
|
|
231
231
|
*/
|
|
232
232
|
--catalog-card-icon-width: 30px;
|
|
233
233
|
--catalog-card-icon-height: 30px;
|
|
234
|
-
--catalog-card-icon-border-radius:
|
|
234
|
+
--catalog-card-icon-border-radius: var(--border-radius);
|
|
235
235
|
--catalog-card-icon-bg-color: var(--bg-color);
|
|
236
236
|
--catalog-card-icon-border-color: var(--border-color-secondary);
|
|
237
237
|
--catalog-card-icon-border-width: 1px;
|
|
@@ -309,7 +309,7 @@ exports.catalog = (0, styled_components_1.css) `
|
|
|
309
309
|
--catalog-actions-min-height: 40px;
|
|
310
310
|
--catalog-actions-bg-color: var(--bg-color-tonal);
|
|
311
311
|
|
|
312
|
-
--catalog-page-badge-border-radius: var(--border-radius);
|
|
312
|
+
--catalog-page-badge-border-radius: var(--badge-border-radius);
|
|
313
313
|
--catalog-page-badge-padding: 0 var(--spacing-xs);
|
|
314
314
|
--catalog-page-badge-font-size: var(--font-size-base);
|
|
315
315
|
--catalog-page-badge-line-height: var(--line-height-base);
|
|
@@ -345,7 +345,7 @@ exports.catalog = (0, styled_components_1.css) `
|
|
|
345
345
|
*/
|
|
346
346
|
--catalog-table-icon-width: 32px;
|
|
347
347
|
--catalog-table-icon-height: 32px;
|
|
348
|
-
--catalog-table-icon-border-radius:
|
|
348
|
+
--catalog-table-icon-border-radius: var(--border-radius);
|
|
349
349
|
--catalog-table-icon-bg-color: var(--bg-color-tonal);
|
|
350
350
|
--catalog-table-icon-border-color: var(--border-color-secondary);
|
|
351
351
|
--catalog-table-icon-border-width: 1px;
|
|
@@ -59,7 +59,7 @@ exports.catalogClassic = (0, styled_components_1.css) `
|
|
|
59
59
|
--catalog-classic-card-border-width: var(--border-width);
|
|
60
60
|
--catalog-classic-card-border-style: var(--border-style);
|
|
61
61
|
--catalog-classic-card-border-color-hover: var(--border-color-primary);
|
|
62
|
-
--catalog-classic-card-border-radius: var(--border-radius-
|
|
62
|
+
--catalog-classic-card-border-radius: var(--border-radius-xl);
|
|
63
63
|
--catalog-classic-cards-group-margin: 0 0 var(--spacing-base) 0;
|
|
64
64
|
--catalog-classic-cards-group-gap: var(--spacing-xl);
|
|
65
65
|
|
|
@@ -96,7 +96,7 @@ exports.catalogClassic = (0, styled_components_1.css) `
|
|
|
96
96
|
--catalog-classic-actions-min-height: 40px;
|
|
97
97
|
--catalog-classic-actions-bg-color: var(--bg-color-tonal);
|
|
98
98
|
|
|
99
|
-
--catalog-classic-page-badge-border-radius: var(--border-radius);
|
|
99
|
+
--catalog-classic-page-badge-border-radius: var(--border-radius-md);
|
|
100
100
|
--catalog-classic-page-badge-padding: 0 var(--spacing-xs);
|
|
101
101
|
--catalog-classic-page-badge-font-size: var(--font-size-base);
|
|
102
102
|
--catalog-classic-page-badge-line-height: var(--line-height-base);
|
|
@@ -98,6 +98,7 @@ function CodeBlock(_a) {
|
|
|
98
98
|
var _a, _b;
|
|
99
99
|
const _source = source || ((_b = (_a = externalSource === null || externalSource === void 0 ? void 0 : externalSource.sample) === null || _a === void 0 ? void 0 : _a.get) === null || _b === void 0 ? void 0 : _b.call(_a, externalSource));
|
|
100
100
|
if (_source) {
|
|
101
|
+
// oxlint-disable-next-line react-you-might-not-need-an-effect/no-derived-state
|
|
101
102
|
setSourceCode(_source);
|
|
102
103
|
}
|
|
103
104
|
}, [source, externalSource]);
|
|
@@ -128,7 +129,7 @@ const ContainerWrapper = styled_components_1.default.div `
|
|
|
128
129
|
`;
|
|
129
130
|
const CodeBlockWrapper = styled_components_1.default.div `
|
|
130
131
|
border: 1px solid var(--border-color-secondary);
|
|
131
|
-
border-radius: var(--border-radius);
|
|
132
|
+
border-radius: var(--border-radius-xl);
|
|
132
133
|
background-color: var(--code-block-bg-color);
|
|
133
134
|
margin: 0 0 var(--spacing-sm);
|
|
134
135
|
|
|
@@ -68,6 +68,7 @@ const CodeBlockContainerComponent = styled_components_1.default.pre `
|
|
|
68
68
|
white-space: ${({ $wrapContents }) => ($wrapContents ? 'pre-wrap' : 'var(--code-wrap, pre)')};
|
|
69
69
|
max-height: ${({ $maxHeight }) => $maxHeight ? $maxHeight : 'var(--code-block-max-height, 600px);'};
|
|
70
70
|
word-break: var(--code-block-word-break, initial);
|
|
71
|
+
border-radius: var(--border-radius-xl);
|
|
71
72
|
|
|
72
73
|
pre,
|
|
73
74
|
code {
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { RenderableChildren } from '../../core/types';
|
|
3
|
+
type DropdownMenuContext = {
|
|
4
|
+
close: () => void;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type DropdownProps = {
|
|
4
8
|
trigger: React.ReactNode;
|
|
9
|
+
children: RenderableChildren<DropdownMenuContext>;
|
|
5
10
|
triggerEvent?: 'click' | 'hover';
|
|
6
11
|
placement?: 'top' | 'bottom';
|
|
7
12
|
alignment?: 'start' | 'end';
|
|
@@ -14,21 +19,6 @@ export type DropdownProps = PropsWithChildren<{
|
|
|
14
19
|
onClick?: (event: React.UIEvent) => void;
|
|
15
20
|
onClose?: () => void;
|
|
16
21
|
onOpen?: () => void;
|
|
17
|
-
}
|
|
18
|
-
export declare const Dropdown: React.ForwardRefExoticComponent<
|
|
19
|
-
|
|
20
|
-
triggerEvent?: 'click' | 'hover';
|
|
21
|
-
placement?: 'top' | 'bottom';
|
|
22
|
-
alignment?: 'start' | 'end';
|
|
23
|
-
active?: boolean;
|
|
24
|
-
closeOnClick?: boolean;
|
|
25
|
-
dataAttributes?: Record<string, string>;
|
|
26
|
-
className?: string;
|
|
27
|
-
withArrow?: boolean;
|
|
28
|
-
portalled?: boolean;
|
|
29
|
-
onClick?: (event: React.UIEvent) => void;
|
|
30
|
-
onClose?: () => void;
|
|
31
|
-
onOpen?: () => void;
|
|
32
|
-
} & {
|
|
33
|
-
children?: React.ReactNode | undefined;
|
|
34
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
};
|
|
23
|
+
export declare const Dropdown: React.ForwardRefExoticComponent<DropdownProps & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
export {};
|
|
@@ -52,6 +52,9 @@ exports.Dropdown = (0, react_1.forwardRef)(({ children, className, active, trigg
|
|
|
52
52
|
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
53
53
|
};
|
|
54
54
|
const handleClose = () => {
|
|
55
|
+
if (!isOpen) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
55
58
|
setIsOpen(false);
|
|
56
59
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
57
60
|
};
|
|
@@ -109,9 +112,10 @@ exports.Dropdown = (0, react_1.forwardRef)(({ children, className, active, trigg
|
|
|
109
112
|
};
|
|
110
113
|
}, [portalled, isOpen, updateMenuPosition]);
|
|
111
114
|
(0, hooks_1.useOutsideClick)(portalled ? [wrapperRef, menuRef] : wrapperRef, handleClose);
|
|
115
|
+
const menuContent = typeof children === 'function' ? children({ close: handleClose, isOpen }) : children;
|
|
112
116
|
const triggerChild = react_1.default.Children.only(trigger);
|
|
113
|
-
const dropdownTrigger = (0, react_1.cloneElement)(triggerChild, Object.assign(Object.assign(Object.assign({ onClick: triggerEvent === 'click' ? handleToggle : undefined, icon: withArrow ? isOpen ? react_1.default.createElement(ChevronUpIcon_1.ChevronUpIcon, null) : react_1.default.createElement(ChevronDownIcon_1.ChevronDownIcon, null) : undefined }, (withArrow ? { iconPosition: 'right' } : {})), triggerChild.props), { onKeyDown: triggerEvent === 'click' ? handleKeyDown : undefined }));
|
|
114
|
-
const menu = (react_1.default.createElement(ChildrenWrapper, { ref: menuRef, $placement: placement, $alignment: alignment, $isOpen: isOpen, $portalled: portalled, style: portalled ? menuStyle : undefined, onClick: closeOnClick ? handleChildClick : undefined },
|
|
117
|
+
const dropdownTrigger = (0, react_1.cloneElement)(triggerChild, Object.assign(Object.assign(Object.assign({ onClick: triggerEvent === 'click' ? handleToggle : undefined, 'aria-expanded': isOpen, icon: withArrow ? isOpen ? react_1.default.createElement(ChevronUpIcon_1.ChevronUpIcon, null) : react_1.default.createElement(ChevronDownIcon_1.ChevronDownIcon, null) : undefined }, (withArrow ? { iconPosition: 'right' } : {})), triggerChild.props), { onKeyDown: triggerEvent === 'click' ? handleKeyDown : undefined }));
|
|
118
|
+
const menu = (react_1.default.createElement(ChildrenWrapper, { ref: menuRef, $placement: placement, $alignment: alignment, $isOpen: isOpen, $portalled: portalled, style: portalled ? menuStyle : undefined, onClick: closeOnClick ? handleChildClick : undefined }, menuContent));
|
|
115
119
|
const portalledMenu = isOpen && typeof document !== 'undefined' ? (0, react_dom_1.createPortal)(menu, document.body) : null;
|
|
116
120
|
return (react_1.default.createElement(DropdownWrapper, Object.assign({ "data-component-name": "Dropdown/Dropdown", "data-testid": "dropdown" }, dataAttributes, { className: className, ref: wrapperRef, onPointerEnter: triggerEvent === 'hover' ? handleOpen : undefined, onPointerLeave: triggerEvent === 'hover' ? handleClose : undefined, onClick: onClick }),
|
|
117
121
|
dropdownTrigger,
|
|
@@ -132,6 +136,13 @@ const DropdownWrapper = styled_components_1.default.div `
|
|
|
132
136
|
position: relative;
|
|
133
137
|
|
|
134
138
|
text-decoration: none;
|
|
139
|
+
|
|
140
|
+
/* The trigger keeps its hovered appearance while the menu is open. */
|
|
141
|
+
> .button[aria-expanded='true'] {
|
|
142
|
+
background-color: var(--button-bg-color-hover);
|
|
143
|
+
color: var(--button-color-hover);
|
|
144
|
+
border-color: var(--button-border-color-hover);
|
|
145
|
+
}
|
|
135
146
|
`;
|
|
136
147
|
const ChildrenWrapper = styled_components_1.default.div `
|
|
137
148
|
padding-top: var(--dropdown-menu-padding-top);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { JSX } from 'react';
|
|
3
|
+
export type DropdownMenuItemContentProps = {
|
|
4
|
+
title: React.ReactNode;
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
description?: React.ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function DropdownMenuItemContent(props: DropdownMenuItemContentProps): JSX.Element;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DropdownMenuItemContent = DropdownMenuItemContent;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
function DropdownMenuItemContent(props) {
|
|
10
|
+
const { title, icon, description, className } = props;
|
|
11
|
+
return (react_1.default.createElement(MenuItemContentWrapper, { "data-component-name": "Dropdown/DropdownMenuItemContent", className: className },
|
|
12
|
+
icon ? react_1.default.createElement(IconWrapper, null, icon) : null,
|
|
13
|
+
react_1.default.createElement(TextWrapper, null,
|
|
14
|
+
react_1.default.createElement(TitleWrapper, null, title),
|
|
15
|
+
description ? react_1.default.createElement(DescriptionWrapper, null, description) : null)));
|
|
16
|
+
}
|
|
17
|
+
const MenuItemContentWrapper = styled_components_1.default.div `
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: row;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: var(--dropdown-menu-item-content-gap);
|
|
22
|
+
padding: var(--dropdown-menu-item-content-padding);
|
|
23
|
+
`;
|
|
24
|
+
const IconWrapper = styled_components_1.default.div `
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
flex-shrink: 0;
|
|
29
|
+
width: var(--dropdown-menu-item-content-icon-size);
|
|
30
|
+
height: var(--dropdown-menu-item-content-icon-size);
|
|
31
|
+
color: var(--dropdown-menu-item-content-icon-color);
|
|
32
|
+
border: var(--dropdown-menu-item-content-icon-border);
|
|
33
|
+
border-radius: var(--dropdown-menu-item-content-icon-border-radius);
|
|
34
|
+
`;
|
|
35
|
+
const TextWrapper = styled_components_1.default.div `
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
flex: 1;
|
|
39
|
+
gap: var(--dropdown-menu-item-content-text-gap);
|
|
40
|
+
`;
|
|
41
|
+
const TitleWrapper = styled_components_1.default.div `
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
gap: var(--dropdown-menu-item-content-title-icon-gap);
|
|
45
|
+
font-weight: var(--dropdown-menu-item-content-title-font-weight);
|
|
46
|
+
font-size: var(--dropdown-menu-item-content-title-font-size);
|
|
47
|
+
line-height: var(--dropdown-menu-item-content-title-line-height);
|
|
48
|
+
color: var(--dropdown-menu-item-content-title-color);
|
|
49
|
+
`;
|
|
50
|
+
const DescriptionWrapper = styled_components_1.default.div `
|
|
51
|
+
font-weight: var(--dropdown-menu-item-content-description-font-weight);
|
|
52
|
+
font-size: var(--dropdown-menu-item-content-description-font-size);
|
|
53
|
+
line-height: var(--dropdown-menu-item-content-description-line-height);
|
|
54
|
+
color: var(--dropdown-menu-item-content-description-color);
|
|
55
|
+
`;
|
|
56
|
+
//# sourceMappingURL=DropdownMenuItemContent.js.map
|
|
@@ -19,7 +19,7 @@ exports.dropdown = (0, styled_components_1.css) `
|
|
|
19
19
|
--dropdown-menu-max-width: 424px;
|
|
20
20
|
--dropdown-menu-max-height: 300px;
|
|
21
21
|
--dropdown-menu-padding: var(--spacing-xxs); // @presenter Spacing
|
|
22
|
-
--dropdown-menu-border-radius: var(--border-radius-
|
|
22
|
+
--dropdown-menu-border-radius: var(--border-radius-xl); // @presenter BorderRadius
|
|
23
23
|
--dropdown-menu-box-shadow: var(--bg-raised-shadow); // @presenter Shadow
|
|
24
24
|
--dropdown-menu-border-color: var(--border-color-secondary); // @presenter Color
|
|
25
25
|
--dropdown-menu-bg-color: var(--bg-color-raised); // @presenter Color
|
|
@@ -29,7 +29,7 @@ exports.dropdown = (0, styled_components_1.css) `
|
|
|
29
29
|
--dropdown-menu-item-padding-vertical: 5px; // @presenter Spacing
|
|
30
30
|
--dropdown-menu-item-separator-padding-top: var(--spacing-xs); // @presenter Spacing
|
|
31
31
|
--dropdown-menu-item-separator-padding-bottom: var(--spacing-xxs); // @presenter Spacing
|
|
32
|
-
--dropdown-menu-item-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
32
|
+
--dropdown-menu-item-border-radius: var(--border-radius-lg); // @presenter BorderRadius
|
|
33
33
|
--dropdown-menu-item-bg-color: transparent;
|
|
34
34
|
--dropdown-menu-item-bg-color-active: var(--bg-color-hover); // @presenter Color
|
|
35
35
|
--dropdown-menu-item-bg-color-hover: var(--bg-color-hover); // @presenter Color
|
|
@@ -47,6 +47,23 @@ exports.dropdown = (0, styled_components_1.css) `
|
|
|
47
47
|
--dropdown-menu-item-color-dangerous: var(--color-error-base);
|
|
48
48
|
|
|
49
49
|
--dropdown-menu-item-border-color-focused: var(--button-border-color-focused);
|
|
50
|
+
|
|
51
|
+
--dropdown-menu-item-content-gap: var(--spacing-sm); // @presenter Spacing
|
|
52
|
+
--dropdown-menu-item-content-padding: var(--spacing-xxs) 0; // @presenter Spacing
|
|
53
|
+
--dropdown-menu-item-content-icon-size: 32px;
|
|
54
|
+
--dropdown-menu-item-content-icon-color: var(--icon-color-secondary); // @presenter Color
|
|
55
|
+
--dropdown-menu-item-content-icon-border: 1px solid var(--border-color-secondary); // @presenter Border
|
|
56
|
+
--dropdown-menu-item-content-icon-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
57
|
+
--dropdown-menu-item-content-text-gap: var(--spacing-xxs); // @presenter Spacing
|
|
58
|
+
--dropdown-menu-item-content-title-icon-gap: var(--spacing-xxs); // @presenter Spacing
|
|
59
|
+
--dropdown-menu-item-content-title-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
60
|
+
--dropdown-menu-item-content-title-font-size: var(--font-size-base); // @presenter FontSize
|
|
61
|
+
--dropdown-menu-item-content-title-line-height: var(--line-height-base); // @presenter LineHeight
|
|
62
|
+
--dropdown-menu-item-content-title-color: var(--text-color-secondary); // @presenter Color
|
|
63
|
+
--dropdown-menu-item-content-description-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
64
|
+
--dropdown-menu-item-content-description-font-size: var(--font-size-sm); // @presenter FontSize
|
|
65
|
+
--dropdown-menu-item-content-description-line-height: var(--line-height-sm); // @presenter LineHeight
|
|
66
|
+
--dropdown-menu-item-content-description-color: var(--text-color-description); // @presenter Color
|
|
50
67
|
// @tokens End
|
|
51
68
|
`;
|
|
52
69
|
//# sourceMappingURL=variables.js.map
|
|
@@ -36,7 +36,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.MOOD_STATES = void 0;
|
|
37
37
|
exports.Mood = Mood;
|
|
38
38
|
const React = __importStar(require("react"));
|
|
39
|
-
const react_1 = require("react");
|
|
40
39
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
41
40
|
const Reasons_1 = require("../../components/Feedback/Reasons");
|
|
42
41
|
const hooks_1 = require("../../core/hooks");
|
|
@@ -115,33 +114,38 @@ function Mood({ settings, onSubmit, className }) {
|
|
|
115
114
|
return 'checkbox';
|
|
116
115
|
return (_a = reasonsSettings[score]) === null || _a === void 0 ? void 0 : _a.component;
|
|
117
116
|
};
|
|
117
|
+
const hasComment = !(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide);
|
|
118
|
+
const hasOptionalEmail = !(optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.hide) && !(userData === null || userData === void 0 ? void 0 : userData.isAuthenticated);
|
|
118
119
|
const displayReasons = checkIfShouldDisplayReasons(score);
|
|
119
|
-
const displayComment = !!
|
|
120
|
+
const displayComment = !!score && hasComment;
|
|
120
121
|
const displaySubmitBnt = !!(score && (displayReasons || displayComment));
|
|
121
|
-
const displayFeedbackEmail = !!score &&
|
|
122
|
-
const
|
|
122
|
+
const displayFeedbackEmail = !!score && hasOptionalEmail;
|
|
123
|
+
const submitMood = (moodScore) => {
|
|
123
124
|
const trimmedComment = (comment === null || comment === void 0 ? void 0 : comment.trim()) || undefined;
|
|
124
125
|
const trimmedEmail = (email === null || email === void 0 ? void 0 : email.trim()) || undefined;
|
|
125
126
|
onSubmit({
|
|
126
|
-
score: remapScore(
|
|
127
|
+
score: remapScore(moodScore),
|
|
127
128
|
comment: trimmedComment,
|
|
128
129
|
reasons,
|
|
129
130
|
email: trimmedEmail,
|
|
130
131
|
});
|
|
131
132
|
setIsSubmitted(true);
|
|
132
133
|
};
|
|
134
|
+
const onSubmitMoodForm = () => {
|
|
135
|
+
submitMood(score);
|
|
136
|
+
};
|
|
137
|
+
const onScoreChange = (newScore) => {
|
|
138
|
+
setScore(newScore);
|
|
139
|
+
if (newScore && !checkIfShouldDisplayReasons(newScore) && !hasComment && !hasOptionalEmail) {
|
|
140
|
+
submitMood(newScore);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
133
143
|
const onCancelMoodForm = () => {
|
|
134
144
|
setScore('');
|
|
135
145
|
setComment('');
|
|
136
146
|
setReasons([]);
|
|
137
147
|
setEmail(undefined);
|
|
138
148
|
};
|
|
139
|
-
(0, react_1.useEffect)(() => {
|
|
140
|
-
if (score && !displayComment && !displayReasons && !displayFeedbackEmail) {
|
|
141
|
-
onSubmitMoodForm();
|
|
142
|
-
}
|
|
143
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
144
|
-
}, [score, displayComment, displayReasons, displayFeedbackEmail]);
|
|
145
149
|
if (isSubmitted) {
|
|
146
150
|
return (React.createElement(MoodWrapper, { "data-component-name": "Feedback/Mood" },
|
|
147
151
|
React.createElement(StyledFormMandatoryFields, null,
|
|
@@ -155,13 +159,13 @@ function Mood({ settings, onSubmit, className }) {
|
|
|
155
159
|
React.createElement(Label, { $standAlone: true, "data-translation-key": "feedback.settings.label" }, label || translate('feedback.settings.label', 'Was this helpful?')),
|
|
156
160
|
React.createElement(StyledMandatoryFieldContainer, null,
|
|
157
161
|
React.createElement(Button_1.Button, { "aria-label": MOOD_STATES.DISSATISFIED, type: "button", size: "medium", variant: score === MOOD_STATES.DISSATISFIED ? 'primary' : 'secondary', tone: score === MOOD_STATES.DISSATISFIED ? 'danger' : 'default', onClick: () => {
|
|
158
|
-
|
|
162
|
+
onScoreChange(MOOD_STATES.DISSATISFIED);
|
|
159
163
|
}, icon: React.createElement(FaceDissatisfiedIcon_1.FaceDissatisfiedIcon, null) }),
|
|
160
164
|
React.createElement(Button_1.Button, { "aria-label": MOOD_STATES.NEUTRAL, type: "button", variant: score === MOOD_STATES.NEUTRAL ? 'primary' : 'secondary', size: "medium", onClick: () => {
|
|
161
|
-
|
|
165
|
+
onScoreChange(MOOD_STATES.NEUTRAL);
|
|
162
166
|
}, icon: React.createElement(FaceNeutralIcon_1.FaceNeutralIcon, null) }),
|
|
163
167
|
React.createElement(Button_1.Button, { "aria-label": MOOD_STATES.SATISFIED, type: "button", variant: score === MOOD_STATES.SATISFIED ? 'primary' : 'secondary', size: "medium", onClick: () => {
|
|
164
|
-
|
|
168
|
+
onScoreChange(MOOD_STATES.SATISFIED);
|
|
165
169
|
}, icon: React.createElement(FaceSatisfiedIcon_1.FaceSatisfiedIcon, null) }))),
|
|
166
170
|
(displayReasons || displayComment) && (React.createElement(StyledFormOptionalFields, null,
|
|
167
171
|
displayReasons && (React.createElement(Reasons_1.Reasons, { settings: {
|
|
@@ -39,7 +39,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.FEEDBACK_MAX_RATING = void 0;
|
|
40
40
|
exports.Rating = Rating;
|
|
41
41
|
const React = __importStar(require("react"));
|
|
42
|
-
const react_1 = require("react");
|
|
43
42
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
44
43
|
const Reasons_1 = require("../../components/Feedback/Reasons");
|
|
45
44
|
const hooks_1 = require("../../core/hooks");
|
|
@@ -59,15 +58,18 @@ function Rating({ settings, onSubmit, className }) {
|
|
|
59
58
|
const { useTranslate, useUserMenu } = (0, hooks_1.useThemeHooks)();
|
|
60
59
|
const { userData } = useUserMenu();
|
|
61
60
|
const { translate } = useTranslate();
|
|
61
|
+
const hasReasons = !!(reasonsSettings && !reasonsSettings.hide);
|
|
62
|
+
const hasComment = !(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide);
|
|
63
|
+
const hasOptionalEmail = !(optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.hide) && !(userData === null || userData === void 0 ? void 0 : userData.isAuthenticated);
|
|
62
64
|
const onEmailChange = (e) => {
|
|
63
65
|
const value = e.target.value;
|
|
64
66
|
setEmail(value || undefined);
|
|
65
67
|
};
|
|
66
|
-
const
|
|
68
|
+
const submitRating = (ratingScore) => {
|
|
67
69
|
const trimmedComment = (comment === null || comment === void 0 ? void 0 : comment.trim()) || undefined;
|
|
68
70
|
const trimmedEmail = (email === null || email === void 0 ? void 0 : email.trim()) || undefined;
|
|
69
71
|
onSubmit({
|
|
70
|
-
score,
|
|
72
|
+
score: ratingScore,
|
|
71
73
|
comment: trimmedComment,
|
|
72
74
|
reasons,
|
|
73
75
|
max: exports.FEEDBACK_MAX_RATING,
|
|
@@ -75,22 +77,25 @@ function Rating({ settings, onSubmit, className }) {
|
|
|
75
77
|
});
|
|
76
78
|
setIsSubmitted(true);
|
|
77
79
|
};
|
|
80
|
+
const onSubmitRatingForm = () => {
|
|
81
|
+
submitRating(score);
|
|
82
|
+
};
|
|
83
|
+
const onScoreChange = (newScore) => {
|
|
84
|
+
setScore(newScore);
|
|
85
|
+
if (newScore && !hasReasons && !hasComment && !hasOptionalEmail) {
|
|
86
|
+
submitRating(newScore);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
78
89
|
const onCancelRatingForm = () => {
|
|
79
90
|
setScore(0);
|
|
80
91
|
setComment('');
|
|
81
92
|
setReasons([]);
|
|
82
93
|
setEmail(undefined);
|
|
83
94
|
};
|
|
84
|
-
const displayReasons = !!
|
|
85
|
-
const displayComment = !!
|
|
95
|
+
const displayReasons = !!score && hasReasons;
|
|
96
|
+
const displayComment = !!score && hasComment;
|
|
86
97
|
const displaySubmitBnt = !!(score && (displayReasons || displayComment));
|
|
87
|
-
const displayFeedbackEmail = !!score &&
|
|
88
|
-
(0, react_1.useEffect)(() => {
|
|
89
|
-
if (score && !displayComment && !displayReasons && !displayFeedbackEmail) {
|
|
90
|
-
onSubmitRatingForm();
|
|
91
|
-
}
|
|
92
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
93
|
-
}, [score, displayComment, displayReasons, displayFeedbackEmail]);
|
|
98
|
+
const displayFeedbackEmail = !!score && hasOptionalEmail;
|
|
94
99
|
if (isSubmitted) {
|
|
95
100
|
return (React.createElement(RatingWrapper, { "data-component-name": "Feedback/Rating" },
|
|
96
101
|
React.createElement(StyledFormMandatoryFields, null,
|
|
@@ -103,7 +108,7 @@ function Rating({ settings, onSubmit, className }) {
|
|
|
103
108
|
React.createElement(StyledFormMandatoryFields, null,
|
|
104
109
|
React.createElement(Label, { "data-translation-key": "feedback.settings.label" }, label || translate('feedback.settings.label', 'Was this helpful?')),
|
|
105
110
|
React.createElement(StyledMandatoryFieldContainer, null,
|
|
106
|
-
React.createElement(Stars_1.Stars, { max: exports.FEEDBACK_MAX_RATING, onChange:
|
|
111
|
+
React.createElement(Stars_1.Stars, { max: exports.FEEDBACK_MAX_RATING, onChange: onScoreChange, value: score }))),
|
|
107
112
|
(displayReasons || displayComment) && (React.createElement(StyledFormOptionalFields, null,
|
|
108
113
|
displayReasons && (React.createElement(Reasons_1.Reasons, { settings: {
|
|
109
114
|
label: reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.label,
|
|
@@ -39,7 +39,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.MAX_SCALE = void 0;
|
|
40
40
|
exports.Scale = Scale;
|
|
41
41
|
const React = __importStar(require("react"));
|
|
42
|
-
const react_1 = require("react");
|
|
43
42
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
44
43
|
const utils_1 = require("../../core/utils");
|
|
45
44
|
const hooks_1 = require("../../core/hooks");
|
|
@@ -63,25 +62,14 @@ function Scale({ settings, onSubmit, className }) {
|
|
|
63
62
|
const value = e.target.value;
|
|
64
63
|
setEmail(value || undefined);
|
|
65
64
|
};
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const displayReasons = !!score && reasonsSettings && !reasonsSettings.hide;
|
|
71
|
-
const displayComment = !!(score && !(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide));
|
|
72
|
-
const displaySubmitBnt = !!score && (displayReasons || displayComment);
|
|
73
|
-
const displayFeedbackEmail = !!score && !(optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.hide) && !userData.isAuthenticated;
|
|
74
|
-
const handleCancel = () => {
|
|
75
|
-
setScore(0);
|
|
76
|
-
setComment('');
|
|
77
|
-
setReasons([]);
|
|
78
|
-
setEmail(undefined);
|
|
79
|
-
};
|
|
80
|
-
const onSubmitScaleForm = () => {
|
|
65
|
+
const hasReasons = !!(reasonsSettings && !reasonsSettings.hide);
|
|
66
|
+
const hasComment = !(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide);
|
|
67
|
+
const hasOptionalEmail = !(optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.hide) && !(userData === null || userData === void 0 ? void 0 : userData.isAuthenticated);
|
|
68
|
+
const submitScale = (scaleScore) => {
|
|
81
69
|
const trimmedComment = (comment === null || comment === void 0 ? void 0 : comment.trim()) || undefined;
|
|
82
70
|
const trimmedEmail = (email === null || email === void 0 ? void 0 : email.trim()) || undefined;
|
|
83
71
|
onSubmit({
|
|
84
|
-
score,
|
|
72
|
+
score: scaleScore,
|
|
85
73
|
comment: trimmedComment,
|
|
86
74
|
reasons,
|
|
87
75
|
max: exports.MAX_SCALE,
|
|
@@ -89,12 +77,29 @@ function Scale({ settings, onSubmit, className }) {
|
|
|
89
77
|
});
|
|
90
78
|
setIsSubmitted(true);
|
|
91
79
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
80
|
+
const onSubmitScaleForm = () => {
|
|
81
|
+
submitScale(score);
|
|
82
|
+
};
|
|
83
|
+
const onScoreChange = (newScore) => {
|
|
84
|
+
setScore(newScore);
|
|
85
|
+
if (newScore && !hasReasons && !hasComment && !hasOptionalEmail) {
|
|
86
|
+
submitScale(newScore);
|
|
95
87
|
}
|
|
96
|
-
|
|
97
|
-
|
|
88
|
+
};
|
|
89
|
+
const handleCancel = () => {
|
|
90
|
+
setScore(0);
|
|
91
|
+
setComment('');
|
|
92
|
+
setReasons([]);
|
|
93
|
+
setEmail(undefined);
|
|
94
|
+
};
|
|
95
|
+
const scaleOptions = [];
|
|
96
|
+
for (let i = 1; i <= exports.MAX_SCALE; i++) {
|
|
97
|
+
scaleOptions.push(React.createElement(Button_1.Button, { id: `scale-option-${i}`, key: `scale-option-${i}`, type: "button", onClick: () => onScoreChange(i), className: `${score === i ? 'active' : ''}` }, i));
|
|
98
|
+
}
|
|
99
|
+
const displayReasons = !!score && hasReasons;
|
|
100
|
+
const displayComment = !!score && hasComment;
|
|
101
|
+
const displaySubmitBnt = !!score && (displayReasons || displayComment);
|
|
102
|
+
const displayFeedbackEmail = !!score && hasOptionalEmail;
|
|
98
103
|
if (isSubmitted) {
|
|
99
104
|
return (React.createElement(ScaleWrapper, { "data-component-name": "Feedback/Scale" },
|
|
100
105
|
React.createElement(Label, { "data-translation-key": "feedback.settings.submitText" }, submitText ||
|