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

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.
@@ -18,6 +18,7 @@ exports.tag = (0, styled_components_1.css) `
18
18
  --tag-badge-border-width: 2px;
19
19
  --tag-badge-border-color: var(--border-color-secondary); // @presenter Color
20
20
  --tag-border-color-focused: var(--color-blue-4); // @presenter Color
21
+ --tag-close-button-bg-color-focus: var(--color-warm-grey-4); // @presenter Color
21
22
 
22
23
  /**
23
24
  * @tokens Tag spacing
@@ -64,6 +65,7 @@ exports.tag = (0, styled_components_1.css) `
64
65
  --tag-icon-width: 14px; // @presenter Spacing
65
66
  --tag-icon-height: 14px; // @presenter Spacing
66
67
 
68
+
67
69
  /**
68
70
  * @tokens Tag colors
69
71
  */
@@ -159,8 +161,7 @@ exports.tag = (0, styled_components_1.css) `
159
161
  --tag-border-color-hover: var(--color-info-border-hover); // @presenter Color
160
162
  }
161
163
 
162
- .tag-purple,
163
- .tag-head {
164
+ .tag-purple {
164
165
  --tag-color: var(--color-purple-7); // @presenter Color
165
166
  --tag-bg-color: var(--color-purple-1); // @presenter Color
166
167
  --tag-border-color: var(--color-purple-4); // @presenter Color
@@ -271,109 +272,125 @@ exports.tag = (0, styled_components_1.css) `
271
272
  * @tokens Operation tag colors
272
273
  */
273
274
 
274
- --tag-operation-color-delete: #e70b46; // @presenter Color
275
- --tag-operation-bg-color-delete: #fee2e9; // @presenter Color
276
-
277
- --tag-operation-color-get: #25b869; // @presenter Color
278
- --tag-operation-bg-color-get: #e5faef; // @presenter Color
279
-
280
- --tag-operation-color-post: #1e65f5; // @presenter Color
281
- --tag-operation-bg-color-post: #e2ebfe; // @presenter Color
282
-
283
- --tag-operation-color-put: #f5901d; // @presenter Color
284
- --tag-operation-bg-color-put: #fef1e2; // @presenter Color
285
-
286
- --tag-operation-color-patch: #f5c31d; // @presenter Color
287
- --tag-operation-bg-color-patch: #fdf6dd; // @presenter Color
288
-
289
- --tag-operation-color-head: #5b4ccc; // @presenter Color
290
- --tag-operation-bg-color-head: #e6e1fe; // @presenter Color
291
-
292
- --tag-operation-color-options: #1a1c21; // @presenter Color
293
- --tag-operation-bg-color-options: #ededf2; // @presenter Color
294
-
295
- --tag-operation-color-deprecated: var(--text-color-disabled); // @presenter Color
296
-
297
- --tag-action-color-receive: #4db144; // @presenter Color
298
- --tag-action-color-sub: #4db144; // @presenter Color
299
- --tag-action-color-cons: #4db144; // @presenter Color
300
-
301
- --tag-action-color-send: #4144f6; // @presenter Color
302
- --tag-action-color-pub: #4144f6; // @presenter Color
303
- --tag-action-color-publish: #4144f6; // @presenter Color
304
-
305
- --tag-action-color-channel: #F0870E; // @presenter Color
306
- --tag-action-color-topic: #F0870E; // @presenter Color
307
- --tag-action-color-queue: #D72E81; // @presenter Color
308
- --tag-action-color-exchange: #9B51E0; // @presenter Color
275
+ .tag-head {
276
+ --tag-color: #6355CA; // @presenter Color
277
+ --tag-bg-color: #ECEBFA; // @presenter Color
278
+ --tag-bg-color-hover: #E0DEF7; // @presenter Color
279
+ }
309
280
 
310
281
  .tag-delete {
311
- --tag-color: var(--tag-operation-color-delete); // @presenter Color
282
+ --tag-color: #e70b46; // @presenter Color
283
+ --tag-bg-color: #fee2e9; // @presenter Color
284
+ --tag-bg-color-hover: #fdd3dd; // @presenter Color
312
285
  }
313
286
 
314
287
  .tag-get {
315
- --tag-color: var(--tag-operation-color-get); // @presenter Color
288
+ --tag-color: #25b869; // @presenter Color
289
+ --tag-bg-color: #e5faef; // @presenter Color
290
+ --tag-bg-color-hover: #D4F7E5; // @presenter Color
316
291
  }
317
292
 
318
293
  .tag-post {
319
- --tag-color: var(--tag-operation-color-post); // @presenter Color
294
+ --tag-color: #1e65f5; // @presenter Color
295
+ --tag-bg-color: #e2ebfe; // @presenter Color
296
+ --tag-bg-color-hover: #CEDDFD; // @presenter Color
320
297
  }
321
298
 
322
299
  .tag-put {
323
- --tag-color: var(--tag-operation-color-put); // @presenter Color
300
+ --tag-color: #f5901d; // @presenter Color
301
+ --tag-bg-color: #fef1e2; // @presenter Color
302
+ --tag-bg-color-hover: #FDE2C4; // @presenter Color
324
303
  }
325
-
304
+
326
305
  .tag-patch {
327
- --tag-color: var(--tag-operation-color-patch); // @presenter Color
306
+ --tag-color: #f5c31d; // @presenter Color
307
+ --tag-bg-color: #fdf6dd; // @presenter Color
308
+ --tag-bg-color-hover: #FCF0C5; // @presenter Color
328
309
  }
329
310
 
330
311
  .tag-http-deprecated {
331
- --tag-color: var(--tag-operation-color-deprecated) // @presenter Color
332
- }
333
-
334
- .tag-receive {
335
- --tag-color: var(--tag-action-color-receive); // @presenter Color
312
+ --tag-color: var(--text-color-disabled); // @presenter Color
336
313
  }
337
314
 
338
315
  .tag-send {
339
- --tag-color: var(--tag-action-color-send); // @presenter Color
316
+ --tag-color: #4144F6; // @presenter Color
317
+ --tag-bg-color: #ECECFE; // @presenter Color
318
+ --tag-bg-color-hover: #CFCFFC; // @presenter Color
340
319
  }
341
320
 
342
321
  .tag-pub {
343
- --tag-color: var(--tag-action-color-pub); // @presenter Color
322
+ --tag-color: #4144F6; // @presenter Color
323
+ --tag-bg-color: #ECECFE; // @presenter Color
324
+ --tag-bg-color-hover: #CFCFFC; // @presenter Color
344
325
  }
345
326
 
346
- .tag-sub {
347
- --tag-color: var(--tag-action-color-sub); // @presenter Color
327
+ .tag-publish {
328
+ --tag-color: #4144F6; // @presenter Color
329
+ --tag-bg-color: #ECECFE; // @presenter Color
330
+ --tag-bg-color-hover: #CFCFFC; // @presenter Color
348
331
  }
349
332
 
350
- .tag-cons {
351
- --tag-color: var(--tag-action-color-cons); // @presenter Color
333
+ .tag-receive {
334
+ --tag-color: #4db144; // @presenter Color
335
+ --tag-bg-color: #E5FDE2; // @presenter Color
336
+ --tag-bg-color-hover: #D4FCCF; // @presenter Color
352
337
  }
353
338
 
354
- .tag-publish {
355
- --tag-color: var(--tag-action-color-publish); // @presenter Color
339
+ .tag-sub {
340
+ --tag-color: #4db144; // @presenter Color
341
+ --tag-bg-color: #E5FDE2; // @presenter Color
342
+ --tag-bg-color-hover: #D4FCCF; // @presenter Color
343
+ }
344
+
345
+ .tag-cons {
346
+ --tag-color: #4db144; // @presenter Color
347
+ --tag-bg-color: #E5FDE2; // @presenter Color
348
+ --tag-bg-color-hover: #D4FCCF; // @presenter Color
356
349
  }
357
350
 
358
351
  .tag-channel {
359
- --tag-color: var(--tag-action-color-channel); // @presenter Color
352
+ --tag-color: #F0870E; // @presenter Color
353
+ --tag-bg-color: #FDF1E2; // @presenter Color
354
+ --tag-bg-color-hover: #FBE1C1; // @presenter Color
360
355
  }
361
356
 
362
357
  .tag-topic {
363
- --tag-color: var(--tag-action-color-channel); // @presenter Color
358
+ --tag-color: #F0870E; // @presenter Color
359
+ --tag-bg-color: #FDF1E2; // @presenter Color
360
+ --tag-bg-color-hover: #FBE1C1; // @presenter Color
364
361
  }
365
362
 
366
363
  .tag-queue {
367
- --tag-color: var(--tag-action-color-queue); // @presenter Color
364
+ --tag-color: #D72E81; // @presenter Color
365
+ --tag-bg-color: #FAE5F0; // @presenter Color
366
+ --tag-bg-color-hover: #F7D4E6; // @presenter Color
368
367
  }
369
368
 
370
369
  .tag-exchange {
371
- --tag-color: var(--tag-action-color-exchange); // @presenter Color
370
+ --tag-color: #9B51E0; // @presenter Color
371
+ --tag-bg-color: #F0E5FA; // @presenter Color
372
+ --tag-bg-color-hover: #E6D4F7; // @presenter Color
372
373
  }
373
374
 
374
375
  // shorten alias for exchange tag:
375
376
  .tag-exch {
376
- --tag-color: var(--tag-action-color-exchange); // @presenter Color
377
+ --tag-color: #9B51E0; // @presenter Color
378
+ --tag-bg-color: #F0E5FA; // @presenter Color
379
+ --tag-bg-color-hover: #E6D4F7; // @presenter Color
380
+ }
381
+
382
+ /**
383
+ * @tokens Tag variants
384
+ */
385
+
386
+ .tag-variant-filled {
387
+ --tag-border-color: transparent;
388
+ --tag-border-color-hover: transparent;
389
+ }
390
+
391
+ .tag-variant-outline {
392
+ --tag-bg-color: transparent;
393
+ --tag-bg-color-hover: transparent;
377
394
  }
378
395
 
379
396
  // @tokens End
@@ -36,6 +36,7 @@ export declare const useTelemetryFallback: () => {
36
36
  sendLanguagePickerLocaleChangedMessage: () => void;
37
37
  sendSearchOpenedMessage: () => void;
38
38
  sendSearchQueryMessage: () => void;
39
+ sendSearchAiOpenedMessage: () => void;
39
40
  sendSearchAIQueryMessage: () => void;
40
41
  sendFeedbackMessage: () => void;
41
42
  sendSearchResultClickedMessage: () => void;
@@ -40,6 +40,7 @@ const useTelemetryFallback = () => ({
40
40
  sendLanguagePickerLocaleChangedMessage: () => { },
41
41
  sendSearchOpenedMessage: () => { },
42
42
  sendSearchQueryMessage: () => { },
43
+ sendSearchAiOpenedMessage: () => { },
43
44
  sendSearchAIQueryMessage: () => { },
44
45
  sendFeedbackMessage: () => { },
45
46
  sendSearchResultClickedMessage: () => { },
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.59.0-next.2",
3
+ "version": "0.59.0-next.4",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
7
7
  "redocly"
8
8
  ],
9
9
  "author": "team@redocly.com",
10
- "license": "SEE LICENSE IN LICENSE",
10
+ "license": "MIT",
11
11
  "main": "lib/index.js",
12
12
  "types": "lib/index.d.ts",
13
13
  "exports": {
@@ -88,7 +88,7 @@
88
88
  "react-calendar": "5.1.0",
89
89
  "react-date-picker": "11.0.0",
90
90
  "@redocly/config": "0.36.0",
91
- "@redocly/realm-asyncapi-sdk": "0.5.0-next.0"
91
+ "@redocly/realm-asyncapi-sdk": "0.5.0-next.1"
92
92
  },
93
93
  "scripts": {
94
94
  "watch": "tsc -p tsconfig.build.json && (concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\")",
@@ -56,8 +56,9 @@ const getIcon = (
56
56
  export function AIAssistantButton() {
57
57
  const [isOpen, setIsOpen] = useState(false);
58
58
  const themeConfig = useThemeConfig();
59
- const { useTranslate } = useThemeHooks();
59
+ const { useTranslate, useTelemetry } = useThemeHooks();
60
60
  const { translate } = useTranslate();
61
+ const telemetry = useTelemetry();
61
62
 
62
63
  const buttonConfig = {
63
64
  ...defaultConfig,
@@ -75,6 +76,9 @@ export function AIAssistantButton() {
75
76
 
76
77
  const handleOpen = () => {
77
78
  setIsOpen(true);
79
+ telemetry.sendSearchAiOpenedMessage({
80
+ method: 'ai_trigger_button',
81
+ });
78
82
  };
79
83
 
80
84
  const handleClose = () => {
@@ -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
  `;
@@ -228,6 +228,9 @@ export function SearchDialog({
228
228
  if (query.trim()) {
229
229
  aiSearch.askQuestion(query);
230
230
  }
231
+ telemetry.sendSearchAiOpenedMessage({
232
+ method: 'ai_search_button',
233
+ });
231
234
  }}
232
235
  >
233
236
  {translate('search.ai.button', 'Search with AI')}
@@ -298,6 +301,9 @@ export function SearchDialog({
298
301
  if (query.trim()) {
299
302
  aiSearch.askQuestion(query);
300
303
  }
304
+ telemetry.sendSearchAiOpenedMessage({
305
+ method: 'ai_search_input',
306
+ });
301
307
  }}
302
308
  onKeyDown={(e) => {
303
309
  if (e.key === 'Enter') {
@@ -305,6 +311,9 @@ export function SearchDialog({
305
311
  if (query.trim()) {
306
312
  aiSearch.askQuestion(query);
307
313
  }
314
+ telemetry.sendSearchAiOpenedMessage({
315
+ method: 'ai_search_input',
316
+ });
308
317
  }
309
318
  }}
310
319
  ref={aiQueryRef}
@@ -45,6 +45,7 @@ export function SearchGroups({
45
45
  borderless
46
46
  active={!searchFilter.some((item) => item.isQuickFilter)}
47
47
  onClick={() => searchFilter.some((item) => item.isQuickFilter) && onQuickFilterReset()}
48
+ selectable
48
49
  >
49
50
  All
50
51
  </GroupTag>
@@ -61,6 +62,7 @@ export function SearchGroups({
61
62
  onClick={() => handleGroupTagClick(value, facet.field, active, currentValues)}
62
63
  active={active}
63
64
  borderless
65
+ selectable
64
66
  >
65
67
  {value} {isCounterVisible && <span>{count}</span>}
66
68
  </GroupTag>
@@ -83,6 +83,7 @@ export function SelectInput<T>(props: SelectInputProps<T>): React.ReactNode {
83
83
  const selectTags = selectedOptions.map((option, index) => (
84
84
  <SelectInputTag
85
85
  closable
86
+ tabIndex={0}
86
87
  key={index}
87
88
  onClose={() => {
88
89
  clearHandler?.(option);
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import styled from 'styled-components';
2
+ import styled, { css } from 'styled-components';
3
3
 
4
4
  import type { JSX } from 'react';
5
5
 
@@ -56,6 +56,7 @@ export type TagProps = {
56
56
  maxLength?: number;
57
57
  textTransform?: 'uppercase' | 'lowercase' | 'capitalize' | 'none';
58
58
  variant?: 'outline' | 'filled';
59
+ selectable?: boolean;
59
60
  };
60
61
 
61
62
  export function Tag({
@@ -75,6 +76,7 @@ export function Tag({
75
76
  maxLength,
76
77
  textTransform,
77
78
  variant = 'filled',
79
+ selectable,
78
80
  ...otherProps
79
81
  }: TagProps): JSX.Element {
80
82
  const truncateText = (text: string, maxLen: number): string => {
@@ -152,6 +154,7 @@ export function Tag({
152
154
  hasCloseButton={closable}
153
155
  textTransform={textTransform}
154
156
  variant={variant}
157
+ selectable={selectable}
155
158
  {...otherProps}
156
159
  >
157
160
  {withStatusDot ? <StatusDot color={statusDotColor} /> : icon ? icon : null}
@@ -186,16 +189,28 @@ const CloseButton = styled.div`
186
189
  justify-content: center;
187
190
  align-self: stretch;
188
191
  border-radius: 0 var(--tag-border-radius) var(--tag-border-radius) 0;
192
+ margin: calc(-1 * var(--tag-border-width));
193
+ padding: var(--tag-border-width);
189
194
 
190
195
  &:hover {
191
196
  background: var(--tag-close-button-bg-color-hover);
192
197
  }
198
+
199
+ &:focus-visible {
200
+ background: var(--tag-close-button-bg-color-focus);
201
+ }
193
202
  `;
194
203
 
195
- const TagWrapper = styled.div.attrs(({ className, color, size }: TagProps) => ({
196
- className:
197
- (className || '') +
198
- ` tag-default ${color ? `tag-${color}` : ''} ${size ? `tag-size-${size}` : ''}`,
204
+ const TagWrapper = styled.div.attrs(({ className, color, size, variant }: TagProps) => ({
205
+ className: [
206
+ className,
207
+ 'tag-default',
208
+ color && `tag-${color}`,
209
+ size && `tag-size-${size}`,
210
+ `tag-variant-${variant || 'filled'}`,
211
+ ]
212
+ .filter(Boolean)
213
+ .join(' '),
199
214
  }))<
200
215
  TagProps & {
201
216
  hasCloseButton?: boolean;
@@ -227,12 +242,11 @@ const TagWrapper = styled.div.attrs(({ className, color, size }: TagProps) => ({
227
242
  `text-transform: ${textTransform ? `${textTransform}` : 'var(--tag-text-transform)'};`}
228
243
 
229
244
  color: var(--tag-color);
230
- background-color: ${({ variant }) =>
231
- variant === 'filled' ? 'var(--tag-bg-color)' : 'transparent'};
232
- ${({ borderless, variant }) =>
245
+ background-color: var(--tag-bg-color);
246
+ ${({ borderless }) =>
233
247
  borderless
234
248
  ? ''
235
- : `border: var(--tag-border-width) var(--tag-border-style) ${variant === 'filled' ? 'transparent' : 'var(--tag-border-color)'};`}
249
+ : `border: var(--tag-border-width) var(--tag-border-style) var(--tag-border-color);`}
236
250
  border-radius: var(--tag-border-radius);
237
251
 
238
252
  svg {
@@ -240,18 +254,20 @@ const TagWrapper = styled.div.attrs(({ className, color, size }: TagProps) => ({
240
254
  height: var(--tag-icon-height);
241
255
  }
242
256
 
243
- &:hover {
244
- background-color: ${({ variant }) =>
245
- variant === 'filled' ? 'var(--tag-bg-color-hover)' : 'transparent'};
246
- border-color: ${({ variant }) =>
247
- variant === 'outline' ? 'var(--tag-border-color-hover)' : 'transparent'};
248
- }
257
+ ${({ selectable }) =>
258
+ selectable &&
259
+ css`
260
+ &:hover {
261
+ background-color: var(--tag-bg-color-hover);
262
+ border-color: var(--tag-border-color-hover);
263
+ }
249
264
 
250
- &:focus-visible {
251
- outline: 1px solid var(--tag-border-color-focused);
252
- outline-offset: 2px;
253
- border-radius: var(--tag-border-radius-focused);
254
- }
265
+ &:focus-visible {
266
+ outline: 1px solid var(--tag-border-color-focused);
267
+ outline-offset: 2px;
268
+ border-radius: var(--tag-border-radius-focused);
269
+ }
270
+ `};
255
271
  `;
256
272
 
257
273
  const StatusDot = styled.div<{ color: string }>`