@verdaccio/ui-components 5.0.0-next-9.24 → 5.0.0-next-9.26

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 (296) hide show
  1. package/README.md +20 -0
  2. package/build/api/use-data.d.ts +2 -2
  3. package/build/api/use-data.js +2 -2
  4. package/build/api/use-data.js.map +1 -1
  5. package/build/api/use-data.mjs +2 -2
  6. package/build/api/use-data.mjs.map +1 -1
  7. package/build/components/CopyClipboard/CopyToClipBoard.d.ts +1 -0
  8. package/build/components/CopyClipboard/CopyToClipBoard.js +36 -17
  9. package/build/components/CopyClipboard/CopyToClipBoard.js.map +1 -1
  10. package/build/components/CopyClipboard/CopyToClipBoard.mjs +36 -19
  11. package/build/components/CopyClipboard/CopyToClipBoard.mjs.map +1 -1
  12. package/build/components/CopyClipboard/utils.d.ts +2 -1
  13. package/build/components/CopyClipboard/utils.js +6 -4
  14. package/build/components/CopyClipboard/utils.js.map +1 -1
  15. package/build/components/CopyClipboard/utils.mjs +6 -4
  16. package/build/components/CopyClipboard/utils.mjs.map +1 -1
  17. package/build/components/DocsLink/DocsLink.d.ts +8 -0
  18. package/build/components/DocsLink/DocsLink.js +40 -0
  19. package/build/components/DocsLink/DocsLink.js.map +1 -0
  20. package/build/components/DocsLink/DocsLink.mjs +35 -0
  21. package/build/components/DocsLink/DocsLink.mjs.map +1 -0
  22. package/build/components/DocsLink/index.d.ts +1 -0
  23. package/build/components/DocsLink/index.js +3 -0
  24. package/build/components/DocsLink/index.mjs +1 -0
  25. package/build/components/Help/Help.d.ts +13 -0
  26. package/build/components/Help/Help.js +280 -36
  27. package/build/components/Help/Help.js.map +1 -1
  28. package/build/components/Help/Help.mjs +274 -39
  29. package/build/components/Help/Help.mjs.map +1 -1
  30. package/build/components/Help/styles.d.ts +29 -0
  31. package/build/components/Help/styles.js +86 -1
  32. package/build/components/Help/styles.js.map +1 -1
  33. package/build/components/Help/styles.mjs +82 -2
  34. package/build/components/Help/styles.mjs.map +1 -1
  35. package/build/components/Icons/Managers/Bun.d.ts +2 -0
  36. package/build/components/Icons/Managers/Bun2.js +18 -0
  37. package/build/components/Icons/Managers/Bun2.js.map +1 -0
  38. package/build/components/Icons/Managers/Bun2.mjs +16 -0
  39. package/build/components/Icons/Managers/Bun2.mjs.map +1 -0
  40. package/build/components/Icons/Managers/bun.js +6 -0
  41. package/build/components/Icons/Managers/bun.js.map +1 -0
  42. package/build/components/Icons/Managers/bun.mjs +6 -0
  43. package/build/components/Icons/Managers/bun.mjs.map +1 -0
  44. package/build/components/Icons/Managers/bun.svg +1 -0
  45. package/build/components/Icons/Managers/index.d.ts +1 -0
  46. package/build/components/Icons/Managers/index.js +2 -0
  47. package/build/components/Icons/Managers/index.mjs +2 -1
  48. package/build/components/Icons/index.js +3 -0
  49. package/build/components/Icons/index.mjs +3 -1
  50. package/build/components/Install/Install.d.ts +2 -0
  51. package/build/components/Install/Install.js +30 -2
  52. package/build/components/Install/Install.js.map +1 -1
  53. package/build/components/Install/Install.mjs +30 -3
  54. package/build/components/Install/Install.mjs.map +1 -1
  55. package/build/components/Install/InstallListItem.d.ts +2 -1
  56. package/build/components/Install/InstallListItem.js +17 -0
  57. package/build/components/Install/InstallListItem.js.map +1 -1
  58. package/build/components/Install/InstallListItem.mjs +17 -0
  59. package/build/components/Install/InstallListItem.mjs.map +1 -1
  60. package/build/components/Loading/PackageListSkeleton.d.ts +3 -0
  61. package/build/components/Loading/PackageListSkeleton.js +70 -0
  62. package/build/components/Loading/PackageListSkeleton.js.map +1 -0
  63. package/build/components/Loading/PackageListSkeleton.mjs +65 -0
  64. package/build/components/Loading/PackageListSkeleton.mjs.map +1 -0
  65. package/build/components/Loading/VersionSkeleton.d.ts +3 -0
  66. package/build/components/Loading/VersionSkeleton.js +119 -0
  67. package/build/components/Loading/VersionSkeleton.js.map +1 -0
  68. package/build/components/Loading/VersionSkeleton.mjs +111 -0
  69. package/build/components/Loading/VersionSkeleton.mjs.map +1 -0
  70. package/build/components/Loading/index.d.ts +2 -0
  71. package/build/components/Loading/index.js +4 -0
  72. package/build/components/Loading/index.mjs +4 -1
  73. package/build/components/Package/Package.js +5 -1
  74. package/build/components/Package/Package.js.map +1 -1
  75. package/build/components/Package/Package.mjs +6 -2
  76. package/build/components/Package/Package.mjs.map +1 -1
  77. package/build/components/Package/styles.d.ts +3 -0
  78. package/build/components/Package/styles.js +8 -0
  79. package/build/components/Package/styles.js.map +1 -1
  80. package/build/components/Package/styles.mjs +8 -1
  81. package/build/components/Package/styles.mjs.map +1 -1
  82. package/build/components/PackageList/PackageList.js +4 -4
  83. package/build/components/PackageList/PackageList.js.map +1 -1
  84. package/build/components/PackageList/PackageList.mjs +5 -5
  85. package/build/components/PackageList/PackageList.mjs.map +1 -1
  86. package/build/components/PackageList/PackageListToolbar.d.ts +15 -0
  87. package/build/components/PackageList/PackageListToolbar.js +127 -0
  88. package/build/components/PackageList/PackageListToolbar.js.map +1 -0
  89. package/build/components/PackageList/PackageListToolbar.mjs +119 -0
  90. package/build/components/PackageList/PackageListToolbar.mjs.map +1 -0
  91. package/build/components/PackageList/filterPackages.d.ts +16 -0
  92. package/build/components/PackageList/filterPackages.js +37 -0
  93. package/build/components/PackageList/filterPackages.js.map +1 -0
  94. package/build/components/PackageList/filterPackages.mjs +34 -0
  95. package/build/components/PackageList/filterPackages.mjs.map +1 -0
  96. package/build/components/RegistryInfoDialog/RegistryInfoDialog.js +18 -7
  97. package/build/components/RegistryInfoDialog/RegistryInfoDialog.js.map +1 -1
  98. package/build/components/RegistryInfoDialog/RegistryInfoDialog.mjs +18 -7
  99. package/build/components/RegistryInfoDialog/RegistryInfoDialog.mjs.map +1 -1
  100. package/build/components/RegistryInfoDialog/types.d.ts +1 -0
  101. package/build/components/Search/AutoComplete/AutoComplete.d.ts +3 -0
  102. package/build/components/Search/AutoComplete/AutoComplete.js +3 -1
  103. package/build/components/Search/AutoComplete/AutoComplete.js.map +1 -1
  104. package/build/components/Search/AutoComplete/AutoComplete.mjs +3 -1
  105. package/build/components/Search/AutoComplete/AutoComplete.mjs.map +1 -1
  106. package/build/components/Search/Search.js +28 -1
  107. package/build/components/Search/Search.js.map +1 -1
  108. package/build/components/Search/Search.mjs +31 -5
  109. package/build/components/Search/Search.mjs.map +1 -1
  110. package/build/components/Search/SearchItem.d.ts +12 -1
  111. package/build/components/Search/SearchItem.js +53 -70
  112. package/build/components/Search/SearchItem.js.map +1 -1
  113. package/build/components/Search/SearchItem.mjs +51 -67
  114. package/build/components/Search/SearchItem.mjs.map +1 -1
  115. package/build/components/Search/utils.d.ts +10 -0
  116. package/build/components/Search/utils.js +28 -1
  117. package/build/components/Search/utils.js.map +1 -1
  118. package/build/components/Search/utils.mjs +26 -2
  119. package/build/components/Search/utils.mjs.map +1 -1
  120. package/build/components/SettingsMenu/SettingsMenu.js +2 -2
  121. package/build/components/SettingsMenu/SettingsMenu.mjs +1 -1
  122. package/build/components/Versions/Versions.js +8 -2
  123. package/build/components/Versions/Versions.js.map +1 -1
  124. package/build/components/Versions/Versions.mjs +8 -2
  125. package/build/components/Versions/Versions.mjs.map +1 -1
  126. package/build/components/VisuallyHidden/index.d.ts +5 -0
  127. package/build/components/VisuallyHidden/index.js +17 -0
  128. package/build/components/VisuallyHidden/index.js.map +1 -0
  129. package/build/components/VisuallyHidden/index.mjs +15 -0
  130. package/build/components/VisuallyHidden/index.mjs.map +1 -0
  131. package/build/configuration.js +2 -1
  132. package/build/configuration.js.map +1 -1
  133. package/build/configuration.mjs +2 -1
  134. package/build/configuration.mjs.map +1 -1
  135. package/build/i18n/crowdin/ui.js +68 -11
  136. package/build/i18n/crowdin/ui.js.map +1 -1
  137. package/build/i18n/crowdin/ui.json +64 -11
  138. package/build/i18n/crowdin/ui.mjs +67 -12
  139. package/build/i18n/crowdin/ui.mjs.map +1 -1
  140. package/build/i18n/download_translations/cs-CZ/ui.js +68 -11
  141. package/build/i18n/download_translations/cs-CZ/ui.js.map +1 -1
  142. package/build/i18n/download_translations/cs-CZ/ui.json +64 -11
  143. package/build/i18n/download_translations/cs-CZ/ui.mjs +67 -12
  144. package/build/i18n/download_translations/cs-CZ/ui.mjs.map +1 -1
  145. package/build/i18n/download_translations/de-DE/ui.js +68 -11
  146. package/build/i18n/download_translations/de-DE/ui.js.map +1 -1
  147. package/build/i18n/download_translations/de-DE/ui.json +64 -11
  148. package/build/i18n/download_translations/de-DE/ui.mjs +67 -12
  149. package/build/i18n/download_translations/de-DE/ui.mjs.map +1 -1
  150. package/build/i18n/download_translations/es-ES/ui.js +68 -11
  151. package/build/i18n/download_translations/es-ES/ui.js.map +1 -1
  152. package/build/i18n/download_translations/es-ES/ui.json +64 -11
  153. package/build/i18n/download_translations/es-ES/ui.mjs +67 -12
  154. package/build/i18n/download_translations/es-ES/ui.mjs.map +1 -1
  155. package/build/i18n/download_translations/fr-FR/ui.js +68 -11
  156. package/build/i18n/download_translations/fr-FR/ui.js.map +1 -1
  157. package/build/i18n/download_translations/fr-FR/ui.json +64 -11
  158. package/build/i18n/download_translations/fr-FR/ui.mjs +67 -12
  159. package/build/i18n/download_translations/fr-FR/ui.mjs.map +1 -1
  160. package/build/i18n/download_translations/ga-IE/ui.js +68 -11
  161. package/build/i18n/download_translations/ga-IE/ui.js.map +1 -1
  162. package/build/i18n/download_translations/ga-IE/ui.json +64 -11
  163. package/build/i18n/download_translations/ga-IE/ui.mjs +67 -12
  164. package/build/i18n/download_translations/ga-IE/ui.mjs.map +1 -1
  165. package/build/i18n/download_translations/gl-ES/ui.js +68 -11
  166. package/build/i18n/download_translations/gl-ES/ui.js.map +1 -1
  167. package/build/i18n/download_translations/gl-ES/ui.json +64 -11
  168. package/build/i18n/download_translations/gl-ES/ui.mjs +67 -12
  169. package/build/i18n/download_translations/gl-ES/ui.mjs.map +1 -1
  170. package/build/i18n/download_translations/it-IT/ui.js +68 -11
  171. package/build/i18n/download_translations/it-IT/ui.js.map +1 -1
  172. package/build/i18n/download_translations/it-IT/ui.json +64 -11
  173. package/build/i18n/download_translations/it-IT/ui.mjs +67 -12
  174. package/build/i18n/download_translations/it-IT/ui.mjs.map +1 -1
  175. package/build/i18n/download_translations/ko-KR/ui.js +68 -11
  176. package/build/i18n/download_translations/ko-KR/ui.js.map +1 -1
  177. package/build/i18n/download_translations/ko-KR/ui.json +64 -11
  178. package/build/i18n/download_translations/ko-KR/ui.mjs +67 -12
  179. package/build/i18n/download_translations/ko-KR/ui.mjs.map +1 -1
  180. package/build/i18n/download_translations/pl-PL/ui.js +68 -11
  181. package/build/i18n/download_translations/pl-PL/ui.js.map +1 -1
  182. package/build/i18n/download_translations/pl-PL/ui.json +64 -11
  183. package/build/i18n/download_translations/pl-PL/ui.mjs +67 -12
  184. package/build/i18n/download_translations/pl-PL/ui.mjs.map +1 -1
  185. package/build/i18n/download_translations/pt-BR/ui.js +68 -11
  186. package/build/i18n/download_translations/pt-BR/ui.js.map +1 -1
  187. package/build/i18n/download_translations/pt-BR/ui.json +64 -11
  188. package/build/i18n/download_translations/pt-BR/ui.mjs +67 -12
  189. package/build/i18n/download_translations/pt-BR/ui.mjs.map +1 -1
  190. package/build/i18n/download_translations/ru-RU/ui.js +68 -11
  191. package/build/i18n/download_translations/ru-RU/ui.js.map +1 -1
  192. package/build/i18n/download_translations/ru-RU/ui.json +64 -11
  193. package/build/i18n/download_translations/ru-RU/ui.mjs +67 -12
  194. package/build/i18n/download_translations/ru-RU/ui.mjs.map +1 -1
  195. package/build/i18n/download_translations/sr-CS/ui.js +66 -12
  196. package/build/i18n/download_translations/sr-CS/ui.js.map +1 -1
  197. package/build/i18n/download_translations/sr-CS/ui.json +64 -11
  198. package/build/i18n/download_translations/sr-CS/ui.mjs +66 -13
  199. package/build/i18n/download_translations/sr-CS/ui.mjs.map +1 -1
  200. package/build/i18n/download_translations/tr-TR/ui.js +68 -11
  201. package/build/i18n/download_translations/tr-TR/ui.js.map +1 -1
  202. package/build/i18n/download_translations/tr-TR/ui.json +64 -11
  203. package/build/i18n/download_translations/tr-TR/ui.mjs +67 -12
  204. package/build/i18n/download_translations/tr-TR/ui.mjs.map +1 -1
  205. package/build/i18n/download_translations/vi-VN/ui.js +66 -12
  206. package/build/i18n/download_translations/vi-VN/ui.js.map +1 -1
  207. package/build/i18n/download_translations/vi-VN/ui.json +64 -11
  208. package/build/i18n/download_translations/vi-VN/ui.mjs +66 -13
  209. package/build/i18n/download_translations/vi-VN/ui.mjs.map +1 -1
  210. package/build/i18n/download_translations/yo-NG/ui.js +66 -12
  211. package/build/i18n/download_translations/yo-NG/ui.js.map +1 -1
  212. package/build/i18n/download_translations/yo-NG/ui.json +64 -11
  213. package/build/i18n/download_translations/yo-NG/ui.mjs +66 -13
  214. package/build/i18n/download_translations/yo-NG/ui.mjs.map +1 -1
  215. package/build/i18n/download_translations/zh-CN/ui.js +68 -11
  216. package/build/i18n/download_translations/zh-CN/ui.js.map +1 -1
  217. package/build/i18n/download_translations/zh-CN/ui.json +64 -11
  218. package/build/i18n/download_translations/zh-CN/ui.mjs +67 -12
  219. package/build/i18n/download_translations/zh-CN/ui.mjs.map +1 -1
  220. package/build/i18n/download_translations/zh-TW/ui.js +68 -11
  221. package/build/i18n/download_translations/zh-TW/ui.js.map +1 -1
  222. package/build/i18n/download_translations/zh-TW/ui.json +64 -11
  223. package/build/i18n/download_translations/zh-TW/ui.mjs +67 -12
  224. package/build/i18n/download_translations/zh-TW/ui.mjs.map +1 -1
  225. package/build/i18n/loadTranslationFile.d.ts +2 -2
  226. package/build/i18n/loadTranslationFile.js +2 -2
  227. package/build/i18n/loadTranslationFile.js.map +1 -1
  228. package/build/i18n/loadTranslationFile.mjs +2 -2
  229. package/build/i18n/loadTranslationFile.mjs.map +1 -1
  230. package/build/index.d.ts +1 -0
  231. package/build/index.js +8 -0
  232. package/build/index.mjs +4 -2
  233. package/build/mockServiceWorker.js +1 -0
  234. package/build/pages/Version/Version.js +2 -2
  235. package/build/pages/Version/Version.js.map +1 -1
  236. package/build/pages/Version/Version.mjs +2 -2
  237. package/build/pages/Version/Version.mjs.map +1 -1
  238. package/build/providers/AppConfigurationProvider/AppConfigurationProvider.js +3 -1
  239. package/build/providers/AppConfigurationProvider/AppConfigurationProvider.js.map +1 -1
  240. package/build/providers/AppConfigurationProvider/AppConfigurationProvider.mjs +3 -1
  241. package/build/providers/AppConfigurationProvider/AppConfigurationProvider.mjs.map +1 -1
  242. package/build/providers/ManifestsProvider/ManifestsProvider.d.ts +3 -0
  243. package/build/providers/ManifestsProvider/ManifestsProvider.js +9 -2
  244. package/build/providers/ManifestsProvider/ManifestsProvider.js.map +1 -1
  245. package/build/providers/ManifestsProvider/ManifestsProvider.mjs +10 -4
  246. package/build/providers/ManifestsProvider/ManifestsProvider.mjs.map +1 -1
  247. package/build/sections/Detail/ContainerContent.js +8 -0
  248. package/build/sections/Detail/ContainerContent.js.map +1 -1
  249. package/build/sections/Detail/ContainerContent.mjs +8 -1
  250. package/build/sections/Detail/ContainerContent.mjs.map +1 -1
  251. package/build/sections/Detail/Detail.d.ts +3 -6
  252. package/build/sections/Detail/Detail.js +13 -14
  253. package/build/sections/Detail/Detail.js.map +1 -1
  254. package/build/sections/Detail/Detail.mjs +14 -15
  255. package/build/sections/Detail/Detail.mjs.map +1 -1
  256. package/build/sections/Detail/Tabs.d.ts +3 -2
  257. package/build/sections/Detail/Tabs.js +9 -4
  258. package/build/sections/Detail/Tabs.js.map +1 -1
  259. package/build/sections/Detail/Tabs.mjs +9 -4
  260. package/build/sections/Detail/Tabs.mjs.map +1 -1
  261. package/build/sections/Footer/Footer.js +24 -3
  262. package/build/sections/Footer/Footer.js.map +1 -1
  263. package/build/sections/Footer/Footer.mjs +24 -4
  264. package/build/sections/Footer/Footer.mjs.map +1 -1
  265. package/build/sections/Footer/styles.d.ts +6 -0
  266. package/build/sections/Footer/styles.js +21 -2
  267. package/build/sections/Footer/styles.js.map +1 -1
  268. package/build/sections/Footer/styles.mjs +21 -3
  269. package/build/sections/Footer/styles.mjs.map +1 -1
  270. package/build/sections/Header/HeaderSettingsDialog.js +39 -10
  271. package/build/sections/Header/HeaderSettingsDialog.js.map +1 -1
  272. package/build/sections/Header/HeaderSettingsDialog.mjs +39 -10
  273. package/build/sections/Header/HeaderSettingsDialog.mjs.map +1 -1
  274. package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.d.ts +1 -4
  275. package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.js +98 -15
  276. package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.js.map +1 -1
  277. package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.mjs +100 -15
  278. package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.mjs.map +1 -1
  279. package/build/sections/Home/Home.js +58 -2
  280. package/build/sections/Home/Home.js.map +1 -1
  281. package/build/sections/Home/Home.mjs +60 -4
  282. package/build/sections/Home/Home.mjs.map +1 -1
  283. package/build/utils/cli-utils.d.ts +10 -0
  284. package/build/utils/cli-utils.js +26 -0
  285. package/build/utils/cli-utils.js.map +1 -1
  286. package/build/utils/cli-utils.mjs +23 -1
  287. package/build/utils/cli-utils.mjs.map +1 -1
  288. package/build/utils/index.d.ts +1 -1
  289. package/build/utils/index.js +4 -0
  290. package/build/utils/index.mjs +2 -2
  291. package/build/utils/markdown.d.ts +6 -0
  292. package/build/utils/markdown.js +16 -0
  293. package/build/utils/markdown.js.map +1 -0
  294. package/build/utils/markdown.mjs +13 -0
  295. package/build/utils/markdown.mjs.map +1 -0
  296. package/package.json +8 -8
package/README.md CHANGED
@@ -91,6 +91,26 @@ const App: React.FC = () => {
91
91
  ``
92
92
  ```
93
93
 
94
+ ## Development
95
+
96
+ Storybook runs with `pnpm start` (port 6006). Stories mock the registry API with
97
+ [msw](https://mswjs.io), which serves the requests from a service worker in
98
+ `public/mockServiceWorker.js`.
99
+
100
+ ### Updating msw
101
+
102
+ The worker file is generated by msw and must match the installed version (`PACKAGE_VERSION` at the
103
+ top of the file). Whenever `msw` changes version in `package.json`:
104
+
105
+ 1. Regenerate the worker from this folder: `npx msw init public`.
106
+ 2. Unregister the old worker in the browser, otherwise it keeps serving the previous version: in
107
+ DevTools open **Application → Service Workers** for `localhost:6006` and click **Unregister**,
108
+ or run `navigator.serviceWorker.getRegistrations().then((rs) => rs.forEach((r) => r.unregister()))`
109
+ in the console.
110
+ 3. Reload the page (a hard reload, so the new worker is installed) and restart Storybook.
111
+
112
+ Commit the regenerated `public/mockServiceWorker.js` together with the version bump.
113
+
94
114
  ## Donations
95
115
 
96
116
  Verdaccio is run by **volunteers**; nobody is working full-time on it. If you find this project to be useful and would like to support its development, consider making a donation - **your logo might end up in this readme.** 😉
@@ -1,4 +1,4 @@
1
- import type { SWRResponse } from 'swr';
1
+ import type { SWRConfiguration, SWRResponse } from 'swr';
2
2
  import type { APIRoute } from '../utils/routes';
3
3
  export declare function buildUrl(basePath: string, route: APIRoute, packageName?: string, packageVersion?: string): string;
4
- export declare function useData<T>(basePath: string, route: APIRoute, packageName?: string, packageVersion?: string): Pick<SWRResponse<T>, 'data' | 'error' | 'isLoading' | 'mutate'>;
4
+ export declare function useData<T>(basePath: string, route: APIRoute, packageName?: string, packageVersion?: string, options?: SWRConfiguration<T>): Pick<SWRResponse<T>, 'data' | 'error' | 'isLoading' | 'mutate'>;
@@ -9,9 +9,9 @@ function buildUrl(basePath, route, packageName, packageVersion) {
9
9
  if (packageVersion) url += `?v=${encodeURIComponent(packageVersion)}`;
10
10
  return url;
11
11
  }
12
- function useData(basePath, route, packageName, packageVersion) {
12
+ function useData(basePath, route, packageName, packageVersion, options) {
13
13
  const url = buildUrl(basePath, route, packageName, packageVersion);
14
- const { data, error, isLoading, mutate } = (0, swr.default)(url, () => require_api.default.request(url));
14
+ const { data, error, isLoading, mutate } = (0, swr.default)(url, () => require_api.default.request(url), options);
15
15
  return {
16
16
  data,
17
17
  error,
@@ -1 +1 @@
1
- {"version":3,"file":"use-data.js","names":["useSWR","API"],"sources":["../../src/api/use-data.ts"],"sourcesContent":["import type { SWRResponse } from 'swr';\nimport useSWR from 'swr';\n\nimport API from '../store/api';\nimport type { APIRoute } from '../utils/routes';\n\nexport function buildUrl(\n basePath: string,\n route: APIRoute,\n packageName?: string,\n packageVersion?: string\n): string {\n let url = `${basePath}${route}`;\n if (packageName) {\n // encode each path segment (scoped names keep their `/`); characters like\n // `+` in build-metadata versions would otherwise be decoded as a space.\n // `@` stays literal: it is path-safe and the npm registry convention —\n // clients, proxies and test intercepts all expect `/@scope/pkg`\n url += packageName\n .split('/')\n .map((segment) => encodeURIComponent(segment).replace(/%40/g, '@'))\n .join('/');\n }\n if (packageVersion) {\n url += `?v=${encodeURIComponent(packageVersion)}`;\n }\n return url;\n}\n\nexport function useData<T>(\n basePath: string,\n route: APIRoute,\n packageName?: string,\n packageVersion?: string\n): Pick<SWRResponse<T>, 'data' | 'error' | 'isLoading' | 'mutate'> {\n const url = buildUrl(basePath, route, packageName, packageVersion);\n\n const { data, error, isLoading, mutate } = useSWR<T>(url, () => API.request<T>(url));\n\n return { data, error, isLoading, mutate };\n}\n"],"mappings":";;;;;AAMA,SAAgB,SACd,UACA,OACA,aACA,gBACQ;CACR,IAAI,MAAM,GAAG,WAAW;CACxB,IAAI,aAKF,OAAO,YACJ,MAAM,GAAG,CAAC,CACV,KAAK,YAAY,mBAAmB,OAAO,CAAC,CAAC,QAAQ,QAAQ,GAAG,CAAC,CAAC,CAClE,KAAK,GAAG;CAEb,IAAI,gBACF,OAAO,MAAM,mBAAmB,cAAc;CAEhD,OAAO;AACT;AAEA,SAAgB,QACd,UACA,OACA,aACA,gBACiE;CACjE,MAAM,MAAM,SAAS,UAAU,OAAO,aAAa,cAAc;CAEjE,MAAM,EAAE,MAAM,OAAO,WAAW,YAAA,GAAWA,IAAAA,QAAAA,CAAU,WAAWC,YAAAA,QAAI,QAAW,GAAG,CAAC;CAEnF,OAAO;EAAE;EAAM;EAAO;EAAW;CAAO;AAC1C"}
1
+ {"version":3,"file":"use-data.js","names":["useSWR","API"],"sources":["../../src/api/use-data.ts"],"sourcesContent":["import type { SWRConfiguration, SWRResponse } from 'swr';\nimport useSWR from 'swr';\n\nimport API from '../store/api';\nimport type { APIRoute } from '../utils/routes';\n\nexport function buildUrl(\n basePath: string,\n route: APIRoute,\n packageName?: string,\n packageVersion?: string\n): string {\n let url = `${basePath}${route}`;\n if (packageName) {\n // encode each path segment (scoped names keep their `/`); characters like\n // `+` in build-metadata versions would otherwise be decoded as a space.\n // `@` stays literal: it is path-safe and the npm registry convention —\n // clients, proxies and test intercepts all expect `/@scope/pkg`\n url += packageName\n .split('/')\n .map((segment) => encodeURIComponent(segment).replace(/%40/g, '@'))\n .join('/');\n }\n if (packageVersion) {\n url += `?v=${encodeURIComponent(packageVersion)}`;\n }\n return url;\n}\n\nexport function useData<T>(\n basePath: string,\n route: APIRoute,\n packageName?: string,\n packageVersion?: string,\n options?: SWRConfiguration<T>\n): Pick<SWRResponse<T>, 'data' | 'error' | 'isLoading' | 'mutate'> {\n const url = buildUrl(basePath, route, packageName, packageVersion);\n\n const { data, error, isLoading, mutate } = useSWR<T>(url, () => API.request<T>(url), options);\n\n return { data, error, isLoading, mutate };\n}\n"],"mappings":";;;;;AAMA,SAAgB,SACd,UACA,OACA,aACA,gBACQ;CACR,IAAI,MAAM,GAAG,WAAW;CACxB,IAAI,aAKF,OAAO,YACJ,MAAM,GAAG,CAAC,CACV,KAAK,YAAY,mBAAmB,OAAO,CAAC,CAAC,QAAQ,QAAQ,GAAG,CAAC,CAAC,CAClE,KAAK,GAAG;CAEb,IAAI,gBACF,OAAO,MAAM,mBAAmB,cAAc;CAEhD,OAAO;AACT;AAEA,SAAgB,QACd,UACA,OACA,aACA,gBACA,SACiE;CACjE,MAAM,MAAM,SAAS,UAAU,OAAO,aAAa,cAAc;CAEjE,MAAM,EAAE,MAAM,OAAO,WAAW,YAAA,GAAWA,IAAAA,QAAAA,CAAU,WAAWC,YAAAA,QAAI,QAAW,GAAG,GAAG,OAAO;CAE5F,OAAO;EAAE;EAAM;EAAO;EAAW;CAAO;AAC1C"}
@@ -7,9 +7,9 @@ function buildUrl(basePath, route, packageName, packageVersion) {
7
7
  if (packageVersion) url += `?v=${encodeURIComponent(packageVersion)}`;
8
8
  return url;
9
9
  }
10
- function useData(basePath, route, packageName, packageVersion) {
10
+ function useData(basePath, route, packageName, packageVersion, options) {
11
11
  const url = buildUrl(basePath, route, packageName, packageVersion);
12
- const { data, error, isLoading, mutate } = useSWR(url, () => api_default.request(url));
12
+ const { data, error, isLoading, mutate } = useSWR(url, () => api_default.request(url), options);
13
13
  return {
14
14
  data,
15
15
  error,
@@ -1 +1 @@
1
- {"version":3,"file":"use-data.mjs","names":["API"],"sources":["../../src/api/use-data.ts"],"sourcesContent":["import type { SWRResponse } from 'swr';\nimport useSWR from 'swr';\n\nimport API from '../store/api';\nimport type { APIRoute } from '../utils/routes';\n\nexport function buildUrl(\n basePath: string,\n route: APIRoute,\n packageName?: string,\n packageVersion?: string\n): string {\n let url = `${basePath}${route}`;\n if (packageName) {\n // encode each path segment (scoped names keep their `/`); characters like\n // `+` in build-metadata versions would otherwise be decoded as a space.\n // `@` stays literal: it is path-safe and the npm registry convention —\n // clients, proxies and test intercepts all expect `/@scope/pkg`\n url += packageName\n .split('/')\n .map((segment) => encodeURIComponent(segment).replace(/%40/g, '@'))\n .join('/');\n }\n if (packageVersion) {\n url += `?v=${encodeURIComponent(packageVersion)}`;\n }\n return url;\n}\n\nexport function useData<T>(\n basePath: string,\n route: APIRoute,\n packageName?: string,\n packageVersion?: string\n): Pick<SWRResponse<T>, 'data' | 'error' | 'isLoading' | 'mutate'> {\n const url = buildUrl(basePath, route, packageName, packageVersion);\n\n const { data, error, isLoading, mutate } = useSWR<T>(url, () => API.request<T>(url));\n\n return { data, error, isLoading, mutate };\n}\n"],"mappings":";;;AAMA,SAAgB,SACd,UACA,OACA,aACA,gBACQ;CACR,IAAI,MAAM,GAAG,WAAW;CACxB,IAAI,aAKF,OAAO,YACJ,MAAM,GAAG,CAAC,CACV,KAAK,YAAY,mBAAmB,OAAO,CAAC,CAAC,QAAQ,QAAQ,GAAG,CAAC,CAAC,CAClE,KAAK,GAAG;CAEb,IAAI,gBACF,OAAO,MAAM,mBAAmB,cAAc;CAEhD,OAAO;AACT;AAEA,SAAgB,QACd,UACA,OACA,aACA,gBACiE;CACjE,MAAM,MAAM,SAAS,UAAU,OAAO,aAAa,cAAc;CAEjE,MAAM,EAAE,MAAM,OAAO,WAAW,WAAW,OAAU,WAAWA,YAAI,QAAW,GAAG,CAAC;CAEnF,OAAO;EAAE;EAAM;EAAO;EAAW;CAAO;AAC1C"}
1
+ {"version":3,"file":"use-data.mjs","names":["API"],"sources":["../../src/api/use-data.ts"],"sourcesContent":["import type { SWRConfiguration, SWRResponse } from 'swr';\nimport useSWR from 'swr';\n\nimport API from '../store/api';\nimport type { APIRoute } from '../utils/routes';\n\nexport function buildUrl(\n basePath: string,\n route: APIRoute,\n packageName?: string,\n packageVersion?: string\n): string {\n let url = `${basePath}${route}`;\n if (packageName) {\n // encode each path segment (scoped names keep their `/`); characters like\n // `+` in build-metadata versions would otherwise be decoded as a space.\n // `@` stays literal: it is path-safe and the npm registry convention —\n // clients, proxies and test intercepts all expect `/@scope/pkg`\n url += packageName\n .split('/')\n .map((segment) => encodeURIComponent(segment).replace(/%40/g, '@'))\n .join('/');\n }\n if (packageVersion) {\n url += `?v=${encodeURIComponent(packageVersion)}`;\n }\n return url;\n}\n\nexport function useData<T>(\n basePath: string,\n route: APIRoute,\n packageName?: string,\n packageVersion?: string,\n options?: SWRConfiguration<T>\n): Pick<SWRResponse<T>, 'data' | 'error' | 'isLoading' | 'mutate'> {\n const url = buildUrl(basePath, route, packageName, packageVersion);\n\n const { data, error, isLoading, mutate } = useSWR<T>(url, () => API.request<T>(url), options);\n\n return { data, error, isLoading, mutate };\n}\n"],"mappings":";;;AAMA,SAAgB,SACd,UACA,OACA,aACA,gBACQ;CACR,IAAI,MAAM,GAAG,WAAW;CACxB,IAAI,aAKF,OAAO,YACJ,MAAM,GAAG,CAAC,CACV,KAAK,YAAY,mBAAmB,OAAO,CAAC,CAAC,QAAQ,QAAQ,GAAG,CAAC,CAAC,CAClE,KAAK,GAAG;CAEb,IAAI,gBACF,OAAO,MAAM,mBAAmB,cAAc;CAEhD,OAAO;AACT;AAEA,SAAgB,QACd,UACA,OACA,aACA,gBACA,SACiE;CACjE,MAAM,MAAM,SAAS,UAAU,OAAO,aAAa,cAAc;CAEjE,MAAM,EAAE,MAAM,OAAO,WAAW,WAAW,OAAU,WAAWA,YAAI,QAAW,GAAG,GAAG,OAAO;CAE5F,OAAO;EAAE;EAAM;EAAO;EAAW;CAAO;AAC1C"}
@@ -5,5 +5,6 @@ interface Props {
5
5
  dataTestId: string;
6
6
  children?: React.ReactNode;
7
7
  }
8
+ export declare const COPIED_FEEDBACK_MS = 2000;
8
9
  declare function CopyToClipBoard({ text, children, dataTestId, title, ...props }: Props): React.JSX.Element;
9
10
  export default CopyToClipBoard;
@@ -1,7 +1,10 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.js");
2
2
  const require_utils = require("./utils.js");
3
+ const require_index = require("../VisuallyHidden/index.js");
3
4
  let _emotion_styled = require("@emotion/styled");
4
5
  _emotion_styled = require_runtime.__toESM(_emotion_styled);
6
+ let _mui_icons_material_Check = require("@mui/icons-material/Check");
7
+ _mui_icons_material_Check = require_runtime.__toESM(_mui_icons_material_Check);
5
8
  let _mui_icons_material_FileCopy = require("@mui/icons-material/FileCopy");
6
9
  _mui_icons_material_FileCopy = require_runtime.__toESM(_mui_icons_material_FileCopy);
7
10
  let _mui_material_IconButton = require("@mui/material/IconButton");
@@ -13,6 +16,7 @@ react = require_runtime.__toESM(react);
13
16
  let react_i18next = require("react-i18next");
14
17
  let react_jsx_runtime = require("react/jsx-runtime");
15
18
  //#region src/components/CopyClipboard/CopyToClipBoard.tsx
19
+ var COPIED_FEEDBACK_MS = 2e3;
16
20
  var Wrapper = (0, _emotion_styled.default)("div")({
17
21
  display: "flex",
18
22
  alignItems: "center",
@@ -28,29 +32,44 @@ var Content = (0, _emotion_styled.default)("span")(({ theme }) => ({
28
32
  }));
29
33
  function CopyToClipBoard({ text, children, dataTestId, title, ...props }) {
30
34
  const { t } = (0, react_i18next.useTranslation)();
31
- const accessibleName = title ?? t("copy-to-clipboard");
35
+ const [copied, setCopied] = (0, react.useState)(false);
36
+ const accessibleName = copied ? t("copy-to-clipboard-done") : title ?? t("copy-to-clipboard");
37
+ (0, react.useEffect)(() => {
38
+ if (!copied) return;
39
+ const timer = setTimeout(() => setCopied(false), COPIED_FEEDBACK_MS);
40
+ return () => clearTimeout(timer);
41
+ }, [copied]);
42
+ const handleCopy = (event) => {
43
+ require_utils.copyToClipBoardUtility(text)(event).then((ok) => setCopied(ok));
44
+ };
45
+ const button = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material_IconButton.default, {
46
+ "aria-label": accessibleName,
47
+ "data-testid": dataTestId,
48
+ onClick: handleCopy,
49
+ size: "small",
50
+ children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_icons_material_Check.default, {
51
+ color: "success",
52
+ fontSize: "small"
53
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_icons_material_FileCopy.default, { fontSize: "small" })
54
+ });
32
55
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Wrapper, {
33
56
  ...props,
34
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Content, { children: children ?? text }), title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material_Tooltip.default, {
35
- disableFocusListener: true,
36
- title,
37
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material_IconButton.default, {
38
- "aria-label": accessibleName,
39
- "data-testid": dataTestId,
40
- onClick: require_utils.copyToClipBoardUtility(text),
41
- size: "small",
42
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_icons_material_FileCopy.default, { fontSize: "small" })
57
+ children: [
58
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Content, { children: children ?? text }),
59
+ title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material_Tooltip.default, {
60
+ disableFocusListener: true,
61
+ title: copied ? t("copy-to-clipboard-done") : title,
62
+ children: button
63
+ }) : button,
64
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.VisuallyHidden, {
65
+ "aria-live": "polite",
66
+ children: copied ? t("copy-to-clipboard-done") : ""
43
67
  })
44
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material_IconButton.default, {
45
- "aria-label": accessibleName,
46
- "data-testid": dataTestId,
47
- onClick: require_utils.copyToClipBoardUtility(text),
48
- size: "small",
49
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_icons_material_FileCopy.default, { fontSize: "small" })
50
- })]
68
+ ]
51
69
  });
52
70
  }
53
71
  //#endregion
72
+ exports.COPIED_FEEDBACK_MS = COPIED_FEEDBACK_MS;
54
73
  exports.default = CopyToClipBoard;
55
74
 
56
75
  //# sourceMappingURL=CopyToClipBoard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CopyToClipBoard.js","names":["styled","useTranslation","Tooltip","IconButton","copyToClipBoardUtility","FileCopy"],"sources":["../../../src/components/CopyClipboard/CopyToClipBoard.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport FileCopy from '@mui/icons-material/FileCopy';\nimport IconButton from '@mui/material/IconButton';\nimport Tooltip from '@mui/material/Tooltip';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport { copyToClipBoardUtility } from './utils';\n\ninterface Props {\n text: string;\n title?: string;\n dataTestId: string;\n children?: React.ReactNode;\n}\n\nconst Wrapper = styled('div')({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n});\n\nconst Content = styled('span')<{ theme?: Theme }>(({ theme }) => ({\n display: 'inline-block',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n height: 'auto',\n whiteSpace: 'break-spaces',\n fontSize: theme.fontSize.sm,\n}));\n\nfunction CopyToClipBoard({ text, children, dataTestId, title, ...props }: Props) {\n const { t } = useTranslation();\n // without a title the icon button had no accessible name at all\n const accessibleName = title ?? t('copy-to-clipboard');\n return (\n <Wrapper {...props}>\n <Content>{children ?? text}</Content>\n {title ? (\n <Tooltip disableFocusListener={true} title={title}>\n <IconButton\n aria-label={accessibleName}\n data-testid={dataTestId}\n onClick={copyToClipBoardUtility(text)}\n size=\"small\"\n >\n <FileCopy fontSize=\"small\" />\n </IconButton>\n </Tooltip>\n ) : (\n <IconButton\n aria-label={accessibleName}\n data-testid={dataTestId}\n onClick={copyToClipBoardUtility(text)}\n size=\"small\"\n >\n <FileCopy fontSize=\"small\" />\n </IconButton>\n )}\n </Wrapper>\n );\n}\n\nexport default CopyToClipBoard;\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,IAAM,WAAA,GAAUA,gBAAAA,QAAAA,CAAO,KAAK,CAAC,CAAC;CAC5B,SAAS;CACT,YAAY;CACZ,gBAAgB;AAClB,CAAC;AAED,IAAM,WAAA,GAAUA,gBAAAA,QAAAA,CAAO,MAAM,CAAC,EAAqB,EAAE,aAAa;CAChE,SAAS;CACT,UAAU;CACV,cAAc;CACd,QAAQ;CACR,YAAY;CACZ,UAAU,MAAM,SAAS;AAC3B,EAAE;AAEF,SAAS,gBAAgB,EAAE,MAAM,UAAU,YAAY,OAAO,GAAG,SAAgB;CAC/E,MAAM,EAAE,OAAA,GAAMC,cAAAA,eAAAA,CAAe;CAE7B,MAAM,iBAAiB,SAAS,EAAE,mBAAmB;CACrD,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,SAAD;EAAS,GAAI;EAAb,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD,EAAA,UAAU,YAAY,KAAc,CAAA,GACnC,QACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,SAAD;GAAS,sBAAsB;GAAa;GAC1C,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,yBAAAA,SAAD;IACE,cAAY;IACZ,eAAa;IACb,SAASC,cAAAA,uBAAuB,IAAI;IACpC,MAAK;IAEL,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,SAAD,EAAU,UAAS,QAAS,CAAA;GAClB,CAAA;EACL,CAAA,IAET,iBAAA,GAAA,kBAAA,IAAA,CAACF,yBAAAA,SAAD;GACE,cAAY;GACZ,eAAa;GACb,SAASC,cAAAA,uBAAuB,IAAI;GACpC,MAAK;GAEL,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,SAAD,EAAU,UAAS,QAAS,CAAA;EAClB,CAAA,CAEP;;AAEb"}
1
+ {"version":3,"file":"CopyToClipBoard.js","names":["styled","useTranslation","useState","IconButton","Check","FileCopy","Tooltip","VisuallyHidden"],"sources":["../../../src/components/CopyClipboard/CopyToClipBoard.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Check from '@mui/icons-material/Check';\nimport FileCopy from '@mui/icons-material/FileCopy';\nimport IconButton from '@mui/material/IconButton';\nimport Tooltip from '@mui/material/Tooltip';\nimport React, { useEffect, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport { copyToClipBoardUtility } from './utils';\nimport { VisuallyHidden } from '../VisuallyHidden';\n\ninterface Props {\n text: string;\n title?: string;\n dataTestId: string;\n children?: React.ReactNode;\n}\n\nexport const COPIED_FEEDBACK_MS = 2000;\n\nconst Wrapper = styled('div')({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n});\n\nconst Content = styled('span')<{ theme?: Theme }>(({ theme }) => ({\n display: 'inline-block',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n height: 'auto',\n whiteSpace: 'break-spaces',\n fontSize: theme.fontSize.sm,\n}));\n\nfunction CopyToClipBoard({ text, children, dataTestId, title, ...props }: Props) {\n const { t } = useTranslation();\n const [copied, setCopied] = useState(false);\n // without a title the icon button had no accessible name at all\n const accessibleName = copied ? t('copy-to-clipboard-done') : (title ?? t('copy-to-clipboard'));\n\n useEffect(() => {\n if (!copied) {\n return;\n }\n const timer = setTimeout(() => setCopied(false), COPIED_FEEDBACK_MS);\n return () => clearTimeout(timer);\n }, [copied]);\n\n const handleCopy = (event: React.SyntheticEvent<HTMLElement>) => {\n // announce the copy only when the clipboard really changed\n copyToClipBoardUtility(text)(event).then((ok) => setCopied(ok));\n };\n\n const button = (\n <IconButton\n aria-label={accessibleName}\n data-testid={dataTestId}\n onClick={handleCopy}\n size=\"small\"\n >\n {copied ? <Check color=\"success\" fontSize=\"small\" /> : <FileCopy fontSize=\"small\" />}\n </IconButton>\n );\n\n return (\n <Wrapper {...props}>\n <Content>{children ?? text}</Content>\n {title ? (\n <Tooltip disableFocusListener={true} title={copied ? t('copy-to-clipboard-done') : title}>\n {button}\n </Tooltip>\n ) : (\n button\n )}\n <VisuallyHidden aria-live=\"polite\">\n {copied ? t('copy-to-clipboard-done') : ''}\n </VisuallyHidden>\n </Wrapper>\n );\n}\n\nexport default CopyToClipBoard;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,IAAa,qBAAqB;AAElC,IAAM,WAAA,GAAUA,gBAAAA,QAAAA,CAAO,KAAK,CAAC,CAAC;CAC5B,SAAS;CACT,YAAY;CACZ,gBAAgB;AAClB,CAAC;AAED,IAAM,WAAA,GAAUA,gBAAAA,QAAAA,CAAO,MAAM,CAAC,EAAqB,EAAE,aAAa;CAChE,SAAS;CACT,UAAU;CACV,cAAc;CACd,QAAQ;CACR,YAAY;CACZ,UAAU,MAAM,SAAS;AAC3B,EAAE;AAEF,SAAS,gBAAgB,EAAE,MAAM,UAAU,YAAY,OAAO,GAAG,SAAgB;CAC/E,MAAM,EAAE,OAAA,GAAMC,cAAAA,eAAAA,CAAe;CAC7B,MAAM,CAAC,QAAQ,cAAA,GAAaC,MAAAA,SAAAA,CAAS,KAAK;CAE1C,MAAM,iBAAiB,SAAS,EAAE,wBAAwB,IAAK,SAAS,EAAE,mBAAmB;CAE7F,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,IAAI,CAAC,QACH;EAEF,MAAM,QAAQ,iBAAiB,UAAU,KAAK,GAAG,kBAAkB;EACnE,aAAa,aAAa,KAAK;CACjC,GAAG,CAAC,MAAM,CAAC;CAEX,MAAM,cAAc,UAA6C;EAE/D,cAAA,uBAAuB,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,OAAO,UAAU,EAAE,CAAC;CAChE;CAEA,MAAM,SACJ,iBAAA,GAAA,kBAAA,IAAA,CAACC,yBAAAA,SAAD;EACE,cAAY;EACZ,eAAa;EACb,SAAS;EACT,MAAK;EAEJ,UAAA,SAAS,iBAAA,GAAA,kBAAA,IAAA,CAACC,0BAAAA,SAAD;GAAO,OAAM;GAAU,UAAS;EAAS,CAAA,IAAI,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,SAAD,EAAU,UAAS,QAAS,CAAA;CACzE,CAAA;CAGd,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,SAAD;EAAS,GAAI;EAAb,UAAA;GACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD,EAAA,UAAU,YAAY,KAAc,CAAA;GACnC,QACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,SAAD;IAAS,sBAAsB;IAAM,OAAO,SAAS,EAAE,wBAAwB,IAAI;IAChF,UAAA;GACM,CAAA,IAET;GAEF,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,gBAAD;IAAgB,aAAU;IACvB,UAAA,SAAS,EAAE,wBAAwB,IAAI;GAC1B,CAAA;EACT;;AAEb"}
@@ -1,12 +1,15 @@
1
1
  import { copyToClipBoardUtility } from "./utils.mjs";
2
+ import { VisuallyHidden } from "../VisuallyHidden/index.mjs";
2
3
  import styled from "@emotion/styled";
4
+ import Check from "@mui/icons-material/Check";
3
5
  import FileCopy from "@mui/icons-material/FileCopy";
4
6
  import IconButton from "@mui/material/IconButton";
5
7
  import Tooltip from "@mui/material/Tooltip";
6
- import "react";
8
+ import { useEffect, useState } from "react";
7
9
  import { useTranslation } from "react-i18next";
8
10
  import { jsx, jsxs } from "react/jsx-runtime";
9
11
  //#region src/components/CopyClipboard/CopyToClipBoard.tsx
12
+ var COPIED_FEEDBACK_MS = 2e3;
10
13
  var Wrapper = styled("div")({
11
14
  display: "flex",
12
15
  alignItems: "center",
@@ -22,29 +25,43 @@ var Content = styled("span")(({ theme }) => ({
22
25
  }));
23
26
  function CopyToClipBoard({ text, children, dataTestId, title, ...props }) {
24
27
  const { t } = useTranslation();
25
- const accessibleName = title ?? t("copy-to-clipboard");
28
+ const [copied, setCopied] = useState(false);
29
+ const accessibleName = copied ? t("copy-to-clipboard-done") : title ?? t("copy-to-clipboard");
30
+ useEffect(() => {
31
+ if (!copied) return;
32
+ const timer = setTimeout(() => setCopied(false), COPIED_FEEDBACK_MS);
33
+ return () => clearTimeout(timer);
34
+ }, [copied]);
35
+ const handleCopy = (event) => {
36
+ copyToClipBoardUtility(text)(event).then((ok) => setCopied(ok));
37
+ };
38
+ const button = /* @__PURE__ */ jsx(IconButton, {
39
+ "aria-label": accessibleName,
40
+ "data-testid": dataTestId,
41
+ onClick: handleCopy,
42
+ size: "small",
43
+ children: copied ? /* @__PURE__ */ jsx(Check, {
44
+ color: "success",
45
+ fontSize: "small"
46
+ }) : /* @__PURE__ */ jsx(FileCopy, { fontSize: "small" })
47
+ });
26
48
  return /* @__PURE__ */ jsxs(Wrapper, {
27
49
  ...props,
28
- children: [/* @__PURE__ */ jsx(Content, { children: children ?? text }), title ? /* @__PURE__ */ jsx(Tooltip, {
29
- disableFocusListener: true,
30
- title,
31
- children: /* @__PURE__ */ jsx(IconButton, {
32
- "aria-label": accessibleName,
33
- "data-testid": dataTestId,
34
- onClick: copyToClipBoardUtility(text),
35
- size: "small",
36
- children: /* @__PURE__ */ jsx(FileCopy, { fontSize: "small" })
50
+ children: [
51
+ /* @__PURE__ */ jsx(Content, { children: children ?? text }),
52
+ title ? /* @__PURE__ */ jsx(Tooltip, {
53
+ disableFocusListener: true,
54
+ title: copied ? t("copy-to-clipboard-done") : title,
55
+ children: button
56
+ }) : button,
57
+ /* @__PURE__ */ jsx(VisuallyHidden, {
58
+ "aria-live": "polite",
59
+ children: copied ? t("copy-to-clipboard-done") : ""
37
60
  })
38
- }) : /* @__PURE__ */ jsx(IconButton, {
39
- "aria-label": accessibleName,
40
- "data-testid": dataTestId,
41
- onClick: copyToClipBoardUtility(text),
42
- size: "small",
43
- children: /* @__PURE__ */ jsx(FileCopy, { fontSize: "small" })
44
- })]
61
+ ]
45
62
  });
46
63
  }
47
64
  //#endregion
48
- export { CopyToClipBoard as default };
65
+ export { COPIED_FEEDBACK_MS, CopyToClipBoard as default };
49
66
 
50
67
  //# sourceMappingURL=CopyToClipBoard.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CopyToClipBoard.mjs","names":[],"sources":["../../../src/components/CopyClipboard/CopyToClipBoard.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport FileCopy from '@mui/icons-material/FileCopy';\nimport IconButton from '@mui/material/IconButton';\nimport Tooltip from '@mui/material/Tooltip';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport { copyToClipBoardUtility } from './utils';\n\ninterface Props {\n text: string;\n title?: string;\n dataTestId: string;\n children?: React.ReactNode;\n}\n\nconst Wrapper = styled('div')({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n});\n\nconst Content = styled('span')<{ theme?: Theme }>(({ theme }) => ({\n display: 'inline-block',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n height: 'auto',\n whiteSpace: 'break-spaces',\n fontSize: theme.fontSize.sm,\n}));\n\nfunction CopyToClipBoard({ text, children, dataTestId, title, ...props }: Props) {\n const { t } = useTranslation();\n // without a title the icon button had no accessible name at all\n const accessibleName = title ?? t('copy-to-clipboard');\n return (\n <Wrapper {...props}>\n <Content>{children ?? text}</Content>\n {title ? (\n <Tooltip disableFocusListener={true} title={title}>\n <IconButton\n aria-label={accessibleName}\n data-testid={dataTestId}\n onClick={copyToClipBoardUtility(text)}\n size=\"small\"\n >\n <FileCopy fontSize=\"small\" />\n </IconButton>\n </Tooltip>\n ) : (\n <IconButton\n aria-label={accessibleName}\n data-testid={dataTestId}\n onClick={copyToClipBoardUtility(text)}\n size=\"small\"\n >\n <FileCopy fontSize=\"small\" />\n </IconButton>\n )}\n </Wrapper>\n );\n}\n\nexport default CopyToClipBoard;\n"],"mappings":";;;;;;;;;AAiBA,IAAM,UAAU,OAAO,KAAK,CAAC,CAAC;CAC5B,SAAS;CACT,YAAY;CACZ,gBAAgB;AAClB,CAAC;AAED,IAAM,UAAU,OAAO,MAAM,CAAC,EAAqB,EAAE,aAAa;CAChE,SAAS;CACT,UAAU;CACV,cAAc;CACd,QAAQ;CACR,YAAY;CACZ,UAAU,MAAM,SAAS;AAC3B,EAAE;AAEF,SAAS,gBAAgB,EAAE,MAAM,UAAU,YAAY,OAAO,GAAG,SAAgB;CAC/E,MAAM,EAAE,MAAM,eAAe;CAE7B,MAAM,iBAAiB,SAAS,EAAE,mBAAmB;CACrD,OACE,qBAAC,SAAD;EAAS,GAAI;EAAb,UAAA,CACE,oBAAC,SAAD,EAAA,UAAU,YAAY,KAAc,CAAA,GACnC,QACC,oBAAC,SAAD;GAAS,sBAAsB;GAAa;GAC1C,UAAA,oBAAC,YAAD;IACE,cAAY;IACZ,eAAa;IACb,SAAS,uBAAuB,IAAI;IACpC,MAAK;IAEL,UAAA,oBAAC,UAAD,EAAU,UAAS,QAAS,CAAA;GAClB,CAAA;EACL,CAAA,IAET,oBAAC,YAAD;GACE,cAAY;GACZ,eAAa;GACb,SAAS,uBAAuB,IAAI;GACpC,MAAK;GAEL,UAAA,oBAAC,UAAD,EAAU,UAAS,QAAS,CAAA;EAClB,CAAA,CAEP;;AAEb"}
1
+ {"version":3,"file":"CopyToClipBoard.mjs","names":[],"sources":["../../../src/components/CopyClipboard/CopyToClipBoard.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Check from '@mui/icons-material/Check';\nimport FileCopy from '@mui/icons-material/FileCopy';\nimport IconButton from '@mui/material/IconButton';\nimport Tooltip from '@mui/material/Tooltip';\nimport React, { useEffect, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport { copyToClipBoardUtility } from './utils';\nimport { VisuallyHidden } from '../VisuallyHidden';\n\ninterface Props {\n text: string;\n title?: string;\n dataTestId: string;\n children?: React.ReactNode;\n}\n\nexport const COPIED_FEEDBACK_MS = 2000;\n\nconst Wrapper = styled('div')({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n});\n\nconst Content = styled('span')<{ theme?: Theme }>(({ theme }) => ({\n display: 'inline-block',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n height: 'auto',\n whiteSpace: 'break-spaces',\n fontSize: theme.fontSize.sm,\n}));\n\nfunction CopyToClipBoard({ text, children, dataTestId, title, ...props }: Props) {\n const { t } = useTranslation();\n const [copied, setCopied] = useState(false);\n // without a title the icon button had no accessible name at all\n const accessibleName = copied ? t('copy-to-clipboard-done') : (title ?? t('copy-to-clipboard'));\n\n useEffect(() => {\n if (!copied) {\n return;\n }\n const timer = setTimeout(() => setCopied(false), COPIED_FEEDBACK_MS);\n return () => clearTimeout(timer);\n }, [copied]);\n\n const handleCopy = (event: React.SyntheticEvent<HTMLElement>) => {\n // announce the copy only when the clipboard really changed\n copyToClipBoardUtility(text)(event).then((ok) => setCopied(ok));\n };\n\n const button = (\n <IconButton\n aria-label={accessibleName}\n data-testid={dataTestId}\n onClick={handleCopy}\n size=\"small\"\n >\n {copied ? <Check color=\"success\" fontSize=\"small\" /> : <FileCopy fontSize=\"small\" />}\n </IconButton>\n );\n\n return (\n <Wrapper {...props}>\n <Content>{children ?? text}</Content>\n {title ? (\n <Tooltip disableFocusListener={true} title={copied ? t('copy-to-clipboard-done') : title}>\n {button}\n </Tooltip>\n ) : (\n button\n )}\n <VisuallyHidden aria-live=\"polite\">\n {copied ? t('copy-to-clipboard-done') : ''}\n </VisuallyHidden>\n </Wrapper>\n );\n}\n\nexport default CopyToClipBoard;\n"],"mappings":";;;;;;;;;;;AAmBA,IAAa,qBAAqB;AAElC,IAAM,UAAU,OAAO,KAAK,CAAC,CAAC;CAC5B,SAAS;CACT,YAAY;CACZ,gBAAgB;AAClB,CAAC;AAED,IAAM,UAAU,OAAO,MAAM,CAAC,EAAqB,EAAE,aAAa;CAChE,SAAS;CACT,UAAU;CACV,cAAc;CACd,QAAQ;CACR,YAAY;CACZ,UAAU,MAAM,SAAS;AAC3B,EAAE;AAEF,SAAS,gBAAgB,EAAE,MAAM,UAAU,YAAY,OAAO,GAAG,SAAgB;CAC/E,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK;CAE1C,MAAM,iBAAiB,SAAS,EAAE,wBAAwB,IAAK,SAAS,EAAE,mBAAmB;CAE7F,gBAAgB;EACd,IAAI,CAAC,QACH;EAEF,MAAM,QAAQ,iBAAiB,UAAU,KAAK,GAAG,kBAAkB;EACnE,aAAa,aAAa,KAAK;CACjC,GAAG,CAAC,MAAM,CAAC;CAEX,MAAM,cAAc,UAA6C;EAE/D,uBAAuB,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,OAAO,UAAU,EAAE,CAAC;CAChE;CAEA,MAAM,SACJ,oBAAC,YAAD;EACE,cAAY;EACZ,eAAa;EACb,SAAS;EACT,MAAK;EAEJ,UAAA,SAAS,oBAAC,OAAD;GAAO,OAAM;GAAU,UAAS;EAAS,CAAA,IAAI,oBAAC,UAAD,EAAU,UAAS,QAAS,CAAA;CACzE,CAAA;CAGd,OACE,qBAAC,SAAD;EAAS,GAAI;EAAb,UAAA;GACE,oBAAC,SAAD,EAAA,UAAU,YAAY,KAAc,CAAA;GACnC,QACC,oBAAC,SAAD;IAAS,sBAAsB;IAAM,OAAO,SAAS,EAAE,wBAAwB,IAAI;IAChF,UAAA;GACM,CAAA,IAET;GAEF,oBAAC,gBAAD;IAAgB,aAAU;IACvB,UAAA,SAAS,EAAE,wBAAwB,IAAI;GAC1B,CAAA;EACT;;AAEb"}
@@ -1,2 +1,3 @@
1
1
  import type { SyntheticEvent } from 'react';
2
- export declare const copyToClipBoardUtility: (str: string) => ((e: SyntheticEvent<HTMLElement>) => void);
2
+ /** Copies `str`; resolves to whether the clipboard actually changed. */
3
+ export declare const copyToClipBoardUtility: (str: string) => ((e: SyntheticEvent<HTMLElement>) => Promise<boolean>);
@@ -1,6 +1,6 @@
1
1
  //#region src/components/CopyClipboard/utils.ts
2
2
  function execCommandCopy(str) {
3
- if (!document.body) return;
3
+ if (!document.body) return false;
4
4
  const textarea = document.createElement("textarea");
5
5
  textarea.value = str;
6
6
  textarea.style.position = "fixed";
@@ -8,13 +8,15 @@ function execCommandCopy(str) {
8
8
  textarea.setAttribute("readonly", "");
9
9
  document.body.appendChild(textarea);
10
10
  textarea.select();
11
- document.execCommand("copy");
11
+ const copied = document.execCommand?.("copy") ?? false;
12
12
  document.body.removeChild(textarea);
13
+ return copied;
13
14
  }
15
+ /** Copies `str`; resolves to whether the clipboard actually changed. */
14
16
  var copyToClipBoardUtility = (str) => (event) => {
15
17
  event.preventDefault();
16
- if (navigator.clipboard?.writeText) navigator.clipboard.writeText(str).catch(() => execCommandCopy(str));
17
- else execCommandCopy(str);
18
+ if (navigator.clipboard?.writeText) return navigator.clipboard.writeText(str).then(() => true, () => execCommandCopy(str));
19
+ return Promise.resolve(execCommandCopy(str));
18
20
  };
19
21
  //#endregion
20
22
  exports.copyToClipBoardUtility = copyToClipBoardUtility;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":[],"sources":["../../../src/components/CopyClipboard/utils.ts"],"sourcesContent":["import type { SyntheticEvent } from 'react';\n\n// clipboard-api-free fallback: outside a secure context (plain-http deployments,\n// very common for LAN registries) `navigator.clipboard` is undefined. The\n// hidden-textarea approach needs no Selection/Range juggling — and\n// window.getSelection() can legitimately return null.\nfunction execCommandCopy(str: string): void {\n if (!document.body) {\n return;\n }\n const textarea = document.createElement('textarea');\n textarea.value = str;\n // keep it out of sight without display:none (which would prevent selection)\n textarea.style.position = 'fixed';\n textarea.style.opacity = '0';\n textarea.setAttribute('readonly', '');\n document.body.appendChild(textarea);\n textarea.select();\n document.execCommand('copy');\n document.body.removeChild(textarea);\n}\n\nexport const copyToClipBoardUtility =\n (str: string): ((e: SyntheticEvent<HTMLElement>) => void) =>\n (event: SyntheticEvent<HTMLElement>): void => {\n event.preventDefault();\n\n if (navigator.clipboard?.writeText) {\n navigator.clipboard.writeText(str).catch(() => execCommandCopy(str));\n } else {\n execCommandCopy(str);\n }\n };\n"],"mappings":";AAMA,SAAS,gBAAgB,KAAmB;CAC1C,IAAI,CAAC,SAAS,MACZ;CAEF,MAAM,WAAW,SAAS,cAAc,UAAU;CAClD,SAAS,QAAQ;CAEjB,SAAS,MAAM,WAAW;CAC1B,SAAS,MAAM,UAAU;CACzB,SAAS,aAAa,YAAY,EAAE;CACpC,SAAS,KAAK,YAAY,QAAQ;CAClC,SAAS,OAAO;CAChB,SAAS,YAAY,MAAM;CAC3B,SAAS,KAAK,YAAY,QAAQ;AACpC;AAEA,IAAa,0BACV,SACA,UAA6C;CAC5C,MAAM,eAAe;CAErB,IAAI,UAAU,WAAW,WACvB,UAAU,UAAU,UAAU,GAAG,CAAC,CAAC,YAAY,gBAAgB,GAAG,CAAC;MAEnE,gBAAgB,GAAG;AAEvB"}
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../../src/components/CopyClipboard/utils.ts"],"sourcesContent":["import type { SyntheticEvent } from 'react';\n\n// clipboard-api-free fallback: outside a secure context (plain-http deployments,\n// very common for LAN registries) `navigator.clipboard` is undefined. The\n// hidden-textarea approach needs no Selection/Range juggling — and\n// window.getSelection() can legitimately return null.\nfunction execCommandCopy(str: string): boolean {\n if (!document.body) {\n return false;\n }\n const textarea = document.createElement('textarea');\n textarea.value = str;\n // keep it out of sight without display:none (which would prevent selection)\n textarea.style.position = 'fixed';\n textarea.style.opacity = '0';\n textarea.setAttribute('readonly', '');\n document.body.appendChild(textarea);\n textarea.select();\n const copied = document.execCommand?.('copy') ?? false;\n document.body.removeChild(textarea);\n return copied;\n}\n\n/** Copies `str`; resolves to whether the clipboard actually changed. */\nexport const copyToClipBoardUtility =\n (str: string): ((e: SyntheticEvent<HTMLElement>) => Promise<boolean>) =>\n (event: SyntheticEvent<HTMLElement>): Promise<boolean> => {\n event.preventDefault();\n\n if (navigator.clipboard?.writeText) {\n return navigator.clipboard.writeText(str).then(\n () => true,\n () => execCommandCopy(str)\n );\n }\n return Promise.resolve(execCommandCopy(str));\n };\n"],"mappings":";AAMA,SAAS,gBAAgB,KAAsB;CAC7C,IAAI,CAAC,SAAS,MACZ,OAAO;CAET,MAAM,WAAW,SAAS,cAAc,UAAU;CAClD,SAAS,QAAQ;CAEjB,SAAS,MAAM,WAAW;CAC1B,SAAS,MAAM,UAAU;CACzB,SAAS,aAAa,YAAY,EAAE;CACpC,SAAS,KAAK,YAAY,QAAQ;CAClC,SAAS,OAAO;CAChB,MAAM,SAAS,SAAS,cAAc,MAAM,KAAK;CACjD,SAAS,KAAK,YAAY,QAAQ;CAClC,OAAO;AACT;;AAGA,IAAa,0BACV,SACA,UAAyD;CACxD,MAAM,eAAe;CAErB,IAAI,UAAU,WAAW,WACvB,OAAO,UAAU,UAAU,UAAU,GAAG,CAAC,CAAC,WAClC,YACA,gBAAgB,GAAG,CAC3B;CAEF,OAAO,QAAQ,QAAQ,gBAAgB,GAAG,CAAC;AAC7C"}
@@ -1,6 +1,6 @@
1
1
  //#region src/components/CopyClipboard/utils.ts
2
2
  function execCommandCopy(str) {
3
- if (!document.body) return;
3
+ if (!document.body) return false;
4
4
  const textarea = document.createElement("textarea");
5
5
  textarea.value = str;
6
6
  textarea.style.position = "fixed";
@@ -8,13 +8,15 @@ function execCommandCopy(str) {
8
8
  textarea.setAttribute("readonly", "");
9
9
  document.body.appendChild(textarea);
10
10
  textarea.select();
11
- document.execCommand("copy");
11
+ const copied = document.execCommand?.("copy") ?? false;
12
12
  document.body.removeChild(textarea);
13
+ return copied;
13
14
  }
15
+ /** Copies `str`; resolves to whether the clipboard actually changed. */
14
16
  var copyToClipBoardUtility = (str) => (event) => {
15
17
  event.preventDefault();
16
- if (navigator.clipboard?.writeText) navigator.clipboard.writeText(str).catch(() => execCommandCopy(str));
17
- else execCommandCopy(str);
18
+ if (navigator.clipboard?.writeText) return navigator.clipboard.writeText(str).then(() => true, () => execCommandCopy(str));
19
+ return Promise.resolve(execCommandCopy(str));
18
20
  };
19
21
  //#endregion
20
22
  export { copyToClipBoardUtility };
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","names":[],"sources":["../../../src/components/CopyClipboard/utils.ts"],"sourcesContent":["import type { SyntheticEvent } from 'react';\n\n// clipboard-api-free fallback: outside a secure context (plain-http deployments,\n// very common for LAN registries) `navigator.clipboard` is undefined. The\n// hidden-textarea approach needs no Selection/Range juggling — and\n// window.getSelection() can legitimately return null.\nfunction execCommandCopy(str: string): void {\n if (!document.body) {\n return;\n }\n const textarea = document.createElement('textarea');\n textarea.value = str;\n // keep it out of sight without display:none (which would prevent selection)\n textarea.style.position = 'fixed';\n textarea.style.opacity = '0';\n textarea.setAttribute('readonly', '');\n document.body.appendChild(textarea);\n textarea.select();\n document.execCommand('copy');\n document.body.removeChild(textarea);\n}\n\nexport const copyToClipBoardUtility =\n (str: string): ((e: SyntheticEvent<HTMLElement>) => void) =>\n (event: SyntheticEvent<HTMLElement>): void => {\n event.preventDefault();\n\n if (navigator.clipboard?.writeText) {\n navigator.clipboard.writeText(str).catch(() => execCommandCopy(str));\n } else {\n execCommandCopy(str);\n }\n };\n"],"mappings":";AAMA,SAAS,gBAAgB,KAAmB;CAC1C,IAAI,CAAC,SAAS,MACZ;CAEF,MAAM,WAAW,SAAS,cAAc,UAAU;CAClD,SAAS,QAAQ;CAEjB,SAAS,MAAM,WAAW;CAC1B,SAAS,MAAM,UAAU;CACzB,SAAS,aAAa,YAAY,EAAE;CACpC,SAAS,KAAK,YAAY,QAAQ;CAClC,SAAS,OAAO;CAChB,SAAS,YAAY,MAAM;CAC3B,SAAS,KAAK,YAAY,QAAQ;AACpC;AAEA,IAAa,0BACV,SACA,UAA6C;CAC5C,MAAM,eAAe;CAErB,IAAI,UAAU,WAAW,WACvB,UAAU,UAAU,UAAU,GAAG,CAAC,CAAC,YAAY,gBAAgB,GAAG,CAAC;MAEnE,gBAAgB,GAAG;AAEvB"}
1
+ {"version":3,"file":"utils.mjs","names":[],"sources":["../../../src/components/CopyClipboard/utils.ts"],"sourcesContent":["import type { SyntheticEvent } from 'react';\n\n// clipboard-api-free fallback: outside a secure context (plain-http deployments,\n// very common for LAN registries) `navigator.clipboard` is undefined. The\n// hidden-textarea approach needs no Selection/Range juggling — and\n// window.getSelection() can legitimately return null.\nfunction execCommandCopy(str: string): boolean {\n if (!document.body) {\n return false;\n }\n const textarea = document.createElement('textarea');\n textarea.value = str;\n // keep it out of sight without display:none (which would prevent selection)\n textarea.style.position = 'fixed';\n textarea.style.opacity = '0';\n textarea.setAttribute('readonly', '');\n document.body.appendChild(textarea);\n textarea.select();\n const copied = document.execCommand?.('copy') ?? false;\n document.body.removeChild(textarea);\n return copied;\n}\n\n/** Copies `str`; resolves to whether the clipboard actually changed. */\nexport const copyToClipBoardUtility =\n (str: string): ((e: SyntheticEvent<HTMLElement>) => Promise<boolean>) =>\n (event: SyntheticEvent<HTMLElement>): Promise<boolean> => {\n event.preventDefault();\n\n if (navigator.clipboard?.writeText) {\n return navigator.clipboard.writeText(str).then(\n () => true,\n () => execCommandCopy(str)\n );\n }\n return Promise.resolve(execCommandCopy(str));\n };\n"],"mappings":";AAMA,SAAS,gBAAgB,KAAsB;CAC7C,IAAI,CAAC,SAAS,MACZ,OAAO;CAET,MAAM,WAAW,SAAS,cAAc,UAAU;CAClD,SAAS,QAAQ;CAEjB,SAAS,MAAM,WAAW;CAC1B,SAAS,MAAM,UAAU;CACzB,SAAS,aAAa,YAAY,EAAE;CACpC,SAAS,KAAK,YAAY,QAAQ;CAClC,SAAS,OAAO;CAChB,MAAM,SAAS,SAAS,cAAc,MAAM,KAAK;CACjD,SAAS,KAAK,YAAY,QAAQ;CAClC,OAAO;AACT;;AAGA,IAAa,0BACV,SACA,UAAyD;CACxD,MAAM,eAAe;CAErB,IAAI,UAAU,WAAW,WACvB,OAAO,UAAU,UAAU,UAAU,GAAG,CAAC,CAAC,WAClC,YACA,gBAAgB,GAAG,CAC3B;CAEF,OAAO,QAAQ,QAAQ,gBAAgB,GAAG,CAAC;AAC7C"}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export declare const VERDACCIO_DOCS_URL = "https://verdaccio.org/docs/what-is-verdaccio";
3
+ /** A link to the Verdaccio documentation, marked as opening in a new tab. */
4
+ declare const DocsLink: React.FC<{
5
+ href?: string;
6
+ dataTestId?: string;
7
+ }>;
8
+ export default DocsLink;
@@ -0,0 +1,40 @@
1
+ const require_runtime = require("../../_virtual/_rolldown/runtime.js");
2
+ const require_index = require("../VisuallyHidden/index.js");
3
+ let react = require("react");
4
+ react = require_runtime.__toESM(react);
5
+ let react_i18next = require("react-i18next");
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ let _mui_material_Link = require("@mui/material/Link");
8
+ _mui_material_Link = require_runtime.__toESM(_mui_material_Link);
9
+ let _mui_icons_material_OpenInNew = require("@mui/icons-material/OpenInNew");
10
+ _mui_icons_material_OpenInNew = require_runtime.__toESM(_mui_icons_material_OpenInNew);
11
+ //#region src/components/DocsLink/DocsLink.tsx
12
+ var VERDACCIO_DOCS_URL = "https://verdaccio.org/docs/what-is-verdaccio";
13
+ /** A link to the Verdaccio documentation, marked as opening in a new tab. */
14
+ var DocsLink = ({ href = VERDACCIO_DOCS_URL, dataTestId = "docs-link" }) => {
15
+ const { t } = (0, react_i18next.useTranslation)();
16
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mui_material_Link.default, {
17
+ "data-testid": dataTestId,
18
+ href,
19
+ rel: "noopener noreferrer",
20
+ sx: {
21
+ display: "inline-flex",
22
+ alignItems: "center",
23
+ gap: .5
24
+ },
25
+ target: "_blank",
26
+ children: [
27
+ t("dialog.docs-link"),
28
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_icons_material_OpenInNew.default, {
29
+ "aria-hidden": true,
30
+ fontSize: "small"
31
+ }),
32
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.VisuallyHidden, { children: t("dialog.opens-in-new-tab") })
33
+ ]
34
+ });
35
+ };
36
+ //#endregion
37
+ exports.VERDACCIO_DOCS_URL = VERDACCIO_DOCS_URL;
38
+ exports.default = DocsLink;
39
+
40
+ //# sourceMappingURL=DocsLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocsLink.js","names":["useTranslation","Link","OpenInNewIcon","VisuallyHidden"],"sources":["../../../src/components/DocsLink/DocsLink.tsx"],"sourcesContent":["import OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport Link from '@mui/material/Link';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport { VisuallyHidden } from '../VisuallyHidden';\n\nexport const VERDACCIO_DOCS_URL = 'https://verdaccio.org/docs/what-is-verdaccio';\n\n/** A link to the Verdaccio documentation, marked as opening in a new tab. */\nconst DocsLink: React.FC<{ href?: string; dataTestId?: string }> = ({\n href = VERDACCIO_DOCS_URL,\n dataTestId = 'docs-link',\n}) => {\n const { t } = useTranslation();\n return (\n <Link\n data-testid={dataTestId}\n href={href}\n rel=\"noopener noreferrer\"\n sx={{ display: 'inline-flex', alignItems: 'center', gap: 0.5 }}\n target=\"_blank\"\n >\n {t('dialog.docs-link')}\n <OpenInNewIcon aria-hidden={true} fontSize=\"small\" />\n <VisuallyHidden>{t('dialog.opens-in-new-tab')}</VisuallyHidden>\n </Link>\n );\n};\n\nexport default DocsLink;\n"],"mappings":";;;;;;;;;;;AAOA,IAAa,qBAAqB;;AAGlC,IAAM,YAA8D,EAClE,OAAO,oBACP,aAAa,kBACT;CACJ,MAAM,EAAE,OAAA,GAAMA,cAAAA,eAAAA,CAAe;CAC7B,OACE,iBAAA,GAAA,kBAAA,KAAA,CAACC,mBAAAA,SAAD;EACE,eAAa;EACP;EACN,KAAI;EACJ,IAAI;GAAE,SAAS;GAAe,YAAY;GAAU,KAAK;EAAI;EAC7D,QAAO;EALT,UAAA;GAOG,EAAE,kBAAkB;GACrB,iBAAA,GAAA,kBAAA,IAAA,CAACC,8BAAAA,SAAD;IAAe,eAAa;IAAM,UAAS;GAAS,CAAA;GACpD,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,gBAAD,EAAA,UAAiB,EAAE,yBAAyB,EAAkB,CAAA;EAC1D;;AAEV"}
@@ -0,0 +1,35 @@
1
+ import { VisuallyHidden } from "../VisuallyHidden/index.mjs";
2
+ import "react";
3
+ import { useTranslation } from "react-i18next";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import Link from "@mui/material/Link";
6
+ import OpenInNewIcon from "@mui/icons-material/OpenInNew";
7
+ //#region src/components/DocsLink/DocsLink.tsx
8
+ var VERDACCIO_DOCS_URL = "https://verdaccio.org/docs/what-is-verdaccio";
9
+ /** A link to the Verdaccio documentation, marked as opening in a new tab. */
10
+ var DocsLink = ({ href = VERDACCIO_DOCS_URL, dataTestId = "docs-link" }) => {
11
+ const { t } = useTranslation();
12
+ return /* @__PURE__ */ jsxs(Link, {
13
+ "data-testid": dataTestId,
14
+ href,
15
+ rel: "noopener noreferrer",
16
+ sx: {
17
+ display: "inline-flex",
18
+ alignItems: "center",
19
+ gap: .5
20
+ },
21
+ target: "_blank",
22
+ children: [
23
+ t("dialog.docs-link"),
24
+ /* @__PURE__ */ jsx(OpenInNewIcon, {
25
+ "aria-hidden": true,
26
+ fontSize: "small"
27
+ }),
28
+ /* @__PURE__ */ jsx(VisuallyHidden, { children: t("dialog.opens-in-new-tab") })
29
+ ]
30
+ });
31
+ };
32
+ //#endregion
33
+ export { VERDACCIO_DOCS_URL, DocsLink as default };
34
+
35
+ //# sourceMappingURL=DocsLink.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocsLink.mjs","names":[],"sources":["../../../src/components/DocsLink/DocsLink.tsx"],"sourcesContent":["import OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport Link from '@mui/material/Link';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport { VisuallyHidden } from '../VisuallyHidden';\n\nexport const VERDACCIO_DOCS_URL = 'https://verdaccio.org/docs/what-is-verdaccio';\n\n/** A link to the Verdaccio documentation, marked as opening in a new tab. */\nconst DocsLink: React.FC<{ href?: string; dataTestId?: string }> = ({\n href = VERDACCIO_DOCS_URL,\n dataTestId = 'docs-link',\n}) => {\n const { t } = useTranslation();\n return (\n <Link\n data-testid={dataTestId}\n href={href}\n rel=\"noopener noreferrer\"\n sx={{ display: 'inline-flex', alignItems: 'center', gap: 0.5 }}\n target=\"_blank\"\n >\n {t('dialog.docs-link')}\n <OpenInNewIcon aria-hidden={true} fontSize=\"small\" />\n <VisuallyHidden>{t('dialog.opens-in-new-tab')}</VisuallyHidden>\n </Link>\n );\n};\n\nexport default DocsLink;\n"],"mappings":";;;;;;;AAOA,IAAa,qBAAqB;;AAGlC,IAAM,YAA8D,EAClE,OAAO,oBACP,aAAa,kBACT;CACJ,MAAM,EAAE,MAAM,eAAe;CAC7B,OACE,qBAAC,MAAD;EACE,eAAa;EACP;EACN,KAAI;EACJ,IAAI;GAAE,SAAS;GAAe,YAAY;GAAU,KAAK;EAAI;EAC7D,QAAO;EALT,UAAA;GAOG,EAAE,kBAAkB;GACrB,oBAAC,eAAD;IAAe,eAAa;IAAM,UAAS;GAAS,CAAA;GACpD,oBAAC,gBAAD,EAAA,UAAiB,EAAE,yBAAyB,EAAkB,CAAA;EAC1D;;AAEV"}
@@ -0,0 +1 @@
1
+ export { default, VERDACCIO_DOCS_URL } from './DocsLink';
@@ -0,0 +1,3 @@
1
+ const require_DocsLink = require("./DocsLink.js");
2
+ exports.VERDACCIO_DOCS_URL = require_DocsLink.VERDACCIO_DOCS_URL;
3
+ exports.default = require_DocsLink.default;
@@ -0,0 +1 @@
1
+ export { VERDACCIO_DOCS_URL, default } from "./DocsLink.mjs";
@@ -1,3 +1,16 @@
1
1
  import React from 'react';
2
+ declare const SETUP_TABS: readonly ['npm', 'pnpm', 'yarn', 'bun', ".npmrc"];
3
+ type SetupTab = (typeof SETUP_TABS)[number];
4
+ /** The one-time command that makes a client use this registry, honouring `web.scope`. */
5
+ export declare function getSetupCommand(tab: SetupTab, scope: string | undefined, registryUrl: string): string;
6
+ /** The markdown that `web.help` sets, with `{{registryUrl}}` filled in. */
7
+ export declare const CustomHelp: React.FC<{
8
+ markdown: string;
9
+ }>;
10
+ /** The steps to point a client at the registry, log in and publish; shared by the welcome card and the settings. */
11
+ export declare const HelpGuide: React.FC<{
12
+ withWaitStep?: boolean;
13
+ labelledBy?: string;
14
+ }>;
2
15
  declare const Help: React.FC;
3
16
  export default Help;