cozy-ui 62.1.3 → 62.3.0

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 (480) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/babel.config.js +1 -1
  3. package/package.json +14 -10
  4. package/react/ActionMenu/index.jsx +30 -7
  5. package/react/AppIcon/index.jsx +3 -1
  6. package/react/AppLinker/index.jsx +29 -7
  7. package/react/AppSections/categories.js +1 -0
  8. package/react/BarContextProvider/index.spec.jsx +1 -23
  9. package/react/Dialog/index.jsx +41 -3
  10. package/react/Icons/Cube.jsx +2 -2
  11. package/react/IntentIframe/IntentIframe.jsx +1 -0
  12. package/react/Popup/index.jsx +1 -0
  13. package/react/PopupOpener/index.jsx +1 -0
  14. package/react/PushClientButton/index.jsx +2 -1
  15. package/react/QuotaAlert/index.jsx +2 -0
  16. package/react/SelectionBar/index.jsx +34 -1
  17. package/react/Sidebar/index.jsx +25 -5
  18. package/react/Viewer/index.jsx +15 -0
  19. package/react/__snapshots__/examples.spec.jsx.snap +1 -1
  20. package/react/helpers/tracker.jsx +1 -1
  21. package/react/hooks/useRealtime.js +2 -0
  22. package/react/hooks/useSetFlagshipUi/useSetFlagshipUI.spec.ts +202 -0
  23. package/react/hooks/useSetFlagshipUi/useSetFlagshipUI.ts +41 -0
  24. package/transpiled/react/ActionMenu/index.js +46 -24
  25. package/transpiled/react/Alerter/Alert.js +13 -8
  26. package/transpiled/react/Alerter/index.js +12 -7
  27. package/transpiled/react/AppIcon/index.js +19 -10
  28. package/transpiled/react/AppLinker/index.js +34 -11
  29. package/transpiled/react/AppSections/Sections.js +23 -16
  30. package/transpiled/react/AppSections/categories.js +19 -17
  31. package/transpiled/react/AppSections/components/AppsSection.js +3 -3
  32. package/transpiled/react/AppSections/components/DropdownFilter.js +12 -5
  33. package/transpiled/react/AppTile/index.js +6 -6
  34. package/transpiled/react/AppTitle/index.js +3 -2
  35. package/transpiled/react/Avatar/index.js +4 -4
  36. package/transpiled/react/Badge/index.js +9 -3
  37. package/transpiled/react/Banner/index.js +11 -11
  38. package/transpiled/react/BarButton/index.js +18 -8
  39. package/transpiled/react/BarContextProvider/index.js +4 -4
  40. package/transpiled/react/BarTitle/index.js +2 -2
  41. package/transpiled/react/BottomDrawer/index.js +15 -8
  42. package/transpiled/react/BottomSheet/BottomSheet.js +15 -10
  43. package/transpiled/react/BottomSheet/BottomSheetHeader.js +1 -1
  44. package/transpiled/react/BottomSheet/BottomSheetItem.js +4 -3
  45. package/transpiled/react/Breadcrumbs/index.js +18 -13
  46. package/transpiled/react/Button/index.js +13 -11
  47. package/transpiled/react/ButtonAction/index.js +7 -6
  48. package/transpiled/react/Buttons/index.js +11 -9
  49. package/transpiled/react/Card/index.js +12 -4
  50. package/transpiled/react/Checkbox/index.js +8 -6
  51. package/transpiled/react/Chip/index.js +20 -9
  52. package/transpiled/react/CipherIcon/index.js +16 -8
  53. package/transpiled/react/Circle/index.js +2 -2
  54. package/transpiled/react/CompositeRow/index.js +10 -9
  55. package/transpiled/react/ContactPicker/index.js +17 -8
  56. package/transpiled/react/ContactsList/ContactRow.js +7 -6
  57. package/transpiled/react/ContactsList/Contacts/ContactCozy.js +1 -1
  58. package/transpiled/react/ContactsList/Contacts/ContactEmail.js +1 -1
  59. package/transpiled/react/ContactsList/Contacts/ContactIdentity.js +5 -5
  60. package/transpiled/react/ContactsList/Contacts/ContactName.js +2 -2
  61. package/transpiled/react/ContactsList/Contacts/ContactPhone.js +1 -1
  62. package/transpiled/react/ContactsList/ContactsList.js +8 -7
  63. package/transpiled/react/ContactsListModal/AddContactButton.js +4 -3
  64. package/transpiled/react/ContactsListModal/DemoProvider.js +1 -1
  65. package/transpiled/react/ContactsListModal/EmptyMessage.js +3 -2
  66. package/transpiled/react/ContactsListModal/index.js +18 -17
  67. package/transpiled/react/Counter/index.js +1 -1
  68. package/transpiled/react/CozyDialogs/ConfirmDialog.js +13 -8
  69. package/transpiled/react/CozyDialogs/Dialog.js +5 -5
  70. package/transpiled/react/CozyDialogs/DialogBackButton.js +5 -4
  71. package/transpiled/react/CozyDialogs/DialogCloseButton.js +5 -4
  72. package/transpiled/react/CozyDialogs/DialogTransition.js +5 -4
  73. package/transpiled/react/CozyDialogs/FixedActionsDialog.js +13 -8
  74. package/transpiled/react/CozyDialogs/FixedDialog.js +5 -5
  75. package/transpiled/react/CozyDialogs/IllustrationDialog.js +13 -8
  76. package/transpiled/react/CozyDialogs/TopAnchoredDialog.js +1 -1
  77. package/transpiled/react/CozyDialogs/e2e.js +1 -1
  78. package/transpiled/react/CozyDialogs/useCozyDialog.js +11 -5
  79. package/transpiled/react/CozyTheme/index.js +4 -4
  80. package/transpiled/react/DateMonthPicker/index.js +9 -9
  81. package/transpiled/react/Dialog/index.js +29 -4
  82. package/transpiled/react/DropdownButton/index.js +5 -4
  83. package/transpiled/react/Empty/index.js +8 -7
  84. package/transpiled/react/Field/index.js +35 -25
  85. package/transpiled/react/Figure/Figure.js +3 -3
  86. package/transpiled/react/Figure/FigureBlock.js +3 -3
  87. package/transpiled/react/FileImageLoader/checkImageSource.js +1 -1
  88. package/transpiled/react/FileImageLoader/index.js +11 -6
  89. package/transpiled/react/FileInput/index.js +6 -5
  90. package/transpiled/react/FilePath/index.js +1 -1
  91. package/transpiled/react/FilePathLink/index.js +4 -3
  92. package/transpiled/react/FilePicker/FilePickerBody.js +4 -4
  93. package/transpiled/react/FilePicker/FilePickerBodyItem.js +10 -10
  94. package/transpiled/react/FilePicker/FilePickerBreadcrumb.js +6 -6
  95. package/transpiled/react/FilePicker/FilePickerFooter.js +3 -3
  96. package/transpiled/react/FilePicker/FilePickerHeader.js +7 -6
  97. package/transpiled/react/FilePicker/index.js +5 -5
  98. package/transpiled/react/Filename/index.js +4 -4
  99. package/transpiled/react/GhostFileBadge/index.js +5 -3
  100. package/transpiled/react/Hero/index.js +4 -3
  101. package/transpiled/react/HistoryRow/index.js +13 -12
  102. package/transpiled/react/I18n/index.js +13 -6
  103. package/transpiled/react/I18n/withLocales.js +17 -6
  104. package/transpiled/react/Icon/Sprite.js +1 -1
  105. package/transpiled/react/Icon/index.js +4 -3
  106. package/transpiled/react/IconStack/index.js +2 -2
  107. package/transpiled/react/Icons/Album.js +2 -2
  108. package/transpiled/react/Icons/AlbumAdd.js +2 -2
  109. package/transpiled/react/Icons/AlbumRemove.js +2 -2
  110. package/transpiled/react/Icons/Answer.js +2 -2
  111. package/transpiled/react/Icons/Apple.js +2 -2
  112. package/transpiled/react/Icons/Archive.js +2 -2
  113. package/transpiled/react/Icons/Attachment.js +2 -2
  114. package/transpiled/react/Icons/Attention.js +2 -2
  115. package/transpiled/react/Icons/Bank.js +2 -2
  116. package/transpiled/react/Icons/Banking.js +2 -2
  117. package/transpiled/react/Icons/BankingAdd.js +2 -2
  118. package/transpiled/react/Icons/Bell.js +2 -2
  119. package/transpiled/react/Icons/Bike.js +3 -3
  120. package/transpiled/react/Icons/Bill.js +2 -2
  121. package/transpiled/react/Icons/Bottom.js +2 -2
  122. package/transpiled/react/Icons/BottomSelect.js +2 -2
  123. package/transpiled/react/Icons/BrowserBrave.js +2 -2
  124. package/transpiled/react/Icons/BrowserChrome.js +2 -2
  125. package/transpiled/react/Icons/BrowserDuckduckgo.js +2 -2
  126. package/transpiled/react/Icons/BrowserEdge.js +4 -4
  127. package/transpiled/react/Icons/BrowserEdgeChromium.js +2 -2
  128. package/transpiled/react/Icons/BrowserFirefox.js +2 -2
  129. package/transpiled/react/Icons/BrowserIe.js +2 -2
  130. package/transpiled/react/Icons/BrowserOpera.js +2 -2
  131. package/transpiled/react/Icons/BrowserSafari.js +2 -2
  132. package/transpiled/react/Icons/Burger.js +2 -2
  133. package/transpiled/react/Icons/Bus.js +2 -2
  134. package/transpiled/react/Icons/Calendar.js +2 -2
  135. package/transpiled/react/Icons/Camera.js +2 -2
  136. package/transpiled/react/Icons/Car.js +2 -2
  137. package/transpiled/react/Icons/CarbonCopy.js +2 -2
  138. package/transpiled/react/Icons/Categories.js +2 -2
  139. package/transpiled/react/Icons/Certified.js +2 -2
  140. package/transpiled/react/Icons/Check.js +2 -2
  141. package/transpiled/react/Icons/CheckCircle.js +2 -2
  142. package/transpiled/react/Icons/CheckList.js +2 -2
  143. package/transpiled/react/Icons/CheckSquare.js +2 -2
  144. package/transpiled/react/Icons/CheckWhite.js +2 -2
  145. package/transpiled/react/Icons/Checkbox.js +3 -3
  146. package/transpiled/react/Icons/CircleFilled.js +2 -2
  147. package/transpiled/react/Icons/Clock.js +2 -2
  148. package/transpiled/react/Icons/Cloud.js +4 -4
  149. package/transpiled/react/Icons/CloudBroken.js +4 -4
  150. package/transpiled/react/Icons/CloudHappy.js +2 -2
  151. package/transpiled/react/Icons/CloudSync.js +4 -4
  152. package/transpiled/react/Icons/Collect.js +2 -2
  153. package/transpiled/react/Icons/Comment.js +2 -2
  154. package/transpiled/react/Icons/Company.js +2 -2
  155. package/transpiled/react/Icons/Compass.js +2 -2
  156. package/transpiled/react/Icons/Connector.js +3 -3
  157. package/transpiled/react/Icons/Contract.js +2 -2
  158. package/transpiled/react/Icons/Contrast.js +2 -2
  159. package/transpiled/react/Icons/Cozy.js +2 -2
  160. package/transpiled/react/Icons/CozyLaugh.js +2 -2
  161. package/transpiled/react/Icons/CozyLogo.js +4 -4
  162. package/transpiled/react/Icons/CozyText.js +2 -2
  163. package/transpiled/react/Icons/Credit.js +4 -4
  164. package/transpiled/react/Icons/CreditCard.js +2 -2
  165. package/transpiled/react/Icons/CreditCardAdd.js +2 -2
  166. package/transpiled/react/Icons/Crop.js +2 -2
  167. package/transpiled/react/Icons/Cross.js +2 -2
  168. package/transpiled/react/Icons/CrossCircle.js +2 -2
  169. package/transpiled/react/Icons/CrossMedium.js +2 -2
  170. package/transpiled/react/Icons/CrossSmall.js +2 -2
  171. package/transpiled/react/Icons/CrossWhite.js +2 -2
  172. package/transpiled/react/Icons/Cube.js +10 -3
  173. package/transpiled/react/Icons/Dash.js +2 -2
  174. package/transpiled/react/Icons/DashWhite.js +2 -2
  175. package/transpiled/react/Icons/Dashboard.js +2 -2
  176. package/transpiled/react/Icons/DataControl.js +2 -2
  177. package/transpiled/react/Icons/Debit.js +4 -4
  178. package/transpiled/react/Icons/DeviceBrowser.js +4 -4
  179. package/transpiled/react/Icons/DeviceLaptop.js +5 -5
  180. package/transpiled/react/Icons/DevicePhone.js +6 -6
  181. package/transpiled/react/Icons/DeviceTablet.js +5 -5
  182. package/transpiled/react/Icons/Devices.js +2 -2
  183. package/transpiled/react/Icons/Dots.js +2 -2
  184. package/transpiled/react/Icons/DotsWhite.js +2 -2
  185. package/transpiled/react/Icons/Down.js +2 -2
  186. package/transpiled/react/Icons/Download.js +2 -2
  187. package/transpiled/react/Icons/DrawingArrowUp.js +2 -2
  188. package/transpiled/react/Icons/Dropdown.js +2 -2
  189. package/transpiled/react/Icons/DropdownClose.js +2 -2
  190. package/transpiled/react/Icons/DropdownOpen.js +2 -2
  191. package/transpiled/react/Icons/Dropup.js +2 -2
  192. package/transpiled/react/Icons/Email.js +2 -2
  193. package/transpiled/react/Icons/EmailNotification.js +2 -2
  194. package/transpiled/react/Icons/Eu.js +2 -2
  195. package/transpiled/react/Icons/Euro.js +2 -2
  196. package/transpiled/react/Icons/Exchange.js +2 -2
  197. package/transpiled/react/Icons/Eye.js +2 -2
  198. package/transpiled/react/Icons/EyeClosed.js +5 -5
  199. package/transpiled/react/Icons/File.js +3 -3
  200. package/transpiled/react/Icons/FileAdd.js +2 -2
  201. package/transpiled/react/Icons/FileDuotone.js +6 -6
  202. package/transpiled/react/Icons/FileNew.js +2 -2
  203. package/transpiled/react/Icons/FileNone.js +3 -3
  204. package/transpiled/react/Icons/FileOutline.js +2 -2
  205. package/transpiled/react/Icons/FileTypeAudio.js +4 -4
  206. package/transpiled/react/Icons/FileTypeBin.js +5 -5
  207. package/transpiled/react/Icons/FileTypeCode.js +7 -7
  208. package/transpiled/react/Icons/FileTypeFiles.js +4 -4
  209. package/transpiled/react/Icons/FileTypeFolder.js +4 -4
  210. package/transpiled/react/Icons/FileTypeImage.js +6 -6
  211. package/transpiled/react/Icons/FileTypeNote.js +3 -3
  212. package/transpiled/react/Icons/FileTypePdf.js +4 -4
  213. package/transpiled/react/Icons/FileTypeSheet.js +4 -4
  214. package/transpiled/react/Icons/FileTypeSlide.js +4 -4
  215. package/transpiled/react/Icons/FileTypeText.js +4 -4
  216. package/transpiled/react/Icons/FileTypeVideo.js +4 -4
  217. package/transpiled/react/Icons/FileTypeZip.js +4 -4
  218. package/transpiled/react/Icons/Filter.js +2 -2
  219. package/transpiled/react/Icons/Fingerprint.js +2 -2
  220. package/transpiled/react/Icons/Fitness.js +2 -2
  221. package/transpiled/react/Icons/Flag.js +2 -2
  222. package/transpiled/react/Icons/FlagOutlined.js +2 -2
  223. package/transpiled/react/Icons/FlashAuto.js +2 -2
  224. package/transpiled/react/Icons/Flashlight.js +2 -2
  225. package/transpiled/react/Icons/Folder.js +4 -4
  226. package/transpiled/react/Icons/FolderAdd.js +2 -2
  227. package/transpiled/react/Icons/FolderMoveto.js +2 -2
  228. package/transpiled/react/Icons/Forbidden.js +2 -2
  229. package/transpiled/react/Icons/ForbiddenSign.js +4 -4
  230. package/transpiled/react/Icons/FromUser.js +2 -2
  231. package/transpiled/react/Icons/Gear.js +4 -4
  232. package/transpiled/react/Icons/Globe.js +2 -2
  233. package/transpiled/react/Icons/Google.js +6 -6
  234. package/transpiled/react/Icons/GraphCircle.js +2 -2
  235. package/transpiled/react/Icons/Grid.js +2 -2
  236. package/transpiled/react/Icons/GroupList.js +2 -2
  237. package/transpiled/react/Icons/Groups.js +2 -2
  238. package/transpiled/react/Icons/Heart.js +2 -2
  239. package/transpiled/react/Icons/Help.js +2 -2
  240. package/transpiled/react/Icons/History.js +2 -2
  241. package/transpiled/react/Icons/Home.js +2 -2
  242. package/transpiled/react/Icons/Hourglass.js +3 -3
  243. package/transpiled/react/Icons/Image.js +2 -2
  244. package/transpiled/react/Icons/Info.js +3 -3
  245. package/transpiled/react/Icons/InfoOutlined.js +2 -2
  246. package/transpiled/react/Icons/Key.js +2 -2
  247. package/transpiled/react/Icons/Keychain.js +4 -4
  248. package/transpiled/react/Icons/Laptop.js +2 -2
  249. package/transpiled/react/Icons/Left.js +2 -2
  250. package/transpiled/react/Icons/Lightbulb.js +2 -2
  251. package/transpiled/react/Icons/Link.js +2 -2
  252. package/transpiled/react/Icons/LinkOut.js +2 -2
  253. package/transpiled/react/Icons/List.js +2 -2
  254. package/transpiled/react/Icons/Location.js +2 -2
  255. package/transpiled/react/Icons/Lock.js +2 -2
  256. package/transpiled/react/Icons/Logout.js +2 -2
  257. package/transpiled/react/Icons/LogoutLarge.js +5 -5
  258. package/transpiled/react/Icons/MagicTrick.js +2 -2
  259. package/transpiled/react/Icons/Magnet.js +2 -2
  260. package/transpiled/react/Icons/Magnifier.js +2 -2
  261. package/transpiled/react/Icons/Merge.js +2 -2
  262. package/transpiled/react/Icons/Mountain.js +2 -2
  263. package/transpiled/react/Icons/Movement.js +2 -2
  264. package/transpiled/react/Icons/MovementIn.js +4 -4
  265. package/transpiled/react/Icons/MovementOut.js +4 -4
  266. package/transpiled/react/Icons/Moveto.js +2 -2
  267. package/transpiled/react/Icons/MultiFiles.js +2 -2
  268. package/transpiled/react/Icons/Music.js +2 -2
  269. package/transpiled/react/Icons/New.js +2 -2
  270. package/transpiled/react/Icons/Next.js +2 -2
  271. package/transpiled/react/Icons/Note.js +2 -2
  272. package/transpiled/react/Icons/NotificationEmail.js +2 -2
  273. package/transpiled/react/Icons/Offline.js +2 -2
  274. package/transpiled/react/Icons/Online.js +2 -2
  275. package/transpiled/react/Icons/Openwith.js +2 -2
  276. package/transpiled/react/Icons/Palette.js +2 -2
  277. package/transpiled/react/Icons/Paperplane.js +2 -2
  278. package/transpiled/react/Icons/Password.js +2 -2
  279. package/transpiled/react/Icons/Pen.js +3 -3
  280. package/transpiled/react/Icons/People.js +2 -2
  281. package/transpiled/react/Icons/Percent.js +2 -2
  282. package/transpiled/react/Icons/PercentCircle.js +2 -2
  283. package/transpiled/react/Icons/PersonalData.js +2 -2
  284. package/transpiled/react/Icons/Phone.js +2 -2
  285. package/transpiled/react/Icons/PhoneDownload.js +2 -2
  286. package/transpiled/react/Icons/PhoneUpload.js +2 -2
  287. package/transpiled/react/Icons/PieChart.js +2 -2
  288. package/transpiled/react/Icons/Pin.js +2 -2
  289. package/transpiled/react/Icons/Plane.js +2 -2
  290. package/transpiled/react/Icons/Plus.js +3 -3
  291. package/transpiled/react/Icons/PlusSmall.js +3 -3
  292. package/transpiled/react/Icons/Previous.js +2 -2
  293. package/transpiled/react/Icons/Printer.js +2 -2
  294. package/transpiled/react/Icons/Qualify.js +2 -2
  295. package/transpiled/react/Icons/RadioChecked.js +2 -2
  296. package/transpiled/react/Icons/RadioUnchecked.js +2 -2
  297. package/transpiled/react/Icons/Rename.js +2 -2
  298. package/transpiled/react/Icons/Repare.js +2 -2
  299. package/transpiled/react/Icons/Reply.js +2 -2
  300. package/transpiled/react/Icons/Restaurant.js +2 -2
  301. package/transpiled/react/Icons/Restore.js +4 -4
  302. package/transpiled/react/Icons/RestoreStraight.js +2 -2
  303. package/transpiled/react/Icons/Right.js +2 -2
  304. package/transpiled/react/Icons/Rise.js +2 -2
  305. package/transpiled/react/Icons/RotateLeft.js +2 -2
  306. package/transpiled/react/Icons/RotateRight.js +2 -2
  307. package/transpiled/react/Icons/SadCozy.js +2 -2
  308. package/transpiled/react/Icons/Safe.js +2 -2
  309. package/transpiled/react/Icons/School.js +2 -2
  310. package/transpiled/react/Icons/SelectAll.js +2 -2
  311. package/transpiled/react/Icons/Setting.js +2 -2
  312. package/transpiled/react/Icons/Share.js +4 -4
  313. package/transpiled/react/Icons/ShareCircle.js +2 -2
  314. package/transpiled/react/Icons/ShareGrey08.js +4 -4
  315. package/transpiled/react/Icons/ShareIos.js +2 -2
  316. package/transpiled/react/Icons/Shield.js +2 -2
  317. package/transpiled/react/Icons/Shop.js +2 -2
  318. package/transpiled/react/Icons/Sound.js +2 -2
  319. package/transpiled/react/Icons/Spinner.js +3 -3
  320. package/transpiled/react/Icons/Stack.js +2 -2
  321. package/transpiled/react/Icons/Star.js +2 -2
  322. package/transpiled/react/Icons/Stats.js +2 -2
  323. package/transpiled/react/Icons/Subway.js +2 -2
  324. package/transpiled/react/Icons/Sync.js +2 -2
  325. package/transpiled/react/Icons/SyncCozy.js +2 -2
  326. package/transpiled/react/Icons/Target.js +2 -2
  327. package/transpiled/react/Icons/Team.js +2 -2
  328. package/transpiled/react/Icons/Telephone.js +2 -2
  329. package/transpiled/react/Icons/ToTheCloud.js +2 -2
  330. package/transpiled/react/Icons/Top.js +2 -2
  331. package/transpiled/react/Icons/TopSelect.js +2 -2
  332. package/transpiled/react/Icons/Train.js +2 -2
  333. package/transpiled/react/Icons/Trash.js +4 -4
  334. package/transpiled/react/Icons/Trophy.js +2 -2
  335. package/transpiled/react/Icons/Unknow.js +2 -2
  336. package/transpiled/react/Icons/Unlink.js +2 -2
  337. package/transpiled/react/Icons/Unlock.js +2 -2
  338. package/transpiled/react/Icons/Up.js +2 -2
  339. package/transpiled/react/Icons/Upload.js +2 -2
  340. package/transpiled/react/Icons/Videos.js +2 -2
  341. package/transpiled/react/Icons/Walk.js +2 -2
  342. package/transpiled/react/Icons/Wallet.js +2 -2
  343. package/transpiled/react/Icons/WalletAdd.js +2 -2
  344. package/transpiled/react/Icons/WalletNew.js +2 -2
  345. package/transpiled/react/Icons/Warn.js +2 -2
  346. package/transpiled/react/Icons/Warning.js +2 -2
  347. package/transpiled/react/Icons/WarningCircle.js +2 -2
  348. package/transpiled/react/Icons/WrenchCircle.js +2 -2
  349. package/transpiled/react/Infos/index.js +16 -15
  350. package/transpiled/react/InfosBadge/index.js +5 -3
  351. package/transpiled/react/InfosCarrousel/index.js +9 -9
  352. package/transpiled/react/InlineCard/index.js +12 -4
  353. package/transpiled/react/Input/index.js +3 -2
  354. package/transpiled/react/InputGroup/index.js +15 -8
  355. package/transpiled/react/IntentDialogOpener/IntentDialogOpener.js +7 -6
  356. package/transpiled/react/IntentHeader/index.js +4 -4
  357. package/transpiled/react/IntentIframe/IntentIframe.js +19 -10
  358. package/transpiled/react/IntentModal/IntentModal.js +18 -8
  359. package/transpiled/react/IntentOpener/IntentOpener.js +5 -4
  360. package/transpiled/react/IntentWrapper/index.js +3 -3
  361. package/transpiled/react/Label/index.js +3 -2
  362. package/transpiled/react/Labs/CollectionField/index.js +9 -8
  363. package/transpiled/react/Labs/ExperimentalDialog/index.js +3 -3
  364. package/transpiled/react/Labs/GridItem/index.js +1 -1
  365. package/transpiled/react/Labs/IconGrid/index.js +1 -1
  366. package/transpiled/react/Labs/PasswordInput/index.js +14 -11
  367. package/transpiled/react/Layout/Layout.js +18 -8
  368. package/transpiled/react/ListItemText/index.js +9 -3
  369. package/transpiled/react/LoadMore/index.js +4 -4
  370. package/transpiled/react/Media/Media.js +9 -6
  371. package/transpiled/react/Menu/Button.js +1 -1
  372. package/transpiled/react/Menu/index.js +29 -15
  373. package/transpiled/react/MidEllipsis/index.js +3 -3
  374. package/transpiled/react/Modal/AnimatedContentHeader.js +9 -2
  375. package/transpiled/react/Modal/ModalBackButton.js +3 -2
  376. package/transpiled/react/Modal/ModalButtons.js +3 -3
  377. package/transpiled/react/Modal/ModalContent.js +14 -7
  378. package/transpiled/react/Modal/ModalCross.js +3 -3
  379. package/transpiled/react/Modal/ModalFooter.js +1 -1
  380. package/transpiled/react/Modal/ModalHeader.js +12 -7
  381. package/transpiled/react/Modal/ModalSection.js +1 -1
  382. package/transpiled/react/Modal/index.js +25 -14
  383. package/transpiled/react/MuiCozyTheme/AccordionExpandIcon.js +1 -1
  384. package/transpiled/react/MuiCozyTheme/Dialog/DialogCloseButton.js +1 -1
  385. package/transpiled/react/MuiCozyTheme/Dialog/DialogContent.js +1 -1
  386. package/transpiled/react/MuiCozyTheme/Dialog/DialogContentText.js +1 -1
  387. package/transpiled/react/MuiCozyTheme/Divider/TextDivider/index.js +3 -2
  388. package/transpiled/react/MuiCozyTheme/Divider/index.js +5 -2
  389. package/transpiled/react/MuiCozyTheme/Menus/index.js +18 -13
  390. package/transpiled/react/MuiCozyTheme/RaisedList/index.js +2 -2
  391. package/transpiled/react/MuiCozyTheme/index.js +1 -1
  392. package/transpiled/react/MuiCozyTheme/makeOverrides.js +10 -6
  393. package/transpiled/react/MuiCozyTheme/makeTheme.js +9 -4
  394. package/transpiled/react/MuiTabs/index.js +1 -1
  395. package/transpiled/react/NarrowContent/index.js +3 -2
  396. package/transpiled/react/Nav/index.js +11 -9
  397. package/transpiled/react/NavigationList/index.js +5 -5
  398. package/transpiled/react/NestedSelect/Modal.js +8 -8
  399. package/transpiled/react/NestedSelect/NestedSelect.js +24 -17
  400. package/transpiled/react/OrderedList/index.js +6 -4
  401. package/transpiled/react/Overlay/index.js +12 -7
  402. package/transpiled/react/Page/index.js +8 -8
  403. package/transpiled/react/PasswordExample/index.js +7 -5
  404. package/transpiled/react/PercentageBar/index.js +4 -3
  405. package/transpiled/react/PercentageLine/index.js +7 -2
  406. package/transpiled/react/Popover/Popover.js +16 -6
  407. package/transpiled/react/Popup/index.js +12 -3
  408. package/transpiled/react/PopupOpener/index.js +3 -1
  409. package/transpiled/react/Portal/index.js +1 -1
  410. package/transpiled/react/ProgressionBanner/index.js +3 -3
  411. package/transpiled/react/PushClientButton/index.js +6 -5
  412. package/transpiled/react/QuotaAlert/index.js +8 -6
  413. package/transpiled/react/Radio/index.js +5 -4
  414. package/transpiled/react/Radios/index.js +3 -3
  415. package/transpiled/react/SelectBox/ControlDefault.js +10 -4
  416. package/transpiled/react/SelectBox/SelectBox.js +40 -28
  417. package/transpiled/react/SelectBox/SelectBoxWithFixedOptions.js +9 -4
  418. package/transpiled/react/SelectionBar/index.js +34 -11
  419. package/transpiled/react/Sidebar/index.js +13 -2
  420. package/transpiled/react/Spinner/index.js +3 -3
  421. package/transpiled/react/SquareAppIcon/index.js +11 -10
  422. package/transpiled/react/Stack/index.js +3 -2
  423. package/transpiled/react/Stepper/testing.js +1 -1
  424. package/transpiled/react/Table/index.js +18 -12
  425. package/transpiled/react/Text/index.js +11 -8
  426. package/transpiled/react/Textarea/index.js +4 -3
  427. package/transpiled/react/Tile/index.js +8 -7
  428. package/transpiled/react/Toggle/index.js +12 -5
  429. package/transpiled/react/UnorderedList/index.js +6 -4
  430. package/transpiled/react/UploadQueue/index.js +43 -38
  431. package/transpiled/react/ViewStack/ModalStack.js +2 -2
  432. package/transpiled/react/ViewStack/ViewStack.js +3 -3
  433. package/transpiled/react/ViewStack/context.js +1 -1
  434. package/transpiled/react/ViewStack/example.js +5 -5
  435. package/transpiled/react/ViewStack/hooks.js +1 -1
  436. package/transpiled/react/Viewer/AudioViewer.js +4 -4
  437. package/transpiled/react/Viewer/Footer/BottomSheetContent.js +2 -2
  438. package/transpiled/react/Viewer/Footer/DownloadButton.js +2 -2
  439. package/transpiled/react/Viewer/Footer/FooterContent.js +15 -10
  440. package/transpiled/react/Viewer/Footer/ForwardButton.js +2 -2
  441. package/transpiled/react/Viewer/Footer/Sharing.js +3 -3
  442. package/transpiled/react/Viewer/Footer.js +1 -1
  443. package/transpiled/react/Viewer/ImageViewer.js +21 -11
  444. package/transpiled/react/Viewer/InformationPanel.js +1 -1
  445. package/transpiled/react/Viewer/Navigation.js +2 -2
  446. package/transpiled/react/Viewer/NoNetworkViewer.js +3 -3
  447. package/transpiled/react/Viewer/NoViewer/DownloadButton.js +1 -1
  448. package/transpiled/react/Viewer/NoViewer/FileIcon.js +1 -1
  449. package/transpiled/react/Viewer/NoViewer/NoViewer.js +4 -4
  450. package/transpiled/react/Viewer/OnlyOfficeViewer.js +2 -2
  451. package/transpiled/react/Viewer/Panel/Certifications.js +8 -8
  452. package/transpiled/react/Viewer/Panel/PanelContent.js +6 -6
  453. package/transpiled/react/Viewer/Panel/Qualification.js +8 -8
  454. package/transpiled/react/Viewer/Panel/QualificationListItemText.js +3 -3
  455. package/transpiled/react/Viewer/PdfJsViewer.js +23 -18
  456. package/transpiled/react/Viewer/PdfMobileViewer.js +8 -8
  457. package/transpiled/react/Viewer/PdfToolbarButton.js +1 -1
  458. package/transpiled/react/Viewer/ShortcutViewer.js +2 -2
  459. package/transpiled/react/Viewer/TextViewer.js +20 -15
  460. package/transpiled/react/Viewer/Toolbar.js +6 -6
  461. package/transpiled/react/Viewer/VideoViewer.js +3 -3
  462. package/transpiled/react/Viewer/ViewerByFile.js +1 -1
  463. package/transpiled/react/Viewer/ViewerControls.js +15 -10
  464. package/transpiled/react/Viewer/ViewerSpinner.js +1 -1
  465. package/transpiled/react/Viewer/ViewerWrapper.js +1 -1
  466. package/transpiled/react/Viewer/index.js +41 -19
  467. package/transpiled/react/Viewer/withFileUrl.js +23 -15
  468. package/transpiled/react/Wizard/index.js +34 -27
  469. package/transpiled/react/helpers/migrateProps.js +19 -17
  470. package/transpiled/react/helpers/tracker.js +1 -1
  471. package/transpiled/react/helpers/useInstance.js +1 -1
  472. package/transpiled/react/helpers/withBreakpoints.js +10 -3
  473. package/transpiled/react/helpers/withOffline.js +13 -10
  474. package/transpiled/react/helpers/withState.js +11 -4
  475. package/transpiled/react/hooks/useBreakpoints/index.js +2 -2
  476. package/transpiled/react/hooks/useConfirmExit/index.js +4 -4
  477. package/transpiled/react/hooks/useRealtime.js +4 -2
  478. package/transpiled/react/hooks/useSetFlagshipUi/useSetFlagshipUI.js +29 -0
  479. package/transpiled/react/utils.js +5 -3
  480. package/tsconfig.json +33 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ # [62.3.0](https://github.com/cozy/cozy-ui/compare/v62.2.0...v62.3.0) (2022-03-25)
2
+
3
+
4
+ ### Features
5
+
6
+ * Implement openApp animation from cozy-ui ([45e9e3b](https://github.com/cozy/cozy-ui/commit/45e9e3b))
7
+
8
+ # [62.2.0](https://github.com/cozy/cozy-ui/compare/v62.1.4...v62.2.0) (2022-03-22)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** Upgrade few packages ([5df4e2b](https://github.com/cozy/cozy-ui/commit/5df4e2b))
14
+
15
+
16
+ ### Features
17
+
18
+ * Add Typescript support ([1ad1a48](https://github.com/cozy/cozy-ui/commit/1ad1a48))
19
+ * Handle FlagshipUI for cozy-drive cases ([6fa0228](https://github.com/cozy/cozy-ui/commit/6fa0228))
20
+ * Refactor setFlagshipUI feature ([64ca864](https://github.com/cozy/cozy-ui/commit/64ca864))
21
+ * Update cozy-intent for flagship-UI ([2b3d026](https://github.com/cozy/cozy-ui/commit/2b3d026))
22
+
23
+ ## [62.1.4](https://github.com/cozy/cozy-ui/compare/v62.1.3...v62.1.4) (2022-03-03)
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * Do not stretch small screenshots ([4af1a3f](https://github.com/cozy/cozy-ui/commit/4af1a3f))
29
+
1
30
  ## [62.1.3](https://github.com/cozy/cozy-ui/compare/v62.1.2...v62.1.3) (2022-03-02)
2
31
 
3
32
 
package/babel.config.js CHANGED
@@ -37,7 +37,7 @@ module.exports = {
37
37
  }
38
38
  ]
39
39
  ],
40
- ignore: ['**/*.spec.jsx', '**/*.spec.js']
40
+ ignore: ['**/*.spec.jsx', '**/*.spec.js', '**/*.spec.tsx', '**/*.spec.ts']
41
41
  },
42
42
  test: {
43
43
  presets: [['cozy-app', { transformRuntime: { helpers: true } }]],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "62.1.3",
3
+ "version": "62.3.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -27,14 +27,14 @@
27
27
  "build:doc:config": "copyfiles -u 1 docs/*.md docs/_config.yml build",
28
28
  "build:doc:kss": "kss --destination build/styleguide --title 'Cozy-UI Styleguide' --source stylus --builder node_modules/michelangelo/kss_styleguide/custom-template --homepage styleguide.md --css app.css",
29
29
  "build:doc:react": "styleguidist build --config docs/styleguide.config.js",
30
- "build": "env BABEL_ENV=transpilation babel react/ --out-dir transpiled/react --verbose",
30
+ "build": "env BABEL_ENV=transpilation babel --extensions .ts,.tsx,.js,.jsx react/ --out-dir transpiled/react --verbose",
31
31
  "clean:doc:kss": "rm -rf build/styleguide",
32
32
  "commitmsg": "commitlint -e $GIT_PARAMS",
33
33
  "deploy:doc": "git-directory-deploy --directory build/ --branch gh-pages",
34
34
  "makeSvgr": "scripts/generate-svgr-icon.sh",
35
35
  "lint": "npm-run-all 'lint:*'",
36
36
  "lint:commit": "git merge-base HEAD master && commitlint --from=$(git merge-base HEAD master) --to=HEAD || true",
37
- "lint:js": "eslint 'react/**/*.jsx' 'react/**/*.js' 'docs/styleguide.config.js'",
37
+ "lint:js": "eslint 'react/**/*.jsx' 'react/**/*.js' 'react/**/*.ts' 'docs/styleguide.config.js'",
38
38
  "lint:stylus": "stylint stylus --config .stylintrc",
39
39
  "lint:md": "remark . -o -S",
40
40
  "palette": "scripts/make-palette.sh",
@@ -68,7 +68,10 @@
68
68
  ],
69
69
  "devDependencies": {
70
70
  "@babel/cli": "7.11.5",
71
- "@babel/core": "7.11.5",
71
+ "@babel/core": "7.16.12",
72
+ "@babel/helper-builder-react-jsx": "7.16.7",
73
+ "@babel/helper-define-map": "7.16.7",
74
+ "@babel/helper-regex": "7.10.5",
72
75
  "@cozy/codemods": "^1.9.0",
73
76
  "@material-ui/core": "4.12.3",
74
77
  "@semantic-release/changelog": "5.0.1",
@@ -83,7 +86,7 @@
83
86
  "babel-loader": "8.1.0",
84
87
  "babel-plugin-css-modules-transform": "1.6.2",
85
88
  "babel-plugin-inline-json-import": "0.3.2",
86
- "babel-preset-cozy-app": "1.9.2",
89
+ "babel-preset-cozy-app": "2.0.2",
87
90
  "browserslist-config-cozy": "0.4.0",
88
91
  "commitlint": "7.6.1",
89
92
  "commitlint-config-cozy": "0.6.0",
@@ -92,7 +95,7 @@
92
95
  "cozy-device-helper": "^1.16.1",
93
96
  "cozy-doctypes": "^1.69.0",
94
97
  "cozy-harvest-lib": "^6.7.3",
95
- "cozy-intent": "^1.6.0",
98
+ "cozy-intent": "1.13.0",
96
99
  "cozy-sharing": "^3.10.0",
97
100
  "cozy-stack-client": "27.19.1",
98
101
  "css-loader": "0.28.11",
@@ -101,8 +104,7 @@
101
104
  "enzyme": "3.11.0",
102
105
  "enzyme-adapter-react-16": "1.15.6",
103
106
  "enzyme-to-json": "3.6.2",
104
- "eslint": "4.19.1",
105
- "eslint-config-cozy-app": "0.5.1",
107
+ "eslint-config-cozy-app": "4.0.0",
106
108
  "express": "^4.17.1",
107
109
  "focus-trap-react": "^6.0.0",
108
110
  "git-directory-deploy": "1.5.1",
@@ -198,7 +200,9 @@
198
200
  "js",
199
201
  "jsx",
200
202
  "json",
201
- "styl"
203
+ "styl",
204
+ "ts",
205
+ "tsx"
202
206
  ],
203
207
  "testPathIgnorePatterns": [
204
208
  "/node_modules/",
@@ -211,7 +215,7 @@
211
215
  "react-styleguidist/lib"
212
216
  ],
213
217
  "transform": {
214
- "^.+\\.jsx?$": "babel-jest"
218
+ "^.+\\.(ts|tsx|js|jsx)?$": "babel-jest"
215
219
  },
216
220
  "transformIgnorePatterns": [
217
221
  "node_modules/(?!(react-styleguidist)/)"
@@ -1,16 +1,19 @@
1
- import React from 'react'
1
+ import ClickAwayListener from '@material-ui/core/ClickAwayListener'
2
2
  import PropTypes from 'prop-types'
3
+ import React from 'react'
3
4
  import cx from 'classnames'
4
- import ClickAwayListener from '@material-ui/core/ClickAwayListener'
5
- import styles from './styles.styl'
6
- import { Media, Bd, Img } from '../Media'
5
+ import { usePopper } from 'react-popper'
6
+ import { useTheme } from '@material-ui/core'
7
+
7
8
  import BottomDrawer from '../BottomDrawer'
9
+ import Radio from '../Radio'
10
+ import createDepreciationLogger from '../helpers/createDepreciationLogger'
11
+ import styles from './styles.styl'
8
12
  import useBreakpoints from '../hooks/useBreakpoints'
13
+ import { Media, Bd, Img } from '../Media'
9
14
  import { getCssVariableValue } from '../utils/color'
10
- import Radio from '../Radio'
11
15
  import { spacingProp } from '../Stack'
12
- import { usePopper } from 'react-popper'
13
- import createDepreciationLogger from '../helpers/createDepreciationLogger'
16
+ import { useSetFlagshipUI } from '../hooks/useSetFlagshipUi/useSetFlagshipUI'
14
17
 
15
18
  const ActionMenuWrapper = ({
16
19
  inline,
@@ -101,6 +104,26 @@ const ActionMenu = ({
101
104
  anchorElRef,
102
105
  containerElRef
103
106
  }) => {
107
+ const theme = useTheme()
108
+ const sidebar = document.getElementById('sidebar')
109
+
110
+ useSetFlagshipUI(
111
+ {
112
+ bottomBackground: theme.palette.background.paper,
113
+ bottomTheme: 'dark',
114
+ topOverlay: getCssVariableValue('overlay'), // TODO: refactor to semantic variable
115
+ topBackground: theme.palette.background.paper,
116
+ topTheme: 'light'
117
+ },
118
+ {
119
+ bottomBackground: theme.palette.background[sidebar ? 'default' : 'paper'],
120
+ bottomTheme: 'dark',
121
+ topOverlay: 'transparent',
122
+ topBackground: theme.palette.background.paper,
123
+ topTheme: 'dark'
124
+ }
125
+ )
126
+
104
127
  if (placement)
105
128
  logDepecratedPlacement(
106
129
  '<ActionMenu placement /> is deprecated, use <ActionMenu popperOptions={{ placement }} /> instead'
@@ -111,8 +111,9 @@ export class AppIcon extends Component {
111
111
  <img
112
112
  alt={alt}
113
113
  className={cx(styles['c-app-icon'], className)}
114
- src={icon}
115
114
  onError={this.handleError}
115
+ ref={this.props.iconRef}
116
+ src={icon}
116
117
  />
117
118
  )
118
119
  case ERRORED:
@@ -128,6 +129,7 @@ export class AppIcon extends Component {
128
129
  icon={fallbackIcon || CubeIcon}
129
130
  width="100%"
130
131
  color={palette['coolGrey']}
132
+ iconRef={this.props.iconRef}
131
133
  />
132
134
  )
133
135
  }
@@ -1,5 +1,6 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
+
3
4
  import {
4
5
  checkApp,
5
6
  startApp,
@@ -9,6 +10,8 @@ import {
9
10
  isAndroid,
10
11
  isFlagshipApp
11
12
  } from 'cozy-device-helper'
13
+ import { WebviewContext } from 'cozy-intent'
14
+ import logger from 'cozy-logger'
12
15
 
13
16
  import {
14
17
  generateUniversalLink,
@@ -17,7 +20,6 @@ import {
17
20
  } from './native'
18
21
  import { NATIVE_APP_INFOS } from './native.config'
19
22
  import expiringMemoize from './expiringMemoize'
20
- import { WebviewContext } from 'cozy-intent'
21
23
 
22
24
  const expirationDelay = 10 * 1000
23
25
  const memoizedCheckApp = expiringMemoize(
@@ -36,6 +38,13 @@ export class AppLinker extends React.Component {
36
38
 
37
39
  constructor(props) {
38
40
  super(props)
41
+
42
+ this.imgRef = null
43
+ }
44
+
45
+ setImgRef = img => {
46
+ this.imgRef = img
47
+ this.setState({ imgRef: this.imgRef })
39
48
  }
40
49
 
41
50
  componentDidMount() {
@@ -69,7 +78,7 @@ export class AppLinker extends React.Component {
69
78
  }
70
79
  }
71
80
 
72
- static getOnClickHref(props, nativeAppIsAvailable, context) {
81
+ static getOnClickHref(props, nativeAppIsAvailable, context, imgRef) {
73
82
  const { app, nativePath } = props
74
83
  const slug = AppLinker.getSlug(props)
75
84
  let href = props.href
@@ -79,15 +88,21 @@ export class AppLinker extends React.Component {
79
88
 
80
89
  if (isFlagshipApp()) {
81
90
  if (!context)
82
- console.warn(
83
- 'FlagshipApp detected but no context found. Is the app wrapped in WebviewIntentProvider?'
91
+ logger.warn(
92
+ 'FlagshipApp detected but no context found. Is the app wrapped in <WebviewIntentProvider? />'
84
93
  )
85
94
 
86
95
  if (context) {
96
+ const imgPayload =
97
+ imgRef &&
98
+ JSON.stringify({
99
+ ...imgRef.getBoundingClientRect().toJSON()
100
+ })
101
+
87
102
  return {
88
103
  onClick: event => {
89
104
  event.preventDefault()
90
- context.call('openApp', href, app)
105
+ context.call('openApp', href, app, imgPayload)
91
106
  },
92
107
  href: '#'
93
108
  }
@@ -180,9 +195,16 @@ export class AppLinker extends React.Component {
180
195
  const { href, onClick } = AppLinker.getOnClickHref(
181
196
  this.props,
182
197
  nativeAppIsAvailable,
183
- this.context
198
+ this.context,
199
+ this.state.imgRef
184
200
  )
185
- return children({ ...appInfo, onClick: onClick, href })
201
+
202
+ return children({
203
+ ...appInfo,
204
+ iconRef: this.setImgRef,
205
+ onClick: onClick,
206
+ href
207
+ })
186
208
  }
187
209
  }
188
210
 
@@ -21,6 +21,7 @@ const multiGroupBy = (iter, grouper) => {
21
21
  for (const obj of iter) {
22
22
  const values = grouper(obj) || []
23
23
  values.forEach(v => {
24
+ // eslint-disable-next-line no-prototype-builtins
24
25
  if (!groups.hasOwnProperty(v)) groups[v] = []
25
26
  groups[v].push(obj)
26
27
  })
@@ -33,6 +33,7 @@ const IntentComponent = () => {
33
33
  let render
34
34
 
35
35
  try {
36
+ // eslint-disable-next-line react-hooks/rules-of-hooks
36
37
  webviewIntent = useWebviewIntent()
37
38
  render = webviewIntent.foo
38
39
  } catch {
@@ -172,27 +173,4 @@ describe('BarContextProvider', () => {
172
173
 
173
174
  expect(queryByText(mockVoidWebviewService)).toBeInTheDocument()
174
175
  })
175
-
176
- it('should not try to provide a cozy-intent context if one is provided', () => {
177
- // Set Web context
178
- window.cozy.isFlagshipApp = false
179
-
180
- const client = createMockClient({})
181
- const mockStore = configureStore()
182
- const store = mockStore(x => x)
183
-
184
- const { queryByText } = render(
185
- <Provider store={store}>
186
- <CozyProvider client={client}>
187
- <I18n lang="en" dictRequire={() => locales}>
188
- <App webviewService={mockWebviewService}>
189
- <IntentComponent />
190
- </App>
191
- </I18n>
192
- </CozyProvider>
193
- </Provider>
194
- )
195
-
196
- expect(queryByText(mockWebviewService.foo)).not.toBeInTheDocument()
197
- })
198
176
  })
@@ -1,9 +1,12 @@
1
1
  import React from 'react'
2
- import { default as MUIDialog } from '@material-ui/core/Dialog'
3
2
  import { RemoveScroll } from 'react-remove-scroll'
3
+ import { default as MUIDialog } from '@material-ui/core/Dialog'
4
+ import { useTheme } from '@material-ui/core'
5
+
4
6
  import useBreakpoints from '../hooks/useBreakpoints'
5
7
  import { useCozyTheme } from '../CozyTheme'
6
8
  import themesStyles from '../../stylus/settings/palette.styl'
9
+ import { useSetFlagshipUI } from '../hooks/useSetFlagshipUi/useSetFlagshipUI'
7
10
 
8
11
  const Dialog = props => {
9
12
  const { isMobile, isTablet } = useBreakpoints()
@@ -21,12 +24,47 @@ const Dialog = props => {
21
24
  (props.open || props.opened) && shouldBlockScroll
22
25
  ? RemoveScroll
23
26
  : React.Fragment
27
+ const cozyTheme = useCozyTheme()
28
+ const theme = useTheme()
29
+ const cozBar = document.querySelector('.coz-bar-wrapper')
30
+ const sidebar = document.getElementById('sidebar')
24
31
 
25
- const theme = useCozyTheme()
32
+ useSetFlagshipUI(
33
+ props.fullScreen
34
+ ? {
35
+ bottomBackground: theme.palette.background.paper,
36
+ bottomTheme: 'dark',
37
+ topBackground: theme.palette.background.paper,
38
+ topTheme: 'dark'
39
+ }
40
+ : {
41
+ bottomBackground: theme.palette.background.default,
42
+ bottomTheme: 'light',
43
+ bottomOverlay: 'rgba(0, 0, 0, 0.5)',
44
+ topOverlay: 'rgba(0, 0, 0, 0.5)',
45
+ topBackground: theme.palette.background.paper,
46
+ topTheme: 'light'
47
+ },
48
+ {
49
+ bottomBackground: theme.palette.background[sidebar ? 'default' : 'paper'],
50
+ bottomTheme: 'dark',
51
+ bottomOverlay: 'transparent',
52
+ topOverlay: 'transparent',
53
+ topBackground:
54
+ cozBar && getComputedStyle(cozBar).getPropertyValue('background-color'),
55
+ topTheme:
56
+ cozBar && cozBar.classList.contains('coz-theme-primary')
57
+ ? 'light'
58
+ : 'dark'
59
+ }
60
+ )
26
61
 
27
62
  return (
28
63
  <Wrapper>
29
- <MUIDialog className={themesStyles[`CozyTheme--${theme}`]} {...props} />
64
+ <MUIDialog
65
+ className={themesStyles[`CozyTheme--${cozyTheme}`]}
66
+ {...props}
67
+ />
30
68
  </Wrapper>
31
69
  )
32
70
  }
@@ -1,9 +1,9 @@
1
1
  // Automatically created, please run `scripts/generate-svg-icon.sh assets/icons/ui/cube.svg` to regenerate;
2
2
  import React from 'react'
3
3
 
4
- function SvgCube(props) {
4
+ function SvgCube({ iconRef, ...props }) {
5
5
  return (
6
- <svg viewBox="0 0 16 16" {...props}>
6
+ <svg viewBox="0 0 16 16" {...props} ref={iconRef}>
7
7
  <path d="M1 11.009V5.5c0-.55.39-.773.872-.498l5.256 3.003c.476.272.872.944.872 1.495v5.508c0 .549-.39.772-.872.497l-5.256-3.003C1.396 12.231 1 11.56 1 11.01zm15 0c0 .55-.396 1.222-.872 1.494l-5.256 3.003c-.481.275-.872.052-.872-.497V9.5c0-.55.396-1.223.872-1.495l5.256-3.003c.481-.275.872-.052.872.498v5.508zM9.35 6.982c-.47.288-1.237.284-1.7 0l-4.8-2.954c-.47-.29-.463-.732.027-.995L7.623.477c.485-.261 1.264-.264 1.754 0l4.746 2.556c.485.26.49.71.027.995l-4.8 2.954z" />
8
8
  </svg>
9
9
  )
@@ -48,6 +48,7 @@ class IntentIframe extends React.Component {
48
48
  })
49
49
  .start(this.intentViewer, this.onFrameLoaded)
50
50
  .then(result => {
51
+ // eslint-disable-next-line promise/always-return
51
52
  result ? onTerminate && onTerminate(result) : onCancel()
52
53
  })
53
54
  .catch(error => {
@@ -12,6 +12,7 @@ import { isMobileApp } from 'cozy-device-helper'
12
12
  */
13
13
  // source https://stackoverflow.com/a/16861050
14
14
  export function popupCenter(w, h) {
15
+ // eslint-disable-next-line no-redeclare
15
16
  /* global screen */
16
17
  // Fixes dual-screen position
17
18
  // Most browsers Firefox
@@ -4,6 +4,7 @@ import PropTypes from 'prop-types'
4
4
  // customized function to center a popup window
5
5
  // source https://stackoverflow.com/a/16861050
6
6
  export function openCenteredPopup(url, title, w, h) {
7
+ // eslint-disable-next-line no-redeclare
7
8
  /* global screen */
8
9
  var width =
9
10
  window.innerWidth || document.documentElement.clientWidth || screen.width
@@ -13,10 +13,11 @@ const ButtonClient = props => {
13
13
  return (
14
14
  <a
15
15
  href={href}
16
- //eslint-disable-next-line react/jsx-no-target-blank
16
+ // eslint-disable-next-line react/jsx-no-target-blank
17
17
  target="_blank"
18
18
  className={cx(styles['c-btn-client'], className)}
19
19
  onClick={onClick}
20
+ rel="noreferrer"
20
21
  >
21
22
  <figure>
22
23
  <Icon icon={icon || DeviceLaptopIcon} size="32" />
@@ -65,6 +65,8 @@ const QuotaAlert = ({ onClose }) => {
65
65
  if (isMobileApp()) {
66
66
  return <QuotaModalAlert onClose={onClose} />
67
67
  }
68
+ // TODO: why is there a conditional hook here?
69
+ // eslint-disable-next-line react-hooks/rules-of-hooks
68
70
  const instanceInfo = useInstance(client)
69
71
  return <QuotaModalAlert instance={instanceInfo} onClose={onClose} />
70
72
  }
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { useEffect } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import cx from 'classnames'
4
4
 
@@ -11,6 +11,8 @@ import useBreakpoints from '../hooks/useBreakpoints'
11
11
  import styles from './styles.styl'
12
12
 
13
13
  import CrossIcon from 'cozy-ui/transpiled/react/Icons/Cross'
14
+ import { useWebviewIntent } from 'cozy-intent'
15
+ import { useTheme } from '@material-ui/core'
14
16
 
15
17
  /*
16
18
 
@@ -39,6 +41,37 @@ const SelectionBar = ({ actions, selected, hideSelectionBar }) => {
39
41
  action.displayCondition === undefined || action.displayCondition(selected)
40
42
  )
41
43
  })
44
+ const webviewIntent = useWebviewIntent()
45
+ const theme = useTheme()
46
+
47
+ // This component is always rendered but hidden with CSS if there is no selection
48
+ // That is why we do not use useSetFlagship API here because that hook can not accept changing values
49
+ useEffect(() => {
50
+ if (!webviewIntent || !theme) return
51
+
52
+ selectedCount === 0 &&
53
+ webviewIntent &&
54
+ webviewIntent.call('setFlagshipUI', {
55
+ bottomBackground: theme.palette.background.default,
56
+ bottomTheme: 'dark'
57
+ })
58
+
59
+ selectedCount > 0 &&
60
+ webviewIntent &&
61
+ webviewIntent.call('setFlagshipUI', {
62
+ bottomBackground: theme.palette.grey[700],
63
+ bottomTheme: 'light'
64
+ })
65
+
66
+ return () =>
67
+ webviewIntent &&
68
+ theme &&
69
+ webviewIntent.call('setFlagshipUI', {
70
+ bottomBackground: theme.palette.background.default,
71
+ bottomTheme: 'dark'
72
+ })
73
+ }, [selectedCount, webviewIntent])
74
+
42
75
  return (
43
76
  <div
44
77
  data-testid="selectionBar"
@@ -2,12 +2,32 @@ import React from 'react'
2
2
  import cx from 'classnames'
3
3
  import PropTypes from 'prop-types'
4
4
  import styles from './styles.styl'
5
+ import { useSetFlagshipUI } from '../hooks/useSetFlagshipUi/useSetFlagshipUI'
6
+ import { useTheme } from '@material-ui/core'
5
7
 
6
- const Sidebar = ({ children, className, ...restProps }) => (
7
- <aside className={cx(styles['o-sidebar'], className)} {...restProps}>
8
- {children}
9
- </aside>
10
- )
8
+ const Sidebar = ({ children, className, ...restProps }) => {
9
+ const theme = useTheme()
10
+
11
+ useSetFlagshipUI(
12
+ {
13
+ bottomBackground: theme.palette.background.default,
14
+ bottomTheme: 'dark'
15
+ },
16
+ {
17
+ bottomBackground: theme.palette.background.paper
18
+ }
19
+ )
20
+
21
+ return (
22
+ <aside
23
+ id="sidebar"
24
+ className={cx(styles['o-sidebar'], className)}
25
+ {...restProps}
26
+ >
27
+ {children}
28
+ </aside>
29
+ )
30
+ }
11
31
 
12
32
  Sidebar.propTypes = {
13
33
  children: PropTypes.node,
@@ -12,6 +12,8 @@ import ViewerByFile from './ViewerByFile'
12
12
  import { isValidForPanel } from './helpers'
13
13
  import PanelContent from './Panel/PanelContent'
14
14
  import FooterContent from './Footer/FooterContent'
15
+ import { useSetFlagshipUI } from '../hooks/useSetFlagshipUi/useSetFlagshipUI'
16
+ import { useTheme } from '@material-ui/core'
15
17
 
16
18
  const KEY_CODE_LEFT = 37
17
19
  const KEY_CODE_RIGHT = 39
@@ -149,6 +151,19 @@ const ViewerInformationsWrapper = ({
149
151
  validForPanel,
150
152
  toolbarRef
151
153
  }) => {
154
+ const theme = useTheme()
155
+ const sidebar = document.querySelector('[class*="sidebar"]')
156
+
157
+ useSetFlagshipUI(
158
+ {
159
+ bottomBackground: theme.palette.background.paper,
160
+ bottomTheme: 'dark'
161
+ },
162
+ {
163
+ bottomBackground: theme.palette.background[sidebar ? 'default' : 'paper']
164
+ }
165
+ )
166
+
152
167
  return (
153
168
  <>
154
169
  {!disableFooter && (
@@ -8090,7 +8090,7 @@ exports[`SelectBox should render examples: SelectBox 14`] = `"<div><button>Toggl
8090
8090
 
8091
8091
  exports[`Sidebar should render examples: Sidebar 1`] = `
8092
8092
  "<div>
8093
- <aside class=\\"styles__o-sidebar___1295j\\" id=\\"sidebar\\">
8093
+ <aside id=\\"sidebar\\" class=\\"styles__o-sidebar___1295j\\">
8094
8094
  <nav role=\\"navigation\\">
8095
8095
  <ul class=\\"styles__c-nav___33dZy\\">
8096
8096
  <li class=\\"styles__c-nav-item___3XOLK\\" id=\\"nav-item\\"><a class=\\"styles__c-nav-link___3mK6W styles__is-active___2D0jN\\"><span class=\\"styles__c-nav-icon___hrJUe\\"><svg viewBox=\\"0 0 48 48\\" class=\\"styles__icon___23x3R\\" width=\\"16\\" height=\\"16\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path fill-rule=\\"evenodd\\" d=\\"M24 48c13.255 0 24-10.745 24-24S37.255 0 24 0 0 10.745 0 24s10.745 24 24 24zm-1.503-34.897c.83-1.438 2.175-1.44 3.007 0l9.992 17.294c.83 1.438.16 2.603-1.504 2.603H14.008c-1.661 0-2.336-1.162-1.504-2.603l9.993-17.294zm.082 5.323A1.334 1.334 0 0123.93 17h.141c.79 0 1.395.633 1.35 1.426l-.365 6.576c-.03.551-.499.998-1.055.998a1.069 1.069 0 01-1.055-.998l-.366-6.576zM22.5 29c0-.828.666-1.5 1.5-1.5.828 0 1.5.666 1.5 1.5 0 .828-.666 1.5-1.5 1.5-.828 0-1.5-.666-1.5-1.5z\\"></path></svg></span><span class=\\"styles__c-nav-text___1J3yU\\">Warn</span></a></li>
@@ -180,7 +180,7 @@ export const trackEvent = (event, trackerForTest) => {
180
180
  if (tracker) {
181
181
  let trackEventArray = []
182
182
  if (event && event[0]) {
183
- //Like that, we can do trackEvent(['Drive', 'option1']) without thinking of adding this `trackEvent` attr
183
+ // Like that, we can do trackEvent(['Drive', 'option1']) without thinking of adding this `trackEvent` attr
184
184
  if (event[0] !== 'trackEvent') {
185
185
  trackEventArray = event.unshift('trackEvent')
186
186
  }
@@ -38,6 +38,8 @@ const useRealtime = (client, specs, deps) => {
38
38
  })
39
39
  }
40
40
 
41
+ // TODO: why is there a conditional hook here?
42
+ // eslint-disable-next-line react-hooks/rules-of-hooks
41
43
  useEffect(() => {
42
44
  subscribeRealtime()
43
45