@camunda8/docusaurus-theme-openapi-docs 4.5.1

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 (312) hide show
  1. package/babel.config.js +35 -0
  2. package/lib/index.d.ts +2 -0
  3. package/lib/index.js +81 -0
  4. package/lib/markdown/createDescription.d.ts +1 -0
  5. package/lib/markdown/createDescription.js +15 -0
  6. package/lib/markdown/schema.d.ts +3 -0
  7. package/lib/markdown/schema.js +154 -0
  8. package/lib/markdown/utils.d.ts +10 -0
  9. package/lib/markdown/utils.js +49 -0
  10. package/lib/markdown/utils.test.d.ts +1 -0
  11. package/lib/markdown/utils.test.js +43 -0
  12. package/lib/theme/ApiExplorer/Accept/index.d.ts +3 -0
  13. package/lib/theme/ApiExplorer/Accept/index.js +38 -0
  14. package/lib/theme/ApiExplorer/Accept/slice.d.ts +11 -0
  15. package/lib/theme/ApiExplorer/Accept/slice.js +22 -0
  16. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/_Container.scss +7 -0
  17. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.d.ts +4 -0
  18. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +35 -0
  19. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.d.ts +3 -0
  20. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.js +41 -0
  21. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.d.ts +3 -0
  22. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +153 -0
  23. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/_Content.scss +91 -0
  24. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/_CopyButton.scss +44 -0
  25. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.d.ts +7 -0
  26. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.js +147 -0
  27. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/_ExitButton.scss +16 -0
  28. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.d.ts +6 -0
  29. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.js +58 -0
  30. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/_ExpandButton.scss +62 -0
  31. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.d.ts +14 -0
  32. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.js +248 -0
  33. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/_Line.scss +34 -0
  34. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.d.ts +3 -0
  35. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.js +59 -0
  36. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/_WordWrapButton.scss +10 -0
  37. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.d.ts +7 -0
  38. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.js +51 -0
  39. package/lib/theme/ApiExplorer/ApiCodeBlock/index.d.ts +3 -0
  40. package/lib/theme/ApiExplorer/ApiCodeBlock/index.js +110 -0
  41. package/lib/theme/ApiExplorer/Authorization/auth-types.d.ts +3 -0
  42. package/lib/theme/ApiExplorer/Authorization/auth-types.js +28 -0
  43. package/lib/theme/ApiExplorer/Authorization/index.d.ts +3 -0
  44. package/lib/theme/ApiExplorer/Authorization/index.js +201 -0
  45. package/lib/theme/ApiExplorer/Authorization/slice.d.ts +40 -0
  46. package/lib/theme/ApiExplorer/Authorization/slice.js +102 -0
  47. package/lib/theme/ApiExplorer/Body/index.d.ts +10 -0
  48. package/lib/theme/ApiExplorer/Body/index.js +394 -0
  49. package/lib/theme/ApiExplorer/Body/json2xml.js +43 -0
  50. package/lib/theme/ApiExplorer/Body/slice.d.ts +82 -0
  51. package/lib/theme/ApiExplorer/Body/slice.js +97 -0
  52. package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.d.ts +21 -0
  53. package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.js +8 -0
  54. package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +11 -0
  55. package/lib/theme/ApiExplorer/CodeSnippets/index.js +435 -0
  56. package/lib/theme/ApiExplorer/CodeSnippets/languages.d.ts +5 -0
  57. package/lib/theme/ApiExplorer/CodeSnippets/languages.js +133 -0
  58. package/lib/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
  59. package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +505 -0
  60. package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +15 -0
  61. package/lib/theme/ApiExplorer/CodeTabs/index.js +283 -0
  62. package/lib/theme/ApiExplorer/ContentType/index.d.ts +3 -0
  63. package/lib/theme/ApiExplorer/ContentType/index.js +40 -0
  64. package/lib/theme/ApiExplorer/ContentType/slice.d.ts +11 -0
  65. package/lib/theme/ApiExplorer/ContentType/slice.js +22 -0
  66. package/lib/theme/ApiExplorer/Export/index.d.ts +3 -0
  67. package/lib/theme/ApiExplorer/Export/index.js +57 -0
  68. package/lib/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +27 -0
  69. package/lib/theme/ApiExplorer/FloatingButton/index.d.ts +8 -0
  70. package/lib/theme/ApiExplorer/FloatingButton/index.js +28 -0
  71. package/lib/theme/ApiExplorer/FormFileUpload/_FormFileUpload.scss +74 -0
  72. package/lib/theme/ApiExplorer/FormFileUpload/index.d.ts +7 -0
  73. package/lib/theme/ApiExplorer/FormFileUpload/index.js +178 -0
  74. package/lib/theme/ApiExplorer/FormItem/_FormItem.scss +21 -0
  75. package/lib/theme/ApiExplorer/FormItem/index.d.ts +10 -0
  76. package/lib/theme/ApiExplorer/FormItem/index.js +49 -0
  77. package/lib/theme/ApiExplorer/FormMultiSelect/_FormMultiSelect.scss +30 -0
  78. package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +9 -0
  79. package/lib/theme/ApiExplorer/FormMultiSelect/index.js +51 -0
  80. package/lib/theme/ApiExplorer/FormSelect/_FormSelect.scss +43 -0
  81. package/lib/theme/ApiExplorer/FormSelect/index.d.ts +8 -0
  82. package/lib/theme/ApiExplorer/FormSelect/index.js +35 -0
  83. package/lib/theme/ApiExplorer/FormTextInput/_FormTextInput.scss +34 -0
  84. package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +11 -0
  85. package/lib/theme/ApiExplorer/FormTextInput/index.js +80 -0
  86. package/lib/theme/ApiExplorer/LiveEditor/_LiveEditor.scss +15 -0
  87. package/lib/theme/ApiExplorer/LiveEditor/index.d.ts +6 -0
  88. package/lib/theme/ApiExplorer/LiveEditor/index.js +176 -0
  89. package/lib/theme/ApiExplorer/MethodEndpoint/_MethodEndpoint.scss +22 -0
  90. package/lib/theme/ApiExplorer/MethodEndpoint/index.d.ts +8 -0
  91. package/lib/theme/ApiExplorer/MethodEndpoint/index.js +86 -0
  92. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +6 -0
  93. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +230 -0
  94. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +6 -0
  95. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +71 -0
  96. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +6 -0
  97. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +97 -0
  98. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +6 -0
  99. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +72 -0
  100. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +6 -0
  101. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.js +38 -0
  102. package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +123 -0
  103. package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +7 -0
  104. package/lib/theme/ApiExplorer/ParamOptions/index.js +233 -0
  105. package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +17 -0
  106. package/lib/theme/ApiExplorer/ParamOptions/slice.js +25 -0
  107. package/lib/theme/ApiExplorer/Request/_Request.scss +129 -0
  108. package/lib/theme/ApiExplorer/Request/index.d.ts +6 -0
  109. package/lib/theme/ApiExplorer/Request/index.js +443 -0
  110. package/lib/theme/ApiExplorer/Request/makeRequest.d.ts +4 -0
  111. package/lib/theme/ApiExplorer/Request/makeRequest.js +223 -0
  112. package/lib/theme/ApiExplorer/Response/_Response.scss +121 -0
  113. package/lib/theme/ApiExplorer/Response/index.d.ts +6 -0
  114. package/lib/theme/ApiExplorer/Response/index.js +207 -0
  115. package/lib/theme/ApiExplorer/Response/slice.d.ts +17 -0
  116. package/lib/theme/ApiExplorer/Response/slice.js +51 -0
  117. package/lib/theme/ApiExplorer/SecuritySchemes/index.d.ts +3 -0
  118. package/lib/theme/ApiExplorer/SecuritySchemes/index.js +519 -0
  119. package/lib/theme/ApiExplorer/Server/_Server.scss +26 -0
  120. package/lib/theme/ApiExplorer/Server/index.d.ts +3 -0
  121. package/lib/theme/ApiExplorer/Server/index.js +213 -0
  122. package/lib/theme/ApiExplorer/Server/slice.d.ts +13 -0
  123. package/lib/theme/ApiExplorer/Server/slice.js +33 -0
  124. package/lib/theme/ApiExplorer/buildPostmanRequest.d.ts +20 -0
  125. package/lib/theme/ApiExplorer/buildPostmanRequest.js +511 -0
  126. package/lib/theme/ApiExplorer/index.d.ts +7 -0
  127. package/lib/theme/ApiExplorer/index.js +107 -0
  128. package/lib/theme/ApiExplorer/persistanceMiddleware.d.ts +19 -0
  129. package/lib/theme/ApiExplorer/persistanceMiddleware.js +54 -0
  130. package/lib/theme/ApiExplorer/storage-utils.d.ts +4 -0
  131. package/lib/theme/ApiExplorer/storage-utils.js +41 -0
  132. package/lib/theme/ApiItem/Layout/index.d.ts +3 -0
  133. package/lib/theme/ApiItem/Layout/index.js +121 -0
  134. package/lib/theme/ApiItem/Layout/styles.module.css +17 -0
  135. package/lib/theme/ApiItem/hooks.d.ts +12 -0
  136. package/lib/theme/ApiItem/hooks.js +13 -0
  137. package/lib/theme/ApiItem/index.d.ts +2 -0
  138. package/lib/theme/ApiItem/index.js +238 -0
  139. package/lib/theme/ApiItem/store.d.ts +58 -0
  140. package/lib/theme/ApiItem/store.js +53 -0
  141. package/lib/theme/ApiLogo/index.d.ts +2 -0
  142. package/lib/theme/ApiLogo/index.js +51 -0
  143. package/lib/theme/ApiTabs/_ApiTabs.scss +142 -0
  144. package/lib/theme/ApiTabs/index.d.ts +7 -0
  145. package/lib/theme/ApiTabs/index.js +275 -0
  146. package/lib/theme/ArrayBrackets/index.d.ts +3 -0
  147. package/lib/theme/ArrayBrackets/index.js +50 -0
  148. package/lib/theme/CodeSamples/_CodeSamples.scss +3 -0
  149. package/lib/theme/CodeSamples/index.d.ts +8 -0
  150. package/lib/theme/CodeSamples/index.js +27 -0
  151. package/lib/theme/DiscriminatorTabs/_DiscriminatorTabs.scss +98 -0
  152. package/lib/theme/DiscriminatorTabs/index.d.ts +3 -0
  153. package/lib/theme/DiscriminatorTabs/index.js +258 -0
  154. package/lib/theme/Markdown/Details/_Details.scss +122 -0
  155. package/lib/theme/Markdown/index.js +179 -0
  156. package/lib/theme/MimeTabs/_MimeTabs.scss +70 -0
  157. package/lib/theme/MimeTabs/index.d.ts +6 -0
  158. package/lib/theme/MimeTabs/index.js +286 -0
  159. package/lib/theme/OperationTabs/_OperationTabs.scss +72 -0
  160. package/lib/theme/OperationTabs/index.d.ts +3 -0
  161. package/lib/theme/OperationTabs/index.js +248 -0
  162. package/lib/theme/ParamsDetails/index.d.ts +6 -0
  163. package/lib/theme/ParamsDetails/index.js +93 -0
  164. package/lib/theme/ParamsItem/_ParamsItem.scss +54 -0
  165. package/lib/theme/ParamsItem/index.d.ts +22 -0
  166. package/lib/theme/ParamsItem/index.js +281 -0
  167. package/lib/theme/RequestSchema/index.d.ts +15 -0
  168. package/lib/theme/RequestSchema/index.js +208 -0
  169. package/lib/theme/ResponseExamples/index.d.ts +18 -0
  170. package/lib/theme/ResponseExamples/index.js +213 -0
  171. package/lib/theme/ResponseHeaders/index.d.ts +13 -0
  172. package/lib/theme/ResponseHeaders/index.js +39 -0
  173. package/lib/theme/ResponseSchema/index.d.ts +15 -0
  174. package/lib/theme/ResponseSchema/index.js +165 -0
  175. package/lib/theme/Schema/index.d.ts +8 -0
  176. package/lib/theme/Schema/index.js +853 -0
  177. package/lib/theme/SchemaItem/_SchemaItem.scss +89 -0
  178. package/lib/theme/SchemaItem/index.d.ts +12 -0
  179. package/lib/theme/SchemaItem/index.js +314 -0
  180. package/lib/theme/SchemaTabs/_SchemaTabs.scss +61 -0
  181. package/lib/theme/SchemaTabs/index.d.ts +3 -0
  182. package/lib/theme/SchemaTabs/index.js +255 -0
  183. package/lib/theme/SkeletonLoader/index.d.ts +6 -0
  184. package/lib/theme/SkeletonLoader/index.js +20 -0
  185. package/lib/theme/StatusCodes/index.d.ts +9 -0
  186. package/lib/theme/StatusCodes/index.js +90 -0
  187. package/lib/theme/styles.scss +215 -0
  188. package/lib/theme/translationIds.d.ts +83 -0
  189. package/lib/theme/translationIds.js +106 -0
  190. package/lib/types.d.ts +46 -0
  191. package/lib/types.js +8 -0
  192. package/package.json +85 -0
  193. package/src/index.ts +85 -0
  194. package/src/markdown/createDescription.ts +13 -0
  195. package/src/markdown/schema.ts +186 -0
  196. package/src/markdown/utils.test.ts +49 -0
  197. package/src/markdown/utils.ts +59 -0
  198. package/src/plugin-content-docs.d.ts +20 -0
  199. package/src/postman-code-generators.d.ts +9 -0
  200. package/src/react-magic-dropzone.d.ts +9 -0
  201. package/src/theme/ApiExplorer/Accept/index.tsx +36 -0
  202. package/src/theme/ApiExplorer/Accept/slice.ts +29 -0
  203. package/src/theme/ApiExplorer/ApiCodeBlock/Container/_Container.scss +7 -0
  204. package/src/theme/ApiExplorer/ApiCodeBlock/Container/index.tsx +32 -0
  205. package/src/theme/ApiExplorer/ApiCodeBlock/Content/Element.tsx +34 -0
  206. package/src/theme/ApiExplorer/ApiCodeBlock/Content/String.tsx +134 -0
  207. package/src/theme/ApiExplorer/ApiCodeBlock/Content/_Content.scss +91 -0
  208. package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/_CopyButton.scss +44 -0
  209. package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.tsx +83 -0
  210. package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/_ExitButton.scss +16 -0
  211. package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.tsx +55 -0
  212. package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/_ExpandButton.scss +62 -0
  213. package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.tsx +166 -0
  214. package/src/theme/ApiExplorer/ApiCodeBlock/Line/_Line.scss +34 -0
  215. package/src/theme/ApiExplorer/ApiCodeBlock/Line/index.tsx +48 -0
  216. package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/_WordWrapButton.scss +10 -0
  217. package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.tsx +54 -0
  218. package/src/theme/ApiExplorer/ApiCodeBlock/index.tsx +45 -0
  219. package/src/theme/ApiExplorer/Authorization/auth-types.ts +30 -0
  220. package/src/theme/ApiExplorer/Authorization/index.tsx +199 -0
  221. package/src/theme/ApiExplorer/Authorization/slice.ts +146 -0
  222. package/src/theme/ApiExplorer/Body/index.tsx +388 -0
  223. package/src/theme/ApiExplorer/Body/json2xml.d.ts +8 -0
  224. package/src/theme/ApiExplorer/Body/json2xml.js +43 -0
  225. package/src/theme/ApiExplorer/Body/slice.ts +133 -0
  226. package/src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts +57 -0
  227. package/src/theme/ApiExplorer/CodeSnippets/index.tsx +383 -0
  228. package/src/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
  229. package/src/theme/ApiExplorer/CodeSnippets/languages.ts +139 -0
  230. package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +505 -0
  231. package/src/theme/ApiExplorer/CodeTabs/index.tsx +261 -0
  232. package/src/theme/ApiExplorer/ContentType/index.tsx +38 -0
  233. package/src/theme/ApiExplorer/ContentType/slice.ts +29 -0
  234. package/src/theme/ApiExplorer/Export/index.tsx +47 -0
  235. package/src/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +27 -0
  236. package/src/theme/ApiExplorer/FloatingButton/index.tsx +29 -0
  237. package/src/theme/ApiExplorer/FormFileUpload/_FormFileUpload.scss +74 -0
  238. package/src/theme/ApiExplorer/FormFileUpload/index.tsx +124 -0
  239. package/src/theme/ApiExplorer/FormItem/_FormItem.scss +21 -0
  240. package/src/theme/ApiExplorer/FormItem/index.tsx +40 -0
  241. package/src/theme/ApiExplorer/FormMultiSelect/_FormMultiSelect.scss +30 -0
  242. package/src/theme/ApiExplorer/FormMultiSelect/index.tsx +57 -0
  243. package/src/theme/ApiExplorer/FormSelect/_FormSelect.scss +43 -0
  244. package/src/theme/ApiExplorer/FormSelect/index.tsx +38 -0
  245. package/src/theme/ApiExplorer/FormTextInput/_FormTextInput.scss +34 -0
  246. package/src/theme/ApiExplorer/FormTextInput/index.tsx +89 -0
  247. package/src/theme/ApiExplorer/LiveEditor/_LiveEditor.scss +15 -0
  248. package/src/theme/ApiExplorer/LiveEditor/index.tsx +122 -0
  249. package/src/theme/ApiExplorer/MethodEndpoint/_MethodEndpoint.scss +22 -0
  250. package/src/theme/ApiExplorer/MethodEndpoint/index.tsx +91 -0
  251. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +185 -0
  252. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +72 -0
  253. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +94 -0
  254. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +74 -0
  255. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx +38 -0
  256. package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +123 -0
  257. package/src/theme/ApiExplorer/ParamOptions/index.tsx +154 -0
  258. package/src/theme/ApiExplorer/ParamOptions/slice.ts +37 -0
  259. package/src/theme/ApiExplorer/Request/_Request.scss +129 -0
  260. package/src/theme/ApiExplorer/Request/index.tsx +352 -0
  261. package/src/theme/ApiExplorer/Request/makeRequest.ts +255 -0
  262. package/src/theme/ApiExplorer/Response/_Response.scss +121 -0
  263. package/src/theme/ApiExplorer/Response/index.tsx +173 -0
  264. package/src/theme/ApiExplorer/Response/slice.ts +52 -0
  265. package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +375 -0
  266. package/src/theme/ApiExplorer/Server/_Server.scss +26 -0
  267. package/src/theme/ApiExplorer/Server/index.tsx +138 -0
  268. package/src/theme/ApiExplorer/Server/slice.ts +39 -0
  269. package/src/theme/ApiExplorer/buildPostmanRequest.ts +524 -0
  270. package/src/theme/ApiExplorer/index.tsx +52 -0
  271. package/src/theme/ApiExplorer/persistanceMiddleware.ts +73 -0
  272. package/src/theme/ApiExplorer/storage-utils.ts +39 -0
  273. package/src/theme/ApiItem/Layout/index.tsx +85 -0
  274. package/src/theme/ApiItem/Layout/styles.module.css +17 -0
  275. package/src/theme/ApiItem/hooks.ts +13 -0
  276. package/src/theme/ApiItem/index.tsx +222 -0
  277. package/src/theme/ApiItem/store.ts +51 -0
  278. package/src/theme/ApiLogo/index.tsx +52 -0
  279. package/src/theme/ApiTabs/_ApiTabs.scss +142 -0
  280. package/src/theme/ApiTabs/index.tsx +243 -0
  281. package/src/theme/ArrayBrackets/index.tsx +37 -0
  282. package/src/theme/CodeSamples/_CodeSamples.scss +3 -0
  283. package/src/theme/CodeSamples/index.tsx +26 -0
  284. package/src/theme/DiscriminatorTabs/_DiscriminatorTabs.scss +98 -0
  285. package/src/theme/DiscriminatorTabs/index.tsx +229 -0
  286. package/src/theme/Markdown/Details/_Details.scss +122 -0
  287. package/src/theme/Markdown/index.d.ts +8 -0
  288. package/src/theme/Markdown/index.js +179 -0
  289. package/src/theme/MimeTabs/_MimeTabs.scss +70 -0
  290. package/src/theme/MimeTabs/index.tsx +257 -0
  291. package/src/theme/OperationTabs/_OperationTabs.scss +72 -0
  292. package/src/theme/OperationTabs/index.tsx +220 -0
  293. package/src/theme/ParamsDetails/index.tsx +90 -0
  294. package/src/theme/ParamsItem/_ParamsItem.scss +54 -0
  295. package/src/theme/ParamsItem/index.tsx +246 -0
  296. package/src/theme/RequestSchema/index.tsx +172 -0
  297. package/src/theme/ResponseExamples/index.tsx +209 -0
  298. package/src/theme/ResponseHeaders/index.tsx +49 -0
  299. package/src/theme/ResponseSchema/index.tsx +150 -0
  300. package/src/theme/Schema/index.tsx +938 -0
  301. package/src/theme/SchemaItem/_SchemaItem.scss +89 -0
  302. package/src/theme/SchemaItem/index.tsx +273 -0
  303. package/src/theme/SchemaTabs/_SchemaTabs.scss +61 -0
  304. package/src/theme/SchemaTabs/index.tsx +224 -0
  305. package/src/theme/SkeletonLoader/index.tsx +18 -0
  306. package/src/theme/StatusCodes/index.tsx +83 -0
  307. package/src/theme/styles.scss +215 -0
  308. package/src/theme/translationIds.ts +103 -0
  309. package/src/theme-classic.d.ts +80 -0
  310. package/src/theme-openapi.d.ts +20 -0
  311. package/src/types.ts +72 -0
  312. package/tsconfig.json +16 -0
@@ -0,0 +1,261 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ import React, { cloneElement, ReactElement, useEffect, useRef } from "react";
9
+
10
+ import {
11
+ sanitizeTabsChildren,
12
+ type TabProps,
13
+ useScrollPositionBlocker,
14
+ useTabs,
15
+ } from "@docusaurus/theme-common/internal";
16
+ import { TabItemProps } from "@docusaurus/theme-common/lib/utils/tabsUtils";
17
+ import useIsBrowser from "@docusaurus/useIsBrowser";
18
+ import clsx from "clsx";
19
+
20
+ import { Language } from "../CodeSnippets/code-snippets-types";
21
+
22
+ export interface Props {
23
+ action: {
24
+ [key: string]: React.Dispatch<any>;
25
+ };
26
+ currentLanguage?: Language;
27
+ languageSet: Language[];
28
+ includeVariant?: boolean;
29
+ }
30
+
31
+ export interface CodeTabsProps extends Props, TabProps {
32
+ includeSample?: boolean;
33
+ }
34
+
35
+ function TabList({
36
+ action,
37
+ currentLanguage,
38
+ languageSet,
39
+ includeVariant,
40
+ includeSample,
41
+ className,
42
+ block,
43
+ selectedValue,
44
+ selectValue,
45
+ tabValues,
46
+ }: CodeTabsProps & ReturnType<typeof useTabs>) {
47
+ const tabRefs = useRef<(HTMLLIElement | null)[]>([]);
48
+ const tabsScrollContainerRef = useRef<any>(null);
49
+ const { blockElementScrollPositionUntilNextRender } =
50
+ useScrollPositionBlocker();
51
+
52
+ useEffect(() => {
53
+ const activeTab = tabRefs.current.find(
54
+ (tab) => tab?.getAttribute("aria-selected") === "true"
55
+ );
56
+
57
+ if (activeTab && tabsScrollContainerRef.current) {
58
+ const container = tabsScrollContainerRef.current;
59
+ const containerRect = container.getBoundingClientRect();
60
+ const activeTabRect = activeTab.getBoundingClientRect();
61
+
62
+ // Calculate the distance to scroll to align active tab to the left
63
+ const glowOffset = 3;
64
+ const scrollOffset =
65
+ activeTabRect.left -
66
+ containerRect.left +
67
+ container.scrollLeft -
68
+ glowOffset;
69
+
70
+ // Check if the active tab is not already at the left position
71
+
72
+ if (Math.abs(scrollOffset - container.scrollLeft) > 4) {
73
+ // Adjust the scroll of the container
74
+ container.scrollLeft = scrollOffset;
75
+ }
76
+ }
77
+ }, []);
78
+
79
+ const handleTabChange = (
80
+ event:
81
+ | React.FocusEvent<HTMLLIElement>
82
+ | React.MouseEvent<HTMLLIElement>
83
+ | React.KeyboardEvent<HTMLLIElement>
84
+ ) => {
85
+ const newTab = event.currentTarget;
86
+ const newTabIndex = tabRefs.current.indexOf(newTab);
87
+ const newTabValue = tabValues[newTabIndex]!.value;
88
+
89
+ if (newTabValue !== selectedValue) {
90
+ blockElementScrollPositionUntilNextRender(newTab);
91
+ selectValue(newTabValue);
92
+ }
93
+
94
+ if (action) {
95
+ let newLanguage: Language;
96
+ if (currentLanguage && includeVariant && includeSample) {
97
+ // Combined mode: samples and variants in one tab group
98
+ newLanguage = languageSet.filter(
99
+ (lang: Language) => lang.language === currentLanguage.language
100
+ )[0];
101
+ if (newLanguage.samples?.includes(newTabValue)) {
102
+ newLanguage.sample = newTabValue;
103
+ action.setSelectedSample(newTabValue);
104
+ } else {
105
+ newLanguage.variant = newTabValue;
106
+ action.setSelectedVariant(newTabValue.toLowerCase());
107
+ }
108
+ } else if (currentLanguage && includeVariant) {
109
+ newLanguage = languageSet.filter(
110
+ (lang: Language) => lang.language === currentLanguage.language
111
+ )[0];
112
+ newLanguage.variant = newTabValue;
113
+ action.setSelectedVariant(newTabValue.toLowerCase());
114
+ } else if (currentLanguage && includeSample) {
115
+ newLanguage = languageSet.filter(
116
+ (lang: Language) => lang.language === currentLanguage.language
117
+ )[0];
118
+ newLanguage.sample = newTabValue;
119
+ action.setSelectedSample(newTabValue);
120
+ } else {
121
+ newLanguage = languageSet.filter(
122
+ (lang: Language) => lang.language === newTabValue
123
+ )[0];
124
+ action.setSelectedVariant(newLanguage.variants[0].toLowerCase());
125
+ action.setSelectedSample(newLanguage.sample);
126
+ }
127
+ action.setLanguage(newLanguage);
128
+ }
129
+ };
130
+
131
+ const handleKeydown = (event: React.KeyboardEvent<HTMLLIElement>) => {
132
+ let focusElement: HTMLLIElement | null = null;
133
+
134
+ switch (event.key) {
135
+ case "Enter": {
136
+ handleTabChange(event);
137
+ break;
138
+ }
139
+ case "ArrowRight": {
140
+ const nextTab = tabRefs.current.indexOf(event.currentTarget) + 1;
141
+ focusElement = tabRefs.current[nextTab] ?? tabRefs.current[0]!;
142
+ break;
143
+ }
144
+ case "ArrowLeft": {
145
+ const prevTab = tabRefs.current.indexOf(event.currentTarget) - 1;
146
+ focusElement =
147
+ tabRefs.current[prevTab] ??
148
+ tabRefs.current[tabRefs.current.length - 1]!;
149
+ break;
150
+ }
151
+ default:
152
+ break;
153
+ }
154
+
155
+ focusElement?.focus();
156
+ };
157
+
158
+ return (
159
+ <ul
160
+ role="tablist"
161
+ aria-orientation="horizontal"
162
+ className={clsx(
163
+ "tabs",
164
+ "openapi-tabs__code-list-container",
165
+ {
166
+ "tabs--block": block,
167
+ },
168
+ className
169
+ )}
170
+ ref={tabsScrollContainerRef}
171
+ >
172
+ {tabValues.map(({ value, label, attributes }) => (
173
+ <li
174
+ // TODO extract TabListItem
175
+ role="tab"
176
+ tabIndex={selectedValue === value ? 0 : -1}
177
+ aria-selected={selectedValue === value}
178
+ key={value}
179
+ ref={(tabControl) => {
180
+ if (tabControl) {
181
+ tabRefs.current.push(tabControl);
182
+ }
183
+ }}
184
+ onKeyDown={handleKeydown}
185
+ onClick={handleTabChange}
186
+ {...attributes}
187
+ className={clsx(
188
+ "tabs__item",
189
+ "openapi-tabs__code-item",
190
+ attributes?.className as string,
191
+ {
192
+ active: selectedValue === value,
193
+ }
194
+ )}
195
+ >
196
+ <span>{label ?? value}</span>
197
+ </li>
198
+ ))}
199
+ </ul>
200
+ );
201
+ }
202
+
203
+ function TabContent({
204
+ lazy,
205
+ children,
206
+ selectedValue,
207
+ }: CodeTabsProps & ReturnType<typeof useTabs>): React.JSX.Element | null {
208
+ const childTabs = (Array.isArray(children) ? children : [children]).filter(
209
+ Boolean
210
+ ) as ReactElement<TabItemProps>[];
211
+ if (lazy) {
212
+ const selectedTabItem = childTabs.find(
213
+ (tabItem) => tabItem.props.value === selectedValue
214
+ );
215
+ if (!selectedTabItem) {
216
+ // fail-safe or fail-fast? not sure what's best here
217
+ return null;
218
+ }
219
+ return cloneElement(selectedTabItem, { className: "margin-top--md" });
220
+ }
221
+ return (
222
+ <div className="margin-top--md openapi-tabs__code-content">
223
+ {childTabs.map((tabItem, i) =>
224
+ cloneElement(tabItem, {
225
+ key: i,
226
+ hidden: tabItem.props.value !== selectedValue,
227
+ })
228
+ )}
229
+ </div>
230
+ );
231
+ }
232
+
233
+ function TabsComponent(props: CodeTabsProps & Props): React.JSX.Element {
234
+ const tabs = useTabs(props);
235
+ const { className } = props;
236
+
237
+ return (
238
+ <div
239
+ className={clsx("tabs-container openapi-tabs__code-container", className)}
240
+ >
241
+ <TabList {...props} {...tabs} />
242
+ <TabContent {...props} {...tabs} />
243
+ </div>
244
+ );
245
+ }
246
+
247
+ export default function CodeTabs(
248
+ props: CodeTabsProps & Props
249
+ ): React.JSX.Element {
250
+ const isBrowser = useIsBrowser();
251
+ return (
252
+ <TabsComponent
253
+ // Remount tabs after hydration
254
+ // Temporary fix for https://github.com/facebook/docusaurus/issues/5653
255
+ key={String(isBrowser)}
256
+ {...props}
257
+ >
258
+ {sanitizeTabsChildren(props.children)}
259
+ </TabsComponent>
260
+ );
261
+ }
@@ -0,0 +1,38 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ import React from "react";
9
+
10
+ import FormItem from "@theme/ApiExplorer/FormItem";
11
+ import FormSelect from "@theme/ApiExplorer/FormSelect";
12
+ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
13
+
14
+ import { setContentType } from "./slice";
15
+
16
+ function ContentType() {
17
+ const value = useTypedSelector((state: any) => state.contentType.value);
18
+ const options = useTypedSelector((state: any) => state.contentType.options);
19
+ const dispatch = useTypedDispatch();
20
+
21
+ if (options.length <= 1) {
22
+ return null;
23
+ }
24
+
25
+ return (
26
+ <FormItem label="Content-Type">
27
+ <FormSelect
28
+ value={value}
29
+ options={options}
30
+ onChange={(e: React.ChangeEvent<HTMLSelectElement>) =>
31
+ dispatch(setContentType(e.target.value))
32
+ }
33
+ />
34
+ </FormItem>
35
+ );
36
+ }
37
+
38
+ export default ContentType;
@@ -0,0 +1,29 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ import { createSlice, PayloadAction } from "@reduxjs/toolkit";
9
+
10
+ export interface State {
11
+ value: string;
12
+ options: string[];
13
+ }
14
+
15
+ const initialState: State = {} as any;
16
+
17
+ export const slice = createSlice({
18
+ name: "contentType",
19
+ initialState,
20
+ reducers: {
21
+ setContentType: (state, action: PayloadAction<string>) => {
22
+ state.value = action.payload;
23
+ },
24
+ },
25
+ });
26
+
27
+ export const { setContentType } = slice.actions;
28
+
29
+ export default slice.reducer;
@@ -0,0 +1,47 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ import React from "react";
9
+
10
+ import fileSaver from "file-saver";
11
+
12
+ const saveFile = (url: string) => {
13
+ let fileName;
14
+ if (url.endsWith("json") || url.endsWith("yaml") || url.endsWith("yml")) {
15
+ fileName = url.substring(url.lastIndexOf("/") + 1);
16
+ }
17
+ fileSaver.saveAs(url, fileName ? fileName : "openapi.txt");
18
+ };
19
+
20
+ function Export({ url, proxy }: any) {
21
+ return (
22
+ <div
23
+ style={{ float: "right" }}
24
+ className="dropdown dropdown--hoverable dropdown--right"
25
+ >
26
+ <button className="export-button button button--sm button--secondary">
27
+ Export
28
+ </button>
29
+ <ul className="export-dropdown dropdown__menu">
30
+ <li>
31
+ <a
32
+ onClick={(e) => {
33
+ e.preventDefault();
34
+ saveFile(`${url}`);
35
+ }}
36
+ className="dropdown__link"
37
+ href={`${url}`}
38
+ >
39
+ OpenAPI Spec
40
+ </a>
41
+ </li>
42
+ </ul>
43
+ </div>
44
+ );
45
+ }
46
+
47
+ export default Export;
@@ -0,0 +1,27 @@
1
+ .openapi-explorer__floating-btn {
2
+ position: relative;
3
+
4
+ button {
5
+ position: relative;
6
+ background: var(--ifm-color-emphasis-900);
7
+ border: none;
8
+ border-radius: var(--ifm-global-radius);
9
+ color: var(--ifm-color-emphasis-100);
10
+ cursor: pointer;
11
+ padding: 0.4rem 0.5rem;
12
+ opacity: 0;
13
+ visibility: hidden;
14
+ transition:
15
+ opacity 0.2s ease-in-out,
16
+ visibility 0.2s ease-in-out,
17
+ bottom 0.2s ease-in-out;
18
+ position: absolute;
19
+ right: calc(var(--ifm-pre-padding) / 2);
20
+ }
21
+ }
22
+ .openapi-explorer__floating-btn:hover button,
23
+ .openapi-explorer__floating-btn:focus-visible button,
24
+ .openapi-explorer__floating-btn button:focus-visible {
25
+ visibility: visible;
26
+ opacity: 1;
27
+ }
@@ -0,0 +1,29 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ import React from "react";
9
+
10
+ export interface Props {
11
+ label?: string;
12
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
13
+ children?: React.ReactNode;
14
+ }
15
+
16
+ function FloatingButton({ label, onClick, children }: Props) {
17
+ return (
18
+ <div tabIndex={0} className="openapi-explorer__floating-btn">
19
+ {label && (
20
+ <button tabIndex={0} onClick={onClick}>
21
+ {label}
22
+ </button>
23
+ )}
24
+ {children}
25
+ </div>
26
+ );
27
+ }
28
+
29
+ export default FloatingButton;
@@ -0,0 +1,74 @@
1
+ .openapi-explorer__dropzone {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ cursor: pointer;
6
+ border: 2px dashed var(--openapi-monaco-border-color);
7
+ background-color: var(--openapi-input-background);
8
+
9
+ width: 100%;
10
+ border-radius: 4px;
11
+ padding: var(--ifm-pre-padding);
12
+ font-size: var(--ifm-code-font-size);
13
+
14
+ &:hover {
15
+ border: 2px dashed var(--ifm-color-primary);
16
+ background:
17
+ linear-gradient(
18
+ var(--openapi-dropzone-hover-shim),
19
+ var(--openapi-dropzone-hover-shim)
20
+ ),
21
+ linear-gradient(var(--ifm-color-primary), var(--ifm-color-primary));
22
+
23
+ .openapi-explorer__dropzone-content {
24
+ color: var(--ifm-pre-color);
25
+ }
26
+ }
27
+ }
28
+
29
+ .openapi-explorer__dropzone-hover {
30
+ display: inline-flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ cursor: pointer;
34
+ border: 2px dashed var(--openapi-monaco-border-color);
35
+ background-color: var(--openapi-input-background);
36
+ width: 100%;
37
+ border-radius: 4px;
38
+ padding: var(--ifm-pre-padding);
39
+ font-size: var(--ifm-code-font-size);
40
+ border: 2px dashed var(--ifm-color-primary);
41
+
42
+ background:
43
+ linear-gradient(
44
+ var(--openapi-dropzone-hover-shim),
45
+ var(--openapi-dropzone-hover-shim)
46
+ ),
47
+ linear-gradient(var(--ifm-color-primary), var(--ifm-color-primary));
48
+
49
+ .openapi-explorer__dropzone-content {
50
+ display: flex;
51
+ align-items: center;
52
+ justify-content: center;
53
+ flex-wrap: wrap;
54
+ margin: var(--ifm-pre-padding) 0;
55
+ color: var(--ifm-pre-color);
56
+ }
57
+
58
+ .openapi-explorer__file-name {
59
+ margin: 0 calc(var(--ifm-pre-padding) * 1.5);
60
+ white-space: nowrap;
61
+ overflow: hidden;
62
+ text-overflow: ellipsis;
63
+ flex: 1;
64
+ }
65
+ }
66
+
67
+ .openapi-explorer__dropzone-content {
68
+ display: flex;
69
+ align-items: center;
70
+ justify-content: center;
71
+ flex-wrap: wrap;
72
+ margin: var(--ifm-pre-padding) 0;
73
+ color: var(--openapi-dropzone-color);
74
+ }
@@ -0,0 +1,124 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ import React, { useState } from "react";
9
+
10
+ import { translate } from "@docusaurus/Translate";
11
+ import FloatingButton from "@theme/ApiExplorer/FloatingButton";
12
+ import { OPENAPI_FORM_FILE_UPLOAD } from "@theme/translationIds";
13
+ import MagicDropzone from "react-magic-dropzone";
14
+
15
+ type PreviewFile = { preview: string } & File;
16
+
17
+ interface RenderPreviewProps {
18
+ file: PreviewFile;
19
+ }
20
+
21
+ function RenderPreview({ file }: RenderPreviewProps) {
22
+ switch (file.type) {
23
+ case "image/png":
24
+ case "image/jpeg":
25
+ case "image/jpg":
26
+ case "image/svg+xml":
27
+ return (
28
+ <img
29
+ style={{
30
+ borderRadius: "4px",
31
+ }}
32
+ src={file.preview}
33
+ alt=""
34
+ />
35
+ );
36
+ default:
37
+ return (
38
+ <div
39
+ style={{
40
+ display: "flex",
41
+ alignItems: "center",
42
+ minWidth: 0,
43
+ }}
44
+ >
45
+ <svg viewBox="0 0 100 120" style={{ width: "50px", height: "60px" }}>
46
+ <path
47
+ fillRule="evenodd"
48
+ fill="#b3beca"
49
+ d="M100.000,39.790 L100.000,105.000 C100.000,113.284 93.284,120.000 85.000,120.000 L15.000,120.000 C6.716,120.000 -0.000,113.284 -0.000,105.000 L-0.000,15.000 C-0.000,6.716 6.716,-0.000 15.000,-0.000 L60.210,-0.000 L100.000,39.790 Z"
50
+ />
51
+ <path
52
+ fillRule="evenodd"
53
+ fill="#90a1b1"
54
+ transform="translate(60, 0)"
55
+ d="M0.210,-0.000 L40.000,39.790 L40.000,40.000 L15.000,40.000 C6.716,40.000 0.000,33.284 0.000,25.000 L0.000,-0.000 L0.210,-0.000 Z"
56
+ />
57
+ </svg>
58
+ <div className="openapi-explorer__file-name">{file.name}</div>
59
+ </div>
60
+ );
61
+ }
62
+ }
63
+
64
+ export interface Props {
65
+ placeholder: string;
66
+ onChange?(file?: File): any;
67
+ }
68
+
69
+ function FormFileUpload({ placeholder, onChange }: Props) {
70
+ const [hover, setHover] = useState(false);
71
+ const [file, setFile] = useState<PreviewFile>();
72
+
73
+ function setAndNotifyFile(file?: PreviewFile) {
74
+ setFile(file);
75
+ onChange?.(file);
76
+ }
77
+
78
+ function handleDrop(accepted: PreviewFile[]) {
79
+ const [file] = accepted;
80
+ setAndNotifyFile(file);
81
+ setHover(false);
82
+ }
83
+
84
+ return (
85
+ <FloatingButton>
86
+ <MagicDropzone
87
+ className={
88
+ hover
89
+ ? "openapi-explorer__dropzone-hover"
90
+ : "openapi-explorer__dropzone"
91
+ }
92
+ onDrop={handleDrop}
93
+ onDragEnter={() => setHover(true)}
94
+ onDragLeave={() => setHover(false)}
95
+ multiple={false}
96
+ style={{ marginTop: "calc(var(--ifm-pre-padding) / 2)" }}
97
+ >
98
+ {file ? (
99
+ <>
100
+ <button
101
+ style={{ marginTop: "calc(var(--ifm-pre-padding) / 2)" }}
102
+ onClick={(e) => {
103
+ e.stopPropagation();
104
+ setAndNotifyFile(undefined);
105
+ }}
106
+ >
107
+ {translate({
108
+ id: OPENAPI_FORM_FILE_UPLOAD.CLEAR_BUTTON,
109
+ message: "Clear",
110
+ })}
111
+ </button>
112
+ <RenderPreview file={file} />
113
+ </>
114
+ ) : (
115
+ <div className="openapi-explorer__dropzone-content">
116
+ {placeholder}
117
+ </div>
118
+ )}
119
+ </MagicDropzone>
120
+ </FloatingButton>
121
+ );
122
+ }
123
+
124
+ export default FormFileUpload;
@@ -0,0 +1,21 @@
1
+ .openapi-explorer__form-item {
2
+ padding: var(--openapi-explorer-padding-input);
3
+ font-size: var(--openapi-explorer-font-size-input);
4
+
5
+ &:first-child {
6
+ margin-top: 0;
7
+ }
8
+
9
+ .required {
10
+ color: var(--openapi-required);
11
+ }
12
+ }
13
+
14
+ .openapi-explorer__form-item-body-container {
15
+ padding: 0;
16
+ }
17
+
18
+ .openapi-explorer__form-item-label {
19
+ font-family: var(--ifm-font-family-monospace);
20
+ font-weight: bold;
21
+ }
@@ -0,0 +1,40 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ import React from "react";
9
+
10
+ import { translate } from "@docusaurus/Translate";
11
+ import { OPENAPI_SCHEMA_ITEM } from "@theme/translationIds";
12
+
13
+ import clsx from "clsx";
14
+
15
+ export interface Props {
16
+ label?: string;
17
+ type?: string;
18
+ required?: boolean | undefined;
19
+ children?: React.ReactNode;
20
+ className?: string;
21
+ }
22
+
23
+ function FormItem({ label, type, required, children, className }: Props) {
24
+ return (
25
+ <div className={clsx("openapi-explorer__form-item", className)}>
26
+ {label && (
27
+ <label className="openapi-explorer__form-item-label">{label}</label>
28
+ )}
29
+ {type && <span style={{ opacity: 0.6 }}> — {type}</span>}
30
+ {required && (
31
+ <span className="openapi-schema__required">
32
+ {translate({ id: OPENAPI_SCHEMA_ITEM.REQUIRED, message: "required" })}
33
+ </span>
34
+ )}
35
+ <div>{children}</div>
36
+ </div>
37
+ );
38
+ }
39
+
40
+ export default FormItem;