@redocly/theme 0.11.2 → 0.11.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.
@@ -145,10 +145,26 @@ function useSearchParams(location) {
145
145
  return React.useMemo(() => new URLSearchParams(location.search), [location.search]);
146
146
  }
147
147
  function normalizeItems(items, config) {
148
+ // because of RBAC some versions can be missing so we need to pick up other default version
149
+ const hasDeafultVersion = {};
150
+ for (const item of items) {
151
+ if (item.versionFolderId && item.isDefault) {
152
+ hasDeafultVersion[item.versionFolderId] = true;
153
+ }
154
+ }
148
155
  if (!config.separateVersions) {
149
156
  // keep only default version
150
157
  // idea: save other versions information (may be useful for cards)
151
- items = items.filter((item) => item.isDefault === true || item.isDefault === undefined);
158
+ items = items.filter((item) => {
159
+ if (!item.versionFolderId)
160
+ return true;
161
+ if (!hasDeafultVersion[item.versionFolderId]) {
162
+ // we already picked the default version so let's ignore next versions
163
+ hasDeafultVersion[item.versionFolderId] = true;
164
+ return true;
165
+ }
166
+ return item.isDefault;
167
+ });
152
168
  }
153
169
  return items.map((item) => {
154
170
  var _a, _b, _c;
@@ -45,15 +45,15 @@ const DropDownHeader = styled_components_1.default.div `
45
45
  border: 1px solid var(--border-color);
46
46
  font-weight: 600;
47
47
  color: var(--text-color);
48
- background: var(--color-secondary-200);
48
+ background: var(--background-color);
49
49
  `;
50
50
  const DropDownList = styled_components_1.default.div `
51
51
  position: absolute;
52
- background: var(--color-secondary-200);
52
+ background: var(--background-color);
53
53
  margin: 2px 20px 0 20px;
54
54
  padding: 0;
55
55
  border-radius: 4px;
56
- border: 1px solid rgba(38, 50, 56, 0.2);
56
+ border: 1px solid var(--border-color);
57
57
  z-index: 9999;
58
58
  left: 0;
59
59
  right: 0;
@@ -67,7 +67,7 @@ const IconWrapper = styled_components_1.default.span `
67
67
  }
68
68
  `;
69
69
  const ListItem = styled_components_1.default.div `
70
- background-color: var(--color-secondary-200);
70
+ background-color: var(--background-color);
71
71
  padding: 0.4em 10px;
72
72
  font-size: 1em;
73
73
  color: var(--text-color);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [],
6
6
  "author": "team@redocly.com",
@@ -165,10 +165,26 @@ function useSearchParams(location: Location) {
165
165
  }
166
166
 
167
167
  function normalizeItems(items: ResolvedNavItem[], config: CatalogConfig): CatalogItem[] {
168
+ // because of RBAC some versions can be missing so we need to pick up other default version
169
+ const hasDeafultVersion: Record<string, boolean> = {};
170
+ for (const item of items) {
171
+ if (item.versionFolderId && item.isDefault) {
172
+ hasDeafultVersion[item.versionFolderId] = true;
173
+ }
174
+ }
175
+
168
176
  if (!config.separateVersions) {
169
177
  // keep only default version
170
178
  // idea: save other versions information (may be useful for cards)
171
- items = items.filter((item) => item.isDefault === true || item.isDefault === undefined);
179
+ items = items.filter((item) => {
180
+ if (!item.versionFolderId) return true;
181
+ if (!hasDeafultVersion[item.versionFolderId]) {
182
+ // we already picked the default version so let's ignore next versions
183
+ hasDeafultVersion[item.versionFolderId] = true;
184
+ return true;
185
+ }
186
+ return item.isDefault;
187
+ });
172
188
  }
173
189
 
174
190
  return items.map((item) => {
@@ -39,16 +39,16 @@ const DropDownHeader = styled.div`
39
39
  border: 1px solid var(--border-color);
40
40
  font-weight: 600;
41
41
  color: var(--text-color);
42
- background: var(--color-secondary-200);
42
+ background: var(--background-color);
43
43
  `;
44
44
 
45
45
  const DropDownList = styled.div`
46
46
  position: absolute;
47
- background: var(--color-secondary-200);
47
+ background: var(--background-color);
48
48
  margin: 2px 20px 0 20px;
49
49
  padding: 0;
50
50
  border-radius: 4px;
51
- border: 1px solid rgba(38, 50, 56, 0.2);
51
+ border: 1px solid var(--border-color);
52
52
  z-index: 9999;
53
53
  left: 0;
54
54
  right: 0;
@@ -64,7 +64,7 @@ const IconWrapper = styled.span`
64
64
  `;
65
65
 
66
66
  const ListItem = styled.div`
67
- background-color: var(--color-secondary-200);
67
+ background-color: var(--background-color);
68
68
  padding: 0.4em 10px;
69
69
  font-size: 1em;
70
70
  color: var(--text-color);