@redocly/theme 0.1.2 → 0.1.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.
Files changed (203) hide show
  1. package/Button/Button.d.ts +17 -0
  2. package/Button/Button.js +34 -0
  3. package/Button/index.d.ts +1 -0
  4. package/Button/index.js +1 -0
  5. package/CodeBlock/CodeBlock.d.ts +1 -0
  6. package/CodeBlock/CodeBlock.js +7 -0
  7. package/CodeBlock/index.d.ts +1 -0
  8. package/CodeBlock/index.js +1 -0
  9. package/CopyButton/CopyButton.d.ts +6 -0
  10. package/CopyButton/CopyButton.js +69 -0
  11. package/CopyButton/CopyButtonWrapper.d.ts +9 -0
  12. package/CopyButton/CopyButtonWrapper.js +37 -0
  13. package/CopyButton/index.d.ts +2 -0
  14. package/CopyButton/index.js +2 -0
  15. package/Headings/Headings.d.ts +3 -0
  16. package/Headings/Headings.js +10 -0
  17. package/Headings/index.d.ts +1 -0
  18. package/Headings/index.js +1 -0
  19. package/JsonViewer/JsonViewer.d.ts +10 -0
  20. package/JsonViewer/JsonViewer.js +92 -0
  21. package/JsonViewer/index.d.ts +1 -0
  22. package/JsonViewer/index.js +1 -0
  23. package/JsonViewer/styled.d.ts +1 -0
  24. package/JsonViewer/styled.js +7 -0
  25. package/Logo/Logo.d.ts +10 -0
  26. package/Logo/Logo.js +25 -0
  27. package/Navbar/Navbar.d.ts +9 -0
  28. package/Navbar/Navbar.js +23 -0
  29. package/Navbar/NavbarItem.d.ts +40 -0
  30. package/Navbar/NavbarItem.js +43 -0
  31. package/Navbar/NavbarMenu.d.ts +4 -0
  32. package/Navbar/NavbarMenu.js +29 -0
  33. package/Panel/CodePanel.d.ts +1 -0
  34. package/Panel/CodePanel.js +13 -0
  35. package/Panel/ContentPanel.d.ts +1 -0
  36. package/Panel/ContentPanel.js +12 -0
  37. package/Panel/DarkHeader.d.ts +1 -0
  38. package/Panel/DarkHeader.js +7 -0
  39. package/Panel/Panel.d.ts +2 -0
  40. package/Panel/Panel.js +10 -0
  41. package/Panel/PanelBody.d.ts +6 -0
  42. package/Panel/PanelBody.js +15 -0
  43. package/Panel/PanelComponent.d.ts +10 -0
  44. package/Panel/PanelComponent.js +40 -0
  45. package/Panel/PanelHeader.d.ts +7 -0
  46. package/Panel/PanelHeader.js +16 -0
  47. package/Panel/PanelHeaderTitle.d.ts +1 -0
  48. package/Panel/PanelHeaderTitle.js +7 -0
  49. package/Panel/index.d.ts +7 -0
  50. package/Panel/index.js +7 -0
  51. package/SamplesPanelControls/SamplesPanelControls.d.ts +4 -0
  52. package/SamplesPanelControls/SamplesPanelControls.js +17 -0
  53. package/SamplesPanelControls/index.d.ts +1 -0
  54. package/SamplesPanelControls/index.js +1 -0
  55. package/SidebarLogo/SidebarLogo.d.ts +9 -0
  56. package/SidebarLogo/SidebarLogo.js +29 -0
  57. package/SidebarLogo/index.d.ts +1 -0
  58. package/SidebarLogo/index.js +1 -0
  59. package/SourceCode/SourceCode.d.ts +24 -0
  60. package/SourceCode/SourceCode.js +31 -0
  61. package/SourceCode/index.d.ts +1 -0
  62. package/SourceCode/index.js +1 -0
  63. package/Tooltip/Tooltip.d.ts +12 -0
  64. package/Tooltip/Tooltip.js +57 -0
  65. package/Tooltip/index.d.ts +1 -0
  66. package/Tooltip/index.js +1 -0
  67. package/globalStyle.d.ts +1 -0
  68. package/globalStyle.js +7 -0
  69. package/hooks/index.d.ts +3 -0
  70. package/hooks/index.js +3 -0
  71. package/hooks/useControl.d.ts +6 -0
  72. package/hooks/useControl.js +12 -0
  73. package/hooks/useMount.d.ts +1 -0
  74. package/hooks/useMount.js +7 -0
  75. package/hooks/useUnmount.d.ts +1 -0
  76. package/hooks/useUnmount.js +9 -0
  77. package/icons/ShelfIcon/ShelfIcon.d.ts +10 -0
  78. package/icons/ShelfIcon/ShelfIcon.js +33 -0
  79. package/icons/ShelfIcon/index.d.ts +2 -0
  80. package/icons/ShelfIcon/index.js +1 -0
  81. package/icons/index.d.ts +1 -0
  82. package/icons/index.js +1 -0
  83. package/index.d.ts +14 -0
  84. package/mocks/Link.d.ts +2 -0
  85. package/mocks/Link.js +17 -0
  86. package/mocks/utils.d.ts +1 -0
  87. package/mocks/utils.js +3 -0
  88. package/package.json +1 -4
  89. package/src/Button/Button.stories.tsx +74 -0
  90. package/src/Button/Button.tsx +122 -0
  91. package/src/Button/__tests__/Button.test.tsx +42 -0
  92. package/src/Button/__tests__/__snapshots__/Button.test.tsx.snap +274 -0
  93. package/src/Button/index.ts +1 -0
  94. package/src/CodeBlock/CodeBlock.ts +125 -0
  95. package/src/CodeBlock/__tests__/CodeBlock.test.tsx +12 -0
  96. package/src/CodeBlock/__tests__/__snapshots__/CodeBlock.test.tsx.snap +140 -0
  97. package/src/CodeBlock/index.ts +1 -0
  98. package/src/CopyButton/CopyButton.stories.tsx +18 -0
  99. package/src/CopyButton/CopyButton.tsx +26 -0
  100. package/src/CopyButton/CopyButtonWrapper.tsx +52 -0
  101. package/src/CopyButton/__tests__/CopyButton.test.tsx +35 -0
  102. package/src/CopyButton/__tests__/CopyButtonWrapper.test.tsx +16 -0
  103. package/src/CopyButton/__tests__/__snapshots__/CopyButton.test.tsx.snap +55 -0
  104. package/src/CopyButton/__tests__/__snapshots__/CopyButtonWrapper.test.tsx.snap +46 -0
  105. package/src/CopyButton/index.ts +2 -0
  106. package/src/Headings/Headings.stories.tsx +36 -0
  107. package/src/Headings/Headings.ts +23 -0
  108. package/src/Headings/__tests__/Headings.test.tsx +24 -0
  109. package/src/Headings/__tests__/__snapshots__/Headings.test.tsx.snap +57 -0
  110. package/src/Headings/index.ts +1 -0
  111. package/src/Introduction.stories.mdx +7 -0
  112. package/src/JsonViewer/JsonViewer.stories.tsx +57 -0
  113. package/src/JsonViewer/JsonViewer.tsx +130 -0
  114. package/src/JsonViewer/__tests__/JsonViewer.test.tsx +82 -0
  115. package/src/JsonViewer/__tests__/__snapshots__/JsonViewer.test.tsx.snap +2728 -0
  116. package/src/JsonViewer/index.ts +1 -0
  117. package/src/JsonViewer/styled.ts +103 -0
  118. package/src/Logo/Logo.tsx +23 -0
  119. package/src/Navbar/Navbar.stories.tsx +38 -0
  120. package/src/Navbar/Navbar.tsx +60 -0
  121. package/src/Navbar/NavbarItem.tsx +90 -0
  122. package/src/Navbar/NavbarMenu.tsx +29 -0
  123. package/src/Panel/CodePanel.stories.tsx +27 -0
  124. package/src/Panel/CodePanel.ts +31 -0
  125. package/src/Panel/ContentPanel.stories.tsx +27 -0
  126. package/src/Panel/ContentPanel.ts +43 -0
  127. package/src/Panel/DarkHeader.ts +8 -0
  128. package/src/Panel/Panel.stories.tsx +58 -0
  129. package/src/Panel/Panel.ts +18 -0
  130. package/src/Panel/PanelBody.ts +30 -0
  131. package/src/Panel/PanelComponent.tsx +73 -0
  132. package/src/Panel/PanelHeader.ts +25 -0
  133. package/src/Panel/PanelHeaderTitle.ts +11 -0
  134. package/src/Panel/__tests__/CodePanel.test.tsx +26 -0
  135. package/src/Panel/__tests__/ContentPanel.test.tsx +26 -0
  136. package/src/Panel/__tests__/Panel.test.tsx +54 -0
  137. package/src/Panel/__tests__/__snapshots__/CodePanel.test.tsx.snap +258 -0
  138. package/src/Panel/__tests__/__snapshots__/ContentPanel.test.tsx.snap +278 -0
  139. package/src/Panel/__tests__/__snapshots__/Panel.test.tsx.snap +398 -0
  140. package/src/Panel/index.ts +7 -0
  141. package/src/SamplesPanelControls/SamplesControlButton.stories.tsx +18 -0
  142. package/src/SamplesPanelControls/SamplesPanelControls.ts +70 -0
  143. package/src/SamplesPanelControls/__tests__/SamplesPanelControls.test.tsx +36 -0
  144. package/src/SamplesPanelControls/__tests__/__snapshots__/SamplesPanelControls.test.tsx.snap +228 -0
  145. package/src/SamplesPanelControls/index.ts +1 -0
  146. package/src/SidebarLogo/SidebarLogo.stories.tsx +21 -0
  147. package/src/SidebarLogo/SidebarLogo.tsx +47 -0
  148. package/src/SidebarLogo/__tests__/SidebarLogo.test.tsx +32 -0
  149. package/src/SidebarLogo/__tests__/__snapshots__/SidebarLogo.test.tsx.snap +62 -0
  150. package/src/SidebarLogo/index.ts +1 -0
  151. package/src/SourceCode/SourceCode.stories.tsx +29 -0
  152. package/src/SourceCode/SourceCode.tsx +67 -0
  153. package/src/SourceCode/__tests__/SourceCode.test.tsx +47 -0
  154. package/src/SourceCode/__tests__/__snapshots__/SourceCode.test.tsx.snap +786 -0
  155. package/src/SourceCode/index.ts +1 -0
  156. package/src/Tooltip/Tooltip.stories.tsx +27 -0
  157. package/src/Tooltip/Tooltip.tsx +171 -0
  158. package/src/Tooltip/__tests__/Tooltip.test.tsx +41 -0
  159. package/src/Tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +83 -0
  160. package/src/Tooltip/index.ts +1 -0
  161. package/src/globalStyle.ts +512 -0
  162. package/src/hooks/index.ts +3 -0
  163. package/src/hooks/useControl.ts +20 -0
  164. package/src/hooks/useMount.ts +8 -0
  165. package/src/hooks/useUnmount.ts +10 -0
  166. package/src/icons/ShelfIcon/ShelfIcon.stories.tsx +36 -0
  167. package/src/icons/ShelfIcon/ShelfIcon.tsx +45 -0
  168. package/src/icons/ShelfIcon/__tests__/ShelfIcon.test.tsx +54 -0
  169. package/src/icons/ShelfIcon/__tests__/__snapshots__/ShelfIcon.test.tsx.snap +235 -0
  170. package/src/icons/ShelfIcon/index.ts +2 -0
  171. package/src/icons/index.ts +1 -0
  172. package/src/index.ts +14 -0
  173. package/src/mocks/Link.tsx +7 -0
  174. package/src/mocks/utils.ts +3 -0
  175. package/src/utils/ClipboardService.ts +92 -0
  176. package/src/utils/__tests__/ClipboardService.test.ts +24 -0
  177. package/src/utils/__tests__/__snapshots__/highlight.test.ts.snap +5 -0
  178. package/src/utils/__tests__/__snapshots__/jsonToHtml.test.ts.snap +5 -0
  179. package/src/utils/__tests__/css-variables.test.ts +20 -0
  180. package/src/utils/__tests__/highlight.test.ts +51 -0
  181. package/src/utils/__tests__/jsonToHtml.test.ts +40 -0
  182. package/src/utils/__tests__/media-css.test.ts +20 -0
  183. package/src/utils/__tests__/theme-helpers.test.ts +25 -0
  184. package/src/utils/css-variables.ts +2 -0
  185. package/src/utils/highlight.ts +81 -0
  186. package/src/utils/index.ts +6 -0
  187. package/src/utils/jsonToHtml.ts +122 -0
  188. package/src/utils/media-css.ts +16 -0
  189. package/src/utils/theme-helpers.ts +34 -0
  190. package/utils/ClipboardService.d.ts +8 -0
  191. package/utils/ClipboardService.js +83 -0
  192. package/utils/css-variables.d.ts +1 -0
  193. package/utils/css-variables.js +4 -0
  194. package/utils/highlight.d.ts +32 -0
  195. package/utils/highlight.js +65 -0
  196. package/utils/index.d.ts +6 -0
  197. package/utils/index.js +6 -0
  198. package/utils/jsonToHtml.d.ts +1 -0
  199. package/utils/jsonToHtml.js +116 -0
  200. package/utils/media-css.d.ts +12 -0
  201. package/utils/media-css.js +9 -0
  202. package/utils/theme-helpers.d.ts +3 -0
  203. package/utils/theme-helpers.js +27 -0
@@ -0,0 +1,512 @@
1
+ import { createGlobalStyle } from 'styled-components';
2
+
3
+ export const GlobalStyle = createGlobalStyle`
4
+ /*
5
+ * Static classnames that can be used to override styles for components:
6
+ * download-specification-button, next-section-button, button-base
7
+ */
8
+ :root {
9
+ /* === Palette === */
10
+
11
+ /*
12
+ * Color palette
13
+ */
14
+ --color-primary-100: #62a1ff;
15
+ --color-primary-200: #4892ff;
16
+ --color-primary-300: #2f83ff;
17
+ --color-primary-400: #1573ff;
18
+ --color-primary-500: #0065fb;
19
+ --color-primary-600: #005be2;
20
+ --color-primary-700: #0050c8;
21
+ --color-primary-800: #0046af;
22
+ --color-primary-900: #003c95;
23
+
24
+ --color-secondary-100: #ffffff;
25
+ --color-secondary-200: #f5f7fa;
26
+ --color-secondary-300: #f3f4f6;
27
+ --color-secondary-400: #e4e7eb;
28
+ --color-secondary-500: #d5dae0;
29
+ --color-secondary-600: #c7cdd5;
30
+ --color-secondary-700: #b8c0ca;
31
+ --color-secondary-800: #a9b3c0;
32
+ --color-secondary-900: #9ba6b5;
33
+
34
+ --color-emphasis-100: #ffffff;
35
+ --color-emphasis-200: #e9eaec;
36
+ --color-emphasis-300: #cdd0d5;
37
+ --color-emphasis-400: #b2b6bd;
38
+ --color-emphasis-500: #969ca6;
39
+ --color-emphasis-600: #7a828f;
40
+ --color-emphasis-700: #626974;
41
+ --color-emphasis-800: #4b5058;
42
+ --color-emphasis-900: #1c1e21;
43
+
44
+ --color-accent-100: #b3dcf3;
45
+ --color-accent-200: #a6dfff;
46
+ --color-accent-300: #8cd5ff;
47
+ --color-accent-400: #73ccff;
48
+ --color-accent-500: #59c3ff;
49
+ --color-accent-600: #40baff;
50
+ --color-accent-700: #26b1ff;
51
+ --color-accent-800: #0da7ff;
52
+ --color-accent-900: #009bf2;
53
+
54
+ --color-success-100: #98eda0;
55
+ --color-success-200: #82e98c;
56
+ --color-success-300: #6ce678;
57
+ --color-success-400: #57e264;
58
+ --color-success-500: #41de50;
59
+ --color-success-600: #2bda3c;
60
+ --color-success-700: #23c933;
61
+ --color-success-800: #1fb32d;
62
+ --color-success-900: #1b9e28;
63
+
64
+ --color-warning-100: #ffc966;
65
+ --color-warning-200: #ffc04d;
66
+ --color-warning-300: #ffb733;
67
+ --color-warning-400: #ffae1a;
68
+ --color-warning-500: #ffa500;
69
+ --color-warning-600: #e69400;
70
+ --color-warning-700: #cc8400;
71
+ --color-warning-800: #b37300;
72
+ --color-warning-900: #996300;
73
+
74
+ --color-error-100: #ffc7c7;
75
+ --color-error-200: #ffaeae;
76
+ --color-error-300: #ff9494;
77
+ --color-error-400: #ff7b7b;
78
+ --color-error-500: #ff6161;
79
+ --color-error-600: #ff4747;
80
+ --color-error-700: #ff2e2e;
81
+ --color-error-800: #ff1414;
82
+ --color-error-900: #ff0000;
83
+
84
+ /* === Typography === */
85
+
86
+ --color-content: #1f2933;
87
+ --color-content-inverse: var(--color-secondary-200);
88
+ --color-content-secondary: #7b8794;
89
+
90
+ --font-size-base: 14px;
91
+ --line-height-base: 1.5em;
92
+ --font-weight-regular: 400;
93
+ --font-weight-bold: 600;
94
+ --font-weight-bolder: 700;
95
+ --font-family-base: Source Sans Pro, sans-serif;
96
+ --font-family-monospaced: Source Code Pro, monospace;
97
+
98
+ --smoothing: antialiased; // text-smoothing
99
+ --text-rendering: optimizeSpeed; // text-rendering
100
+
101
+ /*
102
+ * Spacing
103
+ */
104
+ --spacing-unit: 5px;
105
+ --spacing-horizontal: calc(var(--spacing-unit) * 8);
106
+ --spacing-vertical: calc(var(--spacing-unit) * 4);
107
+
108
+ /*
109
+ * Global
110
+ */
111
+ --global-border-radius: 4px;
112
+ --global-border-width: 1px;
113
+ --global-border-color: var(--color-secondary-400);
114
+ --global-border-color-secondary: #616e7c;
115
+ --global-background-color: transparent;
116
+
117
+ /* === Page layout === */
118
+ //TBD
119
+ /* === Navbar === */
120
+ //--navbar-height:
121
+ //TBD
122
+
123
+ /* === Menu (sidebar) === */
124
+
125
+ --sidebar-width: 285px;
126
+ --sidebar-background-color: #fff;
127
+ --sidebar-right-line-color: var(--global-border-color);
128
+ --sidebar-spacing-unit: 8px;
129
+ --sidebar-spacing-horizontal: var(--sidebar-spacing-unit);
130
+ --sidebar-spacing-vertical: var(--sidebar-spacing-unit);
131
+
132
+ --sidebar-word-break: 'inherit';
133
+ --sidebar-separator-label-color: var(--sidebar-item-color);
134
+ --sidebar-separator-line-color: #dadada;
135
+ --sidebar-chevron-color: var(--sidebar-item-color);
136
+ --sidebar-chevron-size: var(--sidebar-spacing-unit);
137
+
138
+ --sidebar-item-spacing-offset-top: calc(var(--sidebar-spacing-unit) * 2);
139
+ --sidebar-item-spacing-offset-left: calc(var(--sidebar-spacing-unit) * 2);
140
+ --sidebar-item-spacing-offset-nesting: calc(var(--sidebar-spacing-unit) * 2);
141
+ --sidebar-item-border-radius: 4px;
142
+ --sidebar-item-font-family: var(--font-family-base);
143
+ --sidebar-item-font-size: var(--font-size-base);
144
+ --sidebar-item-color: var(--color-content);
145
+ --sidebar-item-active-color: var(--color-content);
146
+ --sidebar-item-background-color: #fff;
147
+ --sidebar-item-active-background-color: var(--global-border-color);
148
+
149
+ //TBD
150
+ /* === Footer === */
151
+ //TBD
152
+ /* === Table of contents === */
153
+ //TBD
154
+ /* === Various components: buttons, inputs, alerts, tooltip === */
155
+
156
+ /*
157
+ * Buttons
158
+ */
159
+ --button-color: white;
160
+ --button-background-color: var(--color-emphasis-500);
161
+ --button-hover-background-color: var(--color-emphasis-600);
162
+ --button-active-background-color: var(--color-emphasis-700);
163
+ --button-outlined-active-border-color: var(--color-emphasis-800);
164
+ --button-border-radius: var(--global-border-radius);
165
+ --button-font-family: inherit;
166
+ --button-font-weight: var(--font-weight-bold);
167
+ --button-box-shadow: none;
168
+ --button-active-box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.1);
169
+
170
+ .button-color-primary {
171
+ --button-color: white;
172
+ --button-background-color: var(--color-primary-500);
173
+ --button-hover-background-color: var(--color-primary-600);
174
+ --button-active-background-color: var(--color-primary-700);
175
+ --button-outlined-active-border-color: var(--color-primary-800);
176
+ }
177
+
178
+ .button-color-secondary {
179
+ --button-color: var(--color-emphasis-800);
180
+ --button-background-color: var(--color-secondary-400);
181
+ --button-hover-background-color: var(--color-secondary-500);
182
+ --button-active-background-color: var(--color-secondary-600);
183
+ --button-outlined-active-border-color: var(--color-secondary-700);
184
+ }
185
+
186
+ --button-small-font-size: 12px;
187
+ --button-small-padding: 8px 10px;
188
+ --button-small-min-width: 90px;
189
+ --button-medium-font-size: 14px;
190
+ --button-medium-padding: 8px 20px;
191
+ --button-medium-min-width: 120px;
192
+ --button-large-font-size: 14px;
193
+ --button-large-padding: 12px 24px;
194
+ --button-large-min-width: 150px;
195
+ --button-xlarge-font-size: 16px;
196
+ --button-xlarge-padding: 20px 24px;
197
+ --button-xlarge-min-width: 200px;
198
+
199
+ /*
200
+ * Tooltip
201
+ */
202
+ --tooltip-color: var(--color-secondary-300);
203
+ --tooltip-background-color: #52606d;
204
+
205
+ .tooltip-copy-button {
206
+ --tooltip-color: #000;
207
+ --tooltip-background-color: #fff;
208
+ }
209
+
210
+ /* === Markdown/Page content (tables, inline code, blockquotes) === */
211
+
212
+ /*
213
+ * Headings
214
+ * --h-{css-property-name} is fallback for h1...h6
215
+ */
216
+ --h-font-family: Source Sans Pro, sans-serif;
217
+ --h-font-weight: var(--font-weight-bolder);
218
+ --h-color: var(--color-content);
219
+
220
+ --h1-font-size: 36px;
221
+ --h2-font-size: 28px;
222
+ --h3-font-size: 18px;
223
+ --h4-font-size: 16px;
224
+ --h5-font-size: 14px;
225
+ --h6-font-size: 12px;
226
+
227
+ --h1-line-height: 36px;
228
+ --h2-line-height: 28px;
229
+ --h3-line-height: 18px;
230
+ --h4-line-height: 16px;
231
+ --h5-line-height: 14px;
232
+ --h6-line-height: 12px;
233
+
234
+ --code-font-size: 13px;
235
+ --code-font-family: var(--font-family-monospaced);
236
+ --code-font-weight: 400;
237
+ --code-wrap: pre;
238
+
239
+ --inline-code-font-size: var(--code-font-size);
240
+ --inline-code-font-family: var(--code-font-family);
241
+ --inline-code-color: #e53935;
242
+ --inline-code-background-color: var(--color-secondary-200);
243
+ --inline-code-border-color: var(--global-border-color);
244
+ --inline-code-border-radius: var(--global-border-radius);
245
+
246
+ --code-block-font-size: var(--code-font-size);
247
+ --code-block-font-family: var(--code-font-family);
248
+ --code-block-color: #f1928f;
249
+ --code-block-background-color: rgba(217, 205, 199, 0.05);
250
+ --code-block-border-color: var(--global-border-color);
251
+ --code-block-border-radius: 8px;
252
+ --code-block-max-height: 600px;
253
+ --code-block-word-break: initial;
254
+ --code-block-preformatted-background-color: #323f4b;
255
+
256
+ /*
257
+ * Links
258
+ */
259
+ --link-color: var(--color-primary-500);
260
+ --link-decoration: none;
261
+ --link-hover-color: var(--color-primary-100);
262
+ --link-hover-decoration: underline;
263
+
264
+ /* === ref docs and graphql docs specific === */
265
+ /*
266
+ * Logo
267
+ */
268
+ --logo-max-height: 285px;
269
+ --logo-max-width: 285px;
270
+ --logo-padding: 2px;
271
+
272
+ /*
273
+ * Http colors
274
+ */
275
+ --color-http-get: #3a9601;
276
+ --color-http-post: #0065fb;
277
+ --color-http-put: #93527b;
278
+ --color-http-options: #947014;
279
+ --color-http-patch: #bf581d;
280
+ --color-http-delete: #c83637;
281
+ --color-http-basic: #707070;
282
+ --color-http-link: #07818f;
283
+ --color-http-head: #a23dad;
284
+ --color-http-hook: var(--color-http-post);
285
+
286
+ /*
287
+ * Response colors
288
+ */
289
+ --response-success-border-color: #b1e996;
290
+ --response-success-background-color: #f6fff4;
291
+ --response-success-text-color: var(--response-success-border-color);
292
+
293
+ --response-error-border-color: #ffc9c9;
294
+ --response-error-background-color: #fff4f4;
295
+ --response-error-text-color: var(--response-error-border-color);
296
+
297
+ --response-redirect-border-color: var(--color-warning-500);
298
+ --response-redirect-background-color: #ffa5001a;
299
+ --response-redirect-text-color: var(--response-redirect-border-color);
300
+
301
+ --response-info-border-color: #87ceeb;
302
+ --response-info-background-color: #87ceeb1a;
303
+ --response-info-text-color: var(--response-info-border-color);
304
+
305
+ /*
306
+ * Panels
307
+ */
308
+ --panels-border-radius: 8px;
309
+ --panels-background-color: #fff;
310
+
311
+ --samples-panel-gap: 20px;
312
+ --samples-panel-width: 37.5%;
313
+ --samples-panel-block-background-color: #fff;
314
+ --samples-panel-background-color: #52606d;
315
+ --samples-panel-callback-background-color: var(--samples-panel-callback-background-color);
316
+ --samples-panel-controls-background-color: #323f4b;
317
+ --samples-panel-controls-hover-background-color: #3c4c5a;
318
+ --samples-panel-controls-active-border-color: var(--color-accent-500);
319
+ --samples-panel-text-color: #fff;
320
+ --samples-panel-heading-color: #fff;
321
+
322
+ --samples-panel-markdown-background-color: #3c4c5a;
323
+ --samples-panel-markdown-border-color: #46596a;
324
+
325
+ --try-it-panel-tab-background-color: var(--samples-panel-background-color);
326
+ --try-it-panel-active-tab-background-color: #47535e;
327
+ --try-it-panel-active-tab-border-color: var(--color-accent-500);
328
+ --try-it-panel-disabled-tab-color: rgba(245, 247, 250, 0.7);
329
+ --try-it-panel-controls-background-color: var(--samples-panel-controls-background-color);
330
+ --try-it-panel-action-button-width: auto;
331
+
332
+ --request-and-response-panel-background-color: #fff;
333
+
334
+ /*
335
+ * Layout
336
+ */
337
+ --layout-buttons-top-offset: 20px;
338
+ --layout-buttons-height: 36px;
339
+ --layout-buttons-width: 36px;
340
+
341
+ --layout-stacked-small-max-width: 90%;
342
+ --layout-stacked-medium-max-width: 75%;
343
+ --layout-stacked-large-max-width: 1200px;
344
+
345
+ --layout-three-panel-small-max-width: 100%;
346
+ --layout-three-panel-medium-max-width: 100%;
347
+ --layout-three-panel-large-max-width: 1800px;
348
+
349
+ --layout-middle-panel-small-max-width: none;
350
+ --layout-middle-panel-medium-max-width: none;
351
+ --layout-middle-panel-large-max-width: none;
352
+
353
+ /*
354
+ * Schema
355
+ */
356
+ --schema-lines-color: var(--global-border-color);
357
+ --schema-default-details-width: 70%;
358
+ --schema-type-name-color: var(--color-content-secondary);
359
+ --schema-type-title-color: var(--color-content-secondary);
360
+ --schema-require-label-color: var(--color-error-900);
361
+ --schema-labels-text-size: 0.9em;
362
+ --schema-nesting-spacing: 1em;
363
+ --schema-nested-background-color: var(--color-secondary-200);
364
+ --schema-chevron-color: var(--color-content);
365
+ --schema-chevron-size: 9px;
366
+
367
+ --schema-controls-color: var(--color-emphasis-800);
368
+ --schema-controls-background-color: var(--color-secondary-400);
369
+ --schema-controls-hover-background-color: var(--color-secondary-500);
370
+ --schema-controls-border-color: var(--color-secondary-600);
371
+
372
+ --field-name-font-size: var(--code-font-size);
373
+ --field-name-font-family: var(--code-font-family);
374
+ --field-enum-background-color: var(--inline-code-background-color);
375
+ --field-constraint-background-color: var(--inline-code-background-color);
376
+
377
+ /*
378
+ * Search
379
+ */
380
+ --search-input-border-bottom: #e6e6e6;
381
+ --search-results-background-color: #f2f2f2;
382
+ --search-results-active-item-background-color: #e6e6e6;
383
+ --search-marked-background-color: #ffff03;
384
+ --search-popup-header-background-color: var(--color-secondary-200);
385
+ --search-clear-button-background-color: var(--color-secondary-400);
386
+ --search-clear-button-hover-background-color: var(--color-secondary-600);
387
+
388
+ /*
389
+ * Other
390
+ */
391
+ --badge-color: var(--color-emphasis-100);
392
+ --badge-background-color: var(--color-primary-500);
393
+ --deprecated-badge-color: var(--color-emphasis-100);
394
+ --deprecated-badge-background-color: var(--color-warning-500);
395
+
396
+ --recursive-label-color: var(--color-warning-500);
397
+
398
+ --http-badge-font-size: 12px;
399
+ --http-badge-line-height: 20px;
400
+ --http-badge-font-family: var(--code-font-family);
401
+ --http-badge-font-weight: var(--font-weight-bold);
402
+ --http-badge-border-radius: 16px;
403
+ --http-badge-color: var(--color-content-inverse);
404
+
405
+ --http-badge-menu-font-size: 8px;
406
+ --http-badge-menu-line-height: 14px;
407
+
408
+ --spinner-color: var(--color-primary-500);
409
+
410
+ --linear-progress-color: var(--color-accent-500);
411
+ --linear-progress-background-color: var(--color-accent-100);
412
+
413
+ /* Floating action button */
414
+ --fab-color: #0065FB;
415
+ --fab-background-color: #f2f2f2;
416
+
417
+
418
+ /**
419
+ * Sidebar
420
+ * */
421
+ --sidebar-spacing-unit: 8px;
422
+ --sidebar-margin-left: calc(var(--sidebar-spacing-unit) * 2);
423
+ --sidebar-padding-horizontal: var(--sidebar-spacing-unit);
424
+ --sidebar-padding-vertical: var(--sidebar-spacing-unit);
425
+
426
+ --sidebar-spacing-padding-vertical: var(--sidebar-spacing-unit);
427
+ --sidebar-spacing-padding-horizontal: var(--sidebar-spacing-unit);
428
+ --sidebar-spacing-offset-top: calc(var(--sidebar-spacing-unit) * 2);
429
+ --sidebar-spacing-offset-left: calc(var(--sidebar-spacing-unit) * 2);
430
+ --sidebar-spacing-offset-nesting: calc(var(--sidebar-spacing-unit) * 2);
431
+
432
+ --sidebar-chevron-size: var(--sidebar-spacing-unit);
433
+ --sidebar-chevron-color: var(--sidebar-text-color);
434
+
435
+ --sidebar-border-radius: 4px;
436
+ --sidebar-background-color: #fff;
437
+ --sidebar-font-size: var(--font-size-base);
438
+ --sidebar-font-family: var(--font-family-primary);
439
+ --sidebar-right-line-color: var(--color-border-light);
440
+ --sidebar-text-color: var(--color-text-main);
441
+ --sidebar-text-active-color: var(--sidebar-text-color);
442
+ --sidebar-text-active-background-color: var(--color-border-light);
443
+ --sidebar-width: 285px;
444
+
445
+ --sidebar-separator-line-color: #dadada;
446
+ --sidebar-separator-label-color: var(--sidebar-text-color);
447
+
448
+ /**
449
+ * Portal Logo
450
+ * */
451
+ --logo-height: 2rem;
452
+ --logo-margin: var(--sidebar-margin-left);
453
+
454
+ /**
455
+ * Portal Navbar
456
+ * */
457
+ --navbar-height: 60px;
458
+ --navbar-color-text: var(--color-content-inverse);
459
+ --navbar-color-background: var(--color-primary-500);
460
+
461
+ /**
462
+ * Portal Navbar Item
463
+ * */
464
+ --navbar-item-font-size: 16px;
465
+ --navbar-item-margin-horizontal: 0;
466
+ --navbar-item-margin-vertical: 0;
467
+ --navbar-item-border-radius: 10px;
468
+ --navbar-item-font-weight: var(--font-weight-bold);
469
+ --navbar-item-active-background-color: #1b75fa;
470
+ --navbar-item-active-text-color: var(--color-primary-contrast);
471
+ --navbar-item-active-text-decoration: none;
472
+ }
473
+
474
+ @media (prefers-color-scheme: dark) {
475
+ :root {
476
+ --color-content: #f5f7fa;
477
+ --global-border-color: #4c4c4c;
478
+ --inline-code-color: #ed8282;
479
+ --schema-require-label-color: #e55252;
480
+ --global-background-color: #101010;
481
+ --sidebar-background-color: #101010;
482
+ --sidebar-item-active-background-color: #424242;
483
+ --samples-panel-block-background-color: var(--sidebar-background-color);
484
+ --color-secondary-200: #1f2933;
485
+ --color-primary-900: #4892ff;
486
+ --search-marked-background-color: #707000;
487
+
488
+ --response-success-border-color: #3c8d06;
489
+ --response-success-background-color: #2e7102;
490
+ --response-error-border-color: #8d5c5c;
491
+ --response-error-background-color: #802828;
492
+ --response-redirect-border-color: #ffa500;
493
+ --response-redirect-background-color: #ffa5001a;
494
+ --response-info-border-color: #87ceeb;
495
+ --response-info-background-color: #87ceeb1a;
496
+
497
+ --link-color: #4d91ff;
498
+ --link-hover-color: #3686ff;
499
+
500
+ --navbar-color-background: #f2f2f2;
501
+
502
+ .search-input {
503
+ color: var(--color-content);
504
+ }
505
+
506
+ .button-clear {
507
+ --color-secondary-600: #3e4c59;
508
+ --color-secondary-400: #1b1b1b;
509
+ }
510
+ }
511
+ }
512
+ `;
@@ -0,0 +1,3 @@
1
+ export * from './useControl';
2
+ export * from './useMount';
3
+ export * from './useUnmount';
@@ -0,0 +1,20 @@
1
+ import { useState, useCallback } from 'react';
2
+
3
+ export type UseControlReturnType = {
4
+ isOpened: boolean;
5
+ handleOpen: () => void;
6
+ handleClose: () => void;
7
+ };
8
+
9
+ export const useControl = (initialVal = false): UseControlReturnType => {
10
+ const [isOpened, setIsOpened] = useState<boolean>(initialVal);
11
+
12
+ const handleOpen = useCallback(() => setIsOpened(true), []);
13
+ const handleClose = useCallback(() => setIsOpened(false), []);
14
+
15
+ return {
16
+ isOpened,
17
+ handleOpen,
18
+ handleClose,
19
+ };
20
+ };
@@ -0,0 +1,8 @@
1
+ import { useEffect } from 'react';
2
+
3
+ export const useMount = (callback: () => void): void => {
4
+ useEffect(() => {
5
+ callback();
6
+ // eslint-disable-next-line react-hooks/exhaustive-deps
7
+ }, []);
8
+ };
@@ -0,0 +1,10 @@
1
+ import { useEffect } from 'react';
2
+
3
+ export const useUnmount = (callback: () => void): void => {
4
+ useEffect(() => {
5
+ return () => {
6
+ callback();
7
+ };
8
+ // eslint-disable-next-line react-hooks/exhaustive-deps
9
+ }, []);
10
+ };
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import { Story, ComponentMeta } from '@storybook/react';
3
+
4
+ import { ShelfIcon, ShelfIconProps } from './ShelfIcon';
5
+
6
+ export default {
7
+ title: 'Icons/ShelfIcon',
8
+ component: ShelfIcon,
9
+ argTypes: {},
10
+ } as ComponentMeta<typeof ShelfIcon>;
11
+
12
+ const Template: Story<ShelfIconProps> = (args) => <ShelfIcon {...args} />;
13
+
14
+ export const Right = Template.bind({});
15
+ Right.args = {
16
+ direction: 'right',
17
+ size: '20px',
18
+ };
19
+
20
+ export const Down = Template.bind({});
21
+ Down.args = {
22
+ direction: 'down',
23
+ size: '20px',
24
+ };
25
+
26
+ export const Left = Template.bind({});
27
+ Left.args = {
28
+ direction: 'left',
29
+ size: '20px',
30
+ };
31
+
32
+ export const Up = Template.bind({});
33
+ Up.args = {
34
+ direction: 'up',
35
+ size: '20px',
36
+ };
@@ -0,0 +1,45 @@
1
+ import * as React from 'react';
2
+ import styled, { css } from 'styled-components';
3
+
4
+ import { getCssColorVariable } from '../../utils/css-variables';
5
+
6
+ const directionMap = {
7
+ right: '0deg',
8
+ down: '90deg',
9
+ left: '180deg',
10
+ up: '270deg',
11
+ };
12
+
13
+ export interface ShelfIconProps {
14
+ className?: string;
15
+ float?: 'left' | 'right';
16
+ size?: string;
17
+ color?: string;
18
+ direction: 'left' | 'right' | 'up' | 'down';
19
+ style?: React.CSSProperties;
20
+ }
21
+
22
+ const IntShelfIcon = ({ className, style }: ShelfIconProps): JSX.Element => (
23
+ <svg
24
+ className={className}
25
+ style={style}
26
+ viewBox="0 0 4.25 7"
27
+ xmlns="http://www.w3.org/2000/svg"
28
+ aria-hidden="true"
29
+ >
30
+ <path d="M0.205025 1.19467L3.00503 3.99467C3.27839 4.26804 3.72161 4.26804 3.99497 3.99467C4.26834 3.7213 4.26834 3.27809 3.99497 3.00472L1.19497 0.20472C0.921608 -0.0686469 0.478392 -0.0686469 0.205025 0.20472C-0.0683418 0.478087 -0.0683417 0.921303 0.205025 1.19467Z" />
31
+ <path d="M3.00503 3.00501L0.205025 5.80501C-0.0683417 6.07838 -0.0683417 6.5216 0.205025 6.79496C0.478392 7.06833 0.921608 7.06833 1.19497 6.79496L3.99497 3.99496C4.26834 3.7216 4.26834 3.27838 3.99497 3.00501C3.72161 2.73165 3.27839 2.73165 3.00503 3.00501Z" />
32
+ </svg>
33
+ );
34
+
35
+ export const ShelfIcon = styled(IntShelfIcon)`
36
+ ${({ size = '9px', float = '', direction, color }) => css`
37
+ height: ${size};
38
+ width: ${size};
39
+ float: ${float};
40
+ transform: rotateZ(${directionMap[direction]});
41
+ fill: ${getCssColorVariable(color)};
42
+ `}
43
+ vertical-align: middle;
44
+ transition: transform 0.2s ease-out;
45
+ `;
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+
4
+ import { ShelfIcon } from '../ShelfIcon';
5
+
6
+ describe('ShelfIcon', () => {
7
+ it('renders right', () => {
8
+ const { container } = render(<ShelfIcon direction={'right'} />);
9
+
10
+ expect(container.firstChild).toMatchSnapshot();
11
+ });
12
+
13
+ it('renders left', () => {
14
+ const { container } = render(<ShelfIcon direction={'left'} />);
15
+
16
+ expect(container.firstChild).toMatchSnapshot();
17
+ });
18
+
19
+ it('renders up', () => {
20
+ const { container } = render(<ShelfIcon direction={'up'} />);
21
+
22
+ expect(container.firstChild).toMatchSnapshot();
23
+ });
24
+
25
+ it('renders down', () => {
26
+ const { container } = render(<ShelfIcon direction={'down'} />);
27
+
28
+ expect(container.firstChild).toMatchSnapshot();
29
+ });
30
+
31
+ it('renders with float left', () => {
32
+ const { container } = render(<ShelfIcon direction={'right'} float={'left'} />);
33
+
34
+ expect(container.firstChild).toMatchSnapshot();
35
+ });
36
+
37
+ it('renders with float right', () => {
38
+ const { container } = render(<ShelfIcon direction={'right'} float={'right'} />);
39
+
40
+ expect(container.firstChild).toMatchSnapshot();
41
+ });
42
+
43
+ it('renders with big size', () => {
44
+ const { container } = render(<ShelfIcon direction={'right'} size={'30px'} />);
45
+
46
+ expect(container.firstChild).toMatchSnapshot();
47
+ });
48
+
49
+ it('renders with color', () => {
50
+ const { container } = render(<ShelfIcon direction={'right'} color={'orange'} />);
51
+
52
+ expect(container.firstChild).toMatchSnapshot();
53
+ });
54
+ });