@redocly/theme 0.59.0-next.0 → 0.59.0-next.10

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 (262) hide show
  1. package/LICENSE +7 -1
  2. package/lib/components/Accordion/Accordion.d.ts +12 -0
  3. package/lib/components/Accordion/Accordion.js +85 -0
  4. package/lib/components/Accordion/AccordionBody.d.ts +8 -0
  5. package/lib/components/Accordion/AccordionBody.js +73 -0
  6. package/lib/components/Accordion/AccordionHeader.d.ts +10 -0
  7. package/lib/components/Accordion/AccordionHeader.js +37 -0
  8. package/lib/components/Accordion/AccordionTitle.d.ts +6 -0
  9. package/lib/components/Accordion/AccordionTitle.js +20 -0
  10. package/lib/components/Accordion/variables.d.ts +1 -0
  11. package/lib/components/Accordion/variables.js +59 -0
  12. package/lib/components/Admonition/Admonition.js +17 -7
  13. package/lib/components/Badge/Badge.js +17 -7
  14. package/lib/components/Breadcrumbs/Breadcrumb.js +17 -7
  15. package/lib/components/Breadcrumbs/BreadcrumbDropdown.js +17 -7
  16. package/lib/components/Button/Button.js +17 -7
  17. package/lib/components/Buttons/AIAssistantButton.d.ts +2 -0
  18. package/lib/components/Buttons/AIAssistantButton.js +139 -0
  19. package/lib/components/Buttons/CopyButton.js +17 -7
  20. package/lib/components/Buttons/variables.d.ts +1 -0
  21. package/lib/components/Buttons/variables.dark.d.ts +1 -0
  22. package/lib/components/Buttons/variables.dark.js +10 -0
  23. package/lib/components/Buttons/variables.js +51 -0
  24. package/lib/components/Catalog/Catalog.d.ts +6 -0
  25. package/lib/components/Catalog/Catalog.js +9 -8
  26. package/lib/components/Catalog/CatalogEntities.js +17 -7
  27. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js +17 -7
  28. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.js +17 -7
  29. package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +1 -0
  30. package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +17 -7
  31. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +1 -1
  32. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +17 -7
  33. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +1 -1
  34. package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +17 -7
  35. package/lib/components/Catalog/CatalogEntityIcon.js +2 -1
  36. package/lib/components/Catalog/CatalogFilter/CatalogFilter.d.ts +6 -0
  37. package/lib/components/Catalog/CatalogFilter/CatalogFilter.js +39 -0
  38. package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.d.ts +6 -0
  39. package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +152 -0
  40. package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.d.ts +13 -0
  41. package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.js +102 -0
  42. package/lib/components/Catalog/CatalogFilter/CatalogFilterDateRange.d.ts +6 -0
  43. package/lib/components/Catalog/CatalogFilter/CatalogFilterDateRange.js +121 -0
  44. package/lib/components/Catalog/CatalogFilter/CatalogFilterSelect.d.ts +6 -0
  45. package/lib/components/Catalog/CatalogFilter/CatalogFilterSelect.js +126 -0
  46. package/lib/components/Catalog/CatalogSelector.js +0 -1
  47. package/lib/components/Catalog/CatalogSortButton.js +17 -7
  48. package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +17 -7
  49. package/lib/components/Catalog/CatalogViewModeToggle.js +17 -7
  50. package/lib/components/Catalog/variables.js +1 -2
  51. package/lib/components/CatalogClassic/CatalogClassicActions.js +17 -7
  52. package/lib/components/CatalogClassic/CatalogClassicCard.js +17 -7
  53. package/lib/components/CatalogClassic/CatalogClassicHighlight.js +17 -7
  54. package/lib/components/CatalogClassic/CatalogClassicVirtualizedGroups.js +17 -7
  55. package/lib/components/CodeBlock/CodeBlock.js +17 -7
  56. package/lib/components/CodeBlock/CodeBlockContainer.js +17 -7
  57. package/lib/components/CodeBlock/CodeBlockTabs.js +17 -7
  58. package/lib/components/Dropdown/Dropdown.d.ts +16 -2
  59. package/lib/components/Dropdown/Dropdown.js +22 -12
  60. package/lib/components/Dropdown/DropdownMenuItem.js +17 -7
  61. package/lib/components/Feedback/Comment.js +17 -7
  62. package/lib/components/Feedback/Feedback.js +17 -7
  63. package/lib/components/Feedback/Mood.js +17 -7
  64. package/lib/components/Feedback/Rating.js +17 -7
  65. package/lib/components/Feedback/Reasons.js +17 -7
  66. package/lib/components/Feedback/Scale.js +17 -7
  67. package/lib/components/Feedback/Sentiment.js +17 -7
  68. package/lib/components/Feedback/Stars.js +17 -7
  69. package/lib/components/Filter/FilterContent.js +17 -7
  70. package/lib/components/Filter/FilterInput.d.ts +1 -0
  71. package/lib/components/Filter/FilterInput.js +19 -9
  72. package/lib/components/Filter/FilterOptions.js +2 -0
  73. package/lib/components/Filter/variables.js +7 -4
  74. package/lib/components/Image/Image.js +17 -7
  75. package/lib/components/JsonViewer/JsonViewer.js +17 -7
  76. package/lib/components/JsonViewer/helpers.js +17 -7
  77. package/lib/components/LastUpdated/LastUpdated.js +17 -7
  78. package/lib/components/Link/Link.js +17 -7
  79. package/lib/components/Markdown/Markdown.js +17 -7
  80. package/lib/components/Marker/Marker.js +17 -7
  81. package/lib/components/Menu/MenuContainer.js +17 -7
  82. package/lib/components/Menu/MenuItem.js +18 -8
  83. package/lib/components/Menu/MenuMobile.js +17 -7
  84. package/lib/components/Navbar/NavbarItem.js +3 -3
  85. package/lib/components/PageActions/PageActions.js +17 -7
  86. package/lib/components/PageNavigation/NextButton.js +17 -7
  87. package/lib/components/Panel/Panel.js +17 -7
  88. package/lib/components/Panel/PanelBody.js +17 -7
  89. package/lib/components/Search/FilterFields/SearchFilterFieldSelect.js +17 -7
  90. package/lib/components/Search/FilterFields/SearchFilterFieldTags.js +1 -2
  91. package/lib/components/Search/SearchAiActionButtons.d.ts +10 -0
  92. package/lib/components/Search/SearchAiActionButtons.js +43 -0
  93. package/lib/components/Search/SearchAiConversationInput.d.ts +3 -1
  94. package/lib/components/Search/SearchAiConversationInput.js +56 -14
  95. package/lib/components/Search/SearchAiDialog.d.ts +3 -6
  96. package/lib/components/Search/SearchAiDialog.js +39 -19
  97. package/lib/components/Search/SearchAiMessage.d.ts +9 -5
  98. package/lib/components/Search/SearchAiMessage.js +146 -22
  99. package/lib/components/Search/SearchAiNegativeFeedbackForm.d.ts +8 -0
  100. package/lib/components/Search/SearchAiNegativeFeedbackForm.js +169 -0
  101. package/lib/components/Search/SearchAiResponse.js +2 -3
  102. package/lib/components/Search/SearchDialog.d.ts +2 -1
  103. package/lib/components/Search/SearchDialog.js +55 -14
  104. package/lib/components/Search/SearchFilter.js +17 -7
  105. package/lib/components/Search/SearchGroups.js +19 -9
  106. package/lib/components/Search/SearchHighlight.js +17 -7
  107. package/lib/components/Search/SearchItem.js +17 -7
  108. package/lib/components/Search/SearchRecent.js +17 -7
  109. package/lib/components/Search/SearchShortcut.js +17 -7
  110. package/lib/components/Search/SearchSuggestedPages.js +17 -7
  111. package/lib/components/Search/SearchTrigger.js +17 -7
  112. package/lib/components/Search/variables.js +36 -64
  113. package/lib/components/Segmented/Segmented.js +17 -7
  114. package/lib/components/Select/Select.js +17 -7
  115. package/lib/components/Select/SelectInput.js +18 -8
  116. package/lib/components/Sidebar/Sidebar.js +17 -7
  117. package/lib/components/SidebarActions/styled.js +17 -7
  118. package/lib/components/SkipContent/SkipContent.js +17 -7
  119. package/lib/components/Switch/Switch.js +17 -7
  120. package/lib/components/TableOfContent/TableOfContent.js +17 -7
  121. package/lib/components/Tag/Tag.d.ts +2 -1
  122. package/lib/components/Tag/Tag.js +67 -18
  123. package/lib/components/Tag/variables.dark.js +137 -38
  124. package/lib/components/Tag/variables.js +78 -61
  125. package/lib/components/Tooltip/Tooltip.js +17 -7
  126. package/lib/components/VersionPicker/VersionPicker.js +17 -7
  127. package/lib/core/constants/search.d.ts +5 -4
  128. package/lib/core/constants/search.js +4 -5
  129. package/lib/core/contexts/CodeSnippetContext.js +17 -7
  130. package/lib/core/hooks/index.d.ts +1 -0
  131. package/lib/core/hooks/index.js +1 -0
  132. package/lib/core/hooks/menu/use-nested-menu.js +1 -1
  133. package/lib/core/hooks/search/use-feedback-tooltip.d.ts +6 -0
  134. package/lib/core/hooks/search/use-feedback-tooltip.js +26 -0
  135. package/lib/core/hooks/use-product-picker.js +2 -1
  136. package/lib/core/hooks/use-tabs.d.ts +3 -2
  137. package/lib/core/hooks/use-tabs.js +115 -57
  138. package/lib/core/hooks/use-telemetry-fallback.d.ts +10 -8
  139. package/lib/core/hooks/use-telemetry-fallback.js +10 -8
  140. package/lib/core/styles/dark.js +33 -26
  141. package/lib/core/styles/global.js +68 -59
  142. package/lib/core/templates/Markdown.js +17 -7
  143. package/lib/core/types/hooks.d.ts +6 -3
  144. package/lib/core/types/l10n.d.ts +1 -1
  145. package/lib/core/types/search.d.ts +11 -4
  146. package/lib/core/types/search.js +6 -0
  147. package/lib/core/utils/download-code-walkthrough.js +17 -7
  148. package/lib/core/utils/frontmatter-translate.d.ts +6 -0
  149. package/lib/core/utils/frontmatter-translate.js +14 -0
  150. package/lib/core/utils/get-file-icon.js +17 -7
  151. package/lib/core/utils/index.d.ts +1 -0
  152. package/lib/core/utils/index.js +1 -0
  153. package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.js +44 -4
  154. package/lib/icons/AiStarsIcon/AiStarsIcon.js +11 -2
  155. package/lib/icons/CubeIcon/CubeIcon.d.ts +9 -0
  156. package/lib/icons/CubeIcon/CubeIcon.js +17 -0
  157. package/lib/icons/GenericIcon/GenericIcon.js +17 -7
  158. package/lib/icons/HashtagIcon/HashtagIcon.d.ts +9 -0
  159. package/lib/icons/HashtagIcon/HashtagIcon.js +22 -0
  160. package/lib/icons/RedoclyIcon/RedoclyIcon.d.ts +9 -0
  161. package/lib/icons/RedoclyIcon/RedoclyIcon.js +24 -0
  162. package/lib/icons/Spinner/Spinner.js +17 -7
  163. package/lib/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.d.ts +9 -0
  164. package/lib/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.js +34 -0
  165. package/lib/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.d.ts +9 -0
  166. package/lib/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.js +34 -0
  167. package/lib/index.d.ts +3 -0
  168. package/lib/index.js +20 -7
  169. package/lib/layouts/OIDCForbidden.js +17 -7
  170. package/lib/layouts/RootLayout.js +6 -1
  171. package/lib/layouts/ThreePanelLayout.js +17 -7
  172. package/lib/markdoc/components/Cards/Card.js +1 -28
  173. package/lib/markdoc/components/Cards/Cards.js +17 -7
  174. package/lib/markdoc/components/CodeGroup/CodeGroup.js +17 -7
  175. package/lib/markdoc/components/CodeWalkthrough/CodeContainer.js +17 -7
  176. package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +17 -7
  177. package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +17 -7
  178. package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.js +17 -7
  179. package/lib/markdoc/components/CodeWalkthrough/CodePanelToolbar.js +17 -7
  180. package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +17 -7
  181. package/lib/markdoc/components/CodeWalkthrough/CodeToggle.js +17 -7
  182. package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +17 -7
  183. package/lib/markdoc/components/CodeWalkthrough/Input.js +17 -7
  184. package/lib/markdoc/components/Heading/Heading.js +17 -7
  185. package/lib/markdoc/components/HtmlBlock/HtmlBlock.js +17 -7
  186. package/lib/markdoc/components/InlineSvg/InlineSvg.js +17 -7
  187. package/lib/markdoc/components/MarkdocExample/MarkdocExample.js +17 -7
  188. package/lib/markdoc/components/Tabs/TabList.d.ts +3 -1
  189. package/lib/markdoc/components/Tabs/TabList.js +214 -54
  190. package/lib/markdoc/components/Tabs/Tabs.d.ts +2 -1
  191. package/lib/markdoc/components/Tabs/Tabs.js +74 -19
  192. package/lib/markdoc/default.d.ts +104 -1
  193. package/lib/markdoc/default.js +17 -7
  194. package/lib/markdoc/tags/card.js +0 -1
  195. package/package.json +8 -8
  196. package/src/components/Accordion/Accordion.tsx +100 -0
  197. package/src/components/Accordion/AccordionBody.tsx +65 -0
  198. package/src/components/Accordion/AccordionHeader.tsx +68 -0
  199. package/src/components/Accordion/AccordionTitle.tsx +26 -0
  200. package/src/components/Accordion/variables.ts +56 -0
  201. package/src/components/Buttons/AIAssistantButton.tsx +145 -0
  202. package/src/components/Buttons/variables.dark.ts +7 -0
  203. package/src/components/Buttons/variables.ts +48 -0
  204. package/src/components/Catalog/Catalog.tsx +18 -6
  205. package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +1 -0
  206. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +1 -1
  207. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +1 -1
  208. package/src/components/Catalog/CatalogEntityIcon.tsx +2 -1
  209. package/src/components/Catalog/CatalogFilter/CatalogFilter.tsx +61 -0
  210. package/src/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.tsx +169 -0
  211. package/src/components/Catalog/CatalogFilter/CatalogFilterContent.tsx +121 -0
  212. package/src/components/Catalog/CatalogFilter/CatalogFilterDateRange.tsx +147 -0
  213. package/src/components/Catalog/CatalogFilter/CatalogFilterSelect.tsx +136 -0
  214. package/src/components/Catalog/CatalogSelector.tsx +0 -1
  215. package/src/components/Catalog/variables.ts +1 -2
  216. package/src/components/Dropdown/Dropdown.tsx +84 -79
  217. package/src/components/Filter/FilterInput.tsx +3 -2
  218. package/src/components/Filter/FilterOptions.tsx +2 -0
  219. package/src/components/Filter/variables.ts +7 -4
  220. package/src/components/Menu/MenuItem.tsx +1 -0
  221. package/src/components/Navbar/NavbarItem.tsx +6 -5
  222. package/src/components/Search/FilterFields/SearchFilterFieldTags.tsx +3 -3
  223. package/src/components/Search/SearchAiActionButtons.tsx +76 -0
  224. package/src/components/Search/SearchAiConversationInput.tsx +61 -18
  225. package/src/components/Search/SearchAiDialog.tsx +54 -25
  226. package/src/components/Search/SearchAiMessage.tsx +172 -43
  227. package/src/components/Search/SearchAiNegativeFeedbackForm.tsx +210 -0
  228. package/src/components/Search/SearchAiResponse.tsx +2 -2
  229. package/src/components/Search/SearchDialog.tsx +56 -15
  230. package/src/components/Search/SearchGroups.tsx +2 -0
  231. package/src/components/Search/variables.ts +36 -64
  232. package/src/components/Select/SelectInput.tsx +1 -0
  233. package/src/components/Tag/Tag.tsx +36 -20
  234. package/src/components/Tag/variables.dark.ts +137 -38
  235. package/src/components/Tag/variables.ts +78 -61
  236. package/src/core/constants/search.ts +8 -4
  237. package/src/core/hooks/index.ts +1 -0
  238. package/src/core/hooks/menu/use-nested-menu.ts +2 -2
  239. package/src/core/hooks/search/use-feedback-tooltip.ts +32 -0
  240. package/src/core/hooks/use-product-picker.ts +2 -1
  241. package/src/core/hooks/use-tabs.ts +168 -86
  242. package/src/core/hooks/use-telemetry-fallback.ts +10 -8
  243. package/src/core/styles/dark.ts +15 -8
  244. package/src/core/styles/global.ts +11 -2
  245. package/src/core/types/hooks.ts +6 -1
  246. package/src/core/types/l10n.ts +6 -0
  247. package/src/core/types/search.ts +13 -4
  248. package/src/core/utils/frontmatter-translate.ts +9 -0
  249. package/src/core/utils/index.ts +1 -0
  250. package/src/icons/AiStarsGradientIcon/AiStarsGradientIcon.tsx +13 -4
  251. package/src/icons/AiStarsIcon/AiStarsIcon.tsx +11 -2
  252. package/src/icons/CubeIcon/CubeIcon.tsx +27 -0
  253. package/src/icons/HashtagIcon/HashtagIcon.tsx +23 -0
  254. package/src/icons/RedoclyIcon/RedoclyIcon.tsx +26 -0
  255. package/src/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.tsx +38 -0
  256. package/src/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.tsx +35 -0
  257. package/src/index.ts +3 -0
  258. package/src/layouts/RootLayout.tsx +6 -0
  259. package/src/markdoc/components/Cards/Card.tsx +1 -28
  260. package/src/markdoc/components/Tabs/TabList.tsx +312 -105
  261. package/src/markdoc/components/Tabs/Tabs.tsx +136 -11
  262. package/src/markdoc/tags/card.ts +0 -1
@@ -0,0 +1,147 @@
1
+ import React, { useMemo } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import type { JSX } from 'react';
5
+ import type { FilterProps } from '@redocly/theme/core/types';
6
+
7
+ import { FilterOptions } from '@redocly/theme/components/Filter/FilterOptions';
8
+ import { DatePicker } from '@redocly/theme/components/DatePicker/DatePicker';
9
+ import { CounterTag } from '@redocly/theme/components/Tags/CounterTag';
10
+ import { useThemeHooks } from '@redocly/theme/core/hooks';
11
+ import { formatDateWithoutTimeZone } from '@redocly/theme/core/utils';
12
+ import { Accordion } from '@redocly/theme/components/Accordion/Accordion';
13
+
14
+ export type CatalogFilterDateRangeProps = FilterProps & {
15
+ className?: string;
16
+ };
17
+
18
+ export function CatalogFilterDateRange({
19
+ filter,
20
+ className,
21
+ }: CatalogFilterDateRangeProps): JSX.Element {
22
+ const { useTranslate } = useThemeHooks();
23
+ const { translate } = useTranslate();
24
+
25
+ const from = useMemo(
26
+ () => (filter.selectedOptions.from ? new Date(filter.selectedOptions.from) : undefined),
27
+ [filter.selectedOptions.from],
28
+ );
29
+ const to = useMemo(
30
+ () => (filter.selectedOptions.to ? new Date(filter.selectedOptions.to) : undefined),
31
+ [filter.selectedOptions.to],
32
+ );
33
+
34
+ const selectedCount = useMemo(() => {
35
+ return from && to ? 1 : 0;
36
+ }, [from, to]);
37
+
38
+ const headerContent = (
39
+ <AccordionHeaderContent>
40
+ <span>{translate(filter.titleTranslationKey, filter.title)}</span>
41
+ {selectedCount > 0 && <CounterTag borderless>{selectedCount}</CounterTag>}
42
+ </AccordionHeaderContent>
43
+ );
44
+
45
+ return (
46
+ <AccordionWrapper
47
+ className={className}
48
+ $hasSelection={selectedCount > 0}
49
+ data-component-name="Catalog/CatalogFilterDateRange"
50
+ >
51
+ <Accordion expanded={false} header={headerContent}>
52
+ <FilterOptions>
53
+ <DateRangeWrapper>
54
+ <DateRangeRow>
55
+ <span>From:</span>
56
+ <DatePicker
57
+ closeCalendar={true}
58
+ format="y-MM-dd"
59
+ dayPlaceholder="DD"
60
+ monthPlaceholder="MM"
61
+ yearPlaceholder="YYYY"
62
+ value={from}
63
+ maxDate={new Date()}
64
+ onChange={(from) => {
65
+ if (Array.isArray(from)) return;
66
+ filter.selectOption({
67
+ ...filter.selectedOptions,
68
+ from: formatDateWithoutTimeZone(from),
69
+ to: formatDateWithoutTimeZone(to),
70
+ });
71
+ }}
72
+ />
73
+ </DateRangeRow>
74
+ <DateRangeRow>
75
+ <span>To:</span>
76
+ <DatePicker
77
+ closeCalendar={true}
78
+ dayPlaceholder="DD"
79
+ monthPlaceholder="MM"
80
+ yearPlaceholder="YYYY"
81
+ format="y-MM-dd"
82
+ minDate={from}
83
+ value={to}
84
+ onChange={(to) => {
85
+ if (Array.isArray(to)) return;
86
+ filter.selectOption({
87
+ ...filter.selectedOptions,
88
+ from: formatDateWithoutTimeZone(from),
89
+ to: formatDateWithoutTimeZone(to),
90
+ });
91
+ }}
92
+ />
93
+ </DateRangeRow>
94
+ </DateRangeWrapper>
95
+ </FilterOptions>
96
+ </Accordion>
97
+ </AccordionWrapper>
98
+ );
99
+ }
100
+
101
+ const AccordionWrapper = styled.div<{ $hasSelection: boolean }>`
102
+ position: relative;
103
+ border-right: 4px solid transparent;
104
+
105
+ ${({ $hasSelection }) =>
106
+ $hasSelection &&
107
+ `border-right-color: var(--color-blueberry-6);
108
+
109
+ &::after {
110
+ content: '';
111
+ position: absolute;
112
+ bottom: -1px;
113
+ right: -4px;
114
+ width: 4px;
115
+ height: 1px;
116
+ background-color: var(--color-blueberry-6);
117
+ z-index: 1;
118
+ }
119
+ `}
120
+ `;
121
+
122
+ const AccordionHeaderContent = styled.div`
123
+ display: flex;
124
+ align-items: center;
125
+ gap: var(--spacing-xs);
126
+ width: 100%;
127
+ `;
128
+
129
+ const DateRangeWrapper = styled.div`
130
+ display: flex;
131
+ flex-direction: column;
132
+ gap: var(--filter-options-gap);
133
+ `;
134
+
135
+ const DateRangeRow = styled.div`
136
+ color: var(--filter-date-picker-color);
137
+ display: flex;
138
+ flex-direction: row;
139
+
140
+ align-items: center;
141
+ gap: var(--filter-date-picker-gap);
142
+
143
+ > span {
144
+ width: var(--filter-date-picker-width);
145
+ color: var(--filter-option-label-color);
146
+ }
147
+ `;
@@ -0,0 +1,136 @@
1
+ import React, { useMemo, useState } from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import type { JSX } from 'react';
5
+ import type { FilterProps, SelectProps, SelectOption } from '@redocly/theme/core/types';
6
+
7
+ import { FilterOption } from '@redocly/theme/components/Filter/FilterOption';
8
+ import { FilterOptionLabel } from '@redocly/theme/components/Filter/FilterOptionLabel';
9
+ import { Select } from '@redocly/theme/components/Select/Select';
10
+ import { CounterTag } from '@redocly/theme/components/Tags/CounterTag';
11
+ import { changeTextCasing } from '@redocly/theme/core/utils';
12
+ import { useThemeHooks } from '@redocly/theme/core/hooks';
13
+ import { Accordion } from '@redocly/theme/components/Accordion/Accordion';
14
+
15
+ export type CatalogFilterSelectProps = FilterProps & {
16
+ className?: string;
17
+ };
18
+
19
+ export function CatalogFilterSelect({
20
+ filter,
21
+ filterValuesCasing,
22
+ showCounter = true,
23
+ className,
24
+ }: CatalogFilterSelectProps): JSX.Element {
25
+ const { useTranslate } = useThemeHooks();
26
+ const { translate } = useTranslate();
27
+ const [isExpanded, setIsExpanded] = useState(false);
28
+
29
+ const selectedCount = useMemo(() => {
30
+ if (filter.selectedOptions instanceof Set) {
31
+ const firstValue = filter.selectedOptions.values().next()?.value;
32
+
33
+ return firstValue && firstValue !== '' ? 1 : 0;
34
+ }
35
+ return 0;
36
+ }, [filter.selectedOptions]);
37
+
38
+ let selectOptions: SelectOption<string>[] = [];
39
+
40
+ const defaultOptionCount = filter.options.reduce((acc, option) => acc + option.count, 0);
41
+
42
+ selectOptions = [
43
+ {
44
+ value: '',
45
+ element: (
46
+ <FilterOption key="all" onClick={() => filter.selectOption('')}>
47
+ <FilterOptionLabel data-translation-key="catalog.filters.select.all">
48
+ {translate('catalog.filters.select.all', 'All')}
49
+ </FilterOptionLabel>
50
+ <CounterTag borderless>{defaultOptionCount}</CounterTag>
51
+ </FilterOption>
52
+ ),
53
+ },
54
+ ...filter.options.map((option) => ({
55
+ value: option.value,
56
+ element: (
57
+ <FilterOption key={option.value}>
58
+ <FilterOptionLabel data-translation-key={option.value}>
59
+ {changeTextCasing(translate(option.value), filterValuesCasing)}
60
+ </FilterOptionLabel>
61
+ {showCounter && <CounterTag borderless>{option.count}</CounterTag>}
62
+ </FilterOption>
63
+ ),
64
+ })),
65
+ ];
66
+
67
+ const headerContent = (
68
+ <AccordionHeaderContent>
69
+ <span>{translate(filter.titleTranslationKey, filter.title)}</span>
70
+ {selectedCount > 0 && <CounterTag borderless>{selectedCount}</CounterTag>}
71
+ </AccordionHeaderContent>
72
+ );
73
+
74
+ return (
75
+ <AccordionWrapper
76
+ className={className}
77
+ $hasSelection={selectedCount > 0 && !isExpanded}
78
+ data-component-name="Catalog/CatalogFilterSelect"
79
+ >
80
+ <Accordion expanded={isExpanded} header={headerContent} onToggle={setIsExpanded}>
81
+ <StyledSelect
82
+ value={
83
+ (filter.selectedOptions instanceof Set ? filter.selectedOptions : new Set())
84
+ .values()
85
+ .next()?.value || ''
86
+ }
87
+ onChange={(value) => filter.selectOption(value)}
88
+ options={selectOptions}
89
+ />
90
+ </Accordion>
91
+ </AccordionWrapper>
92
+ );
93
+ }
94
+
95
+ const AccordionWrapper = styled.div<{ $hasSelection: boolean }>`
96
+ position: relative;
97
+ border-right: 4px solid transparent;
98
+
99
+ ${({ $hasSelection }) =>
100
+ $hasSelection &&
101
+ `border-right-color: var(--color-blueberry-6);
102
+
103
+ &::after {
104
+ content: '';
105
+ position: absolute;
106
+ bottom: -1px;
107
+ right: -4px;
108
+ width: 4px;
109
+ height: 1px;
110
+ background-color: var(--color-blueberry-6);
111
+ z-index: 1;
112
+ }
113
+ `}
114
+ `;
115
+
116
+ const AccordionHeaderContent = styled.div`
117
+ display: flex;
118
+ align-items: center;
119
+ gap: var(--spacing-xs);
120
+ width: 100%;
121
+ `;
122
+
123
+ const StyledSelect = styled(Select)<SelectProps>`
124
+ --select-list-max-width: var(--filter-select-max-width);
125
+
126
+ min-height: var(--filter-select-min-height);
127
+ --select-text-color: var(--filter-select-color);
128
+ border: 1px solid var(--filter-select-border-color);
129
+ --select-border-radius: var(--filter-select-border-radius);
130
+ padding: var(--filter-select-padding);
131
+
132
+ :hover {
133
+ border-color: var(--filter-select-border-color-hover);
134
+ }
135
+ --filter-option-margin: var(--filter-select-option-margin);
136
+ `;
@@ -52,7 +52,6 @@ export function CatalogSelector({
52
52
 
53
53
  export const CatalogSelectWrapper = styled.div`
54
54
  margin-top: var(--catalog-select-wrapper-margin-top);
55
- margin-bottom: var(--catalog-select-wrapper-margin-bottom);
56
55
  `;
57
56
 
58
57
  export const CatalogSelectLabel = styled.label`
@@ -80,7 +80,6 @@ export const catalog = css`
80
80
  * @tokens Catalog selector
81
81
  */
82
82
  --catalog-select-wrapper-margin-top: var(--spacing-xxs);
83
- --catalog-select-wrapper-margin-bottom: var(--spacing-base);
84
83
  --catalog-select-label-margin-bottom: var(--spacing-xxs);
85
84
  --catalog-select-label-font-weight: var(--filter-title-font-weight);
86
85
  --catalog-select-label-font-size: var(--filter-title-font-size);
@@ -98,7 +97,7 @@ export const catalog = css`
98
97
  /**
99
98
  * @tokens Catalog entity icon
100
99
  */
101
- --catalog-entity-icon-color: var(--color-primary-base);
100
+ --catalog-entity-icon-color: var(--color-persian-green-8);
102
101
  --catalog-entity-border-color: var(--border-color-secondary);
103
102
  --catalog-entity-bg-color: var(--bg-color-tonal);
104
103
 
@@ -1,7 +1,7 @@
1
- import React, { cloneElement, useRef } from 'react';
1
+ import React, { cloneElement, useRef, forwardRef } from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
- import type { PropsWithChildren, ReactElement, JSX } from 'react';
4
+ import type { PropsWithChildren, ReactElement } from 'react';
5
5
 
6
6
  import { useOutsideClick, useControlledState } from '@redocly/theme/core/hooks';
7
7
  import { ChevronDownIcon } from '@redocly/theme/icons/ChevronDownIcon/ChevronDownIcon';
@@ -32,84 +32,89 @@ export type DropdownProps = PropsWithChildren<{
32
32
  onClose?: () => void;
33
33
  }>;
34
34
 
35
- export function Dropdown({
36
- children,
37
- className,
38
- active,
39
- trigger,
40
- triggerEvent = 'click',
41
- closeOnClick = true,
42
- withArrow,
43
- dataAttributes,
44
- placement,
45
- alignment,
46
- onClick,
47
- onClose,
48
- }: DropdownProps): JSX.Element {
49
- const dropdownRef = useRef<HTMLDivElement | null>(null);
50
- const [isOpen, setIsOpen] = useControlledState<boolean>(false, active);
51
-
52
- const handleOpen = () => {
53
- setIsOpen(true);
54
- };
55
-
56
- const handleClose = () => {
57
- setIsOpen(false);
58
- onClose?.();
59
- };
60
-
61
- const handleChildClick = () => {
62
- handleClose();
63
- };
64
-
65
- const handleToggle = (event: React.UIEvent) => {
66
- event.stopPropagation();
67
- event.preventDefault();
68
- setIsOpen(!isOpen);
69
- };
70
-
71
- const handleKeyDown = (event: React.KeyboardEvent) => {
72
- if (event.key === 'Enter' || event.key === ' ') {
73
- handleToggle(event);
74
- }
75
- };
76
-
77
- useOutsideClick(dropdownRef, handleClose);
78
-
79
- const triggerChild = React.Children.only(trigger) as ReactElement<TriggerProps>;
80
-
81
- const dropdownTrigger = cloneElement(triggerChild, {
82
- onClick: triggerEvent === 'click' ? handleToggle : undefined,
83
- icon: withArrow ? isOpen ? <ChevronUpIcon /> : <ChevronDownIcon /> : undefined,
84
- ...(withArrow ? { iconPosition: 'right' } : {}),
85
- ...triggerChild.props,
86
- onKeyDown: triggerEvent === 'click' ? handleKeyDown : undefined,
87
- });
88
-
89
- return (
90
- <DropdownWrapper
91
- data-component-name="Dropdown/Dropdown"
92
- data-testid="dropdown"
93
- {...dataAttributes}
94
- className={className}
95
- ref={dropdownRef}
96
- onPointerEnter={triggerEvent === 'hover' ? handleOpen : undefined}
97
- onPointerLeave={triggerEvent === 'hover' ? handleClose : undefined}
98
- onClick={onClick}
99
- >
100
- {dropdownTrigger}
101
-
102
- <ChildrenWrapper
103
- placement={placement}
104
- alignment={alignment}
105
- isOpen={isOpen}
106
- onClick={closeOnClick ? handleChildClick : undefined}
35
+ export const Dropdown = forwardRef<HTMLDivElement, DropdownProps>(
36
+ (
37
+ {
38
+ children,
39
+ className,
40
+ active,
41
+ trigger,
42
+ triggerEvent = 'click',
43
+ closeOnClick = true,
44
+ withArrow,
45
+ dataAttributes,
46
+ placement,
47
+ alignment,
48
+ onClick,
49
+ onClose,
50
+ },
51
+ ref,
52
+ ) => {
53
+ const dropdownRef = useRef<HTMLDivElement | null>(null);
54
+ const [isOpen, setIsOpen] = useControlledState<boolean>(false, active);
55
+
56
+ const handleOpen = () => {
57
+ setIsOpen(true);
58
+ };
59
+
60
+ const handleClose = () => {
61
+ setIsOpen(false);
62
+ onClose?.();
63
+ };
64
+
65
+ const handleChildClick = () => {
66
+ handleClose();
67
+ };
68
+
69
+ const handleToggle = (event: React.UIEvent) => {
70
+ event.stopPropagation();
71
+ event.preventDefault();
72
+ setIsOpen(!isOpen);
73
+ };
74
+
75
+ const handleKeyDown = (event: React.KeyboardEvent) => {
76
+ if (event.key === 'Enter' || event.key === ' ') {
77
+ handleToggle(event);
78
+ }
79
+ };
80
+
81
+ useOutsideClick((ref as React.RefObject<HTMLElement | null>) || dropdownRef, handleClose);
82
+
83
+ const triggerChild = React.Children.only(trigger) as ReactElement<TriggerProps>;
84
+
85
+ const dropdownTrigger = cloneElement(triggerChild, {
86
+ onClick: triggerEvent === 'click' ? handleToggle : undefined,
87
+ icon: withArrow ? isOpen ? <ChevronUpIcon /> : <ChevronDownIcon /> : undefined,
88
+ ...(withArrow ? { iconPosition: 'right' } : {}),
89
+ ...triggerChild.props,
90
+ onKeyDown: triggerEvent === 'click' ? handleKeyDown : undefined,
91
+ });
92
+
93
+ return (
94
+ <DropdownWrapper
95
+ data-component-name="Dropdown/Dropdown"
96
+ data-testid="dropdown"
97
+ {...dataAttributes}
98
+ className={className}
99
+ ref={ref || dropdownRef}
100
+ onPointerEnter={triggerEvent === 'hover' ? handleOpen : undefined}
101
+ onPointerLeave={triggerEvent === 'hover' ? handleClose : undefined}
102
+ onClick={onClick}
107
103
  >
108
- {children}
109
- </ChildrenWrapper>
110
- </DropdownWrapper>
111
- );
112
- }
104
+ {dropdownTrigger}
105
+
106
+ <ChildrenWrapper
107
+ placement={placement}
108
+ alignment={alignment}
109
+ isOpen={isOpen}
110
+ onClick={closeOnClick ? handleChildClick : undefined}
111
+ >
112
+ {children}
113
+ </ChildrenWrapper>
114
+ </DropdownWrapper>
115
+ );
116
+ },
117
+ );
113
118
 
114
119
  const DropdownWrapper = styled.div`
115
120
  --button-gap: var(--spacing-xxs);
@@ -9,10 +9,11 @@ import { SearchIcon } from '@redocly/theme/icons/SearchIcon/SearchIcon';
9
9
  export type FilterInputProps = {
10
10
  value: string;
11
11
  onChange: (newValue: string) => void;
12
+ dataTestId?: string;
12
13
  };
13
14
 
14
15
  export function FilterInput(props: FilterInputProps): JSX.Element {
15
- const { value: initialValue, onChange } = props;
16
+ const { value: initialValue, onChange, dataTestId } = props;
16
17
 
17
18
  const [value, setValue] = useState(initialValue);
18
19
 
@@ -30,7 +31,7 @@ export function FilterInput(props: FilterInputProps): JSX.Element {
30
31
  const { translate } = useTranslate();
31
32
 
32
33
  return (
33
- <InputWrapper data-component-name="Filter/FilterInput">
34
+ <InputWrapper data-component-name="Filter/FilterInput" data-testid={dataTestId}>
34
35
  <InputIcon />
35
36
  <Input
36
37
  value={value}
@@ -16,4 +16,6 @@ const FilterOptionsComponent = styled.div`
16
16
  display: flex;
17
17
  flex-direction: column;
18
18
  gap: var(--filter-options-gap);
19
+ max-height: var(--filter-options-max-height);
20
+ overflow-y: scroll;
19
21
  `;
@@ -15,6 +15,7 @@ export const filter = css`
15
15
  --filter-options-padding-vertical: 0;
16
16
  --filter-options-padding-horizontal: 0;
17
17
  --filter-options-gap: var(--spacing-sm);
18
+ --filter-options-max-height: 350px;
18
19
 
19
20
  --filter-option-font-size: var(--font-size-base);
20
21
  --filter-option-gap: var(--spacing-xs);
@@ -25,12 +26,14 @@ export const filter = css`
25
26
 
26
27
  --filter-option-checkbox-padding-left: var(--spacing-xs);
27
28
 
28
- --filter-content-header-padding-vertical: 5px;
29
- --filter-content-header-padding-horizontal: 0;
29
+ --filter-content-header-padding-vertical: var(--spacing-xs) var(--spacing-sm);
30
+ --filter-content-header-padding-horizontal: var(--spacing-base);
30
31
 
31
- --filter-content-title-font-size: var(--font-size-base);
32
- --filter-content-title-line-height: var(--line-height-base);
32
+ --filter-content-title-font-size: var(--font-size-lg);
33
+ --filter-content-title-line-height: var(--line-height-lg);
33
34
  --filter-content-title-font-weight: var(--font-weight-semibold);
35
+
36
+ --filter-content-search-padding: 0 var(--spacing-xs) var(--spacing-sm);
34
37
 
35
38
  --filter-content-padding-vertical: var(--spacing-sm);
36
39
  --filter-content-padding-horizontal: var(--spacing-base);
@@ -82,6 +82,7 @@ export function MenuItem(props: React.PropsWithChildren<MenuItemProps>): JSX.Ele
82
82
  role={item.link ? 'none' : 'link'}
83
83
  tabIndex={!item.link ? 0 : undefined}
84
84
  data-testid="menu-item-label"
85
+ data-active={item.active}
85
86
  >
86
87
  {hasChevron ? <ChevronWrapper>{chevron}</ChevronWrapper> : null}
87
88
  <MenuItemIcon icon={item.icon} srcSet={item.srcSet} />
@@ -34,12 +34,13 @@ export function NavbarItem({ navItem, className }: NavbarItemProps): JSX.Element
34
34
  if (navItem.type !== 'link' && !navItem.items) return null;
35
35
 
36
36
  const item = navItem as ResolvedNavLinkItem;
37
- const normalizedPath =
38
- (item.link && item.link !== '/' ? removeTrailingSlash(item.link) : item.link) || '';
37
+ const normalizedPath = (item.link ? removeTrailingSlash(item.link) : item.link) || '';
39
38
 
40
- const isActive =
41
- pathname ===
42
- withPathPrefix(getPathnameForLocale(normalizedPath, defaultLocale, currentLocale, locales));
39
+ const pathWithPathPrefix = withPathPrefix(
40
+ getPathnameForLocale(normalizedPath, defaultLocale, currentLocale, locales),
41
+ );
42
+
43
+ const isActive = removeTrailingSlash(pathname) === removeTrailingSlash(pathWithPathPrefix);
43
44
 
44
45
  const itemContent = (
45
46
  <NavbarMenuItem
@@ -3,7 +3,7 @@ import styled from 'styled-components';
3
3
 
4
4
  import type { SearchFacet, SearchFacetCount } from '@redocly/theme/core/types';
5
5
 
6
- import { Tag, type TagProps } from '@redocly/theme/components/Tag/Tag';
6
+ import { Tag } from '@redocly/theme/components/Tag/Tag';
7
7
 
8
8
  type SearchFilterFieldTagsProps = {
9
9
  className?: string;
@@ -47,6 +47,7 @@ export function SearchFilterFieldTags({
47
47
  }}
48
48
  active={active}
49
49
  borderless
50
+ selectable
50
51
  >
51
52
  {value} {isCounterVisible && <span>{count}</span>}
52
53
  </FilterTagWrapper>
@@ -62,9 +63,8 @@ const FilterTagsWrapper = styled.div`
62
63
  gap: var(--search-filter-field-tags-gap);
63
64
  `;
64
65
 
65
- const FilterTagWrapper = styled(Tag)<{ color: TagProps['color'] }>`
66
+ const FilterTagWrapper = styled(Tag)`
66
67
  text-transform: uppercase;
67
68
  cursor: pointer;
68
- ${({ color }) => color && `background-color: var(--tag-operation-bg-color-${color});`}
69
69
  margin: var(--search-filter-field-tags-tag-margin);
70
70
  `;
@@ -0,0 +1,76 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import type { JSX } from 'react';
5
+
6
+ import { FeedbackType } from '@redocly/theme/core/types';
7
+ import { Button } from '@redocly/theme/components/Button/Button';
8
+ import { ThumbUpIcon } from '@redocly/theme/icons/ThumbUpIcon/ThumbUpIcon';
9
+ import { ThumbUpFilledIcon } from '@redocly/theme/icons/ThumbUpFilledIcon/ThumbUpFilledIcon';
10
+ import { ThumbDownIcon } from '@redocly/theme/icons/ThumbDownIcon/ThumbDownIcon';
11
+ import { ThumbDownFilledIcon } from '@redocly/theme/icons/ThumbDownFilledIcon/ThumbDownFilledIcon';
12
+ import { CopyButton } from '@redocly/theme/components/Buttons/CopyButton';
13
+
14
+ export type SearchAiActionButtonsProps = {
15
+ content: string;
16
+ className?: string;
17
+ feedback?: FeedbackType;
18
+ onFeedback: (feedback: FeedbackType) => void;
19
+ disabled?: boolean;
20
+ };
21
+
22
+ export function SearchAiActionButtons({
23
+ content,
24
+ className,
25
+ feedback,
26
+ onFeedback,
27
+ disabled,
28
+ }: SearchAiActionButtonsProps): JSX.Element {
29
+ return (
30
+ <ActionButtonsWrapper className={className} data-component-name="Search/SearchAiActionButtons">
31
+ <CopyButton data={content} />
32
+ <FeedbackButton
33
+ variant="text"
34
+ size="small"
35
+ icon={feedback === FeedbackType.Like ? <ThumbUpFilledIcon /> : <ThumbUpIcon />}
36
+ onClick={() => !disabled && onFeedback(FeedbackType.Like)}
37
+ extraClass={feedback === FeedbackType.Like ? 'active' : ''}
38
+ aria-label="Like this response"
39
+ disabled={disabled}
40
+ />
41
+
42
+ <FeedbackButton
43
+ variant="text"
44
+ size="small"
45
+ icon={feedback === FeedbackType.Dislike ? <ThumbDownFilledIcon /> : <ThumbDownIcon />}
46
+ onClick={() => !disabled && onFeedback(FeedbackType.Dislike)}
47
+ extraClass={feedback === FeedbackType.Dislike ? 'active' : ''}
48
+ aria-label="Dislike this response"
49
+ disabled={disabled}
50
+ />
51
+ </ActionButtonsWrapper>
52
+ );
53
+ }
54
+
55
+ const ActionButtonsWrapper = styled.div`
56
+ display: flex;
57
+ align-items: center;
58
+ gap: var(--search-ai-feedback-gap);
59
+ `;
60
+
61
+ const FeedbackButton = styled(Button)`
62
+ &:disabled {
63
+ pointer-events: none;
64
+ cursor: default;
65
+ opacity: 1;
66
+ background-color: var(--button-bg-color);
67
+ color: var(--button-color);
68
+ border-color: var(--button-border-color);
69
+ }
70
+
71
+ &:disabled.active {
72
+ background-color: var(--button-bg-color-active);
73
+ border-color: var(--button-border-color-active);
74
+ color: var(--button-color-active);
75
+ }
76
+ `;