@redocly/theme 0.59.0-next.2 → 0.59.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -1
- package/lib/components/Navbar/NavbarItem.js +3 -3
- package/lib/components/Search/FilterFields/SearchFilterFieldTags.js +1 -2
- package/lib/components/Search/SearchGroups.js +2 -2
- package/lib/components/Select/SelectInput.js +1 -1
- package/lib/components/Tag/Tag.d.ts +2 -1
- package/lib/components/Tag/Tag.js +67 -18
- package/lib/components/Tag/variables.dark.js +135 -36
- package/lib/components/Tag/variables.js +78 -61
- package/package.json +2 -2
- package/src/components/Navbar/NavbarItem.tsx +6 -5
- package/src/components/Search/FilterFields/SearchFilterFieldTags.tsx +3 -3
- package/src/components/Search/SearchGroups.tsx +2 -0
- package/src/components/Select/SelectInput.tsx +1 -0
- package/src/components/Tag/Tag.tsx +36 -20
- package/src/components/Tag/variables.dark.ts +135 -36
- package/src/components/Tag/variables.ts +78 -61
|
@@ -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
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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-
|
|
347
|
-
|
|
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-
|
|
351
|
-
|
|
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-
|
|
355
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.59.0-next.
|
|
3
|
+
"version": "0.59.0-next.3",
|
|
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": "
|
|
10
|
+
"license": "MIT",
|
|
11
11
|
"main": "lib/index.js",
|
|
12
12
|
"types": "lib/index.d.ts",
|
|
13
13
|
"exports": {
|
|
@@ -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
|
|
41
|
-
|
|
42
|
-
|
|
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
|
|
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)
|
|
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
|
`;
|
|
@@ -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>
|
|
@@ -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
|
-
|
|
198
|
-
|
|
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:
|
|
231
|
-
|
|
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)
|
|
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
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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 }>`
|