@redocly/openapi-docs 3.12.0-rc.7 → 3.12.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 (390) hide show
  1. package/dist/redocly-openapi-docs.min.js +2153 -1963
  2. package/lib/components/ApiInfo/ApiInfo.js +29 -1
  3. package/lib/components/ApiInfo/Metadata.js +29 -1
  4. package/lib/components/ApiInfo/index.js +2 -1
  5. package/lib/components/ApiInfo/styled.js +17 -8
  6. package/lib/components/CallbackSamples/CallbackSamples.js +25 -4
  7. package/lib/components/CallbackSamples/index.js +2 -1
  8. package/lib/components/Callbacks/CallbackDetails.js +17 -3
  9. package/lib/components/Callbacks/CallbackOperation.js +24 -3
  10. package/lib/components/Callbacks/CallbackSummary.js +19 -3
  11. package/lib/components/Callbacks/CallbacksList.js +16 -1
  12. package/lib/components/Callbacks/index.js +4 -1
  13. package/lib/components/Callbacks/styled.js +6 -3
  14. package/lib/components/Content/Content.js +10 -1
  15. package/lib/components/Content/index.js +2 -1
  16. package/lib/components/Content/useAutoScroll.js +50 -1
  17. package/lib/components/ContentItem/ContentItem.js +31 -1
  18. package/lib/components/ContentItem/index.js +2 -1
  19. package/lib/components/ContentItem/useIsExpanded.js +33 -1
  20. package/lib/components/ContentItems/ContentItems.js +19 -1
  21. package/lib/components/ContentItems/Items.js +13 -1
  22. package/lib/components/ContentItems/VirtualList.js +35 -1
  23. package/lib/components/ContentItems/helpers.js +49 -1
  24. package/lib/components/ContentItems/index.js +2 -1
  25. package/lib/components/ContentItems/useScrollOnRender.js +26 -1
  26. package/lib/components/Discriminator/Discriminator.js +27 -2
  27. package/lib/components/Discriminator/index.js +2 -1
  28. package/lib/components/Download/DownloadSpecification.js +46 -4
  29. package/lib/components/Download/index.js +2 -1
  30. package/lib/components/Download/types.js +2 -0
  31. package/lib/components/Download/useDownloadInfo.js +42 -1
  32. package/lib/components/ErrorBoundary/ErrorBoundary.js +22 -2
  33. package/lib/components/ErrorBoundary/index.js +2 -1
  34. package/lib/components/ExpandAllButton/ExpandAllButton.js +31 -2
  35. package/lib/components/ExpandAllButton/index.js +2 -1
  36. package/lib/components/ExternalDocumentation/ExternalDocumentation.js +18 -4
  37. package/lib/components/ExternalDocumentation/index.js +2 -1
  38. package/lib/components/Language/LanguageDropdown.js +21 -1
  39. package/lib/components/Language/LanguageItem.js +33 -1
  40. package/lib/components/Language/LanguageList.js +93 -1
  41. package/lib/components/Language/_tests_/LanguageDropdown.test.js +23 -1
  42. package/lib/components/Language/constants.js +3 -1
  43. package/lib/components/Language/index.js +4 -1
  44. package/lib/components/Language/styled.js +29 -15
  45. package/lib/components/Markdown/Markdown.js +64 -1
  46. package/lib/components/Markdown/index.js +3 -1
  47. package/lib/components/Markdown/types.js +2 -0
  48. package/lib/components/MediaTypeSwitch/MediaTypesSwitch.js +51 -1
  49. package/lib/components/MediaTypeSwitch/index.js +2 -1
  50. package/lib/components/OperationItem/Description.d.ts +1 -4
  51. package/lib/components/OperationItem/Description.js +9 -1
  52. package/lib/components/OperationItem/OperationItem.js +70 -5
  53. package/lib/components/OperationItem/_tests_/OperationItem.test.js +70 -1
  54. package/lib/components/OperationItem/_tests_/__mocks__/mock-intersection-observer.js +40 -1
  55. package/lib/components/OperationItem/index.js +2 -1
  56. package/lib/components/OperationItem/types.js +2 -0
  57. package/lib/components/Overlay.js +48 -3
  58. package/lib/components/Overview/Overview.js +20 -1
  59. package/lib/components/Overview/index.js +2 -1
  60. package/lib/components/PageFooter/PageFooter.js +19 -1
  61. package/lib/components/PageFooter/index.js +2 -1
  62. package/lib/components/Panel/ResponsePanel.js +12 -6
  63. package/lib/components/Panel/Trigger.js +4 -2
  64. package/lib/components/Panel/index.js +3 -1
  65. package/lib/components/PanelItem/PanelItem.js +6 -1
  66. package/lib/components/PanelItem/index.js +3 -1
  67. package/lib/components/PanelItem/styled.js +20 -10
  68. package/lib/components/PayloadSamples/Example.js +6 -1
  69. package/lib/components/PayloadSamples/ExampleValue.js +30 -1
  70. package/lib/components/PayloadSamples/MediaTypeSamples.js +36 -2
  71. package/lib/components/PayloadSamples/PayloadSamples.js +26 -1
  72. package/lib/components/PayloadSamples/index.js +7 -1
  73. package/lib/components/PayloadSamples/styled.js +9 -4
  74. package/lib/components/PayloadSamples/types.js +2 -0
  75. package/lib/components/PropertyDetails/DescriptionEnums.js +19 -3
  76. package/lib/components/PropertyDetails/EnumValues.js +37 -1
  77. package/lib/components/PropertyDetails/Examples.js +26 -1
  78. package/lib/components/PropertyDetails/Extensions.js +17 -2
  79. package/lib/components/PropertyDetails/FieldDetail.js +15 -2
  80. package/lib/components/PropertyDetails/FieldDetails.js +51 -6
  81. package/lib/components/PropertyDetails/Pattern.js +21 -1
  82. package/lib/components/PropertyDetails/PlusCircleIcon.js +10 -4
  83. package/lib/components/PropertyDetails/PropertyDetails.js +22 -5
  84. package/lib/components/PropertyDetails/SchemaTypeInfo.js +10 -2
  85. package/lib/components/PropertyDetails/SimpleEnums.js +13 -2
  86. package/lib/components/PropertyDetails/cycleColorsByLevel.js +18 -1
  87. package/lib/components/PropertyDetails/index.js +4 -1
  88. package/lib/components/PropertyDetails/styled.js +15 -7
  89. package/lib/components/PropertyDetails/types.js +2 -0
  90. package/lib/components/RedoclyOpenAPIDocs/Providers.js +114 -1
  91. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +57 -1
  92. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js +86 -1
  93. package/lib/components/RedoclyOpenAPIDocs/index.js +5 -1
  94. package/lib/components/RedoclyOpenAPIDocs/styled.js +4 -2
  95. package/lib/components/RedoclyOpenAPIDocs/types.js +2 -0
  96. package/lib/components/RedoclyOpenAPIDocs/utils.js +33 -1
  97. package/lib/components/RenderHook/RenderHook.js +17 -1
  98. package/lib/components/RenderHook/index.js +2 -1
  99. package/lib/components/Replay/EmbeddedReplay.js +41 -3
  100. package/lib/components/Replay/Replay.js +99 -1
  101. package/lib/components/Replay/index.js +3 -1
  102. package/lib/components/Replay/utils.js +208 -1
  103. package/lib/components/Request/RequestDetails.js +33 -2
  104. package/lib/components/Request/types.js +2 -0
  105. package/lib/components/RequestParameters/Body.js +8 -1
  106. package/lib/components/RequestParameters/ParametersGroup.js +19 -4
  107. package/lib/components/RequestParameters/RequestParameters.js +40 -1
  108. package/lib/components/RequestParameters/index.js +4 -1
  109. package/lib/components/RequestSamples/CodeSample.js +55 -2
  110. package/lib/components/RequestSamples/Example.js +37 -1
  111. package/lib/components/RequestSamples/RequestSamples.js +89 -5
  112. package/lib/components/RequestSamples/index.js +3 -1
  113. package/lib/components/RequestSamples/useCodeSamples.js +92 -1
  114. package/lib/components/ResponseSamples/ResponseSamples.js +47 -1
  115. package/lib/components/ResponseSamples/Summary.js +9 -1
  116. package/lib/components/ResponseSamples/index.js +2 -1
  117. package/lib/components/Responses/OperationResponseList.js +42 -2
  118. package/lib/components/Responses/ResponseDetails.js +18 -1
  119. package/lib/components/Responses/ResponseHeaders.js +15 -1
  120. package/lib/components/Responses/index.js +6 -1
  121. package/lib/components/Responses/styled.js +14 -6
  122. package/lib/components/Responses/types.js +2 -0
  123. package/lib/components/RightPanel/RightPanel.js +21 -1
  124. package/lib/components/RightPanel/index.js +2 -1
  125. package/lib/components/Samples/ExampleSwitch.js +33 -1
  126. package/lib/components/Samples/index.js +3 -1
  127. package/lib/components/Samples/use-example-key.js +12 -1
  128. package/lib/components/Schema/ArraySchema.js +45 -1
  129. package/lib/components/Schema/ObjectSchema.js +29 -1
  130. package/lib/components/Schema/OneOfSchema.js +47 -3
  131. package/lib/components/Schema/RecursiveSchema.js +10 -1
  132. package/lib/components/Schema/Schema.js +63 -2
  133. package/lib/components/Schema/SubSchema.js +20 -1
  134. package/lib/components/Schema/helpers.js +16 -1
  135. package/lib/components/Schema/index.js +5 -1
  136. package/lib/components/Schema/types.js +2 -0
  137. package/lib/components/Schema/useOneOfLocationIdx.js +11 -1
  138. package/lib/components/SchemaDefinition/SchemaDefinition.js +65 -2
  139. package/lib/components/SchemaDefinition/index.js +2 -1
  140. package/lib/components/SectionContent/SectionContent.js +49 -6
  141. package/lib/components/SectionContent/index.js +2 -1
  142. package/lib/components/SectionItem/SectionItem.js +14 -1
  143. package/lib/components/SectionItem/index.js +2 -1
  144. package/lib/components/Security/Divider.js +9 -2
  145. package/lib/components/Security/OAuthFlow.js +11 -1
  146. package/lib/components/Security/OAuthScopes.js +59 -9
  147. package/lib/components/Security/Security.js +15 -1
  148. package/lib/components/Security/SecurityButton.js +31 -7
  149. package/lib/components/Security/SecurityFlow.js +28 -4
  150. package/lib/components/Security/SecurityModal.js +34 -5
  151. package/lib/components/Security/SecuritySchemeItem.js +15 -4
  152. package/lib/components/Security/helper.js +16 -1
  153. package/lib/components/Security/index.js +11 -1
  154. package/lib/components/Security/styled.js +6 -3
  155. package/lib/components/SelectOrLabel/SelectOrLabel.js +12 -2
  156. package/lib/components/SelectOrLabel/index.js +2 -1
  157. package/lib/components/ServerList/ServerList.js +36 -10
  158. package/lib/components/ServerList/index.js +2 -1
  159. package/lib/components/ServerList/types.js +2 -0
  160. package/lib/components/ServerListDropdown/ServerListDropdown.js +54 -1
  161. package/lib/components/ServerListDropdown/index.js +2 -1
  162. package/lib/components/ServerListDropdown/styled.js +15 -6
  163. package/lib/components/SideMenu/SideMenu.js +13 -2
  164. package/lib/components/SideMenu/hooks/useMenuItems.js +110 -1
  165. package/lib/components/SideMenu/index.js +2 -1
  166. package/lib/components/SideMenu/types.js +2 -0
  167. package/lib/components/StickySidebar/SidebarActions.js +14 -2
  168. package/lib/components/StickySidebar/StickyResponsiveSidebar.js +37 -7
  169. package/lib/components/StickySidebar/index.js +2 -1
  170. package/lib/components/Tabs/Tabs.js +16 -5
  171. package/lib/components/Tabs/index.js +3 -1
  172. package/lib/components/Tabs/useTabsState.js +22 -1
  173. package/lib/components/TagItem/OperationNavigationItems.js +18 -4
  174. package/lib/components/TagItem/OperationsNavigation.js +46 -2
  175. package/lib/components/TagItem/TagItem.js +41 -8
  176. package/lib/components/TagItem/index.js +2 -1
  177. package/lib/components/TagItem/styled.js +5 -2
  178. package/lib/components/TagItem/types.js +2 -0
  179. package/lib/components/ViewNested/ViewNested.js +42 -9
  180. package/lib/components/ViewNested/index.js +2 -1
  181. package/lib/components/common/Badges.js +21 -5
  182. package/lib/components/common/BodyContent/BodyContent.js +31 -4
  183. package/lib/components/common/BodyContent/index.js +2 -1
  184. package/lib/components/common/ClearButton/ClearButton.js +5 -1
  185. package/lib/components/common/ClearButton/index.js +3 -1
  186. package/lib/components/common/ClearButton/styled.js +5 -2
  187. package/lib/components/common/ClearButton/types.js +2 -0
  188. package/lib/components/common/CodeBlockPanel.js +7 -3
  189. package/lib/components/common/ConstraintsView.js +14 -2
  190. package/lib/components/common/Dropdown/Dropdown.js +22 -4
  191. package/lib/components/common/Dropdown/index.js +2 -1
  192. package/lib/components/common/ExpandableExample/ExpandableExample.js +24 -3
  193. package/lib/components/common/ExpandableExample/index.js +2 -1
  194. package/lib/components/common/Extensions.js +17 -2
  195. package/lib/components/common/Fields/fields-layout.js +76 -51
  196. package/lib/components/common/Fields/fields.js +39 -17
  197. package/lib/components/common/Fields/index.js +3 -1
  198. package/lib/components/common/LinkToField.js +33 -6
  199. package/lib/components/common/OperationItemTitle.d.ts +1 -0
  200. package/lib/components/common/OperationItemTitle.js +16 -5
  201. package/lib/components/common/SchemaSelection/SchemaSelection.js +51 -1
  202. package/lib/components/common/SchemaSelection/index.js +2 -1
  203. package/lib/components/common/Select/Select.js +21 -1
  204. package/lib/components/common/Select/index.js +3 -1
  205. package/lib/components/common/Select/styled.js +17 -9
  206. package/lib/components/common/Select/types.js +2 -0
  207. package/lib/components/common/Skeleton/LanguageListSkeleton.js +16 -6
  208. package/lib/components/common/Skeleton/Skeleton.js +15 -5
  209. package/lib/components/common/Skeleton/index.js +3 -1
  210. package/lib/components/common/headers.js +4 -2
  211. package/lib/components/common/index.js +14 -1
  212. package/lib/components/common/linkify.js +28 -4
  213. package/lib/components/common/mixins.js +4 -2
  214. package/lib/components/common/panels.js +58 -33
  215. package/lib/components/common/schema.js +16 -8
  216. package/lib/components/common/styled.js +15 -7
  217. package/lib/components/index.js +25 -1
  218. package/lib/components/pluggable/RedocExample.js +20 -1
  219. package/lib/components/pluggable/RedocSchema.js +22 -1
  220. package/lib/components/pluggable/index.js +3 -1
  221. package/lib/components/pluggable/styled.components.js +9 -4
  222. package/lib/constants.js +30 -1
  223. package/lib/empty.js +7 -1
  224. package/lib/events/codeSampleCopy.js +19 -1
  225. package/lib/events/creator.js +5 -1
  226. package/lib/events/index.js +8 -1
  227. package/lib/events/languageSwitch.js +18 -1
  228. package/lib/events/panelToggle.js +16 -1
  229. package/lib/events/serverSwitch.js +13 -1
  230. package/lib/events/tryItOpen.js +12 -1
  231. package/lib/events/tryItSent.js +12 -1
  232. package/lib/events/types.js +11 -1
  233. package/lib/hoc/types.js +2 -0
  234. package/lib/hoc/utils.js +4 -1
  235. package/lib/hoc/withRouter.js +17 -1
  236. package/lib/hoc/withStore.js +28 -1
  237. package/lib/hooks/index.js +9 -1
  238. package/lib/hooks/useActivateExample.js +35 -1
  239. package/lib/hooks/useActiveWithFallback.js +12 -1
  240. package/lib/hooks/useContentItems.js +10 -1
  241. package/lib/hooks/useLicense.js +17 -1
  242. package/lib/hooks/usePerformanceMetrics.js +26 -1
  243. package/lib/hooks/useRouter.js +17 -1
  244. package/lib/hooks/useTelemetry.js +5 -1
  245. package/lib/hooks/useTranslate.js +6 -1
  246. package/lib/hooks/useUppercase2LowercaseRedirect.js +12 -1
  247. package/lib/icons/CSharpIcon/CSharpIcon.js +7 -1
  248. package/lib/icons/CSharpIcon/index.js +2 -1
  249. package/lib/icons/CurlIcon/CurlIcon.js +8 -2
  250. package/lib/icons/CurlIcon/index.js +2 -1
  251. package/lib/icons/GOIcon/GOIcon.js +7 -1
  252. package/lib/icons/GOIcon/index.js +2 -1
  253. package/lib/icons/JavaIcon/JavaIcon.js +7 -1
  254. package/lib/icons/JavaIcon/index.js +2 -1
  255. package/lib/icons/JavaScriptIcon/JavaScriptIcon.js +7 -1
  256. package/lib/icons/JavaScriptIcon/index.js +2 -1
  257. package/lib/icons/NodeJSIcon/NodeJSIcon.js +7 -1
  258. package/lib/icons/NodeJSIcon/index.js +2 -1
  259. package/lib/icons/PHPIcon/PHPIcon.js +7 -1
  260. package/lib/icons/PHPIcon/index.js +2 -1
  261. package/lib/icons/PayloadIcon/PayloadIcon.js +7 -1
  262. package/lib/icons/PayloadIcon/index.js +2 -1
  263. package/lib/icons/PythonIcon/PythonIcon.js +7 -1
  264. package/lib/icons/PythonIcon/index.js +2 -1
  265. package/lib/icons/RIcon/RIcon.js +7 -1
  266. package/lib/icons/RIcon/index.js +2 -1
  267. package/lib/icons/RubyIcon/RubyIcon.js +7 -1
  268. package/lib/icons/RubyIcon/index.js +2 -1
  269. package/lib/index.js +49 -1
  270. package/lib/jotai/app.js +113 -1
  271. package/lib/jotai/operation.js +28 -1
  272. package/lib/jotai/replay.js +5 -1
  273. package/lib/jotai/store.js +8 -1
  274. package/lib/jotai/use-write-atom.js +9 -1
  275. package/lib/models/callback.js +28 -1
  276. package/lib/models/code-sample-options.js +2 -0
  277. package/lib/models/example.js +17 -1
  278. package/lib/models/field.js +109 -1
  279. package/lib/models/group.js +38 -1
  280. package/lib/models/index.js +14 -1
  281. package/lib/models/mediaContent.js +26 -1
  282. package/lib/models/mediaType.js +153 -1
  283. package/lib/models/operation.js +166 -1
  284. package/lib/models/request.js +25 -1
  285. package/lib/models/response.js +46 -1
  286. package/lib/models/schema.js +474 -2
  287. package/lib/models/security.js +84 -1
  288. package/lib/models/tab.js +2 -0
  289. package/lib/models/types.js +2 -0
  290. package/lib/services/OpenAPIParser.js +321 -1
  291. package/lib/services/check.js +104 -1
  292. package/lib/services/code-samples/constants.js +16 -1
  293. package/lib/services/code-samples/generator.js +540 -1
  294. package/lib/services/code-samples/httpsnippet/helpers/code-builder.d.ts +5 -1
  295. package/lib/services/code-samples/httpsnippet/helpers/code-builder.js +252 -3
  296. package/lib/services/code-samples/httpsnippet/helpers/code-helpers.d.ts +2 -2
  297. package/lib/services/code-samples/httpsnippet/helpers/code-helpers.js +90 -2
  298. package/lib/services/code-samples/httpsnippet/helpers/constants.js +28 -1
  299. package/lib/services/code-samples/httpsnippet/helpers/lodash-int.js +173 -1
  300. package/lib/services/code-samples/httpsnippet/helpers/mocks/code-helpers-mock.js +76 -37
  301. package/lib/services/code-samples/httpsnippet/helpers/reducer.js +16 -1
  302. package/lib/services/code-samples/httpsnippet/helpers/shell.js +20 -1
  303. package/lib/services/code-samples/httpsnippet/helpers/string-utility.js +19 -1
  304. package/lib/services/code-samples/httpsnippet/index.js +166 -1
  305. package/lib/services/code-samples/httpsnippet/targets/__mocks__/mock.js +2340 -146
  306. package/lib/services/code-samples/httpsnippet/targets/csharp/httpclient.js +227 -2
  307. package/lib/services/code-samples/httpsnippet/targets/csharp/index.js +11 -1
  308. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/httpclient.js +185 -2
  309. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/index.js +11 -1
  310. package/lib/services/code-samples/httpsnippet/targets/go/index.js +11 -1
  311. package/lib/services/code-samples/httpsnippet/targets/go/native.js +222 -3
  312. package/lib/services/code-samples/httpsnippet/targets/index.js +28 -1
  313. package/lib/services/code-samples/httpsnippet/targets/java/httpclient.js +184 -3
  314. package/lib/services/code-samples/httpsnippet/targets/java/index.js +11 -1
  315. package/lib/services/code-samples/httpsnippet/targets/java8/apachehttp.js +223 -2
  316. package/lib/services/code-samples/httpsnippet/targets/java8/index.js +11 -1
  317. package/lib/services/code-samples/httpsnippet/targets/javascript/fetch.js +147 -1
  318. package/lib/services/code-samples/httpsnippet/targets/javascript/index.js +11 -1
  319. package/lib/services/code-samples/httpsnippet/targets/node/fetch.js +199 -1
  320. package/lib/services/code-samples/httpsnippet/targets/node/index.js +11 -1
  321. package/lib/services/code-samples/httpsnippet/targets/php/curl.js +203 -5
  322. package/lib/services/code-samples/httpsnippet/targets/php/index.js +11 -1
  323. package/lib/services/code-samples/httpsnippet/targets/php/types.js +2 -0
  324. package/lib/services/code-samples/httpsnippet/targets/php/utils.js +106 -5
  325. package/lib/services/code-samples/httpsnippet/targets/python/index.js +11 -1
  326. package/lib/services/code-samples/httpsnippet/targets/python/requests.js +185 -6
  327. package/lib/services/code-samples/httpsnippet/targets/r/httr.js +111 -1
  328. package/lib/services/code-samples/httpsnippet/targets/r/index.js +11 -1
  329. package/lib/services/code-samples/httpsnippet/targets/r/utils.js +18 -6
  330. package/lib/services/code-samples/httpsnippet/targets/ruby/index.js +11 -1
  331. package/lib/services/code-samples/httpsnippet/targets/ruby/native.js +169 -1
  332. package/lib/services/code-samples/httpsnippet/targets/shell/curl.js +94 -6
  333. package/lib/services/code-samples/httpsnippet/targets/shell/index.js +11 -1
  334. package/lib/services/code-samples/index.js +3 -1
  335. package/lib/services/code-samples/types.js +2 -0
  336. package/lib/services/config-options/helpers.js +49 -1
  337. package/lib/services/config-options/index.js +3 -1
  338. package/lib/services/config-options/normalizeOptions.js +83 -1
  339. package/lib/services/config-options/types.js +2 -0
  340. package/lib/services/history/helpers.js +63 -1
  341. package/lib/services/history/index.js +2 -1
  342. package/lib/services/index.js +9 -1
  343. package/lib/services/menu/builder.js +47 -1
  344. package/lib/services/menu/index.js +2 -1
  345. package/lib/services/menu/markdown.js +93 -1
  346. package/lib/services/menu/operation.js +50 -1
  347. package/lib/services/menu/tags.js +166 -1
  348. package/lib/services/types.d.ts +0 -3
  349. package/lib/services/types.js +2 -0
  350. package/lib/services/utils.js +83 -1
  351. package/lib/standalone.js +68 -1
  352. package/lib/styled-components.js +6 -1
  353. package/lib/types/app.js +2 -0
  354. package/lib/types/index.js +4 -1
  355. package/lib/types/open-api.d.ts +1 -0
  356. package/lib/types/open-api.js +2 -0
  357. package/lib/types/security.js +2 -0
  358. package/lib/utils/JsonPointer.js +84 -1
  359. package/lib/utils/areArraysEqual.js +4 -1
  360. package/lib/utils/argValuesHelpers.js +35 -1
  361. package/lib/utils/compose.js +2 -1
  362. package/lib/utils/configure-helpers.js +223 -1
  363. package/lib/utils/convertSwagger2OpenAPI.js +14 -1
  364. package/lib/utils/cookies.js +73 -1
  365. package/lib/utils/debounce.js +22 -1
  366. package/lib/utils/debug.js +11 -1
  367. package/lib/utils/dom.js +65 -1
  368. package/lib/utils/environments.js +13 -1
  369. package/lib/utils/helpers.js +222 -12
  370. package/lib/utils/index.js +25 -1
  371. package/lib/utils/isMobile.js +13 -1
  372. package/lib/utils/loadAndBundleSpec.js +32 -1
  373. package/lib/utils/local-storage.js +12 -1
  374. package/lib/utils/object.js +31 -1
  375. package/lib/utils/openapi.js +592 -1
  376. package/lib/utils/parameters.js +13 -1
  377. package/lib/utils/path.js +22 -1
  378. package/lib/utils/queryString.js +60 -1
  379. package/lib/utils/replaceVariables.js +14 -1
  380. package/lib/utils/saveTextBeforeHeading.js +35 -1
  381. package/lib/utils/security-details.js +49 -1
  382. package/lib/utils/session-storage.js +12 -1
  383. package/lib/utils/simplifyAstStructure.js +22 -1
  384. package/lib/utils/sort.js +21 -1
  385. package/lib/utils/string.js +65 -1
  386. package/lib/utils/telemetry.js +7 -1
  387. package/lib/utils/test-utils.js +26 -1
  388. package/lib/utils/theme-helpers.js +24 -3
  389. package/lib/utils/url.js +38 -1
  390. package/package.json +5 -5
@@ -1,32 +1,39 @@
1
- import{CheckmarkIcon as o}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon";import{styled as t}from"../../styled-components.js";const r=t.span`
1
+ import { CheckmarkIcon } from '@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon';
2
+ import { styled } from '../../styled-components.js';
3
+ export const PanelItemWrap = styled.span `
2
4
  display: flex;
3
5
  justify-content: space-between;
4
6
  align-items: center;
5
7
  padding: 0;
6
8
  position: relative;
7
9
  width: 100%;
8
- `,a=t.span`
10
+ `;
11
+ export const Item = styled.span `
9
12
  display: flex;
10
13
  flex-direction: column;
11
14
  justify-content: flex-start;
12
15
  overflow: hidden;
13
- `,s=t.span`
16
+ `;
17
+ export const Header = styled.span `
14
18
  text-align: left;
15
19
  color: var(--menu-content-title-color);
16
20
  font-size: var(--h6-font-size);
17
21
  line-height: var(--line-height-xsm);
18
- `,l=t.p`
22
+ `;
23
+ export const Title = styled.p `
19
24
  margin: 0;
20
25
  color: var(--text-color-secondary);
21
26
  font-size: var(--font-size-base);
22
27
  line-height: var(--line-height-base);
23
28
  overflow: hidden;
24
29
  text-overflow: ellipsis;
25
- font-weight: ${({active:e})=>e&&"var(--font-weight-medium)"};
26
- `,p=t.div`
30
+ font-weight: ${({ active }) => active && 'var(--font-weight-medium)'};
31
+ `;
32
+ export const ActionsWrap = styled.div `
27
33
  display: flex;
28
34
  gap: var(--spacing-xs);
29
- `,c=t.div`
35
+ `;
36
+ export const PanelItemsList = styled.div `
30
37
  & > span {
31
38
  border-bottom: 1px solid var(--border-color-secondary);
32
39
  margin-bottom: var(--spacing-xs);
@@ -38,15 +45,18 @@ import{CheckmarkIcon as o}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon"
38
45
  margin-bottom: 0;
39
46
  padding-bottom: 0;
40
47
  }
41
- `,d=t.span`
48
+ `;
49
+ export const PanelItemDescription = styled.span `
42
50
  color: var(--text-color-secondary);
43
51
  font-size: var(--font-size-base);
44
52
  line-height: var(--line-height-base);
45
53
  font-weight: var(--font-weight-medium);
46
- `,m=t(o)`
54
+ `;
55
+ export const StyledCheckmarkIcon = styled(CheckmarkIcon) `
47
56
  width: 14px;
48
57
  height: 14px;
49
58
  position: absolute;
50
59
  left: -18px;
51
60
  bottom: 3px;
52
- `;export{p as ActionsWrap,s as Header,a as Item,d as PanelItemDescription,r as PanelItemWrap,c as PanelItemsList,m as StyledCheckmarkIcon,l as Title};
61
+ `;
62
+ //# sourceMappingURL=styled.js.map
@@ -1 +1,6 @@
1
- import{jsx as l}from"react/jsx-runtime";import{ExampleValue as m}from"./ExampleValue.js";function p({example:o,mimeType:e,onCopyClick:n,onPanelToggle:i}){return l(m,{value:o.value,mimeType:e,encoding:o.encoding,onCopyClick:n,onPanelToggle:i})}export{p as Example};
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ExampleValue } from './ExampleValue.js';
3
+ export function Example({ example, mimeType, onCopyClick, onPanelToggle, }) {
4
+ return (_jsx(ExampleValue, { value: example.value, mimeType: mimeType, encoding: example.encoding, onCopyClick: onCopyClick, onPanelToggle: onPanelToggle }));
5
+ }
6
+ //# sourceMappingURL=Example.js.map
@@ -1 +1,30 @@
1
- import{jsx as n}from"react/jsx-runtime";import{useAtomValue as i}from"jotai";import{JsonViewer as m}from"@redocly/theme/components/JsonViewer/JsonViewer";import{isFormUrlEncoded as a,isJsonLike as c,langFromMime as d,urlFormEncodePayload as f}from"../../utils/index.js";import{globalOptionsAtom as p}from"../../jotai/store.js";import{StyledCodeBlock as g}from"./styled.js";function y({value:o,mimeType:r,encoding:t,onCopyClick:e,onPanelToggle:l}){const{jsonSamplesExpandLevel:s}=i(p);return c(r)?n(m,{data:o,expandLevel:s,onCopyClick:e,onPanelToggle:l}):(typeof o=="object"&&(a(r)?o=f(o,t):o=JSON.stringify(o,null,2)),n(g,{lang:d(r),source:o,header:{className:"code-block-header",controls:{copy:{onClick:e}}}}))}export{y as ExampleValue};
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useAtomValue } from 'jotai';
3
+ import { JsonViewer } from '@redocly/theme/components/JsonViewer/JsonViewer';
4
+ import { isFormUrlEncoded, isJsonLike, langFromMime, urlFormEncodePayload, } from '../../utils/index.js';
5
+ import { globalOptionsAtom } from '../../jotai/store.js';
6
+ import { StyledCodeBlock } from './styled.js';
7
+ export function ExampleValue({ value, mimeType, encoding, onCopyClick, onPanelToggle, }) {
8
+ const { jsonSamplesExpandLevel } = useAtomValue(globalOptionsAtom);
9
+ if (isJsonLike(mimeType)) {
10
+ return (_jsx(JsonViewer, { data: value, expandLevel: jsonSamplesExpandLevel, onCopyClick: onCopyClick, onPanelToggle: onPanelToggle }));
11
+ }
12
+ if (typeof value === 'object') {
13
+ if (isFormUrlEncoded(mimeType)) {
14
+ value = urlFormEncodePayload(value, encoding);
15
+ }
16
+ else {
17
+ // just in case example was cached as json but used as non-json
18
+ value = JSON.stringify(value, null, 2);
19
+ }
20
+ }
21
+ return (_jsx(StyledCodeBlock, { lang: langFromMime(mimeType), source: value, header: {
22
+ className: 'code-block-header',
23
+ controls: {
24
+ copy: {
25
+ onClick: onCopyClick,
26
+ },
27
+ },
28
+ } }));
29
+ }
30
+ //# sourceMappingURL=ExampleValue.js.map
@@ -1,3 +1,37 @@
1
- import{jsx as r,Fragment as f,jsxs as y}from"react/jsx-runtime";import{memo as d}from"react";import u from"deepmerge";import{Markdown as h}from"../Markdown/index.js";import{Example as j}from"./Example.js";import{ExampleSwitch as k,useExampleKey as E}from"../Samples/index.js";import{arrayMergeStrategy as M}from"../../services/utils.js";import{StyledCodeBlock as S}from"./styled.js";import{useTranslate as v}from"../../hooks/index.js";import{styled as C}from"../../styled-components.js";function K({mediaType:o,properties:a,onChange:l,onCopyClick:c,onPanelToggle:i}){const e=o.examples||o.formExamples||{},x=o.name,s=Object.keys(e),g=v(),{exampleKey:n}=E(o.operation,e),m=s.length===1?Object.values(e)[0]:e[n];if(!s.length)return r(S,{lang:"clike",source:g("openapi.noResponseExample","No response example"),header:{controls:!1}});const t=a?{...m,value:u(m.value,a,{arrayMerge:M})}:m,p=t.description;return y(f,{children:[r(k,{examples:e,exampleKey:n,onChange:l}),p&&r(w,{source:p}),r(j,{example:t,mimeType:x,onCopyClick:c,onPanelToggle:i})]})}const w=C(h)`
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import merge from 'deepmerge';
4
+ import { Markdown } from '../Markdown/index.js';
5
+ import { Example } from './Example.js';
6
+ import { ExampleSwitch, useExampleKey } from '../Samples/index.js';
7
+ import { arrayMergeStrategy } from '../../services/utils.js';
8
+ import { StyledCodeBlock } from './styled.js';
9
+ import { useTranslate } from '../../hooks/index.js';
10
+ import { styled } from '../../styled-components.js';
11
+ function MediaTypeSamplesComponent({ mediaType, properties, onChange, onCopyClick, onPanelToggle, }) {
12
+ const examples = mediaType.examples || mediaType.formExamples || {};
13
+ const mimeType = mediaType.name;
14
+ const examplesKeys = Object.keys(examples);
15
+ const translate = useTranslate();
16
+ const { exampleKey } = useExampleKey(mediaType.operation, examples);
17
+ const example = examplesKeys.length === 1 ? Object.values(examples)[0] : examples[exampleKey];
18
+ if (!examplesKeys.length) {
19
+ return (_jsx(StyledCodeBlock, { lang: "clike", source: translate('openapi.noResponseExample', 'No response example'), header: { controls: false } }));
20
+ }
21
+ // properties will be passed in developer portal
22
+ const mergedExamples = properties
23
+ ? {
24
+ ...example,
25
+ value: merge(example.value, properties, {
26
+ arrayMerge: arrayMergeStrategy,
27
+ }),
28
+ }
29
+ : example;
30
+ const description = mergedExamples.description;
31
+ return (_jsxs(_Fragment, { children: [_jsx(ExampleSwitch, { examples: examples, exampleKey: exampleKey, onChange: onChange }), description && _jsx(StyledMarkdown, { source: description }), _jsx(Example, { example: mergedExamples, mimeType: mimeType, onCopyClick: onCopyClick, onPanelToggle: onPanelToggle })] }));
32
+ }
33
+ const StyledMarkdown = styled(Markdown) `
2
34
  margin: 0 var(--spacing-md) var(--spacing-sm);
3
- `,z=d(K);export{z as MediaTypeSamples};
35
+ `;
36
+ export const MediaTypeSamples = memo(MediaTypeSamplesComponent);
37
+ //# sourceMappingURL=MediaTypeSamples.js.map
@@ -1 +1,26 @@
1
- import{jsx as t}from"react/jsx-runtime";import{memo as c,useCallback as d}from"react";import{useAtomValue as u}from"jotai";import{SelectOrLabel as f}from"../SelectOrLabel/index.js";import{MediaTypesSwitch as y}from"../MediaTypeSwitch/index.js";import{MimeLabel as S,Select as h}from"../common/index.js";import{MediaTypeSamples as M}from"./MediaTypeSamples.js";import{SelectWrapper as T,StyledCodeBlock as x}from"./styled.js";import{activeMimeNameAtom as b}from"../../jotai/app.js";import{useActivateExample as v,useTranslate as A}from"../../hooks/index.js";function g({onlyDefaultMimeType:r,content:o,...l}){const m=v(o),n=u(b),a=r&&n,p=A(),s=d(e=>a?null:t(T,{children:t(f,{Label:S,Select:h,variant:"dark",fullWidth:!0,...e})}),[a]),i=e=>m(e);return o?t(y,{content:o,renderSelect:s,children:e=>t(M,{mediaType:e,...l,onChange:i},"samples")}):t(x,{lang:"text",source:p("openapi.noRequestPayload","No request payload"),header:{controls:!1}})}const B=c(g);export{B as PayloadSamples};
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo, useCallback } from 'react';
3
+ import { useAtomValue } from 'jotai';
4
+ import { SelectOrLabel } from '../SelectOrLabel/index.js';
5
+ import { MediaTypesSwitch } from '../MediaTypeSwitch/index.js';
6
+ import { MimeLabel, Select } from '../common/index.js';
7
+ import { MediaTypeSamples } from './MediaTypeSamples.js';
8
+ import { SelectWrapper, StyledCodeBlock } from './styled.js';
9
+ import { activeMimeNameAtom } from '../../jotai/app.js';
10
+ import { useActivateExample, useTranslate } from '../../hooks/index.js';
11
+ function PayloadSamplesComponent({ onlyDefaultMimeType, content: mimeContent, ...props }) {
12
+ const setActivateExampleName = useActivateExample(mimeContent);
13
+ const defaultMimeType = useAtomValue(activeMimeNameAtom); // we pass defaultMimeType from portal
14
+ const showDefaultMimeType = onlyDefaultMimeType && defaultMimeType;
15
+ const translate = useTranslate();
16
+ const renderSelect = useCallback((props) => {
17
+ return showDefaultMimeType ? null : (_jsx(SelectWrapper, { children: _jsx(SelectOrLabel, { Label: MimeLabel, Select: Select, variant: "dark", fullWidth: true, ...props }) }));
18
+ }, [showDefaultMimeType]);
19
+ const handleMediaTypeChange = (key) => setActivateExampleName(key);
20
+ if (!mimeContent) {
21
+ return (_jsx(StyledCodeBlock, { lang: "text", source: translate('openapi.noRequestPayload', 'No request payload'), header: { controls: false } }));
22
+ }
23
+ return (_jsx(MediaTypesSwitch, { content: mimeContent, renderSelect: renderSelect, children: (mediaType) => (_jsx(MediaTypeSamples, { mediaType: mediaType, ...props, onChange: handleMediaTypeChange }, "samples")) }));
24
+ }
25
+ export const PayloadSamples = memo(PayloadSamplesComponent);
26
+ //# sourceMappingURL=PayloadSamples.js.map
@@ -1 +1,7 @@
1
- import{PayloadSamples as r}from"./PayloadSamples.js";import{Example as m}from"./Example.js";import{ExampleValue as x}from"./ExampleValue.js";import{MediaTypeSamples as l}from"./MediaTypeSamples.js";export*from"./types.js";export*from"./styled.js";export{m as Example,x as ExampleValue,l as MediaTypeSamples,r as PayloadSamples};
1
+ export { PayloadSamples } from './PayloadSamples.js';
2
+ export { Example } from './Example.js';
3
+ export { ExampleValue } from './ExampleValue.js';
4
+ export { MediaTypeSamples } from './MediaTypeSamples.js';
5
+ export * from './types.js';
6
+ export * from './styled.js';
7
+ //# sourceMappingURL=index.js.map
@@ -1,4 +1,6 @@
1
- import{CodeBlock as e}from"@redocly/theme/components/CodeBlock/CodeBlock";import{styled as o}from"../../styled-components.js";const a=o.span`
1
+ import { CodeBlock } from '@redocly/theme/components/CodeBlock/CodeBlock';
2
+ import { styled } from '../../styled-components.js';
3
+ export const SelectLabel = styled.span `
2
4
  font-size: 12px;
3
5
  position: absolute;
4
6
  z-index: 1;
@@ -8,9 +10,11 @@ import{CodeBlock as e}from"@redocly/theme/components/CodeBlock/CodeBlock";import
8
10
  color: var(--panel-samples-text-color);
9
11
  opacity: 0.7;
10
12
  font-family: var(--font-family-base);
11
- `,i=o.div`
13
+ `;
14
+ export const SelectWrapper = styled.div `
12
15
  position: relative;
13
- `,p=o(e)`
16
+ `;
17
+ export const StyledCodeBlock = styled(CodeBlock) `
14
18
  border: none;
15
19
  margin: 0;
16
20
 
@@ -18,4 +22,5 @@ import{CodeBlock as e}from"@redocly/theme/components/CodeBlock/CodeBlock";import
18
22
  border-bottom: 0;
19
23
  padding-right: var(--spacing-sm);
20
24
  }
21
- `;export{a as SelectLabel,i as SelectWrapper,p as StyledCodeBlock};
25
+ `;
26
+ //# sourceMappingURL=styled.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -1,9 +1,25 @@
1
- import{jsxs as n,jsx as e,Fragment as s}from"react/jsx-runtime";import{memo as a}from"react";import{Markdown as h}from"../Markdown/index.js";import{DescriptionEnumsBlock as u}from"./styled.js";import{ToggleButton as f}from"../common/index.js";import{styled as t}from"../../styled-components.js";const y=t.td`
1
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { Markdown } from '../Markdown/index.js';
4
+ import { DescriptionEnumsBlock } from './styled.js';
5
+ import { ToggleButton } from '../common/index.js';
6
+ import { styled } from '../../styled-components.js';
7
+ const EnumValueStyled = styled.td `
2
8
  word-wrap: break-word;
3
9
  font-size: var(--md-table-font-size);
4
- `,g=t.td`
10
+ `;
11
+ const DescriptionValueStyled = styled.td `
5
12
  & p,
6
13
  p:only-of-type {
7
14
  margin: 0;
8
15
  }
9
- `;function x({enums:o,toggle:l,showToggleButton:p,toggleButtonText:c,type:d,translate:r}){return e(s,{children:e(u,{children:n("table",{className:"md",children:[e("thead",{children:n("tr",{children:[n("th",{style:{width:"30%"},children:[d==="array"?r("openapi.items","Items"):""," ",o.length===1?r("openapi.value","Value"):`${r("openapi.enum","Enum")} ${r("openapi.value","Value")}`]}),e("th",{children:r("openapi.description","Description")})]})}),e("tbody",{children:o.map(({description:m,value:i})=>n("tr",{children:[e(y,{children:i}),e(g,{children:e(h,{source:m})})]},i))}),p?e("tfoot",{children:e("tr",{children:e("td",{colSpan:2,children:e(f,{onClick:l,children:c})})})}):null]})})})}const V=a(x);export{V as DescriptionEnums,x as DescriptionEnumsComponent};
16
+ `;
17
+ export function DescriptionEnumsComponent({ enums, toggle, showToggleButton, toggleButtonText, type, translate, }) {
18
+ return (_jsx(_Fragment, { children: _jsx(DescriptionEnumsBlock, { children: _jsxs("table", { className: "md", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsxs("th", { style: { width: '30%' }, children: [type === 'array' ? translate('openapi.items', 'Items') : '', ' ', enums.length === 1
19
+ ? translate('openapi.value', 'Value')
20
+ : `${translate('openapi.enum', 'Enum')} ${translate('openapi.value', 'Value')}`] }), _jsx("th", { children: translate('openapi.description', 'Description') })] }) }), _jsx("tbody", { children: enums.map(({ description, value }) => {
21
+ return (_jsxs("tr", { children: [_jsx(EnumValueStyled, { children: value }), _jsx(DescriptionValueStyled, { children: _jsx(Markdown, { source: description }) })] }, value));
22
+ }) }), showToggleButton ? (_jsx("tfoot", { children: _jsx("tr", { children: _jsx("td", { colSpan: 2, children: _jsx(ToggleButton, { onClick: toggle, children: toggleButtonText }) }) }) })) : null] }) }) }));
23
+ }
24
+ export const DescriptionEnums = memo(DescriptionEnumsComponent);
25
+ //# sourceMappingURL=DescriptionEnums.js.map
@@ -1 +1,37 @@
1
- import{jsx as m,Fragment as c}from"react/jsx-runtime";import{useState as f,memo as d,useCallback as h,useMemo as x}from"react";import{useAtomValue as y}from"jotai";import{SimpleEnums as E}from"./SimpleEnums.js";import{DescriptionEnums as T}from"./DescriptionEnums.js";import{globalOptionsAtom as A}from"../../jotai/store.js";import{useTranslate as B}from"../../hooks/index.js";function C(o){return Array.isArray(o)&&o||Object.entries(o||{}).map(([r,e])=>({value:r,description:e}))}function V({values:o,type:r}){const e=B(),[s,g]=f(!0),{maxDisplayedEnumValues:t}=y(A),l=h(()=>{g(!s)},[s]),p=!Array.isArray(o),n=C(o),a=x(()=>s&&t?n.slice(0,t):n,[n,s,t]);if(!n.length)return null;const i=t?n.length>t:!1,u=t?s?`+${n.length-t} ${e("openapi.actions.more","more")}`:e("openapi.actions.hide","Hide"):"";return m(c,{children:p?m(T,{enums:a,toggle:l,showToggleButton:i,toggleButtonText:u,type:r,translate:e}):m(E,{enums:a,type:r,toggle:l,toggleButtonText:u,showToggleButton:i,translate:e})})}const S=d(V);export{S as EnumValues};
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState, memo, useCallback, useMemo } from 'react';
3
+ import { useAtomValue } from 'jotai';
4
+ import { SimpleEnums } from './SimpleEnums.js';
5
+ import { DescriptionEnums } from './DescriptionEnums.js';
6
+ import { globalOptionsAtom } from '../../jotai/store.js';
7
+ import { useTranslate } from '../../hooks/index.js';
8
+ function getEnums(values) {
9
+ return ((Array.isArray(values) && values) ||
10
+ Object.entries(values || {}).map(([value, description]) => ({
11
+ value,
12
+ description,
13
+ })));
14
+ }
15
+ function EnumValuesComponent({ values, type }) {
16
+ const translate = useTranslate();
17
+ const [isCollapsed, setIsCollapsed] = useState(true);
18
+ const { maxDisplayedEnumValues } = useAtomValue(globalOptionsAtom);
19
+ const toggle = useCallback(() => {
20
+ setIsCollapsed(!isCollapsed);
21
+ }, [isCollapsed]);
22
+ const isDescriptionEnum = !Array.isArray(values);
23
+ const enums = getEnums(values);
24
+ const displayedItems = useMemo(() => (isCollapsed && maxDisplayedEnumValues ? enums.slice(0, maxDisplayedEnumValues) : enums), [enums, isCollapsed, maxDisplayedEnumValues]);
25
+ if (!enums.length) {
26
+ return null;
27
+ }
28
+ const showToggleButton = maxDisplayedEnumValues ? enums.length > maxDisplayedEnumValues : false;
29
+ const toggleButtonText = maxDisplayedEnumValues
30
+ ? isCollapsed
31
+ ? `+${enums.length - maxDisplayedEnumValues} ${translate('openapi.actions.more', 'more')}`
32
+ : translate('openapi.actions.hide', 'Hide')
33
+ : '';
34
+ return (_jsx(_Fragment, { children: isDescriptionEnum ? (_jsx(DescriptionEnums, { enums: displayedItems, toggle: toggle, showToggleButton: showToggleButton, toggleButtonText: toggleButtonText, type: type, translate: translate })) : (_jsx(SimpleEnums, { enums: displayedItems, type: type, toggle: toggle, toggleButtonText: toggleButtonText, showToggleButton: showToggleButton, translate: translate })) }));
35
+ }
36
+ export const EnumValues = memo(EnumValuesComponent);
37
+ //# sourceMappingURL=EnumValues.js.map
@@ -1 +1,26 @@
1
- import{jsxs as t,jsx as n,Fragment as i}from"react/jsx-runtime";import{ExampleValue as l,FieldLabel as p}from"../common/index.js";import{tryDecodeURIComponent as u,normalizeText as o,serializeParameterValue as c}from"../../utils/index.js";import{ExampleWrap as x,ExamplesList as d,ExampleSummary as f}from"./styled.js";import{useTranslate as h}from"../../hooks/index.js";import{Markdown as E}from"../Markdown/index.js";function b({field:e}){const r=h();return e.examples?t(i,{children:[t(p,{children:[" ",r("openapi.examples","Examples"),": "]}),n(d,{children:Object.entries(e.examples).map(([m,a])=>{const s=o(a.description);return t(x,{children:[t(f,{children:[o(a.summary)||m," "]}),s&&n(E,{source:s}),n(l,{children:j(e,a.value)})]},m)})})]}):null}function j(e,r){return e.in?u(c(e,r)):r}export{b as Examples,j as getSerializedValue};
1
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { ExampleValue, FieldLabel } from '../common/index.js';
3
+ import { tryDecodeURIComponent, normalizeText, serializeParameterValue, } from '../../utils/index.js';
4
+ import { ExampleWrap, ExamplesList, ExampleSummary } from './styled.js';
5
+ import { useTranslate } from '../../hooks/index.js';
6
+ import { Markdown } from '../Markdown/index.js';
7
+ export function Examples({ field }) {
8
+ const translate = useTranslate();
9
+ if (!field.examples) {
10
+ return null;
11
+ }
12
+ return (_jsxs(_Fragment, { children: [_jsxs(FieldLabel, { children: [" ", translate('openapi.examples', 'Examples'), ": "] }), _jsx(ExamplesList, { children: Object.entries(field.examples).map(([id, example]) => {
13
+ const description = normalizeText(example.description);
14
+ return (_jsxs(ExampleWrap, { children: [_jsxs(ExampleSummary, { children: [normalizeText(example.summary) || id, " "] }), description && _jsx(Markdown, { source: description }), _jsx(ExampleValue, { children: getSerializedValue(field, example.value) })] }, id));
15
+ }) })] }));
16
+ }
17
+ export function getSerializedValue(field, example) {
18
+ if (field.in) {
19
+ // decode for better readability in examples: see https://github.com/Redocly/redoc/issues/1138
20
+ return tryDecodeURIComponent(serializeParameterValue(field, example));
21
+ }
22
+ else {
23
+ return example;
24
+ }
25
+ }
26
+ //# sourceMappingURL=Examples.js.map
@@ -1,3 +1,18 @@
1
- import{jsxs as t,jsx as n,Fragment as s}from"react/jsx-runtime";import{memo as i}from"react";import{useAtomValue as a}from"jotai";import{Markdown as e}from"@redocly/theme/components/Markdown/Markdown";import{ExtensionValue as p,FieldLabel as l}from"../common/index.js";import{globalOptionsAtom as f}from"../../jotai/store.js";import{styled as c}from"../../styled-components.js";const d=c(e)`
1
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { useAtomValue } from 'jotai';
4
+ import { Markdown as MarkdownWrapper } from '@redocly/theme/components/Markdown/Markdown';
5
+ import { ExtensionValue, FieldLabel } from '../common/index.js';
6
+ import { globalOptionsAtom } from '../../jotai/store.js';
7
+ import { styled } from '../../styled-components.js';
8
+ const Container = styled(MarkdownWrapper) `
2
9
  margin: 2px 0;
3
- `;function g({extensions:r}){const{showExtensions:m}=a(f);return m?n(s,{children:Object.keys(r).map(o=>t(d,{children:[t(l,{children:[o.substring(2),": "]})," ",n(p,{children:typeof r[o]=="string"?r[o]:JSON.stringify(r[o])})]},o))}):null}const F=i(g);export{F as Extensions};
10
+ `;
11
+ function ExtensionsComponent({ extensions }) {
12
+ const { showExtensions } = useAtomValue(globalOptionsAtom);
13
+ return showExtensions ? (_jsx(_Fragment, { children: Object.keys(extensions).map((key) => (_jsxs(Container, { children: [_jsxs(FieldLabel, { children: [key.substring(2), ": "] }), ' ', _jsx(ExtensionValue, { children: (typeof extensions[key] === 'string'
14
+ ? extensions[key]
15
+ : JSON.stringify(extensions[key])) })] }, key))) })) : null;
16
+ }
17
+ export const Extensions = memo(ExtensionsComponent);
18
+ //# sourceMappingURL=Extensions.js.map
@@ -1,7 +1,20 @@
1
- import{jsxs as a,jsx as l}from"react/jsx-runtime";import{memo as s}from"react";import{FieldLabel as o,DefaultValue as p,FieldValueLabel as d,ExpandableExample as m}from"../common/index.js";import{styled as x}from"../../styled-components.js";function f({value:e,label:n,raw:t,type:r="other"}){if(e===void 0)return null;const i=t?String(e):JSON.stringify(e);return a(c,{children:[a(o,{children:[" ",n," "]}),r==="default"?l(p,{children:i}):r==="example"?l(m,{value:i}):l(d,{children:i})]})}const j=s(f),c=x.div`
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { FieldLabel, DefaultValue, FieldValueLabel, ExpandableExample } from '../common/index.js';
4
+ import { styled } from '../../styled-components.js';
5
+ function FieldDetailComponent({ value, label, raw, type = 'other', }) {
6
+ if (value === undefined) {
7
+ return null;
8
+ }
9
+ const _value = raw ? String(value) : JSON.stringify(value);
10
+ return (_jsxs(Wrapper, { children: [_jsxs(FieldLabel, { children: [" ", label, " "] }), type === 'default' ? (_jsx(DefaultValue, { children: _value })) : type === 'example' ? (_jsx(ExpandableExample, { value: _value })) : (_jsx(FieldValueLabel, { children: _value }))] }));
11
+ }
12
+ export const FieldDetail = memo(FieldDetailComponent);
13
+ const Wrapper = styled.div `
2
14
  margin-top: var(--spacing-xxs);
3
15
  display: flex;
4
16
  align-items: baseline;
5
17
  gap: var(--spacing-xxs);
6
18
  flex-wrap: wrap;
7
- `;export{j as FieldDetail};
19
+ `;
20
+ //# sourceMappingURL=FieldDetail.js.map
@@ -1,18 +1,61 @@
1
- import{jsx as e,jsxs as p,Fragment as E}from"react/jsx-runtime";import{memo as T,useMemo as k}from"react";import{useAtomValue as S}from"jotai";import{LinkIcon as L}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{RecursiveLabel as h,Tag as x,AccessLabel as j,RequiredLabel as q,StyledBadge as A}from"../common/index.js";import{ExternalDocumentation as C}from"../ExternalDocumentation/index.js";import{Markdown as M}from"../Markdown/index.js";import{FieldDetail as l}from"./FieldDetail.js";import{Extensions as R}from"./Extensions.js";import{EnumValues as V}from"./EnumValues.js";import{Examples as $,getSerializedValue as N}from"./Examples.js";import{globalOptionsAtom as _}from"../../jotai/store.js";import{SchemaTypeInfo as i}from"./SchemaTypeInfo.js";import{LinkToField as B}from"../common/LinkToField.js";import{Pattern as I}from"./Pattern.js";import{getAccessModeLabelText as O}from"../RenderHook/index.js";import{useTranslate as G}from"../../hooks/index.js";import{styled as n}from"../../styled-components.js";function H({field:t,renderDiscriminatorSwitch:v,deepLink:m,fieldParentsName:y=[]}){const a=G(),{hidePropertiesPrefix:g,hideSchemaTitles:b}=S(_),{schema:r,description:w,example:c,deprecated:D,examples:s,kind:d,required:F,name:f}=t,P=t.in==="header",z=k(()=>{if(c!==void 0||s!==void 0){if(s!==void 0)return e($,{field:t});{const o=!!t.in;return e(l,{label:`${a("openapi.example","Example")}:`,value:N(t,t.example),raw:o})}}else return null},[c,s,t,a]),u=O(t.schema);return p(E,{children:[p(J,{children:[f&&p(Q,{children:[m&&e(B,{to:m}),!g&&y.map(o=>o+".\u200B"),e(U,{className:"schema-name",children:f})]}),e(i,{type:r.typePrefix+r.displayType}),e(i,{type:r.displayFormat&&`(${r.displayFormat})`}),e(i,{type:r.contentEncoding}),e(i,{type:r.title&&!b?`(${r.title})`:""}),r.constraints?.map(o=>e(i,{type:o},o)),D&&e(A,{deprecated:!0,children:a("openapi.badges.deprecated","Deprecated")}),e(I,{pattern:r.pattern}),d==="additionalProperties"&&e(x,{children:a("openapi.additionalProperties","additional property")}),d==="patternProperties"&&e(x,{children:a("openapi.patternProperties","pattern property")}),u&&e(j,{children:u}),F&&e(q,{children:a("openapi.required","required")}),r.isCircular&&e(h,{children:a("openapi.recursive","Recursive")})]}),r.isComplex&&e(h,{children:a("openapi.complex","Complex")}),e(K,{source:w}),e(l,{raw:P,type:"default",label:a("openapi.default","Default"),value:r.default}),e(V,{type:r.type,values:r["x-enumDescriptions"]||r.enum}),z,e(R,{extensions:{...t.extensions,...r.extensions}}),r.externalDocs&&e(C,{externalDocs:r.externalDocs,compact:!0}),v?.(),e(l,{label:a("openapi.value","Value"),value:t.const||void 0})]})}const ue=T(H),J=n.div`
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { memo, useMemo } from 'react';
3
+ import { useAtomValue } from 'jotai';
4
+ import { LinkIcon } from '@redocly/theme/icons/LinkIcon/LinkIcon';
5
+ import { RecursiveLabel, Tag, AccessLabel, RequiredLabel, StyledBadge } from '../common/index.js';
6
+ import { ExternalDocumentation } from '../ExternalDocumentation/index.js';
7
+ import { Markdown } from '../Markdown/index.js';
8
+ import { FieldDetail } from './FieldDetail.js';
9
+ import { Extensions } from './Extensions.js';
10
+ import { EnumValues } from './EnumValues.js';
11
+ import { Examples, getSerializedValue } from './Examples.js';
12
+ import { globalOptionsAtom } from '../../jotai/store.js';
13
+ import { SchemaTypeInfo } from './SchemaTypeInfo.js';
14
+ import { LinkToField } from '../common/LinkToField.js';
15
+ import { Pattern } from './Pattern.js';
16
+ import { getAccessModeLabelText } from '../RenderHook/index.js';
17
+ import { useTranslate } from '../../hooks/index.js';
18
+ import { styled } from '../../styled-components.js';
19
+ function FieldDetailsComponent({ field, renderDiscriminatorSwitch, deepLink, fieldParentsName = [], }) {
20
+ const translate = useTranslate();
21
+ const { hidePropertiesPrefix, hideSchemaTitles } = useAtomValue(globalOptionsAtom);
22
+ const { schema, description, example, deprecated, examples, kind, required, name } = field;
23
+ const rawDefault = field.in === 'header'; // having quotes around header field default values is confusing and inappropriate
24
+ const renderedExamples = useMemo(() => {
25
+ if (example !== undefined || examples !== undefined) {
26
+ if (examples !== undefined) {
27
+ return _jsx(Examples, { field: field });
28
+ }
29
+ else {
30
+ const raw = !!field.in;
31
+ return (_jsx(FieldDetail, { label: `${translate('openapi.example', 'Example')}:`, value: getSerializedValue(field, field.example), raw: raw }));
32
+ }
33
+ }
34
+ else
35
+ return null;
36
+ }, [example, examples, field, translate]);
37
+ const accessMode = getAccessModeLabelText(field.schema);
38
+ return (_jsxs(_Fragment, { children: [_jsxs(Row, { children: [name && (_jsxs(Name, { children: [deepLink && _jsx(LinkToField, { to: deepLink }), !hidePropertiesPrefix &&
39
+ fieldParentsName.map((name) => name + '.\u200B'), _jsx(SchemaName, { className: "schema-name", children: name })] })), _jsx(SchemaTypeInfo, { type: schema.typePrefix + schema.displayType }), _jsx(SchemaTypeInfo, { type: schema.displayFormat && `(${schema.displayFormat})` }), _jsx(SchemaTypeInfo, { type: schema.contentEncoding }), _jsx(SchemaTypeInfo, { type: schema.title && !hideSchemaTitles ? `(${schema.title})` : '' }), schema.constraints?.map((constraint) => (_jsx(SchemaTypeInfo, { type: constraint }, constraint))), deprecated && (_jsx(StyledBadge, { deprecated: true, children: translate('openapi.badges.deprecated', 'Deprecated') })), _jsx(Pattern, { pattern: schema.pattern }), kind === 'additionalProperties' && (_jsx(Tag, { children: translate('openapi.additionalProperties', 'additional property') })), kind === 'patternProperties' && (_jsx(Tag, { children: translate('openapi.patternProperties', 'pattern property') })), accessMode && _jsx(AccessLabel, { children: accessMode }), required && _jsx(RequiredLabel, { children: translate('openapi.required', 'required') }), schema.isCircular && (_jsx(RecursiveLabel, { children: translate('openapi.recursive', 'Recursive') }))] }), schema.isComplex && (_jsx(RecursiveLabel, { children: translate('openapi.complex', 'Complex') })), _jsx(StyledDescription, { source: description }), _jsx(FieldDetail, { raw: rawDefault, type: "default", label: translate('openapi.default', 'Default'), value: schema.default }), _jsx(EnumValues, { type: schema.type, values: schema['x-enumDescriptions'] || schema.enum }), renderedExamples, _jsx(Extensions, { extensions: { ...field.extensions, ...schema.extensions } }), schema.externalDocs && _jsx(ExternalDocumentation, { externalDocs: schema.externalDocs, compact: true }), renderDiscriminatorSwitch?.(), _jsx(FieldDetail, { label: translate('openapi.value', 'Value'), value: field.const || undefined })] }));
40
+ }
41
+ export const FieldDetails = memo(FieldDetailsComponent);
42
+ const Row = styled.div `
2
43
  display: flex;
3
44
  align-items: center;
4
45
  gap: calc(var(--spacing-xxs) / 4) var(--spacing-xxs);
5
46
  flex-wrap: wrap;
6
47
  margin-bottom: 2px;
7
48
  position: relative;
8
- `,K=n(M)`
49
+ `;
50
+ const StyledDescription = styled(Markdown) `
9
51
  font-size: var(--font-size-base);
10
52
  line-height: var(--line-height-base);
11
53
 
12
54
  article p:last-child {
13
55
  margin-bottom: 0;
14
56
  }
15
- `,Q=n.span`
57
+ `;
58
+ const Name = styled.span `
16
59
  position: relative;
17
60
  font-family: var(--font-family-monospaced);
18
61
  line-height: var(--line-height-base);
@@ -24,16 +67,18 @@ import{jsx as e,jsxs as p,Fragment as E}from"react/jsx-runtime";import{memo as T
24
67
  white-space: pre-wrap;
25
68
 
26
69
  :hover {
27
- ${L} {
70
+ ${LinkIcon} {
28
71
  opacity: 1;
29
72
  visibility: visible;
30
73
  background-color: var(--bg-color);
31
74
  }
32
75
  }
33
- `,U=n.span`
76
+ `;
77
+ const SchemaName = styled.span `
34
78
  font-family: var(--font-family-monospaced);
35
79
  font-weight: var(--font-weight-semibold);
36
80
  font-size: var(--schemas-property-name-font-size);
37
81
  line-height: var(--schemas-property-name-line-height);
38
82
  color: var(--text-color-primary);
39
- `;export{ue as FieldDetails};
83
+ `;
84
+ //# sourceMappingURL=FieldDetails.js.map
@@ -1 +1,21 @@
1
- import{jsx as r,Fragment as i,jsxs as l}from"react/jsx-runtime";import{useState as c}from"react";import{Tag as h,ToggleButton as m}from"../common/index.js";import{useTranslate as g}from"../../hooks/index.js";const n=45;function T({pattern:t}){const o=g(),[e,s]=c(!1);if(!t)return null;const a=()=>{s(!e)};return l(i,{children:[r(h,{children:e||t.length<n?t:`${t.slice(0,n)}...`}),t.length>n&&r(m,{onClick:a,children:e?o("openapi.hidePattern","Hide pattern"):o("openapi.showPattern","Show pattern")})]})}export{T as Pattern};
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { Tag, ToggleButton } from '../common/index.js';
4
+ import { useTranslate } from '../../hooks/index.js';
5
+ const MAX_PATTERN_LENGTH = 45;
6
+ export function Pattern({ pattern }) {
7
+ const translate = useTranslate();
8
+ const [isPatternShown, setIsPatternShown] = useState(false);
9
+ if (!pattern) {
10
+ return null;
11
+ }
12
+ const togglePattern = () => {
13
+ setIsPatternShown(!isPatternShown);
14
+ };
15
+ return (_jsxs(_Fragment, { children: [_jsx(Tag, { children: isPatternShown || pattern.length < MAX_PATTERN_LENGTH
16
+ ? pattern
17
+ : `${pattern.slice(0, MAX_PATTERN_LENGTH)}...` }), pattern.length > MAX_PATTERN_LENGTH && (_jsx(ToggleButton, { onClick: togglePattern, children: isPatternShown
18
+ ? translate('openapi.hidePattern', 'Hide pattern')
19
+ : translate('openapi.showPattern', 'Show pattern') }))] }));
20
+ }
21
+ //# sourceMappingURL=Pattern.js.map
@@ -1,10 +1,16 @@
1
- import{jsx as c}from"react/jsx-runtime";import{styled as i}from"../../styled-components.js";function s({sign:r,className:o,color:e}){return c(l,{className:o,color:e,children:r})}const l=i.span`
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { styled } from '../../styled-components.js';
3
+ export function CircleIcon({ sign, className, color }) {
4
+ return (_jsx(StyledCircleIcon, { className: className, color: color, children: sign }));
5
+ }
6
+ const StyledCircleIcon = styled.span `
2
7
  background-color: var(--bg-color);
3
8
  border-radius: 50%;
4
- border: 1px solid ${({color:r})=>r||"var(--border-color-primary)"};
9
+ border: 1px solid ${({ color }) => color || 'var(--border-color-primary)'};
5
10
  font-size: var(--font-size-lg);
6
11
  line-height: var(--font-size-lg);
7
- color: ${({color:r})=>r||"var(--text-color-secondary)"};
12
+ color: ${({ color }) => color || 'var(--text-color-secondary)'};
8
13
  width: 20px;
9
14
  height: 20px;
10
- `;export{s as CircleIcon};
15
+ `;
16
+ //# sourceMappingURL=PlusCircleIcon.js.map
@@ -1,8 +1,24 @@
1
- import{jsx as n,jsxs as g}from"react/jsx-runtime";import{memo as f}from"react";import{useAtomValue as u}from"jotai";import{Schema as x}from"../Schema/index.js";import{FieldDetails as k}from"./FieldDetails.js";import{generateDeepLink as w}from"../common/LinkToField.js";import{activeMimeNameAtom as D}from"../../jotai/app.js";import{styled as L}from"../../styled-components.js";function $({field:e,skipWriteOnly:m,skipReadOnly:p,level:d=1,showTitle:c,renderDiscriminatorSwitch:l,isFirst:h,fieldParentsName:o,disableDeepLinks:i,oneOfLevel:b,slug:r,onOneOfChange:v}){const y=u(D),t=i?void 0:w(e,y),a=r&&t?`${r}&${t.replace("#","")}`:t,s=!e.schema.isPrimitive&&!e.schema.isCircular;return g(O,{isFist:h,expanded:s,className:"property",children:[n(k,{field:e,renderDiscriminatorSwitch:l,deepLink:a,fieldParentsName:o}),s&&n(x,{schema:e.schema,skipReadOnly:p,skipWriteOnly:m,showTitle:c,expandable:!0,level:d+1,fieldParentsName:[...o||[],e.name],deepLink:a,required:e.required,disableDeepLinks:i,oneOfLevel:b,slug:r,onOneOfChange:v})]})}const M=f($),O=L.div`
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { useAtomValue } from 'jotai';
4
+ import { Schema } from '../Schema/index.js';
5
+ import { FieldDetails } from './FieldDetails.js';
6
+ import { generateDeepLink } from '../common/LinkToField.js';
7
+ import { activeMimeNameAtom } from '../../jotai/app.js';
8
+ import { styled } from '../../styled-components.js';
9
+ function PropertyDetailsComponent({ field, skipWriteOnly, skipReadOnly, level = 1, showTitle, renderDiscriminatorSwitch, isFirst, fieldParentsName, disableDeepLinks, oneOfLevel, slug, onOneOfChange, }) {
10
+ const activeMimeName = useAtomValue(activeMimeNameAtom);
11
+ const generatedDeepLink = disableDeepLinks ? undefined : generateDeepLink(field, activeMimeName);
12
+ const deepLink = slug && generatedDeepLink ? `${slug}&${generatedDeepLink.replace('#', '')}` : generatedDeepLink;
13
+ const withSubSchema = !field.schema.isPrimitive && !field.schema.isCircular;
14
+ return (_jsxs(Wrapper, { isFist: isFirst, expanded: withSubSchema, className: "property", children: [_jsx(FieldDetails, { field: field, renderDiscriminatorSwitch: renderDiscriminatorSwitch, deepLink: deepLink, fieldParentsName: fieldParentsName }), withSubSchema && (_jsx(Schema, { schema: field.schema, skipReadOnly: skipReadOnly, skipWriteOnly: skipWriteOnly, showTitle: showTitle, expandable: true, level: level + 1, fieldParentsName: [...(fieldParentsName || []), field.name], deepLink: deepLink, required: field.required, disableDeepLinks: disableDeepLinks, oneOfLevel: oneOfLevel, slug: slug, onOneOfChange: onOneOfChange }))] }));
15
+ }
16
+ export const PropertyDetails = memo(PropertyDetailsComponent);
17
+ const Wrapper = styled.div `
2
18
  width: 100%;
3
- padding: ${({isFist:e})=>`var(--schema-${e?"fist-":""}property-details-spacing)`} 0
4
- ${({expanded:e})=>e?0:"var(--schema-property-details-spacing)"};
5
- ${({expanded:e})=>!e&&"border-bottom: 1px solid var(--border-color-primary)"};
19
+ padding: ${({ isFist }) => `var(--schema-${isFist ? 'fist-' : ''}property-details-spacing)`} 0
20
+ ${({ expanded }) => (expanded ? 0 : 'var(--schema-property-details-spacing)')};
21
+ ${({ expanded }) => !expanded && 'border-bottom: 1px solid var(--border-color-primary)'};
6
22
 
7
23
  // This styles needs to override the dividers when array closing label is present
8
24
  &:has(+ span.array-closing-label) {
@@ -14,4 +30,5 @@ import{jsx as n,jsxs as g}from"react/jsx-runtime";import{memo as f}from"react";i
14
30
  padding-bottom: 0;
15
31
  }
16
32
  }
17
- `;export{M as PropertyDetails};
33
+ `;
34
+ //# sourceMappingURL=PropertyDetails.js.map
@@ -1,4 +1,11 @@
1
- import{jsx as a}from"react/jsx-runtime";import{styled as n}from"../../styled-components.js";function l({type:e,className:t}){return e?a(o,{className:t,"data-testid":"schema-type-info",children:e}):null}const o=n.em`
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { styled } from '../../styled-components.js';
3
+ export function SchemaTypeInfo({ type, className }) {
4
+ if (!type)
5
+ return null;
6
+ return (_jsx(FieldLabel, { className: className, "data-testid": "schema-type-info", children: type }));
7
+ }
8
+ const FieldLabel = styled.em `
2
9
  vertical-align: middle;
3
10
  color: var(--schema-type-text-color);
4
11
  font-size: var(--font-size-base);
@@ -12,4 +19,5 @@ import{jsx as a}from"react/jsx-runtime";import{styled as n}from"../../styled-com
12
19
  &:last-of-type:after {
13
20
  content: '';
14
21
  }
15
- `;export{l as SchemaTypeInfo};
22
+ `;
23
+ //# sourceMappingURL=SchemaTypeInfo.js.map
@@ -1,7 +1,18 @@
1
- import{jsxs as o,jsx as p}from"react/jsx-runtime";import{memo as l}from"react";import{FieldLabel as x,Tag as c,ToggleButton as d}from"../common/index.js";import{styled as g}from"../../styled-components.js";function u({enums:i,type:m,toggle:r,showToggleButton:s,toggleButtonText:t,translate:e}){return o(f,{"data-testid":"simple-enums",children:[o(x,{children:[m==="array"?e("openapi.items","Items"):""," ",i.length===1?e("openapi.value","Value"):e("openapi.enum","Enum")]}),i.map((n,a)=>p(c,{children:JSON.stringify(n)},n+a)),s?p(d,{onClick:r,children:t}):null]})}const w=l(u),f=g.div`
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { FieldLabel, Tag, ToggleButton } from '../common/index.js';
4
+ import { styled } from '../../styled-components.js';
5
+ export function SimpleEnumsComponent({ enums, type, toggle, showToggleButton, toggleButtonText, translate, }) {
6
+ return (_jsxs(Row, { "data-testid": "simple-enums", children: [_jsxs(FieldLabel, { children: [type === 'array' ? translate('openapi.items', 'Items') : '', ' ', enums.length === 1
7
+ ? translate('openapi.value', 'Value')
8
+ : translate('openapi.enum', 'Enum')] }), enums.map((value, idx) => (_jsx(Tag, { children: JSON.stringify(value) }, value + idx))), showToggleButton ? _jsx(ToggleButton, { onClick: toggle, children: toggleButtonText }) : null] }));
9
+ }
10
+ export const SimpleEnums = memo(SimpleEnumsComponent);
11
+ const Row = styled.div `
2
12
  display: flex;
3
13
  flex-wrap: wrap;
4
14
  align-items: center;
5
15
  gap: var(--spacing-xxs);
6
16
  margin-top: var(--spacing-xxs);
7
- `;export{w as SimpleEnums,u as SimpleEnumsComponent};
17
+ `;
18
+ //# sourceMappingURL=SimpleEnums.js.map