@redocly/theme 0.59.0-next.4 → 0.59.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/LICENSE +1 -7
  2. package/lib/components/Buttons/AIAssistantButton.js +1 -5
  3. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +1 -1
  4. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +1 -1
  5. package/lib/components/Catalog/CatalogTagsWithTooltip.js +1 -1
  6. package/lib/components/Dropdown/Dropdown.d.ts +2 -16
  7. package/lib/components/Dropdown/Dropdown.js +5 -5
  8. package/lib/components/Menu/MenuItem.js +1 -1
  9. package/lib/components/Navbar/NavbarItem.js +3 -3
  10. package/lib/components/OpenApiDocs/hooks/AdditionalOverviewInfo.d.ts +1 -0
  11. package/lib/components/OpenApiDocs/hooks/AdditionalOverviewInfo.js +11 -0
  12. package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.d.ts +1 -0
  13. package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.js +5 -0
  14. package/lib/components/Search/FilterFields/SearchFilterFieldTags.js +2 -1
  15. package/lib/components/Search/SearchAiConversationInput.d.ts +1 -2
  16. package/lib/components/Search/SearchAiConversationInput.js +3 -11
  17. package/lib/components/Search/SearchDialog.js +3 -15
  18. package/lib/components/Search/SearchGroups.js +2 -2
  19. package/lib/components/Search/variables.js +1 -5
  20. package/lib/components/Select/SelectInput.js +1 -1
  21. package/lib/components/Select/variables.js +2 -2
  22. package/lib/components/Tag/Tag.d.ts +1 -2
  23. package/lib/components/Tag/Tag.js +17 -66
  24. package/lib/components/Tag/variables.dark.js +36 -135
  25. package/lib/components/Tag/variables.js +61 -78
  26. package/lib/core/constants/search.d.ts +4 -5
  27. package/lib/core/constants/search.js +5 -4
  28. package/lib/core/hooks/use-page-actions.d.ts +1 -1
  29. package/lib/core/hooks/use-page-actions.js +24 -1
  30. package/lib/core/hooks/use-tabs.d.ts +2 -3
  31. package/lib/core/hooks/use-tabs.js +57 -115
  32. package/lib/core/hooks/use-telemetry-fallback.d.ts +0 -1
  33. package/lib/core/hooks/use-telemetry-fallback.js +0 -1
  34. package/lib/core/types/hooks.d.ts +2 -2
  35. package/lib/ext/process-scorecard.d.ts +5 -0
  36. package/lib/ext/process-scorecard.js +11 -0
  37. package/lib/icons/AiStarsIcon/AiStarsIcon.js +2 -11
  38. package/lib/icons/RedoclyIcon/RedoclyIcon.js +7 -4
  39. package/lib/index.d.ts +2 -0
  40. package/lib/index.js +2 -0
  41. package/lib/markdoc/components/Tabs/TabList.d.ts +1 -3
  42. package/lib/markdoc/components/Tabs/TabList.js +47 -197
  43. package/lib/markdoc/components/Tabs/Tabs.d.ts +1 -2
  44. package/lib/markdoc/components/Tabs/Tabs.js +12 -57
  45. package/package.json +5 -5
  46. package/src/components/Buttons/AIAssistantButton.tsx +1 -5
  47. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +1 -1
  48. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +1 -1
  49. package/src/components/Catalog/CatalogTagsWithTooltip.tsx +5 -1
  50. package/src/components/Dropdown/Dropdown.tsx +79 -84
  51. package/src/components/Menu/MenuItem.tsx +0 -1
  52. package/src/components/Navbar/NavbarItem.tsx +5 -6
  53. package/src/components/OpenApiDocs/hooks/AdditionalOverviewInfo.tsx +9 -0
  54. package/src/components/OpenApiDocs/hooks/AfterOpenApiDescription.tsx +1 -0
  55. package/src/components/Search/FilterFields/SearchFilterFieldTags.tsx +3 -3
  56. package/src/components/Search/SearchAiConversationInput.tsx +2 -12
  57. package/src/components/Search/SearchDialog.tsx +3 -15
  58. package/src/components/Search/SearchGroups.tsx +0 -2
  59. package/src/components/Search/variables.ts +1 -5
  60. package/src/components/Select/SelectInput.tsx +0 -1
  61. package/src/components/Select/variables.ts +2 -2
  62. package/src/components/Tag/Tag.tsx +19 -35
  63. package/src/components/Tag/variables.dark.ts +36 -135
  64. package/src/components/Tag/variables.ts +61 -78
  65. package/src/core/constants/search.ts +4 -8
  66. package/src/core/hooks/use-page-actions.ts +33 -2
  67. package/src/core/hooks/use-tabs.ts +86 -168
  68. package/src/core/hooks/use-telemetry-fallback.ts +0 -1
  69. package/src/core/types/hooks.ts +1 -5
  70. package/src/ext/process-scorecard.ts +13 -0
  71. package/src/icons/AiStarsIcon/AiStarsIcon.tsx +2 -11
  72. package/src/icons/RedoclyIcon/RedoclyIcon.tsx +22 -4
  73. package/src/index.ts +2 -0
  74. package/src/markdoc/components/Tabs/TabList.tsx +105 -312
  75. package/src/markdoc/components/Tabs/Tabs.tsx +11 -136
package/LICENSE CHANGED
@@ -1,7 +1 @@
1
- Copyright 2022 Redocly Inc.
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ (c) Copyright 2022 Redocly Inc, all rights reserved.
@@ -73,9 +73,8 @@ function AIAssistantButton() {
73
73
  var _a, _b;
74
74
  const [isOpen, setIsOpen] = (0, react_1.useState)(false);
75
75
  const themeConfig = (0, hooks_1.useThemeConfig)();
76
- const { useTranslate, useTelemetry } = (0, hooks_1.useThemeHooks)();
76
+ const { useTranslate } = (0, hooks_1.useThemeHooks)();
77
77
  const { translate } = useTranslate();
78
- const telemetry = useTelemetry();
79
78
  const buttonConfig = Object.assign(Object.assign({}, defaultConfig), ((_b = (_a = themeConfig.aiAssistant) === null || _a === void 0 ? void 0 : _a.trigger) !== null && _b !== void 0 ? _b : {}));
80
79
  const { hide, inputIcon, inputType } = buttonConfig;
81
80
  if (hide) {
@@ -85,9 +84,6 @@ function AIAssistantButton() {
85
84
  const text = translate('aiAssistant.trigger', 'Ask AI');
86
85
  const handleOpen = () => {
87
86
  setIsOpen(true);
88
- telemetry.sendSearchAiOpenedMessage({
89
- method: 'ai_trigger_button',
90
- });
91
87
  };
92
88
  const handleClose = () => {
93
89
  setIsOpen(false);
@@ -13,7 +13,7 @@ const MoleculesIcon_1 = require("../../../../icons/MoleculesIcon/MoleculesIcon")
13
13
  const NetworkIcon_1 = require("../../../../icons/NetworkIcon/NetworkIcon");
14
14
  function CatalogEntityApiDescriptionRelations({ entity, relations, query, searchQuery, setSearchQuery, setFilter, entitiesCatalogConfig, catalogConfig, sortOption, setSortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, }) {
15
15
  return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations" },
16
- react_1.default.createElement(Tabs_1.Tabs, { key: entity.id, forceReady: relations.length > 0, size: Tabs_1.TabsSize.MEDIUM },
16
+ react_1.default.createElement(Tabs_1.Tabs, { key: entity.id, size: Tabs_1.TabsSize.MEDIUM },
17
17
  react_1.default.createElement(TabItem, { label: "Operations", icon: react_1.default.createElement(MoleculesIcon_1.MoleculesIcon, null), onClick: () => setFilter('type:api-operation') },
18
18
  react_1.default.createElement(CatalogEntityDefaultRelations_1.CatalogEntityDefaultRelations, { key: "operations-table", entity: entity, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore, shouldShowHeading: false, listType: "api-operation" })),
19
19
  react_1.default.createElement(TabItem, { label: "Schemas", icon: react_1.default.createElement(NetworkIcon_1.NetworkIcon, null), onClick: () => setFilter('type:data-schema') },
@@ -40,7 +40,7 @@ const teamColumns = [
40
40
  ];
41
41
  function CatalogEntityTeamRelations({ entity, relations, query, searchQuery, setSearchQuery, setFilter, entitiesCatalogConfig, catalogConfig, sortOption, setSortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, }) {
42
42
  return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations" },
43
- react_1.default.createElement(Tabs_1.Tabs, { forceReady: relations.length > 0, size: Tabs_1.TabsSize.MEDIUM },
43
+ react_1.default.createElement(Tabs_1.Tabs, { size: Tabs_1.TabsSize.MEDIUM },
44
44
  react_1.default.createElement(TabItem, { label: "Members", icon: react_1.default.createElement(PeopleIcon_1.PeopleIcon, null), onClick: () => setFilter('type:user') },
45
45
  react_1.default.createElement(CatalogEntityRelationsTable_1.CatalogEntityRelationsTable, { key: "members-table", entity: entity, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, columns: teamColumns, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore, listType: "team" })),
46
46
  react_1.default.createElement(TabItem, { label: "Related entities", icon: react_1.default.createElement(EntityTypeIcon_1.EntityTypeIcon, null), onClick: () => setFilter('-type:user') },
@@ -14,7 +14,7 @@ function CatalogTagsWithTooltip({ items, itemsToShow = 1, showPlaceholder = true
14
14
  if (!items || items.length === 0) {
15
15
  if (showPlaceholder) {
16
16
  return (react_1.default.createElement(CatalogTagsWrapper, { "data-component-name": "Catalog/CatalogTagsWithTooltip" },
17
- react_1.default.createElement(Tag_1.Tag, { style: { backgroundColor: 'var(--catalog-tags-placeholder-bg-color)' }, color: "grey" }, "N/A")));
17
+ react_1.default.createElement(Tag_1.Tag, { variant: "outline", style: { backgroundColor: 'var(--catalog-tags-placeholder-bg-color)' }, color: "grey" }, "N/A")));
18
18
  }
19
19
  return null;
20
20
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { PropsWithChildren } from 'react';
2
+ import type { PropsWithChildren, JSX } from 'react';
3
3
  export type DropdownProps = PropsWithChildren<{
4
4
  trigger: React.ReactNode;
5
5
  triggerEvent?: 'click' | 'hover';
@@ -13,18 +13,4 @@ export type DropdownProps = PropsWithChildren<{
13
13
  onClick?: (event: React.UIEvent) => void;
14
14
  onClose?: () => void;
15
15
  }>;
16
- export declare const Dropdown: React.ForwardRefExoticComponent<{
17
- trigger: React.ReactNode;
18
- triggerEvent?: "click" | "hover";
19
- placement?: "top" | "bottom";
20
- alignment?: "start" | "end";
21
- active?: boolean;
22
- closeOnClick?: boolean;
23
- dataAttributes?: Record<string, string>;
24
- className?: string;
25
- withArrow?: boolean;
26
- onClick?: (event: React.UIEvent) => void;
27
- onClose?: () => void;
28
- } & {
29
- children?: React.ReactNode | undefined;
30
- } & React.RefAttributes<HTMLDivElement>>;
16
+ export declare function Dropdown({ children, className, active, trigger, triggerEvent, closeOnClick, withArrow, dataAttributes, placement, alignment, onClick, onClose, }: DropdownProps): JSX.Element;
@@ -36,13 +36,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.Dropdown = void 0;
39
+ exports.Dropdown = Dropdown;
40
40
  const react_1 = __importStar(require("react"));
41
41
  const styled_components_1 = __importDefault(require("styled-components"));
42
42
  const hooks_1 = require("../../core/hooks");
43
43
  const ChevronDownIcon_1 = require("../../icons/ChevronDownIcon/ChevronDownIcon");
44
44
  const ChevronUpIcon_1 = require("../../icons/ChevronUpIcon/ChevronUpIcon");
45
- exports.Dropdown = (0, react_1.forwardRef)(({ children, className, active, trigger, triggerEvent = 'click', closeOnClick = true, withArrow, dataAttributes, placement, alignment, onClick, onClose, }, ref) => {
45
+ function Dropdown({ children, className, active, trigger, triggerEvent = 'click', closeOnClick = true, withArrow, dataAttributes, placement, alignment, onClick, onClose, }) {
46
46
  const dropdownRef = (0, react_1.useRef)(null);
47
47
  const [isOpen, setIsOpen] = (0, hooks_1.useControlledState)(false, active);
48
48
  const handleOpen = () => {
@@ -65,13 +65,13 @@ exports.Dropdown = (0, react_1.forwardRef)(({ children, className, active, trigg
65
65
  handleToggle(event);
66
66
  }
67
67
  };
68
- (0, hooks_1.useOutsideClick)(ref || dropdownRef, handleClose);
68
+ (0, hooks_1.useOutsideClick)(dropdownRef, handleClose);
69
69
  const triggerChild = react_1.default.Children.only(trigger);
70
70
  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 }));
71
- return (react_1.default.createElement(DropdownWrapper, Object.assign({ "data-component-name": "Dropdown/Dropdown", "data-testid": "dropdown" }, dataAttributes, { className: className, ref: ref || dropdownRef, onPointerEnter: triggerEvent === 'hover' ? handleOpen : undefined, onPointerLeave: triggerEvent === 'hover' ? handleClose : undefined, onClick: onClick }),
71
+ return (react_1.default.createElement(DropdownWrapper, Object.assign({ "data-component-name": "Dropdown/Dropdown", "data-testid": "dropdown" }, dataAttributes, { className: className, ref: dropdownRef, onPointerEnter: triggerEvent === 'hover' ? handleOpen : undefined, onPointerLeave: triggerEvent === 'hover' ? handleClose : undefined, onClick: onClick }),
72
72
  dropdownTrigger,
73
73
  react_1.default.createElement(ChildrenWrapper, { placement: placement, alignment: alignment, isOpen: isOpen, onClick: closeOnClick ? handleChildClick : undefined }, children)));
74
- });
74
+ }
75
75
  const DropdownWrapper = styled_components_1.default.div `
76
76
  --button-gap: var(--spacing-xxs);
77
77
 
@@ -81,7 +81,7 @@ function MenuItem(props) {
81
81
  };
82
82
  const chevron = hasChevron ? (isExpanded ? (react_1.default.createElement(ChevronDownIcon_1.ChevronDownIcon, { size: "var(--menu-item-label-chevron-size)", color: "--tree-content-color-default" })) : (react_1.default.createElement(ChevronRightIcon_1.ChevronRightIcon, { size: "var(--menu-item-label-chevron-size)", color: "--tree-content-color-default" }))) : null;
83
83
  const httpColor = item.deprecated ? 'http-deprecated' : item.httpVerb;
84
- const label = item.label && (react_1.default.createElement(MenuItemLabelWrapper, { active: item.active, deprecated: item.deprecated, depth: depth, withChevron: hasChevron, isSeparator: isSeparator, onClick: handleOnClick, onKeyDown: handleExpandOnEnter, ref: labelRef, role: item.link ? 'none' : 'link', tabIndex: !item.link ? 0 : undefined, "data-testid": "menu-item-label", "data-active": item.active },
84
+ const label = item.label && (react_1.default.createElement(MenuItemLabelWrapper, { active: item.active, deprecated: item.deprecated, depth: depth, withChevron: hasChevron, isSeparator: isSeparator, onClick: handleOnClick, onKeyDown: handleExpandOnEnter, ref: labelRef, role: item.link ? 'none' : 'link', tabIndex: !item.link ? 0 : undefined, "data-testid": "menu-item-label" },
85
85
  hasChevron ? react_1.default.createElement(ChevronWrapper, null, chevron) : null,
86
86
  react_1.default.createElement(MenuItemIcon, { icon: item.icon, srcSet: item.srcSet }),
87
87
  react_1.default.createElement(MenuItemLabelTextWrapper, null,
@@ -24,9 +24,9 @@ function NavbarItem({ navItem, className }) {
24
24
  if (navItem.type !== 'link' && !navItem.items)
25
25
  return null;
26
26
  const item = navItem;
27
- const normalizedPath = (item.link ? (0, utils_1.removeTrailingSlash)(item.link) : item.link) || '';
28
- const pathWithPathPrefix = (0, utils_1.withPathPrefix)((0, utils_1.getPathnameForLocale)(normalizedPath, defaultLocale, currentLocale, locales));
29
- const isActive = (0, utils_1.removeTrailingSlash)(pathname) === (0, utils_1.removeTrailingSlash)(pathWithPathPrefix);
27
+ const normalizedPath = (item.link && item.link !== '/' ? (0, utils_1.removeTrailingSlash)(item.link) : item.link) || '';
28
+ const isActive = pathname ===
29
+ (0, utils_1.withPathPrefix)((0, utils_1.getPathnameForLocale)(normalizedPath, defaultLocale, currentLocale, locales));
30
30
  const itemContent = (react_1.default.createElement(NavbarMenuItem, { as: item.link ? Link_1.Link : undefined, active: isActive, className: className, onClick: () => telemetry.sendNavbarMenuItemClickedMessage({ type: item.type }), external: item.external, target: item.target, to: item.link },
31
31
  react_1.default.createElement(NavbarIcon, { icon: item.icon, srcSet: item.srcSet }),
32
32
  react_1.default.createElement(NavbarLabel, { "data-translation-key": item.labelTranslationKey }, translate(item.labelTranslationKey, item.label)),
@@ -0,0 +1 @@
1
+ export declare const AdditionalOverviewInfo: any;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // interface AdditionalOverviewInfoProps {
3
+ // info: any;
4
+ // }
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AdditionalOverviewInfo = void 0;
7
+ // export function AdditionalOverviewInfo(_props: AdditionalOverviewInfoProps) {
8
+ // return null;
9
+ // }
10
+ exports.AdditionalOverviewInfo = null;
11
+ //# sourceMappingURL=AdditionalOverviewInfo.js.map
@@ -0,0 +1 @@
1
+ export declare const AfterOpenApiDescription: any;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AfterOpenApiDescription = void 0;
4
+ exports.AfterOpenApiDescription = null;
5
+ //# sourceMappingURL=AfterOpenApiDescription.js.map
@@ -23,7 +23,7 @@ function SearchFilterFieldTags({ className, facet, selectedValues, onChange, })
23
23
  if (e.key === 'Enter') {
24
24
  updateSelectedValues();
25
25
  }
26
- }, active: active, borderless: true, selectable: true },
26
+ }, active: active, borderless: true },
27
27
  value,
28
28
  " ",
29
29
  isCounterVisible && react_1.default.createElement("span", null, count)));
@@ -37,6 +37,7 @@ const FilterTagsWrapper = styled_components_1.default.div `
37
37
  const FilterTagWrapper = (0, styled_components_1.default)(Tag_1.Tag) `
38
38
  text-transform: uppercase;
39
39
  cursor: pointer;
40
+ ${({ color }) => color && `background-color: var(--tag-operation-bg-color-${color});`}
40
41
  margin: var(--search-filter-field-tags-tag-margin);
41
42
  `;
42
43
  //# sourceMappingURL=SearchFilterFieldTags.js.map
@@ -4,7 +4,6 @@ type SearchAiConversationInputProps = {
4
4
  isGeneratingResponse: boolean;
5
5
  placeholder?: string;
6
6
  className?: string;
7
- disabled?: boolean;
8
7
  };
9
- export declare function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, className, placeholder, disabled, }: SearchAiConversationInputProps): JSX.Element;
8
+ export declare function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, className, placeholder, }: SearchAiConversationInputProps): JSX.Element;
10
9
  export {};
@@ -43,7 +43,7 @@ const constants_1 = require("../../core/constants");
43
43
  const Button_1 = require("../../components/Button/Button");
44
44
  const SendIcon_1 = require("../../icons/SendIcon/SendIcon");
45
45
  const hooks_1 = require("../../core/hooks");
46
- function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, className, placeholder, disabled, }) {
46
+ function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, className, placeholder, }) {
47
47
  const { useTranslate } = (0, hooks_1.useThemeHooks)();
48
48
  const { translate } = useTranslate();
49
49
  const inputRef = (0, react_1.useRef)(null);
@@ -57,8 +57,6 @@ function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, classN
57
57
  }
58
58
  }, [isGeneratingResponse]);
59
59
  const handleSendMessage = () => {
60
- if (disabled)
61
- return;
62
60
  setQuery('');
63
61
  onMessageSent(query);
64
62
  };
@@ -67,9 +65,9 @@ function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, classN
67
65
  handleSendMessage();
68
66
  }
69
67
  };
70
- const isDisabled = disabled || isGeneratingResponse || query.trim().length === 0;
68
+ const isDisabled = isGeneratingResponse || query.trim().length === 0;
71
69
  return (react_1.default.createElement(SearchAiConversationInputWrapper, { "data-component-name": "Search/SearchAiConversationInput", className: className },
72
- react_1.default.createElement(ConversationInput, { ref: inputRef, type: "text", placeholder: placeholder || translate('search.ai.followUpQuestion', 'Ask a follow up question?'), onChange: (e) => setQuery(e.target.value), onKeyUp: handleOnKeyUp, value: query, disabled: disabled || isGeneratingResponse, maxLength: constants_1.AI_SEARCH_MAX_MESSAGE_LENGTH }),
70
+ react_1.default.createElement(ConversationInput, { ref: inputRef, type: "text", placeholder: placeholder || translate('search.ai.followUpQuestion', 'Ask a follow up question?'), onChange: (e) => setQuery(e.target.value), onKeyUp: handleOnKeyUp, value: query, disabled: isGeneratingResponse, maxLength: constants_1.AI_SEARCH_MAX_MESSAGE_LENGTH }),
73
71
  react_1.default.createElement(SendButton, { disabled: isDisabled, size: "small", icon: react_1.default.createElement(SendIcon_1.SendIcon, { color: isDisabled
74
72
  ? '--button-content-color-disabled'
75
73
  : 'var(--search-ai-conversation-input-send-button-icon-color)' }), onClick: handleSendMessage })));
@@ -100,10 +98,6 @@ const ConversationInput = styled_components_1.default.input `
100
98
  border-color: var(--search-ai-conversation-input-border-color-focus);
101
99
  }
102
100
 
103
- &:disabled {
104
- background-color: var(--search-ai-conversation-input-bg-color-disabled);
105
- }
106
-
107
101
  &:focus:disabled {
108
102
  border-color: var(--search-ai-conversation-input-border-color-disabled);
109
103
  }
@@ -118,8 +112,6 @@ const SendButton = (0, styled_components_1.default)(Button_1.Button) `
118
112
  display: flex;
119
113
  align-items: center;
120
114
  justify-content: center;
121
- border-radius: var(--search-ai-conversation-input-send-button-border-radius);
122
- padding: var(--search-ai-conversation-input-send-button-padding);
123
115
 
124
116
  &:hover {
125
117
  background-color: var(--search-ai-conversation-input-send-button-bg-color-hover);
@@ -66,13 +66,12 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
66
66
  const products = useProducts();
67
67
  const currentProduct = useCurrentProduct();
68
68
  const [product, setProduct] = (0, react_1.useState)(currentProduct);
69
- const searchSessionId = `search-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
70
69
  const [mode, setMode] = (0, react_1.useState)(initialMode);
71
70
  const autoSearchDisabled = mode !== 'search';
72
- const { query, setQuery, filter, setFilter, items, isSearchLoading, facets, setLoadMore, advancedSearch, askAi, groupField, } = useSearch(product === null || product === void 0 ? void 0 : product.name, autoSearchDisabled, searchSessionId);
71
+ const { query, setQuery, filter, setFilter, items, isSearchLoading, facets, setLoadMore, advancedSearch, askAi, groupField, } = useSearch(product === null || product === void 0 ? void 0 : product.name, autoSearchDisabled);
73
72
  const { isFilterOpen, onFilterToggle, onFilterChange, onFilterReset, onFacetReset, onQuickFilterReset, } = (0, hooks_1.useSearchFilter)(filter, setFilter);
74
73
  const { addSearchHistoryItem } = (0, hooks_1.useRecentSearches)();
75
- const aiSearch = useAiSearch({ filter }, searchSessionId);
74
+ const aiSearch = useAiSearch({ filter });
76
75
  const searchInputRef = (0, react_1.useRef)(null);
77
76
  const modalRef = (0, react_1.useRef)(null);
78
77
  const aiQueryRef = (0, react_1.useRef)(null);
@@ -127,11 +126,10 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
127
126
  totalResults: results.length.toString(),
128
127
  index: index.toString(),
129
128
  searchEngine: mode,
130
- searchSessionId,
131
129
  });
132
130
  onClose();
133
131
  } }));
134
- }, [onClose, product, products, addSearchHistoryItem, query, telemetry, mode, searchSessionId]);
132
+ }, [onClose, product, products, addSearchHistoryItem, query, telemetry, mode]);
135
133
  const showLoadMore = (0, react_1.useCallback)((groupKey, currentCount = 0) => {
136
134
  const groupFacet = facets.find((facet) => facet.field === groupField);
137
135
  let needLoadMore = false;
@@ -176,9 +174,6 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
176
174
  if (query.trim()) {
177
175
  aiSearch.askQuestion(query);
178
176
  }
179
- telemetry.sendSearchAiOpenedMessage({
180
- method: 'ai_search_button',
181
- });
182
177
  } }, translate('search.ai.button', 'Search with AI'))) : null,
183
178
  showSearchFilterButton && (react_1.default.createElement(SearchFilterToggleButton, { icon: react_1.default.createElement(SettingsIcon_1.SettingsIcon, null), onClick: onFilterToggle })))))) : (react_1.default.createElement(AiDialogHeaderWrapper, null,
184
179
  react_1.default.createElement(Button_1.Button, { variant: "secondary", onClick: () => {
@@ -197,18 +192,12 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
197
192
  if (query.trim()) {
198
193
  aiSearch.askQuestion(query);
199
194
  }
200
- telemetry.sendSearchAiOpenedMessage({
201
- method: 'ai_search_input',
202
- });
203
195
  }, onKeyDown: (e) => {
204
196
  if (e.key === 'Enter') {
205
197
  setMode('ai-dialog');
206
198
  if (query.trim()) {
207
199
  aiSearch.askQuestion(query);
208
200
  }
209
- telemetry.sendSearchAiOpenedMessage({
210
- method: 'ai_search_input',
211
- });
212
201
  }
213
202
  }, ref: aiQueryRef, tabIndex: 0, role: "option", "aria-selected": "true" },
214
203
  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)" }),
@@ -245,7 +234,6 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
245
234
  telemetry.sendSearchRecentClickedMessage({
246
235
  query,
247
236
  index: index.toString(),
248
- searchSessionId,
249
237
  });
250
238
  setQuery(query);
251
239
  focusSearchInput();
@@ -49,14 +49,14 @@ function SearchGroups({ facets, searchFilter, groupField, onFilterChange, onQuic
49
49
  onFilterChange(fieldId, values, true);
50
50
  };
51
51
  return (React.createElement(SearchGroupsWrapper, null,
52
- React.createElement(GroupTag, { borderless: true, active: !searchFilter.some((item) => item.isQuickFilter), onClick: () => searchFilter.some((item) => item.isQuickFilter) && onQuickFilterReset(), selectable: true }, "All"),
52
+ React.createElement(GroupTag, { borderless: true, active: !searchFilter.some((item) => item.isQuickFilter), onClick: () => searchFilter.some((item) => item.isQuickFilter) && onQuickFilterReset() }, "All"),
53
53
  React.createElement(Divider, null),
54
54
  groupFacets.flatMap((facet) => facet.values.map((facetCount, index) => {
55
55
  var _a;
56
56
  const { value, count, isCounterVisible } = facetCount;
57
57
  const currentValues = ((_a = searchFilter.find((item) => item.field === facet.field)) === null || _a === void 0 ? void 0 : _a.values) || [];
58
58
  const active = currentValues === null || currentValues === void 0 ? void 0 : currentValues.includes(value);
59
- return (React.createElement(GroupTag, { key: `${facet.field}-${index}`, onClick: () => handleGroupTagClick(value, facet.field, active, currentValues), active: active, borderless: true, selectable: true },
59
+ return (React.createElement(GroupTag, { key: `${facet.field}-${index}`, onClick: () => handleGroupTagClick(value, facet.field, active, currentValues), active: active, borderless: true },
60
60
  value,
61
61
  " ",
62
62
  isCounterVisible && React.createElement("span", null, count)));
@@ -173,7 +173,6 @@ exports.search = (0, styled_components_1.css) `
173
173
  --search-ai-assistant-bg-color: var(--layer-color);
174
174
  --search-ai-assistant-text-color: var(--text-color-primary);
175
175
  --search-ai-assistant-border: 1px solid var(--border-color-primary);
176
- --search-ai-assistant-message-max-width: 80%;
177
176
 
178
177
  --search-ai-resources-gap: var(--spacing-base);
179
178
  --search-ai-resources-title-font-weight: var(--font-weight-medium);
@@ -235,7 +234,6 @@ exports.search = (0, styled_components_1.css) `
235
234
  * @tokens AI Search Conversation Input
236
235
  */
237
236
  --search-ai-conversation-input-bg-color: var(--bg-color);
238
- --search-ai-conversation-input-bg-color-disabled: var(--color-warm-grey-1);
239
237
  --search-ai-conversation-input-padding: var(--spacing-sm) var(--spacing-md);
240
238
  --search-ai-conversation-input-border: 1px solid var(--border-color-secondary);
241
239
  --search-ai-conversation-input-border-radius: var(--border-radius-lg);
@@ -245,12 +243,10 @@ exports.search = (0, styled_components_1.css) `
245
243
  --search-ai-conversation-input-border-color-disabled: var(--border-color-secondary);
246
244
 
247
245
  --search-ai-conversation-input-send-button-right: 12px;
248
- --search-ai-conversation-input-send-button-padding: 5px;
249
246
  --search-ai-conversation-input-send-button-bg-color: var(--button-bg-color-primary);
250
247
  --search-ai-conversation-input-send-button-bg-color-hover: var(--button-bg-color-primary-hover);
251
248
  --search-ai-conversation-input-send-button-bg-color-disabled: var(--button-bg-color-disabled);
252
249
  --search-ai-conversation-input-send-button-border-disabled: 1px solid var(--button-border-color-disabled);
253
- --search-ai-conversation-input-send-button-border-radius: var(--border-radius);
254
250
 
255
251
  /**
256
252
  * @tokens AI Search Response
@@ -283,7 +279,7 @@ exports.search = (0, styled_components_1.css) `
283
279
 
284
280
  --search-ai-suggestions-gap: var(--spacing-sm);
285
281
  --search-ai-suggestions-margin-left: var(--spacing-xs);
286
- --search-ai-suggestion-item-gap: var(--spacing-xxs);
282
+ --search-ai-suggestion-item-gap: var(--spacing-xs);
287
283
 
288
284
  --search-ai-suggestions-title-text-color: var(--text-color-description);
289
285
  --search-ai-suggestions-title-font-size: var(--font-size-base);
@@ -73,7 +73,7 @@ function SelectInput(props) {
73
73
  e.stopPropagation();
74
74
  clearHandler === null || clearHandler === void 0 ? void 0 : clearHandler();
75
75
  };
76
- const selectTags = selectedOptions.map((option, index) => (react_1.default.createElement(SelectInputTag, { closable: true, tabIndex: 0, key: index, onClose: () => {
76
+ const selectTags = selectedOptions.map((option, index) => (react_1.default.createElement(SelectInputTag, { closable: true, key: index, onClose: () => {
77
77
  var _a;
78
78
  clearHandler === null || clearHandler === void 0 ? void 0 : clearHandler(option);
79
79
  (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
@@ -12,7 +12,7 @@ exports.select = (0, styled_components_1.css) `
12
12
  --select-text-color: var(--text-color-secondary); // @presenter Color
13
13
  --select-border-radius: var(--border-radius); // @presenter BorderRadius
14
14
  --select-border: var(--border-width) var(--border-style) var(--border-color-primary); // @presenter Border
15
-
15
+
16
16
  --select-input-padding-vertical: 6px; // @presenter Spacing
17
17
  --select-input-padding-horizontal: 6px; // @presenter Spacing
18
18
  --select-input-padding: var(--select-input-padding-vertical) var(--select-input-padding-horizontal);
@@ -40,7 +40,7 @@ exports.select = (0, styled_components_1.css) `
40
40
  --select-list-item-border-radius: var(--border-radius); // @presenter BorderRadius
41
41
  --select-list-item-bg-color-active: transparent; // @presenter Color
42
42
  --select-list-item-bg-color-hover: var(--menu-item-bg-color-hover); // @presenter Color
43
- --select-list-item-font-weight-active: var(--font-weight-medium); // @presenter Color
43
+ --select-list-item-font-weight-active: var(--font-weight-medium); // @presenter Color
44
44
 
45
45
  --select-placeholder-color: var(--color-warm-grey-6); // @presenter Color
46
46
  // @tokens End
@@ -28,8 +28,7 @@ export type TagProps = {
28
28
  maxLength?: number;
29
29
  textTransform?: 'uppercase' | 'lowercase' | 'capitalize' | 'none';
30
30
  variant?: 'outline' | 'filled';
31
- selectable?: boolean;
32
31
  };
33
- export declare function Tag({ children, color, icon, active, closable, tabIndex, onClick, onKeyDown, onClose, size, borderless, withStatusDot, statusDotColor, maxLength, textTransform, variant, selectable, ...otherProps }: TagProps): JSX.Element;
32
+ export declare function Tag({ children, color, icon, active, closable, tabIndex, onClick, onKeyDown, onClose, size, borderless, withStatusDot, statusDotColor, maxLength, textTransform, variant, ...otherProps }: TagProps): JSX.Element;
34
33
  export declare const ContentWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
35
34
  export {};
@@ -1,37 +1,4 @@
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 __rest = (this && this.__rest) || function (s, e) {
36
3
  var t = {};
37
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -50,11 +17,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
50
17
  exports.ContentWrapper = void 0;
51
18
  exports.Tag = Tag;
52
19
  const react_1 = __importDefault(require("react"));
53
- const styled_components_1 = __importStar(require("styled-components"));
20
+ const styled_components_1 = __importDefault(require("styled-components"));
54
21
  const CloseIcon_1 = require("../../icons/CloseIcon/CloseIcon");
55
22
  const CheckmarkFilledIcon_1 = require("../../icons/CheckmarkFilledIcon/CheckmarkFilledIcon");
56
23
  function Tag(_a) {
57
- var { children, color, icon, active, closable, tabIndex, onClick, onKeyDown, onClose, size, borderless, withStatusDot, statusDotColor = 'var(--tag-status-dot-color-default)', maxLength, textTransform, variant = 'filled', selectable } = _a, otherProps = __rest(_a, ["children", "color", "icon", "active", "closable", "tabIndex", "onClick", "onKeyDown", "onClose", "size", "borderless", "withStatusDot", "statusDotColor", "maxLength", "textTransform", "variant", "selectable"]);
24
+ var { children, color, icon, active, closable, tabIndex, onClick, onKeyDown, onClose, size, borderless, withStatusDot, statusDotColor = 'var(--tag-status-dot-color-default)', maxLength, textTransform, variant = 'filled' } = _a, otherProps = __rest(_a, ["children", "color", "icon", "active", "closable", "tabIndex", "onClick", "onKeyDown", "onClose", "size", "borderless", "withStatusDot", "statusDotColor", "maxLength", "textTransform", "variant"]);
58
25
  const truncateText = (text, maxLen) => {
59
26
  if (text.length <= maxLen)
60
27
  return text;
@@ -107,7 +74,7 @@ function Tag(_a) {
107
74
  }
108
75
  return children;
109
76
  };
110
- return (react_1.default.createElement(TagWrapper, Object.assign({ tabIndex: tabIndex, "data-component-name": "Tag/Tag", borderless: borderless, color: color, size: size, onClick: onClick, onKeyDown: onKeyDown, hasCloseButton: closable, textTransform: textTransform, variant: variant, selectable: selectable }, otherProps),
77
+ return (react_1.default.createElement(TagWrapper, Object.assign({ tabIndex: tabIndex, "data-component-name": "Tag/Tag", borderless: borderless, color: color, size: size, onClick: onClick, onKeyDown: onKeyDown, hasCloseButton: closable, textTransform: textTransform, variant: variant }, otherProps),
111
78
  withStatusDot ? react_1.default.createElement(StatusDot, { color: statusDotColor }) : icon ? icon : null,
112
79
  react_1.default.createElement(exports.ContentWrapper, null, renderChildren()),
113
80
  closable && (react_1.default.createElement(CloseButton, { onClick: (event) => {
@@ -131,27 +98,14 @@ const CloseButton = styled_components_1.default.div `
131
98
  justify-content: center;
132
99
  align-self: stretch;
133
100
  border-radius: 0 var(--tag-border-radius) var(--tag-border-radius) 0;
134
- margin: calc(-1 * var(--tag-border-width));
135
- padding: var(--tag-border-width);
136
101
 
137
102
  &:hover {
138
103
  background: var(--tag-close-button-bg-color-hover);
139
104
  }
140
-
141
- &:focus-visible {
142
- background: var(--tag-close-button-bg-color-focus);
143
- }
144
105
  `;
145
- const TagWrapper = styled_components_1.default.div.attrs(({ className, color, size, variant }) => ({
146
- className: [
147
- className,
148
- 'tag-default',
149
- color && `tag-${color}`,
150
- size && `tag-size-${size}`,
151
- `tag-variant-${variant || 'filled'}`,
152
- ]
153
- .filter(Boolean)
154
- .join(' '),
106
+ const TagWrapper = styled_components_1.default.div.attrs(({ className, color, size }) => ({
107
+ className: (className || '') +
108
+ ` tag-default ${color ? `tag-${color}` : ''} ${size ? `tag-size-${size}` : ''}`,
155
109
  })) `
156
110
  display: inline-flex;
157
111
  align-items: center;
@@ -177,7 +131,7 @@ const TagWrapper = styled_components_1.default.div.attrs(({ className, color, si
177
131
  ${({ textTransform }) => `text-transform: ${textTransform ? `${textTransform}` : 'var(--tag-text-transform)'};`}
178
132
 
179
133
  color: var(--tag-color);
180
- background-color: var(--tag-bg-color);
134
+ background-color: ${({ variant }) => variant === 'filled' ? 'var(--tag-bg-color)' : 'transparent'};
181
135
  ${({ borderless }) => borderless
182
136
  ? ''
183
137
  : `border: var(--tag-border-width) var(--tag-border-style) var(--tag-border-color);`}
@@ -187,20 +141,17 @@ const TagWrapper = styled_components_1.default.div.attrs(({ className, color, si
187
141
  width: var(--tag-icon-width);
188
142
  height: var(--tag-icon-height);
189
143
  }
144
+ /*
145
+ &:hover {
146
+ background-color: ${({ variant }) => variant === 'filled' ? 'var(--tag-bg-color-hover)' : 'transparent'};
147
+ border-color: ${({ variant }) => variant === 'outline' ? 'var(--tag-border-color-hover)' : 'transparent'};
148
+ } */
190
149
 
191
- ${({ selectable }) => selectable &&
192
- (0, styled_components_1.css) `
193
- &:hover {
194
- background-color: var(--tag-bg-color-hover);
195
- border-color: var(--tag-border-color-hover);
196
- }
197
-
198
- &:focus-visible {
199
- outline: 1px solid var(--tag-border-color-focused);
200
- outline-offset: 2px;
201
- border-radius: var(--tag-border-radius-focused);
202
- }
203
- `};
150
+ &:focus-visible {
151
+ outline: 1px solid var(--tag-border-color-focused);
152
+ outline-offset: 2px;
153
+ border-radius: var(--tag-border-radius-focused);
154
+ }
204
155
  `;
205
156
  const StatusDot = styled_components_1.default.div `
206
157
  display: inline-block;