@portnet/ui 6.0.1 → 6.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1011) hide show
  1. package/CHANGELOG.md +737 -0
  2. package/dist/esm/index.js +90 -3
  3. package/dist/esm/index.js.map +1 -1
  4. package/dist/esm/v2/__tests__/AppMain.test.js +130 -0
  5. package/dist/esm/v2/__tests__/AppMain.test.js.map +1 -0
  6. package/dist/esm/v2/__tests__/ChartFigure.test.js +180 -0
  7. package/dist/esm/v2/__tests__/ChartFigure.test.js.map +1 -0
  8. package/dist/esm/v2/__tests__/DataGridRowActionsPropagation.test.js +150 -0
  9. package/dist/esm/v2/__tests__/DataGridRowActionsPropagation.test.js.map +1 -0
  10. package/dist/esm/v2/__tests__/DrawerTactileTargets.test.js +93 -0
  11. package/dist/esm/v2/__tests__/DrawerTactileTargets.test.js.map +1 -0
  12. package/dist/esm/v2/__tests__/FieldError.test.js +71 -39
  13. package/dist/esm/v2/__tests__/FieldError.test.js.map +1 -1
  14. package/dist/esm/v2/__tests__/FieldNaming.test.js +160 -0
  15. package/dist/esm/v2/__tests__/FieldNaming.test.js.map +1 -0
  16. package/dist/esm/v2/__tests__/FieldWidth.test.js +146 -0
  17. package/dist/esm/v2/__tests__/FieldWidth.test.js.map +1 -0
  18. package/dist/esm/v2/__tests__/FileCard.test.js +18 -18
  19. package/dist/esm/v2/__tests__/FileCard.test.js.map +1 -1
  20. package/dist/esm/v2/__tests__/FormikCheckbox.test.js +173 -0
  21. package/dist/esm/v2/__tests__/FormikCheckbox.test.js.map +1 -0
  22. package/dist/esm/v2/__tests__/FormikDateTimePicker.test.js +236 -0
  23. package/dist/esm/v2/__tests__/FormikDateTimePicker.test.js.map +1 -0
  24. package/dist/esm/v2/__tests__/FormikDisplayWidth.test.js +101 -0
  25. package/dist/esm/v2/__tests__/FormikDisplayWidth.test.js.map +1 -0
  26. package/dist/esm/v2/__tests__/FormikRadioGroup.test.js +299 -0
  27. package/dist/esm/v2/__tests__/FormikRadioGroup.test.js.map +1 -0
  28. package/dist/esm/v2/__tests__/MobileRowCard.test.js +44 -43
  29. package/dist/esm/v2/__tests__/MobileRowCard.test.js.map +1 -1
  30. package/dist/esm/v2/__tests__/PreviewDrawer.test.js +165 -0
  31. package/dist/esm/v2/__tests__/PreviewDrawer.test.js.map +1 -0
  32. package/dist/esm/v2/__tests__/ReferentielFieldContainer.test.js +156 -0
  33. package/dist/esm/v2/__tests__/ReferentielFieldContainer.test.js.map +1 -0
  34. package/dist/esm/v2/__tests__/SectionErrorBoundary.test.js +37 -52
  35. package/dist/esm/v2/__tests__/SectionErrorBoundary.test.js.map +1 -1
  36. package/dist/esm/v2/__tests__/apiError.test.js +50 -69
  37. package/dist/esm/v2/__tests__/apiError.test.js.map +1 -1
  38. package/dist/esm/v2/__tests__/banned-patterns.test.js +41 -122
  39. package/dist/esm/v2/__tests__/banned-patterns.test.js.map +1 -1
  40. package/dist/esm/v2/__tests__/chart-palette.test.js +204 -0
  41. package/dist/esm/v2/__tests__/chart-palette.test.js.map +1 -0
  42. package/dist/esm/v2/__tests__/contrast-palette.test.js +42 -74
  43. package/dist/esm/v2/__tests__/contrast-palette.test.js.map +1 -1
  44. package/dist/esm/v2/__tests__/cssVariables.test.js +44 -51
  45. package/dist/esm/v2/__tests__/cssVariables.test.js.map +1 -1
  46. package/dist/esm/v2/__tests__/fileValidation.test.js +134 -0
  47. package/dist/esm/v2/__tests__/fileValidation.test.js.map +1 -0
  48. package/dist/esm/v2/__tests__/filterCriteria.test.js +321 -0
  49. package/dist/esm/v2/__tests__/filterCriteria.test.js.map +1 -0
  50. package/dist/esm/v2/__tests__/fmtDate.test.js +68 -0
  51. package/dist/esm/v2/__tests__/fmtDate.test.js.map +1 -0
  52. package/dist/esm/v2/__tests__/gap-leakage-refonte.test.js +218 -0
  53. package/dist/esm/v2/__tests__/gap-leakage-refonte.test.js.map +1 -0
  54. package/dist/esm/v2/__tests__/labels-merge.test.js +17 -22
  55. package/dist/esm/v2/__tests__/labels-merge.test.js.map +1 -1
  56. package/dist/esm/v2/__tests__/locale-fallback.test.js +35 -40
  57. package/dist/esm/v2/__tests__/locale-fallback.test.js.map +1 -1
  58. package/dist/esm/v2/__tests__/reviveSavedCriteria.test.js +143 -0
  59. package/dist/esm/v2/__tests__/reviveSavedCriteria.test.js.map +1 -0
  60. package/dist/esm/v2/__tests__/rowActions.test.js +182 -0
  61. package/dist/esm/v2/__tests__/rowActions.test.js.map +1 -0
  62. package/dist/esm/v2/__tests__/useFocusOnRouteChange.test.js +155 -0
  63. package/dist/esm/v2/__tests__/useFocusOnRouteChange.test.js.map +1 -0
  64. package/dist/esm/v2/__tests__/useFocusTrap.test.js +266 -402
  65. package/dist/esm/v2/__tests__/useFocusTrap.test.js.map +1 -1
  66. package/dist/esm/v2/__tests__/usePrefersReducedMotion.test.js +120 -0
  67. package/dist/esm/v2/__tests__/usePrefersReducedMotion.test.js.map +1 -0
  68. package/dist/esm/v2/components/Accordion.js +48 -70
  69. package/dist/esm/v2/components/Accordion.js.map +1 -1
  70. package/dist/esm/v2/components/ActionStrip.js +31 -43
  71. package/dist/esm/v2/components/ActionStrip.js.map +1 -1
  72. package/dist/esm/v2/components/Banner.js +25 -22
  73. package/dist/esm/v2/components/Banner.js.map +1 -1
  74. package/dist/esm/v2/components/Busy.js +14 -19
  75. package/dist/esm/v2/components/Busy.js.map +1 -1
  76. package/dist/esm/v2/components/Button.js +34 -45
  77. package/dist/esm/v2/components/Button.js.map +1 -1
  78. package/dist/esm/v2/components/CategoryTag.js +44 -27
  79. package/dist/esm/v2/components/CategoryTag.js.map +1 -1
  80. package/dist/esm/v2/components/Checkbox.js +32 -38
  81. package/dist/esm/v2/components/Checkbox.js.map +1 -1
  82. package/dist/esm/v2/components/Chip.js +23 -36
  83. package/dist/esm/v2/components/Chip.js.map +1 -1
  84. package/dist/esm/v2/components/Combobox.js +112 -136
  85. package/dist/esm/v2/components/Combobox.js.map +1 -1
  86. package/dist/esm/v2/components/CommandPalette.js +113 -198
  87. package/dist/esm/v2/components/CommandPalette.js.map +1 -1
  88. package/dist/esm/v2/components/ConfirmDialog.js +36 -45
  89. package/dist/esm/v2/components/ConfirmDialog.js.map +1 -1
  90. package/dist/esm/v2/components/DatePicker.js +78 -81
  91. package/dist/esm/v2/components/DatePicker.js.map +1 -1
  92. package/dist/esm/v2/components/DateRangePicker.js +63 -74
  93. package/dist/esm/v2/components/DateRangePicker.js.map +1 -1
  94. package/dist/esm/v2/components/DateTimePicker.js +118 -90
  95. package/dist/esm/v2/components/DateTimePicker.js.map +1 -1
  96. package/dist/esm/v2/components/Drawer.js +71 -65
  97. package/dist/esm/v2/components/Drawer.js.map +1 -1
  98. package/dist/esm/v2/components/Dropzone.js +130 -177
  99. package/dist/esm/v2/components/Dropzone.js.map +1 -1
  100. package/dist/esm/v2/components/EmptyState.js +9 -9
  101. package/dist/esm/v2/components/EmptyState.js.map +1 -1
  102. package/dist/esm/v2/components/FavoriteToggle.js +24 -33
  103. package/dist/esm/v2/components/FavoriteToggle.js.map +1 -1
  104. package/dist/esm/v2/components/Field.js +210 -52
  105. package/dist/esm/v2/components/Field.js.map +1 -1
  106. package/dist/esm/v2/components/FieldError.js +9 -13
  107. package/dist/esm/v2/components/FieldError.js.map +1 -1
  108. package/dist/esm/v2/components/FieldHelp.js +28 -49
  109. package/dist/esm/v2/components/FieldHelp.js.map +1 -1
  110. package/dist/esm/v2/components/FileCard.js +14 -19
  111. package/dist/esm/v2/components/FileCard.js.map +1 -1
  112. package/dist/esm/v2/components/FilterTab.js +22 -31
  113. package/dist/esm/v2/components/FilterTab.js.map +1 -1
  114. package/dist/esm/v2/components/ForbiddenPage.js +28 -8
  115. package/dist/esm/v2/components/ForbiddenPage.js.map +1 -1
  116. package/dist/esm/v2/components/FormGrid.js +48 -54
  117. package/dist/esm/v2/components/FormGrid.js.map +1 -1
  118. package/dist/esm/v2/components/FormikDisplay.js +98 -24
  119. package/dist/esm/v2/components/FormikDisplay.js.map +1 -1
  120. package/dist/esm/v2/components/Input.js +75 -34
  121. package/dist/esm/v2/components/Input.js.map +1 -1
  122. package/dist/esm/v2/components/KPICard.js +42 -51
  123. package/dist/esm/v2/components/KPICard.js.map +1 -1
  124. package/dist/esm/v2/components/KPIStrip.js +9 -15
  125. package/dist/esm/v2/components/KPIStrip.js.map +1 -1
  126. package/dist/esm/v2/components/KV.js +16 -23
  127. package/dist/esm/v2/components/KV.js.map +1 -1
  128. package/dist/esm/v2/components/KVGrid.js +15 -23
  129. package/dist/esm/v2/components/KVGrid.js.map +1 -1
  130. package/dist/esm/v2/components/Layout.js +81 -117
  131. package/dist/esm/v2/components/Layout.js.map +1 -1
  132. package/dist/esm/v2/components/MobileRowCard.js +64 -75
  133. package/dist/esm/v2/components/MobileRowCard.js.map +1 -1
  134. package/dist/esm/v2/components/Modal.js +44 -53
  135. package/dist/esm/v2/components/Modal.js.map +1 -1
  136. package/dist/esm/v2/components/NetworkErrorPage.js +28 -11
  137. package/dist/esm/v2/components/NetworkErrorPage.js.map +1 -1
  138. package/dist/esm/v2/components/NotFoundPage.js +28 -9
  139. package/dist/esm/v2/components/NotFoundPage.js.map +1 -1
  140. package/dist/esm/v2/components/NumberInput.js +77 -107
  141. package/dist/esm/v2/components/NumberInput.js.map +1 -1
  142. package/dist/esm/v2/components/OverflowMenu.js +24 -42
  143. package/dist/esm/v2/components/OverflowMenu.js.map +1 -1
  144. package/dist/esm/v2/components/PdfViewer.js +24 -33
  145. package/dist/esm/v2/components/PdfViewer.js.map +1 -1
  146. package/dist/esm/v2/components/ProgressBar.js +28 -36
  147. package/dist/esm/v2/components/ProgressBar.js.map +1 -1
  148. package/dist/esm/v2/components/Radio.js +49 -57
  149. package/dist/esm/v2/components/Radio.js.map +1 -1
  150. package/dist/esm/v2/components/SectionErrorBoundary.js +84 -130
  151. package/dist/esm/v2/components/SectionErrorBoundary.js.map +1 -1
  152. package/dist/esm/v2/components/SectionHeader.js +24 -31
  153. package/dist/esm/v2/components/SectionHeader.js.map +1 -1
  154. package/dist/esm/v2/components/Segmented.js +59 -84
  155. package/dist/esm/v2/components/Segmented.js.map +1 -1
  156. package/dist/esm/v2/components/Select.js +100 -138
  157. package/dist/esm/v2/components/Select.js.map +1 -1
  158. package/dist/esm/v2/components/ServerErrorPage.js +27 -10
  159. package/dist/esm/v2/components/ServerErrorPage.js.map +1 -1
  160. package/dist/esm/v2/components/Skeleton.js +81 -96
  161. package/dist/esm/v2/components/Skeleton.js.map +1 -1
  162. package/dist/esm/v2/components/SkipLink.js +6 -7
  163. package/dist/esm/v2/components/SkipLink.js.map +1 -1
  164. package/dist/esm/v2/components/Spinner.js +13 -22
  165. package/dist/esm/v2/components/Spinner.js.map +1 -1
  166. package/dist/esm/v2/components/Status.js +14 -25
  167. package/dist/esm/v2/components/Status.js.map +1 -1
  168. package/dist/esm/v2/components/Stepper.js +68 -71
  169. package/dist/esm/v2/components/Stepper.js.map +1 -1
  170. package/dist/esm/v2/components/Surface.js +25 -44
  171. package/dist/esm/v2/components/Surface.js.map +1 -1
  172. package/dist/esm/v2/components/Switch.js +21 -29
  173. package/dist/esm/v2/components/Switch.js.map +1 -1
  174. package/dist/esm/v2/components/TabPanel.js +84 -0
  175. package/dist/esm/v2/components/TabPanel.js.map +1 -0
  176. package/dist/esm/v2/components/Tabs.js +43 -19
  177. package/dist/esm/v2/components/Tabs.js.map +1 -1
  178. package/dist/esm/v2/components/TelInput.js +75 -108
  179. package/dist/esm/v2/components/TelInput.js.map +1 -1
  180. package/dist/esm/v2/components/Textarea.js +21 -30
  181. package/dist/esm/v2/components/Textarea.js.map +1 -1
  182. package/dist/esm/v2/components/TimePicker.js +59 -69
  183. package/dist/esm/v2/components/TimePicker.js.map +1 -1
  184. package/dist/esm/v2/components/Toast.js +109 -163
  185. package/dist/esm/v2/components/Toast.js.map +1 -1
  186. package/dist/esm/v2/components/Tooltip.js +18 -31
  187. package/dist/esm/v2/components/Tooltip.js.map +1 -1
  188. package/dist/esm/v2/components/_ErrorPageBody.js +6 -5
  189. package/dist/esm/v2/components/_ErrorPageBody.js.map +1 -1
  190. package/dist/esm/v2/components/_pickerShared.js +2 -2
  191. package/dist/esm/v2/components/_pickerShared.js.map +1 -1
  192. package/dist/esm/v2/components/index.js +64 -0
  193. package/dist/esm/v2/components/index.js.map +1 -1
  194. package/dist/esm/v2/hooks/index.js +62 -0
  195. package/dist/esm/v2/hooks/index.js.map +1 -1
  196. package/dist/esm/v2/hooks/useAppliedFilters.js +112 -0
  197. package/dist/esm/v2/hooks/useAppliedFilters.js.map +1 -0
  198. package/dist/esm/v2/hooks/useDebouncedCallback.js +82 -0
  199. package/dist/esm/v2/hooks/useDebouncedCallback.js.map +1 -0
  200. package/dist/esm/v2/hooks/useDelayedFlag.js +5 -19
  201. package/dist/esm/v2/hooks/useDelayedFlag.js.map +1 -1
  202. package/dist/esm/v2/hooks/useDensity.js +13 -17
  203. package/dist/esm/v2/hooks/useDensity.js.map +1 -1
  204. package/dist/esm/v2/hooks/useFocusFirstError.js +25 -33
  205. package/dist/esm/v2/hooks/useFocusFirstError.js.map +1 -1
  206. package/dist/esm/v2/hooks/useFocusOnRouteChange.js +81 -0
  207. package/dist/esm/v2/hooks/useFocusOnRouteChange.js.map +1 -0
  208. package/dist/esm/v2/hooks/useFocusTrap.js +19 -23
  209. package/dist/esm/v2/hooks/useFocusTrap.js.map +1 -1
  210. package/dist/esm/v2/hooks/useFormAutoSave.js +38 -53
  211. package/dist/esm/v2/hooks/useFormAutoSave.js.map +1 -1
  212. package/dist/esm/v2/hooks/useFormCompletionProgress.js +32 -51
  213. package/dist/esm/v2/hooks/useFormCompletionProgress.js.map +1 -1
  214. package/dist/esm/v2/hooks/useKeyboardShortcuts.js +125 -0
  215. package/dist/esm/v2/hooks/useKeyboardShortcuts.js.map +1 -0
  216. package/dist/esm/v2/hooks/usePrefersReducedMotion.js +99 -0
  217. package/dist/esm/v2/hooks/usePrefersReducedMotion.js.map +1 -0
  218. package/dist/esm/v2/hooks/useResolvedDensity.js +2 -10
  219. package/dist/esm/v2/hooks/useResolvedDensity.js.map +1 -1
  220. package/dist/esm/v2/hooks/useSortedRows.js +3 -5
  221. package/dist/esm/v2/hooks/useSortedRows.js.map +1 -1
  222. package/dist/esm/v2/hooks/useTabLoading.js +6 -21
  223. package/dist/esm/v2/hooks/useTabLoading.js.map +1 -1
  224. package/dist/esm/v2/index.js +14 -4
  225. package/dist/esm/v2/index.js.map +1 -1
  226. package/dist/esm/v2/modalContext.js +2 -2
  227. package/dist/esm/v2/modalContext.js.map +1 -1
  228. package/dist/esm/v2/models/favorite.js.map +1 -1
  229. package/dist/esm/v2/models/personalization.js.map +1 -1
  230. package/dist/esm/v2/models/referentiel.js.map +1 -1
  231. package/dist/esm/v2/models/savedFilter.js.map +1 -1
  232. package/dist/esm/v2/patterns/ActionBar.js +115 -159
  233. package/dist/esm/v2/patterns/ActionBar.js.map +1 -1
  234. package/dist/esm/v2/patterns/AppMain.js +108 -0
  235. package/dist/esm/v2/patterns/AppMain.js.map +1 -0
  236. package/dist/esm/v2/patterns/BulkActionBar.js +31 -34
  237. package/dist/esm/v2/patterns/BulkActionBar.js.map +1 -1
  238. package/dist/esm/v2/patterns/ChartFigure.js +151 -0
  239. package/dist/esm/v2/patterns/ChartFigure.js.map +1 -0
  240. package/dist/esm/v2/patterns/CollapsibleDataGrid.js +111 -152
  241. package/dist/esm/v2/patterns/CollapsibleDataGrid.js.map +1 -1
  242. package/dist/esm/v2/patterns/ColumnsToggle.js +43 -77
  243. package/dist/esm/v2/patterns/ColumnsToggle.js.map +1 -1
  244. package/dist/esm/v2/patterns/DataGrid.js +221 -255
  245. package/dist/esm/v2/patterns/DataGrid.js.map +1 -1
  246. package/dist/esm/v2/patterns/DataGridSettingsMenu.js +76 -94
  247. package/dist/esm/v2/patterns/DataGridSettingsMenu.js.map +1 -1
  248. package/dist/esm/v2/patterns/DataGridToolbar.js +85 -89
  249. package/dist/esm/v2/patterns/DataGridToolbar.js.map +1 -1
  250. package/dist/esm/v2/patterns/DataGridVirtualized.js +141 -182
  251. package/dist/esm/v2/patterns/DataGridVirtualized.js.map +1 -1
  252. package/dist/esm/v2/patterns/DeleteResourceConfirmDialog.js +26 -30
  253. package/dist/esm/v2/patterns/DeleteResourceConfirmDialog.js.map +1 -1
  254. package/dist/esm/v2/patterns/DetailSplit.js +108 -0
  255. package/dist/esm/v2/patterns/DetailSplit.js.map +1 -0
  256. package/dist/esm/v2/patterns/FavoriteColumn.js +26 -75
  257. package/dist/esm/v2/patterns/FavoriteColumn.js.map +1 -1
  258. package/dist/esm/v2/patterns/FavoritesFilter.js +30 -39
  259. package/dist/esm/v2/patterns/FavoritesFilter.js.map +1 -1
  260. package/dist/esm/v2/patterns/FilterTabBar.js +112 -0
  261. package/dist/esm/v2/patterns/FilterTabBar.js.map +1 -0
  262. package/dist/esm/v2/patterns/FormErrorSummary.js +12 -13
  263. package/dist/esm/v2/patterns/FormErrorSummary.js.map +1 -1
  264. package/dist/esm/v2/patterns/FormPageShell.js +43 -41
  265. package/dist/esm/v2/patterns/FormPageShell.js.map +1 -1
  266. package/dist/esm/v2/patterns/FormSection.js +30 -38
  267. package/dist/esm/v2/patterns/FormSection.js.map +1 -1
  268. package/dist/esm/v2/patterns/FormikCheckbox.js +130 -0
  269. package/dist/esm/v2/patterns/FormikCheckbox.js.map +1 -0
  270. package/dist/esm/v2/patterns/FormikCheckboxGroup.js +56 -60
  271. package/dist/esm/v2/patterns/FormikCheckboxGroup.js.map +1 -1
  272. package/dist/esm/v2/patterns/FormikCombobox.js +51 -66
  273. package/dist/esm/v2/patterns/FormikCombobox.js.map +1 -1
  274. package/dist/esm/v2/patterns/FormikDatePicker.js +51 -99
  275. package/dist/esm/v2/patterns/FormikDatePicker.js.map +1 -1
  276. package/dist/esm/v2/patterns/FormikDateTimePicker.js +136 -0
  277. package/dist/esm/v2/patterns/FormikDateTimePicker.js.map +1 -0
  278. package/dist/esm/v2/patterns/FormikErrorFocus.js +22 -23
  279. package/dist/esm/v2/patterns/FormikErrorFocus.js.map +1 -1
  280. package/dist/esm/v2/patterns/FormikErrorSummary.js +89 -0
  281. package/dist/esm/v2/patterns/FormikErrorSummary.js.map +1 -0
  282. package/dist/esm/v2/patterns/FormikFile.js +94 -78
  283. package/dist/esm/v2/patterns/FormikFile.js.map +1 -1
  284. package/dist/esm/v2/patterns/FormikInput.js +40 -50
  285. package/dist/esm/v2/patterns/FormikInput.js.map +1 -1
  286. package/dist/esm/v2/patterns/FormikRadioGroup.js +129 -0
  287. package/dist/esm/v2/patterns/FormikRadioGroup.js.map +1 -0
  288. package/dist/esm/v2/patterns/FormikReferentielField.js +49 -59
  289. package/dist/esm/v2/patterns/FormikReferentielField.js.map +1 -1
  290. package/dist/esm/v2/patterns/FormikSelect.js +64 -84
  291. package/dist/esm/v2/patterns/FormikSelect.js.map +1 -1
  292. package/dist/esm/v2/patterns/FormikTextarea.js +30 -43
  293. package/dist/esm/v2/patterns/FormikTextarea.js.map +1 -1
  294. package/dist/esm/v2/patterns/KeyboardShortcutsHelp.js +64 -65
  295. package/dist/esm/v2/patterns/KeyboardShortcutsHelp.js.map +1 -1
  296. package/dist/esm/v2/patterns/NetworkErrorBanner.js +6 -7
  297. package/dist/esm/v2/patterns/NetworkErrorBanner.js.map +1 -1
  298. package/dist/esm/v2/patterns/PageContent.js +10 -14
  299. package/dist/esm/v2/patterns/PageContent.js.map +1 -1
  300. package/dist/esm/v2/patterns/PreviewDrawer.js +153 -0
  301. package/dist/esm/v2/patterns/PreviewDrawer.js.map +1 -0
  302. package/dist/esm/v2/patterns/ReferentielField.js +327 -312
  303. package/dist/esm/v2/patterns/ReferentielField.js.map +1 -1
  304. package/dist/esm/v2/patterns/RowFavoriteToggle.js +127 -0
  305. package/dist/esm/v2/patterns/RowFavoriteToggle.js.map +1 -0
  306. package/dist/esm/v2/patterns/SaveFilterDialog.js +38 -66
  307. package/dist/esm/v2/patterns/SaveFilterDialog.js.map +1 -1
  308. package/dist/esm/v2/patterns/SavedFiltersMenu.js +62 -81
  309. package/dist/esm/v2/patterns/SavedFiltersMenu.js.map +1 -1
  310. package/dist/esm/v2/patterns/SkeletonPageShell.js +106 -129
  311. package/dist/esm/v2/patterns/SkeletonPageShell.js.map +1 -1
  312. package/dist/esm/v2/patterns/SortableHeader.js +22 -45
  313. package/dist/esm/v2/patterns/SortableHeader.js.map +1 -1
  314. package/dist/esm/v2/patterns/Tour.js +94 -120
  315. package/dist/esm/v2/patterns/Tour.js.map +1 -1
  316. package/dist/esm/v2/patterns/_dataGridShared.js +107 -128
  317. package/dist/esm/v2/patterns/_dataGridShared.js.map +1 -1
  318. package/dist/esm/v2/patterns/_pickerSerialisation.js +72 -0
  319. package/dist/esm/v2/patterns/_pickerSerialisation.js.map +1 -0
  320. package/dist/esm/v2/patterns/_sort.js +17 -33
  321. package/dist/esm/v2/patterns/_sort.js.map +1 -1
  322. package/dist/esm/v2/patterns/_useColumnReorder.js +122 -160
  323. package/dist/esm/v2/patterns/_useColumnReorder.js.map +1 -1
  324. package/dist/esm/v2/patterns/_useColumnResize.js +78 -96
  325. package/dist/esm/v2/patterns/_useColumnResize.js.map +1 -1
  326. package/dist/esm/v2/patterns/filterCriteria.js +102 -0
  327. package/dist/esm/v2/patterns/filterCriteria.js.map +1 -0
  328. package/dist/esm/v2/patterns/index.js +235 -0
  329. package/dist/esm/v2/patterns/index.js.map +1 -1
  330. package/dist/esm/v2/patterns/rowActions.js +223 -0
  331. package/dist/esm/v2/patterns/rowActions.js.map +1 -0
  332. package/dist/esm/v2/personalization/PersonalizationProvider.js +50 -47
  333. package/dist/esm/v2/personalization/PersonalizationProvider.js.map +1 -1
  334. package/dist/esm/v2/personalization/adapters/_storageKey.js +5 -5
  335. package/dist/esm/v2/personalization/adapters/_storageKey.js.map +1 -1
  336. package/dist/esm/v2/personalization/adapters/createLocalStorageAdapter.js +22 -23
  337. package/dist/esm/v2/personalization/adapters/createLocalStorageAdapter.js.map +1 -1
  338. package/dist/esm/v2/personalization/adapters/createMemoryAdapter.js +13 -13
  339. package/dist/esm/v2/personalization/adapters/createMemoryAdapter.js.map +1 -1
  340. package/dist/esm/v2/personalization/capabilities/favorites.js +36 -60
  341. package/dist/esm/v2/personalization/capabilities/favorites.js.map +1 -1
  342. package/dist/esm/v2/personalization/capabilities/favoritesView.js +22 -34
  343. package/dist/esm/v2/personalization/capabilities/favoritesView.js.map +1 -1
  344. package/dist/esm/v2/personalization/capabilities/gridPreferences.js +203 -0
  345. package/dist/esm/v2/personalization/capabilities/gridPreferences.js.map +1 -0
  346. package/dist/esm/v2/personalization/capabilities/index.js +5 -0
  347. package/dist/esm/v2/personalization/capabilities/index.js.map +1 -1
  348. package/dist/esm/v2/personalization/capabilities/reviveSavedCriteria.js +119 -0
  349. package/dist/esm/v2/personalization/capabilities/reviveSavedCriteria.js.map +1 -0
  350. package/dist/esm/v2/personalization/capabilities/savedFilters.js +90 -98
  351. package/dist/esm/v2/personalization/capabilities/savedFilters.js.map +1 -1
  352. package/dist/esm/v2/personalization/createPersonalizationStore.js +78 -181
  353. package/dist/esm/v2/personalization/createPersonalizationStore.js.map +1 -1
  354. package/dist/esm/v2/personalization/index.js +35 -0
  355. package/dist/esm/v2/personalization/index.js.map +1 -1
  356. package/dist/esm/v2/personalization/personalizationContext.js +9 -9
  357. package/dist/esm/v2/personalization/personalizationContext.js.map +1 -1
  358. package/dist/esm/v2/personalization/schema.js +8 -9
  359. package/dist/esm/v2/personalization/schema.js.map +1 -1
  360. package/dist/esm/v2/referentiel/ReferentielProvider.js +27 -42
  361. package/dist/esm/v2/referentiel/ReferentielProvider.js.map +1 -1
  362. package/dist/esm/v2/referentiel/types.js +2 -0
  363. package/dist/esm/v2/referentiel/types.js.map +1 -0
  364. package/dist/esm/v2/referentiel/useReferentielClient.js +10 -11
  365. package/dist/esm/v2/referentiel/useReferentielClient.js.map +1 -1
  366. package/dist/esm/v2/referentiel/useReferentielOptions.js +60 -117
  367. package/dist/esm/v2/referentiel/useReferentielOptions.js.map +1 -1
  368. package/dist/esm/v2/referentiel/useReferentielSearch.js +37 -91
  369. package/dist/esm/v2/referentiel/useReferentielSearch.js.map +1 -1
  370. package/dist/esm/v2/theme/_brand.js +8 -24
  371. package/dist/esm/v2/theme/_brand.js.map +1 -1
  372. package/dist/esm/v2/theme/_brandSecondary.js +8 -24
  373. package/dist/esm/v2/theme/_brandSecondary.js.map +1 -1
  374. package/dist/esm/v2/theme/createPortnetTheme.js +51 -61
  375. package/dist/esm/v2/theme/createPortnetTheme.js.map +1 -1
  376. package/dist/esm/v2/theme/cssVariables.js +62 -69
  377. package/dist/esm/v2/theme/cssVariables.js.map +1 -1
  378. package/dist/esm/v2/theme/index.js +5 -5
  379. package/dist/esm/v2/theme/index.js.map +1 -1
  380. package/dist/esm/v2/tokens/breakpoints.js +14 -14
  381. package/dist/esm/v2/tokens/breakpoints.js.map +1 -1
  382. package/dist/esm/v2/tokens/chart.js +261 -0
  383. package/dist/esm/v2/tokens/chart.js.map +1 -0
  384. package/dist/esm/v2/tokens/colors.js +22 -22
  385. package/dist/esm/v2/tokens/colors.js.map +1 -1
  386. package/dist/esm/v2/tokens/density.js +62 -7
  387. package/dist/esm/v2/tokens/density.js.map +1 -1
  388. package/dist/esm/v2/tokens/index.js +49 -34
  389. package/dist/esm/v2/tokens/index.js.map +1 -1
  390. package/dist/esm/v2/tokens/motion.js +12 -20
  391. package/dist/esm/v2/tokens/motion.js.map +1 -1
  392. package/dist/esm/v2/tokens/radius.js +1 -1
  393. package/dist/esm/v2/tokens/radius.js.map +1 -1
  394. package/dist/esm/v2/tokens/shadows.js +6 -6
  395. package/dist/esm/v2/tokens/shadows.js.map +1 -1
  396. package/dist/esm/v2/tokens/spacing.js +2 -2
  397. package/dist/esm/v2/tokens/spacing.js.map +1 -1
  398. package/dist/esm/v2/tokens/state.js +1 -1
  399. package/dist/esm/v2/tokens/state.js.map +1 -1
  400. package/dist/esm/v2/tokens/statusPalette.js +17 -21
  401. package/dist/esm/v2/tokens/statusPalette.js.map +1 -1
  402. package/dist/esm/v2/tokens/tokens.json +6 -1
  403. package/dist/esm/v2/tokens/typography.js +13 -13
  404. package/dist/esm/v2/tokens/typography.js.map +1 -1
  405. package/dist/esm/v2/tokens/zIndex.js +1 -1
  406. package/dist/esm/v2/tokens/zIndex.js.map +1 -1
  407. package/dist/esm/v2/types/datagrid.js.map +1 -1
  408. package/dist/esm/v2/utils/apiError.js +16 -37
  409. package/dist/esm/v2/utils/apiError.js.map +1 -1
  410. package/dist/esm/v2/utils/contrast.js +31 -32
  411. package/dist/esm/v2/utils/contrast.js.map +1 -1
  412. package/dist/esm/v2/utils/cx.js +5 -25
  413. package/dist/esm/v2/utils/cx.js.map +1 -1
  414. package/dist/esm/v2/utils/fileDownload.js +23 -26
  415. package/dist/esm/v2/utils/fileDownload.js.map +1 -1
  416. package/dist/esm/v2/utils/fileValidation.js +209 -0
  417. package/dist/esm/v2/utils/fileValidation.js.map +1 -0
  418. package/dist/esm/v2/utils/fmtDate.js +111 -0
  419. package/dist/esm/v2/utils/fmtDate.js.map +1 -0
  420. package/dist/esm/v2/utils/fmtMoney.js +8 -10
  421. package/dist/esm/v2/utils/fmtMoney.js.map +1 -1
  422. package/dist/esm/v2/utils/formikErrors.js +78 -0
  423. package/dist/esm/v2/utils/formikErrors.js.map +1 -0
  424. package/dist/esm/v2/utils/index.js +35 -2
  425. package/dist/esm/v2/utils/index.js.map +1 -1
  426. package/dist/esm/v2/utils/mergeLabels.js +7 -12
  427. package/dist/esm/v2/utils/mergeLabels.js.map +1 -1
  428. package/dist/esm/v2/utils/networkStatus.js +12 -12
  429. package/dist/esm/v2/utils/networkStatus.js.map +1 -1
  430. package/dist/index.d.ts +9 -1
  431. package/dist/index.d.ts.map +1 -1
  432. package/dist/index.js +122 -47
  433. package/dist/index.js.map +1 -1
  434. package/dist/v2/__tests__/AppMain.test.js +133 -0
  435. package/dist/v2/__tests__/AppMain.test.js.map +1 -0
  436. package/dist/v2/__tests__/ChartFigure.test.js +183 -0
  437. package/dist/v2/__tests__/ChartFigure.test.js.map +1 -0
  438. package/dist/v2/__tests__/DataGridRowActionsPropagation.test.js +153 -0
  439. package/dist/v2/__tests__/DataGridRowActionsPropagation.test.js.map +1 -0
  440. package/dist/v2/__tests__/DrawerTactileTargets.test.js +94 -0
  441. package/dist/v2/__tests__/DrawerTactileTargets.test.js.map +1 -0
  442. package/dist/v2/__tests__/FieldError.test.js +98 -69
  443. package/dist/v2/__tests__/FieldError.test.js.map +1 -1
  444. package/dist/v2/__tests__/FieldNaming.test.js +161 -0
  445. package/dist/v2/__tests__/FieldNaming.test.js.map +1 -0
  446. package/dist/v2/__tests__/FieldWidth.test.js +148 -0
  447. package/dist/v2/__tests__/FieldWidth.test.js.map +1 -0
  448. package/dist/v2/__tests__/FileCard.test.js +45 -48
  449. package/dist/v2/__tests__/FileCard.test.js.map +1 -1
  450. package/dist/v2/__tests__/FormikCheckbox.test.js +175 -0
  451. package/dist/v2/__tests__/FormikCheckbox.test.js.map +1 -0
  452. package/dist/v2/__tests__/FormikDateTimePicker.test.js +237 -0
  453. package/dist/v2/__tests__/FormikDateTimePicker.test.js.map +1 -0
  454. package/dist/v2/__tests__/FormikDisplayWidth.test.js +102 -0
  455. package/dist/v2/__tests__/FormikDisplayWidth.test.js.map +1 -0
  456. package/dist/v2/__tests__/FormikRadioGroup.test.js +300 -0
  457. package/dist/v2/__tests__/FormikRadioGroup.test.js.map +1 -0
  458. package/dist/v2/__tests__/MobileRowCard.test.js +100 -102
  459. package/dist/v2/__tests__/MobileRowCard.test.js.map +1 -1
  460. package/dist/v2/__tests__/PreviewDrawer.test.js +169 -0
  461. package/dist/v2/__tests__/PreviewDrawer.test.js.map +1 -0
  462. package/dist/v2/__tests__/ReferentielFieldContainer.test.js +159 -0
  463. package/dist/v2/__tests__/ReferentielFieldContainer.test.js.map +1 -0
  464. package/dist/v2/__tests__/SectionErrorBoundary.test.js +53 -68
  465. package/dist/v2/__tests__/SectionErrorBoundary.test.js.map +1 -1
  466. package/dist/v2/__tests__/apiError.test.js +50 -69
  467. package/dist/v2/__tests__/apiError.test.js.map +1 -1
  468. package/dist/v2/__tests__/banned-patterns.test.js +42 -123
  469. package/dist/v2/__tests__/banned-patterns.test.js.map +1 -1
  470. package/dist/v2/__tests__/chart-palette.test.js +205 -0
  471. package/dist/v2/__tests__/chart-palette.test.js.map +1 -0
  472. package/dist/v2/__tests__/contrast-palette.test.js +42 -74
  473. package/dist/v2/__tests__/contrast-palette.test.js.map +1 -1
  474. package/dist/v2/__tests__/cssVariables.test.js +44 -51
  475. package/dist/v2/__tests__/cssVariables.test.js.map +1 -1
  476. package/dist/v2/__tests__/fileValidation.test.js +136 -0
  477. package/dist/v2/__tests__/fileValidation.test.js.map +1 -0
  478. package/dist/v2/__tests__/filterCriteria.test.js +324 -0
  479. package/dist/v2/__tests__/filterCriteria.test.js.map +1 -0
  480. package/dist/v2/__tests__/fmtDate.test.js +69 -0
  481. package/dist/v2/__tests__/fmtDate.test.js.map +1 -0
  482. package/dist/v2/__tests__/gap-leakage-refonte.test.js +221 -0
  483. package/dist/v2/__tests__/gap-leakage-refonte.test.js.map +1 -0
  484. package/dist/v2/__tests__/labels-merge.test.js +38 -46
  485. package/dist/v2/__tests__/labels-merge.test.js.map +1 -1
  486. package/dist/v2/__tests__/locale-fallback.test.js +47 -52
  487. package/dist/v2/__tests__/locale-fallback.test.js.map +1 -1
  488. package/dist/v2/__tests__/reviveSavedCriteria.test.js +144 -0
  489. package/dist/v2/__tests__/reviveSavedCriteria.test.js.map +1 -0
  490. package/dist/v2/__tests__/rowActions.test.js +186 -0
  491. package/dist/v2/__tests__/rowActions.test.js.map +1 -0
  492. package/dist/v2/__tests__/useFocusOnRouteChange.test.js +156 -0
  493. package/dist/v2/__tests__/useFocusOnRouteChange.test.js.map +1 -0
  494. package/dist/v2/__tests__/useFocusTrap.test.js +270 -407
  495. package/dist/v2/__tests__/useFocusTrap.test.js.map +1 -1
  496. package/dist/v2/__tests__/usePrefersReducedMotion.test.js +123 -0
  497. package/dist/v2/__tests__/usePrefersReducedMotion.test.js.map +1 -0
  498. package/dist/v2/components/Accordion.js +60 -82
  499. package/dist/v2/components/Accordion.js.map +1 -1
  500. package/dist/v2/components/ActionStrip.js +40 -52
  501. package/dist/v2/components/ActionStrip.js.map +1 -1
  502. package/dist/v2/components/Banner.js +42 -41
  503. package/dist/v2/components/Banner.js.map +1 -1
  504. package/dist/v2/components/Busy.js +22 -27
  505. package/dist/v2/components/Busy.js.map +1 -1
  506. package/dist/v2/components/Button.js +39 -50
  507. package/dist/v2/components/Button.js.map +1 -1
  508. package/dist/v2/components/CategoryTag.d.ts.map +1 -1
  509. package/dist/v2/components/CategoryTag.js +49 -32
  510. package/dist/v2/components/CategoryTag.js.map +1 -1
  511. package/dist/v2/components/Checkbox.js +39 -45
  512. package/dist/v2/components/Checkbox.js.map +1 -1
  513. package/dist/v2/components/Chip.js +29 -42
  514. package/dist/v2/components/Chip.js.map +1 -1
  515. package/dist/v2/components/Combobox.js +122 -144
  516. package/dist/v2/components/Combobox.js.map +1 -1
  517. package/dist/v2/components/CommandPalette.js +138 -225
  518. package/dist/v2/components/CommandPalette.js.map +1 -1
  519. package/dist/v2/components/ConfirmDialog.js +46 -56
  520. package/dist/v2/components/ConfirmDialog.js.map +1 -1
  521. package/dist/v2/components/DatePicker.js +81 -86
  522. package/dist/v2/components/DatePicker.js.map +1 -1
  523. package/dist/v2/components/DateRangePicker.js +77 -87
  524. package/dist/v2/components/DateRangePicker.js.map +1 -1
  525. package/dist/v2/components/DateTimePicker.d.ts.map +1 -1
  526. package/dist/v2/components/DateTimePicker.js +121 -95
  527. package/dist/v2/components/DateTimePicker.js.map +1 -1
  528. package/dist/v2/components/Drawer.d.ts.map +1 -1
  529. package/dist/v2/components/Drawer.js +93 -88
  530. package/dist/v2/components/Drawer.js.map +1 -1
  531. package/dist/v2/components/Dropzone.js +150 -196
  532. package/dist/v2/components/Dropzone.js.map +1 -1
  533. package/dist/v2/components/EmptyState.js +18 -20
  534. package/dist/v2/components/EmptyState.js.map +1 -1
  535. package/dist/v2/components/FavoriteToggle.js +28 -39
  536. package/dist/v2/components/FavoriteToggle.js.map +1 -1
  537. package/dist/v2/components/Field.d.ts +121 -5
  538. package/dist/v2/components/Field.d.ts.map +1 -1
  539. package/dist/v2/components/Field.js +221 -62
  540. package/dist/v2/components/Field.js.map +1 -1
  541. package/dist/v2/components/FieldError.js +18 -21
  542. package/dist/v2/components/FieldError.js.map +1 -1
  543. package/dist/v2/components/FieldHelp.js +40 -60
  544. package/dist/v2/components/FieldHelp.js.map +1 -1
  545. package/dist/v2/components/FileCard.js +27 -31
  546. package/dist/v2/components/FileCard.js.map +1 -1
  547. package/dist/v2/components/FilterTab.js +30 -38
  548. package/dist/v2/components/FilterTab.js.map +1 -1
  549. package/dist/v2/components/ForbiddenPage.d.ts +25 -1
  550. package/dist/v2/components/ForbiddenPage.d.ts.map +1 -1
  551. package/dist/v2/components/ForbiddenPage.js +37 -17
  552. package/dist/v2/components/ForbiddenPage.js.map +1 -1
  553. package/dist/v2/components/FormGrid.js +53 -59
  554. package/dist/v2/components/FormGrid.js.map +1 -1
  555. package/dist/v2/components/FormikDisplay.d.ts +50 -1
  556. package/dist/v2/components/FormikDisplay.d.ts.map +1 -1
  557. package/dist/v2/components/FormikDisplay.js +108 -33
  558. package/dist/v2/components/FormikDisplay.js.map +1 -1
  559. package/dist/v2/components/Input.d.ts +40 -0
  560. package/dist/v2/components/Input.d.ts.map +1 -1
  561. package/dist/v2/components/Input.js +81 -41
  562. package/dist/v2/components/Input.js.map +1 -1
  563. package/dist/v2/components/KPICard.js +57 -67
  564. package/dist/v2/components/KPICard.js.map +1 -1
  565. package/dist/v2/components/KPIStrip.js +16 -22
  566. package/dist/v2/components/KPIStrip.js.map +1 -1
  567. package/dist/v2/components/KV.js +25 -31
  568. package/dist/v2/components/KV.js.map +1 -1
  569. package/dist/v2/components/KVGrid.js +19 -26
  570. package/dist/v2/components/KVGrid.js.map +1 -1
  571. package/dist/v2/components/Layout.js +91 -120
  572. package/dist/v2/components/Layout.js.map +1 -1
  573. package/dist/v2/components/MobileRowCard.js +79 -91
  574. package/dist/v2/components/MobileRowCard.js.map +1 -1
  575. package/dist/v2/components/Modal.js +61 -69
  576. package/dist/v2/components/Modal.js.map +1 -1
  577. package/dist/v2/components/NetworkErrorPage.d.ts +19 -1
  578. package/dist/v2/components/NetworkErrorPage.d.ts.map +1 -1
  579. package/dist/v2/components/NetworkErrorPage.js +38 -21
  580. package/dist/v2/components/NetworkErrorPage.js.map +1 -1
  581. package/dist/v2/components/NotFoundPage.d.ts +17 -1
  582. package/dist/v2/components/NotFoundPage.d.ts.map +1 -1
  583. package/dist/v2/components/NotFoundPage.js +37 -18
  584. package/dist/v2/components/NotFoundPage.js.map +1 -1
  585. package/dist/v2/components/NumberInput.js +88 -118
  586. package/dist/v2/components/NumberInput.js.map +1 -1
  587. package/dist/v2/components/OverflowMenu.js +38 -56
  588. package/dist/v2/components/OverflowMenu.js.map +1 -1
  589. package/dist/v2/components/PdfViewer.js +34 -45
  590. package/dist/v2/components/PdfViewer.js.map +1 -1
  591. package/dist/v2/components/ProgressBar.js +42 -49
  592. package/dist/v2/components/ProgressBar.js.map +1 -1
  593. package/dist/v2/components/Radio.js +59 -67
  594. package/dist/v2/components/Radio.js.map +1 -1
  595. package/dist/v2/components/SectionErrorBoundary.js +90 -135
  596. package/dist/v2/components/SectionErrorBoundary.js.map +1 -1
  597. package/dist/v2/components/SectionHeader.js +34 -41
  598. package/dist/v2/components/SectionHeader.js.map +1 -1
  599. package/dist/v2/components/Segmented.js +69 -93
  600. package/dist/v2/components/Segmented.js.map +1 -1
  601. package/dist/v2/components/Select.d.ts +26 -2
  602. package/dist/v2/components/Select.d.ts.map +1 -1
  603. package/dist/v2/components/Select.js +120 -155
  604. package/dist/v2/components/Select.js.map +1 -1
  605. package/dist/v2/components/ServerErrorPage.d.ts +27 -1
  606. package/dist/v2/components/ServerErrorPage.d.ts.map +1 -1
  607. package/dist/v2/components/ServerErrorPage.js +37 -20
  608. package/dist/v2/components/ServerErrorPage.js.map +1 -1
  609. package/dist/v2/components/Skeleton.js +86 -100
  610. package/dist/v2/components/Skeleton.js.map +1 -1
  611. package/dist/v2/components/SkipLink.js +9 -12
  612. package/dist/v2/components/SkipLink.js.map +1 -1
  613. package/dist/v2/components/Spinner.js +16 -25
  614. package/dist/v2/components/Spinner.js.map +1 -1
  615. package/dist/v2/components/Status.js +18 -29
  616. package/dist/v2/components/Status.js.map +1 -1
  617. package/dist/v2/components/Stepper.js +80 -82
  618. package/dist/v2/components/Stepper.js.map +1 -1
  619. package/dist/v2/components/Surface.js +34 -49
  620. package/dist/v2/components/Surface.js.map +1 -1
  621. package/dist/v2/components/Switch.js +29 -37
  622. package/dist/v2/components/Switch.js.map +1 -1
  623. package/dist/v2/components/TabPanel.d.ts +17 -0
  624. package/dist/v2/components/TabPanel.d.ts.map +1 -0
  625. package/dist/v2/components/TabPanel.js +90 -0
  626. package/dist/v2/components/TabPanel.js.map +1 -0
  627. package/dist/v2/components/Tabs.d.ts +25 -0
  628. package/dist/v2/components/Tabs.d.ts.map +1 -1
  629. package/dist/v2/components/Tabs.js +53 -29
  630. package/dist/v2/components/Tabs.js.map +1 -1
  631. package/dist/v2/components/TelInput.js +80 -115
  632. package/dist/v2/components/TelInput.js.map +1 -1
  633. package/dist/v2/components/Textarea.js +26 -35
  634. package/dist/v2/components/Textarea.js.map +1 -1
  635. package/dist/v2/components/TimePicker.js +62 -74
  636. package/dist/v2/components/TimePicker.js.map +1 -1
  637. package/dist/v2/components/Toast.js +119 -174
  638. package/dist/v2/components/Toast.js.map +1 -1
  639. package/dist/v2/components/Tooltip.js +23 -38
  640. package/dist/v2/components/Tooltip.js.map +1 -1
  641. package/dist/v2/components/_ErrorPageBody.js +15 -16
  642. package/dist/v2/components/_ErrorPageBody.js.map +1 -1
  643. package/dist/v2/components/_pickerShared.js +5 -5
  644. package/dist/v2/components/_pickerShared.js.map +1 -1
  645. package/dist/v2/components/index.d.ts +67 -1
  646. package/dist/v2/components/index.d.ts.map +1 -1
  647. package/dist/v2/components/index.js +153 -136
  648. package/dist/v2/components/index.js.map +1 -1
  649. package/dist/v2/hooks/index.d.ts +65 -0
  650. package/dist/v2/hooks/index.d.ts.map +1 -1
  651. package/dist/v2/hooks/index.js +63 -24
  652. package/dist/v2/hooks/index.js.map +1 -1
  653. package/dist/v2/hooks/useAppliedFilters.d.ts +102 -0
  654. package/dist/v2/hooks/useAppliedFilters.d.ts.map +1 -0
  655. package/dist/v2/hooks/useAppliedFilters.js +117 -0
  656. package/dist/v2/hooks/useAppliedFilters.js.map +1 -0
  657. package/dist/v2/hooks/useDebouncedCallback.d.ts +64 -0
  658. package/dist/v2/hooks/useDebouncedCallback.d.ts.map +1 -0
  659. package/dist/v2/hooks/useDebouncedCallback.js +87 -0
  660. package/dist/v2/hooks/useDebouncedCallback.js.map +1 -0
  661. package/dist/v2/hooks/useDelayedFlag.js +6 -20
  662. package/dist/v2/hooks/useDelayedFlag.js.map +1 -1
  663. package/dist/v2/hooks/useDensity.d.ts.map +1 -1
  664. package/dist/v2/hooks/useDensity.js +14 -18
  665. package/dist/v2/hooks/useDensity.js.map +1 -1
  666. package/dist/v2/hooks/useFocusFirstError.js +26 -34
  667. package/dist/v2/hooks/useFocusFirstError.js.map +1 -1
  668. package/dist/v2/hooks/useFocusOnRouteChange.d.ts +65 -0
  669. package/dist/v2/hooks/useFocusOnRouteChange.d.ts.map +1 -0
  670. package/dist/v2/hooks/useFocusOnRouteChange.js +88 -0
  671. package/dist/v2/hooks/useFocusOnRouteChange.js.map +1 -0
  672. package/dist/v2/hooks/useFocusTrap.js +20 -24
  673. package/dist/v2/hooks/useFocusTrap.js.map +1 -1
  674. package/dist/v2/hooks/useFormAutoSave.d.ts +4 -4
  675. package/dist/v2/hooks/useFormAutoSave.d.ts.map +1 -1
  676. package/dist/v2/hooks/useFormAutoSave.js +39 -54
  677. package/dist/v2/hooks/useFormAutoSave.js.map +1 -1
  678. package/dist/v2/hooks/useFormCompletionProgress.d.ts +1 -1
  679. package/dist/v2/hooks/useFormCompletionProgress.d.ts.map +1 -1
  680. package/dist/v2/hooks/useFormCompletionProgress.js +33 -52
  681. package/dist/v2/hooks/useFormCompletionProgress.js.map +1 -1
  682. package/dist/v2/hooks/useKeyboardShortcuts.d.ts +25 -0
  683. package/dist/v2/hooks/useKeyboardShortcuts.d.ts.map +1 -0
  684. package/dist/v2/hooks/useKeyboardShortcuts.js +132 -0
  685. package/dist/v2/hooks/useKeyboardShortcuts.js.map +1 -0
  686. package/dist/v2/hooks/usePrefersReducedMotion.d.ts +56 -0
  687. package/dist/v2/hooks/usePrefersReducedMotion.d.ts.map +1 -0
  688. package/dist/v2/hooks/usePrefersReducedMotion.js +105 -0
  689. package/dist/v2/hooks/usePrefersReducedMotion.js.map +1 -0
  690. package/dist/v2/hooks/useResolvedDensity.js +5 -13
  691. package/dist/v2/hooks/useResolvedDensity.js.map +1 -1
  692. package/dist/v2/hooks/useSortedRows.js +4 -6
  693. package/dist/v2/hooks/useSortedRows.js.map +1 -1
  694. package/dist/v2/hooks/useTabLoading.js +7 -22
  695. package/dist/v2/hooks/useTabLoading.js.map +1 -1
  696. package/dist/v2/index.d.ts.map +1 -1
  697. package/dist/v2/index.js +143 -145
  698. package/dist/v2/index.js.map +1 -1
  699. package/dist/v2/modalContext.js +2 -2
  700. package/dist/v2/modalContext.js.map +1 -1
  701. package/dist/v2/models/favorite.d.ts +8 -9
  702. package/dist/v2/models/favorite.d.ts.map +1 -1
  703. package/dist/v2/models/favorite.js.map +1 -1
  704. package/dist/v2/models/index.js +4 -4
  705. package/dist/v2/models/index.js.map +1 -1
  706. package/dist/v2/models/personalization.d.ts +44 -48
  707. package/dist/v2/models/personalization.d.ts.map +1 -1
  708. package/dist/v2/models/personalization.js.map +1 -1
  709. package/dist/v2/models/referentiel.d.ts +32 -50
  710. package/dist/v2/models/referentiel.d.ts.map +1 -1
  711. package/dist/v2/models/referentiel.js.map +1 -1
  712. package/dist/v2/models/savedFilter.d.ts +8 -17
  713. package/dist/v2/models/savedFilter.d.ts.map +1 -1
  714. package/dist/v2/models/savedFilter.js.map +1 -1
  715. package/dist/v2/patterns/ActionBar.js +152 -187
  716. package/dist/v2/patterns/ActionBar.js.map +1 -1
  717. package/dist/v2/patterns/AppMain.d.ts +109 -0
  718. package/dist/v2/patterns/AppMain.d.ts.map +1 -0
  719. package/dist/v2/patterns/AppMain.js +115 -0
  720. package/dist/v2/patterns/AppMain.js.map +1 -0
  721. package/dist/v2/patterns/BulkActionBar.js +40 -42
  722. package/dist/v2/patterns/BulkActionBar.js.map +1 -1
  723. package/dist/v2/patterns/ChartFigure.d.ts +124 -0
  724. package/dist/v2/patterns/ChartFigure.d.ts.map +1 -0
  725. package/dist/v2/patterns/ChartFigure.js +159 -0
  726. package/dist/v2/patterns/ChartFigure.js.map +1 -0
  727. package/dist/v2/patterns/CollapsibleDataGrid.js +138 -174
  728. package/dist/v2/patterns/CollapsibleDataGrid.js.map +1 -1
  729. package/dist/v2/patterns/ColumnsToggle.js +60 -94
  730. package/dist/v2/patterns/ColumnsToggle.js.map +1 -1
  731. package/dist/v2/patterns/DataGrid.d.ts.map +1 -1
  732. package/dist/v2/patterns/DataGrid.js +262 -297
  733. package/dist/v2/patterns/DataGrid.js.map +1 -1
  734. package/dist/v2/patterns/DataGridSettingsMenu.d.ts +12 -0
  735. package/dist/v2/patterns/DataGridSettingsMenu.d.ts.map +1 -1
  736. package/dist/v2/patterns/DataGridSettingsMenu.js +104 -121
  737. package/dist/v2/patterns/DataGridSettingsMenu.js.map +1 -1
  738. package/dist/v2/patterns/DataGridToolbar.js +103 -106
  739. package/dist/v2/patterns/DataGridToolbar.js.map +1 -1
  740. package/dist/v2/patterns/DataGridVirtualized.js +179 -217
  741. package/dist/v2/patterns/DataGridVirtualized.js.map +1 -1
  742. package/dist/v2/patterns/DeleteResourceConfirmDialog.js +32 -35
  743. package/dist/v2/patterns/DeleteResourceConfirmDialog.js.map +1 -1
  744. package/dist/v2/patterns/DetailSplit.d.ts +87 -0
  745. package/dist/v2/patterns/DetailSplit.d.ts.map +1 -0
  746. package/dist/v2/patterns/DetailSplit.js +116 -0
  747. package/dist/v2/patterns/DetailSplit.js.map +1 -0
  748. package/dist/v2/patterns/FavoriteColumn.d.ts +9 -9
  749. package/dist/v2/patterns/FavoriteColumn.d.ts.map +1 -1
  750. package/dist/v2/patterns/FavoriteColumn.js +32 -80
  751. package/dist/v2/patterns/FavoriteColumn.js.map +1 -1
  752. package/dist/v2/patterns/FavoritesFilter.js +36 -44
  753. package/dist/v2/patterns/FavoritesFilter.js.map +1 -1
  754. package/dist/v2/patterns/FilterTabBar.d.ts +28 -0
  755. package/dist/v2/patterns/FilterTabBar.d.ts.map +1 -0
  756. package/dist/v2/patterns/FilterTabBar.js +120 -0
  757. package/dist/v2/patterns/FilterTabBar.js.map +1 -0
  758. package/dist/v2/patterns/FormErrorSummary.js +20 -23
  759. package/dist/v2/patterns/FormErrorSummary.js.map +1 -1
  760. package/dist/v2/patterns/FormPageShell.js +53 -50
  761. package/dist/v2/patterns/FormPageShell.js.map +1 -1
  762. package/dist/v2/patterns/FormSection.d.ts +8 -3
  763. package/dist/v2/patterns/FormSection.d.ts.map +1 -1
  764. package/dist/v2/patterns/FormSection.js +44 -51
  765. package/dist/v2/patterns/FormSection.js.map +1 -1
  766. package/dist/v2/patterns/FormikCheckbox.d.ts +77 -0
  767. package/dist/v2/patterns/FormikCheckbox.d.ts.map +1 -0
  768. package/dist/v2/patterns/FormikCheckbox.js +138 -0
  769. package/dist/v2/patterns/FormikCheckbox.js.map +1 -0
  770. package/dist/v2/patterns/FormikCheckboxGroup.d.ts +17 -1
  771. package/dist/v2/patterns/FormikCheckboxGroup.d.ts.map +1 -1
  772. package/dist/v2/patterns/FormikCheckboxGroup.js +62 -65
  773. package/dist/v2/patterns/FormikCheckboxGroup.js.map +1 -1
  774. package/dist/v2/patterns/FormikCombobox.d.ts +7 -1
  775. package/dist/v2/patterns/FormikCombobox.d.ts.map +1 -1
  776. package/dist/v2/patterns/FormikCombobox.js +55 -69
  777. package/dist/v2/patterns/FormikCombobox.js.map +1 -1
  778. package/dist/v2/patterns/FormikDatePicker.d.ts +13 -1
  779. package/dist/v2/patterns/FormikDatePicker.d.ts.map +1 -1
  780. package/dist/v2/patterns/FormikDatePicker.js +59 -106
  781. package/dist/v2/patterns/FormikDatePicker.js.map +1 -1
  782. package/dist/v2/patterns/FormikDateTimePicker.d.ts +111 -0
  783. package/dist/v2/patterns/FormikDateTimePicker.d.ts.map +1 -0
  784. package/dist/v2/patterns/FormikDateTimePicker.js +144 -0
  785. package/dist/v2/patterns/FormikDateTimePicker.js.map +1 -0
  786. package/dist/v2/patterns/FormikErrorFocus.js +25 -26
  787. package/dist/v2/patterns/FormikErrorFocus.js.map +1 -1
  788. package/dist/v2/patterns/FormikErrorSummary.d.ts +74 -0
  789. package/dist/v2/patterns/FormikErrorSummary.d.ts.map +1 -0
  790. package/dist/v2/patterns/FormikErrorSummary.js +97 -0
  791. package/dist/v2/patterns/FormikErrorSummary.js.map +1 -0
  792. package/dist/v2/patterns/FormikFile.d.ts +14 -1
  793. package/dist/v2/patterns/FormikFile.d.ts.map +1 -1
  794. package/dist/v2/patterns/FormikFile.js +99 -83
  795. package/dist/v2/patterns/FormikFile.js.map +1 -1
  796. package/dist/v2/patterns/FormikInput.d.ts +11 -1
  797. package/dist/v2/patterns/FormikInput.d.ts.map +1 -1
  798. package/dist/v2/patterns/FormikInput.js +45 -55
  799. package/dist/v2/patterns/FormikInput.js.map +1 -1
  800. package/dist/v2/patterns/FormikRadioGroup.d.ts +80 -0
  801. package/dist/v2/patterns/FormikRadioGroup.d.ts.map +1 -0
  802. package/dist/v2/patterns/FormikRadioGroup.js +137 -0
  803. package/dist/v2/patterns/FormikRadioGroup.js.map +1 -0
  804. package/dist/v2/patterns/FormikReferentielField.d.ts +12 -1
  805. package/dist/v2/patterns/FormikReferentielField.d.ts.map +1 -1
  806. package/dist/v2/patterns/FormikReferentielField.js +54 -64
  807. package/dist/v2/patterns/FormikReferentielField.js.map +1 -1
  808. package/dist/v2/patterns/FormikSelect.d.ts +9 -1
  809. package/dist/v2/patterns/FormikSelect.d.ts.map +1 -1
  810. package/dist/v2/patterns/FormikSelect.js +70 -89
  811. package/dist/v2/patterns/FormikSelect.js.map +1 -1
  812. package/dist/v2/patterns/FormikTextarea.d.ts +9 -1
  813. package/dist/v2/patterns/FormikTextarea.d.ts.map +1 -1
  814. package/dist/v2/patterns/FormikTextarea.js +35 -48
  815. package/dist/v2/patterns/FormikTextarea.js.map +1 -1
  816. package/dist/v2/patterns/KeyboardShortcutsHelp.d.ts +14 -1
  817. package/dist/v2/patterns/KeyboardShortcutsHelp.d.ts.map +1 -1
  818. package/dist/v2/patterns/KeyboardShortcutsHelp.js +71 -74
  819. package/dist/v2/patterns/KeyboardShortcutsHelp.js.map +1 -1
  820. package/dist/v2/patterns/NetworkErrorBanner.js +13 -16
  821. package/dist/v2/patterns/NetworkErrorBanner.js.map +1 -1
  822. package/dist/v2/patterns/PageContent.js +17 -20
  823. package/dist/v2/patterns/PageContent.js.map +1 -1
  824. package/dist/v2/patterns/PreviewDrawer.d.ts +49 -0
  825. package/dist/v2/patterns/PreviewDrawer.d.ts.map +1 -0
  826. package/dist/v2/patterns/PreviewDrawer.js +159 -0
  827. package/dist/v2/patterns/PreviewDrawer.js.map +1 -0
  828. package/dist/v2/patterns/ReferentielField.d.ts +86 -2
  829. package/dist/v2/patterns/ReferentielField.d.ts.map +1 -1
  830. package/dist/v2/patterns/ReferentielField.js +347 -327
  831. package/dist/v2/patterns/ReferentielField.js.map +1 -1
  832. package/dist/v2/patterns/RowFavoriteToggle.d.ts +98 -0
  833. package/dist/v2/patterns/RowFavoriteToggle.d.ts.map +1 -0
  834. package/dist/v2/patterns/RowFavoriteToggle.js +135 -0
  835. package/dist/v2/patterns/RowFavoriteToggle.js.map +1 -0
  836. package/dist/v2/patterns/SaveFilterDialog.js +50 -77
  837. package/dist/v2/patterns/SaveFilterDialog.js.map +1 -1
  838. package/dist/v2/patterns/SavedFiltersMenu.js +89 -107
  839. package/dist/v2/patterns/SavedFiltersMenu.js.map +1 -1
  840. package/dist/v2/patterns/SkeletonPageShell.js +122 -143
  841. package/dist/v2/patterns/SkeletonPageShell.js.map +1 -1
  842. package/dist/v2/patterns/SortableHeader.js +35 -57
  843. package/dist/v2/patterns/SortableHeader.js.map +1 -1
  844. package/dist/v2/patterns/Tour.js +121 -142
  845. package/dist/v2/patterns/Tour.js.map +1 -1
  846. package/dist/v2/patterns/_dataGridShared.d.ts.map +1 -1
  847. package/dist/v2/patterns/_dataGridShared.js +131 -147
  848. package/dist/v2/patterns/_dataGridShared.js.map +1 -1
  849. package/dist/v2/patterns/_pickerSerialisation.d.ts +44 -0
  850. package/dist/v2/patterns/_pickerSerialisation.d.ts.map +1 -0
  851. package/dist/v2/patterns/_pickerSerialisation.js +80 -0
  852. package/dist/v2/patterns/_pickerSerialisation.js.map +1 -0
  853. package/dist/v2/patterns/_sort.js +17 -33
  854. package/dist/v2/patterns/_sort.js.map +1 -1
  855. package/dist/v2/patterns/_useColumnReorder.js +124 -163
  856. package/dist/v2/patterns/_useColumnReorder.js.map +1 -1
  857. package/dist/v2/patterns/_useColumnResize.js +80 -99
  858. package/dist/v2/patterns/_useColumnResize.js.map +1 -1
  859. package/dist/v2/patterns/filterCriteria.d.ts +78 -0
  860. package/dist/v2/patterns/filterCriteria.d.ts.map +1 -0
  861. package/dist/v2/patterns/filterCriteria.js +110 -0
  862. package/dist/v2/patterns/filterCriteria.js.map +1 -0
  863. package/dist/v2/patterns/index.d.ts +247 -0
  864. package/dist/v2/patterns/index.d.ts.map +1 -1
  865. package/dist/v2/patterns/index.js +182 -70
  866. package/dist/v2/patterns/index.js.map +1 -1
  867. package/dist/v2/patterns/rowActions.d.ts +150 -0
  868. package/dist/v2/patterns/rowActions.d.ts.map +1 -0
  869. package/dist/v2/patterns/rowActions.js +232 -0
  870. package/dist/v2/patterns/rowActions.js.map +1 -0
  871. package/dist/v2/personalization/PersonalizationProvider.d.ts.map +1 -1
  872. package/dist/v2/personalization/PersonalizationProvider.js +57 -53
  873. package/dist/v2/personalization/PersonalizationProvider.js.map +1 -1
  874. package/dist/v2/personalization/adapters/_storageKey.js +5 -5
  875. package/dist/v2/personalization/adapters/_storageKey.js.map +1 -1
  876. package/dist/v2/personalization/adapters/createLocalStorageAdapter.js +25 -24
  877. package/dist/v2/personalization/adapters/createLocalStorageAdapter.js.map +1 -1
  878. package/dist/v2/personalization/adapters/createMemoryAdapter.js +14 -14
  879. package/dist/v2/personalization/adapters/createMemoryAdapter.js.map +1 -1
  880. package/dist/v2/personalization/adapters/index.js +5 -5
  881. package/dist/v2/personalization/adapters/index.js.map +1 -1
  882. package/dist/v2/personalization/capabilities/favorites.js +39 -62
  883. package/dist/v2/personalization/capabilities/favorites.js.map +1 -1
  884. package/dist/v2/personalization/capabilities/favoritesView.js +25 -37
  885. package/dist/v2/personalization/capabilities/favoritesView.js.map +1 -1
  886. package/dist/v2/personalization/capabilities/gridPreferences.d.ts +100 -0
  887. package/dist/v2/personalization/capabilities/gridPreferences.d.ts.map +1 -0
  888. package/dist/v2/personalization/capabilities/gridPreferences.js +210 -0
  889. package/dist/v2/personalization/capabilities/gridPreferences.js.map +1 -0
  890. package/dist/v2/personalization/capabilities/index.d.ts +6 -0
  891. package/dist/v2/personalization/capabilities/index.d.ts.map +1 -1
  892. package/dist/v2/personalization/capabilities/index.js +23 -10
  893. package/dist/v2/personalization/capabilities/index.js.map +1 -1
  894. package/dist/v2/personalization/capabilities/reviveSavedCriteria.d.ts +88 -0
  895. package/dist/v2/personalization/capabilities/reviveSavedCriteria.d.ts.map +1 -0
  896. package/dist/v2/personalization/capabilities/reviveSavedCriteria.js +126 -0
  897. package/dist/v2/personalization/capabilities/reviveSavedCriteria.js.map +1 -0
  898. package/dist/v2/personalization/capabilities/savedFilters.js +93 -100
  899. package/dist/v2/personalization/capabilities/savedFilters.js.map +1 -1
  900. package/dist/v2/personalization/createPersonalizationStore.d.ts.map +1 -1
  901. package/dist/v2/personalization/createPersonalizationStore.js +81 -182
  902. package/dist/v2/personalization/createPersonalizationStore.js.map +1 -1
  903. package/dist/v2/personalization/index.d.ts +34 -0
  904. package/dist/v2/personalization/index.d.ts.map +1 -1
  905. package/dist/v2/personalization/index.js +41 -21
  906. package/dist/v2/personalization/index.js.map +1 -1
  907. package/dist/v2/personalization/personalizationContext.js +10 -12
  908. package/dist/v2/personalization/personalizationContext.js.map +1 -1
  909. package/dist/v2/personalization/schema.js +8 -9
  910. package/dist/v2/personalization/schema.js.map +1 -1
  911. package/dist/v2/referentiel/ReferentielProvider.js +31 -45
  912. package/dist/v2/referentiel/ReferentielProvider.js.map +1 -1
  913. package/dist/v2/referentiel/index.js +11 -13
  914. package/dist/v2/referentiel/index.js.map +1 -1
  915. package/dist/v2/referentiel/types.d.ts +105 -0
  916. package/dist/v2/referentiel/types.d.ts.map +1 -0
  917. package/dist/v2/referentiel/types.js +6 -0
  918. package/dist/v2/referentiel/types.js.map +1 -0
  919. package/dist/v2/referentiel/useReferentielClient.js +13 -16
  920. package/dist/v2/referentiel/useReferentielClient.js.map +1 -1
  921. package/dist/v2/referentiel/useReferentielOptions.d.ts +7 -17
  922. package/dist/v2/referentiel/useReferentielOptions.d.ts.map +1 -1
  923. package/dist/v2/referentiel/useReferentielOptions.js +63 -120
  924. package/dist/v2/referentiel/useReferentielOptions.js.map +1 -1
  925. package/dist/v2/referentiel/useReferentielSearch.d.ts +7 -48
  926. package/dist/v2/referentiel/useReferentielSearch.d.ts.map +1 -1
  927. package/dist/v2/referentiel/useReferentielSearch.js +40 -95
  928. package/dist/v2/referentiel/useReferentielSearch.js.map +1 -1
  929. package/dist/v2/theme/_brand.js +12 -26
  930. package/dist/v2/theme/_brand.js.map +1 -1
  931. package/dist/v2/theme/_brandSecondary.js +12 -26
  932. package/dist/v2/theme/_brandSecondary.js.map +1 -1
  933. package/dist/v2/theme/createPortnetTheme.js +41 -49
  934. package/dist/v2/theme/createPortnetTheme.js.map +1 -1
  935. package/dist/v2/theme/cssVariables.d.ts +3 -3
  936. package/dist/v2/theme/cssVariables.d.ts.map +1 -1
  937. package/dist/v2/theme/cssVariables.js +65 -70
  938. package/dist/v2/theme/cssVariables.js.map +1 -1
  939. package/dist/v2/theme/index.js +10 -10
  940. package/dist/v2/theme/index.js.map +1 -1
  941. package/dist/v2/tokens/breakpoints.js +16 -16
  942. package/dist/v2/tokens/breakpoints.js.map +1 -1
  943. package/dist/v2/tokens/chart.d.ts +103 -0
  944. package/dist/v2/tokens/chart.d.ts.map +1 -0
  945. package/dist/v2/tokens/chart.js +270 -0
  946. package/dist/v2/tokens/chart.js.map +1 -0
  947. package/dist/v2/tokens/colors.js +24 -24
  948. package/dist/v2/tokens/colors.js.map +1 -1
  949. package/dist/v2/tokens/density.d.ts +104 -0
  950. package/dist/v2/tokens/density.d.ts.map +1 -1
  951. package/dist/v2/tokens/density.js +67 -12
  952. package/dist/v2/tokens/density.js.map +1 -1
  953. package/dist/v2/tokens/index.d.ts +50 -1
  954. package/dist/v2/tokens/index.d.ts.map +1 -1
  955. package/dist/v2/tokens/index.js +116 -68
  956. package/dist/v2/tokens/index.js.map +1 -1
  957. package/dist/v2/tokens/motion.js +16 -22
  958. package/dist/v2/tokens/motion.js.map +1 -1
  959. package/dist/v2/tokens/radius.js +3 -3
  960. package/dist/v2/tokens/radius.js.map +1 -1
  961. package/dist/v2/tokens/shadows.js +8 -8
  962. package/dist/v2/tokens/shadows.js.map +1 -1
  963. package/dist/v2/tokens/spacing.js +4 -4
  964. package/dist/v2/tokens/spacing.js.map +1 -1
  965. package/dist/v2/tokens/state.js +3 -3
  966. package/dist/v2/tokens/state.js.map +1 -1
  967. package/dist/v2/tokens/statusPalette.js +21 -23
  968. package/dist/v2/tokens/statusPalette.js.map +1 -1
  969. package/dist/v2/tokens/tokens.json +6 -1
  970. package/dist/v2/tokens/typography.js +15 -15
  971. package/dist/v2/tokens/typography.js.map +1 -1
  972. package/dist/v2/tokens/zIndex.js +3 -3
  973. package/dist/v2/tokens/zIndex.js.map +1 -1
  974. package/dist/v2/types/datagrid.d.ts +9 -1
  975. package/dist/v2/types/datagrid.d.ts.map +1 -1
  976. package/dist/v2/types/datagrid.js.map +1 -1
  977. package/dist/v2/types/index.js +2 -2
  978. package/dist/v2/types/index.js.map +1 -1
  979. package/dist/v2/utils/apiError.js +16 -37
  980. package/dist/v2/utils/apiError.js.map +1 -1
  981. package/dist/v2/utils/contrast.js +31 -32
  982. package/dist/v2/utils/contrast.js.map +1 -1
  983. package/dist/v2/utils/cx.js +7 -27
  984. package/dist/v2/utils/cx.js.map +1 -1
  985. package/dist/v2/utils/fileDownload.js +25 -28
  986. package/dist/v2/utils/fileDownload.js.map +1 -1
  987. package/dist/v2/utils/fileValidation.d.ts +116 -0
  988. package/dist/v2/utils/fileValidation.d.ts.map +1 -0
  989. package/dist/v2/utils/fileValidation.js +220 -0
  990. package/dist/v2/utils/fileValidation.js.map +1 -0
  991. package/dist/v2/utils/fmtDate.d.ts +103 -0
  992. package/dist/v2/utils/fmtDate.d.ts.map +1 -0
  993. package/dist/v2/utils/fmtDate.js +119 -0
  994. package/dist/v2/utils/fmtDate.js.map +1 -0
  995. package/dist/v2/utils/fmtMoney.d.ts +3 -3
  996. package/dist/v2/utils/fmtMoney.d.ts.map +1 -1
  997. package/dist/v2/utils/fmtMoney.js +9 -11
  998. package/dist/v2/utils/fmtMoney.js.map +1 -1
  999. package/dist/v2/utils/formikErrors.d.ts +67 -0
  1000. package/dist/v2/utils/formikErrors.d.ts.map +1 -0
  1001. package/dist/v2/utils/formikErrors.js +85 -0
  1002. package/dist/v2/utils/formikErrors.js.map +1 -0
  1003. package/dist/v2/utils/index.d.ts +5 -0
  1004. package/dist/v2/utils/index.d.ts.map +1 -1
  1005. package/dist/v2/utils/index.js +67 -18
  1006. package/dist/v2/utils/index.js.map +1 -1
  1007. package/dist/v2/utils/mergeLabels.js +9 -14
  1008. package/dist/v2/utils/mergeLabels.js.map +1 -1
  1009. package/dist/v2/utils/networkStatus.js +14 -14
  1010. package/dist/v2/utils/networkStatus.js.map +1 -1
  1011. package/package.json +26 -9
@@ -1,9 +1,3 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
5
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
1
  import "@testing-library/jest-dom";
8
2
  import * as React from "react";
9
3
  import { render, screen, fireEvent } from "@testing-library/react";
@@ -31,23 +25,23 @@ import SectionErrorBoundary from "../components/SectionErrorBoundary";
31
25
 
32
26
  /** A component that throws on render, controlled by a prop. */
33
27
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
34
- function Boom(_ref) {
35
- var _ref$shouldThrow = _ref.shouldThrow,
36
- shouldThrow = _ref$shouldThrow === void 0 ? true : _ref$shouldThrow;
28
+ function Boom({
29
+ shouldThrow = true
30
+ }) {
37
31
  if (shouldThrow) throw new Error("payload inattendu: articles.map n'est pas une fonction");
38
32
  return /*#__PURE__*/_jsx("div", {
39
33
  children: "contenu r\xE9tabli"
40
34
  });
41
35
  }
42
- var consoleErrorSpy;
43
- beforeEach(function () {
44
- consoleErrorSpy = jest.spyOn(console, "error").mockImplementation(function () {});
36
+ let consoleErrorSpy;
37
+ beforeEach(() => {
38
+ consoleErrorSpy = jest.spyOn(console, "error").mockImplementation(() => {});
45
39
  });
46
- afterEach(function () {
40
+ afterEach(() => {
47
41
  consoleErrorSpy.mockRestore();
48
42
  });
49
- describe("SectionErrorBoundary — containment", function () {
50
- test("renders children untouched when nothing throws", function () {
43
+ describe("SectionErrorBoundary — containment", () => {
44
+ test("renders children untouched when nothing throws", () => {
51
45
  render(/*#__PURE__*/_jsx(SectionErrorBoundary, {
52
46
  title: "Marchandises",
53
47
  children: /*#__PURE__*/_jsx("div", {
@@ -57,7 +51,7 @@ describe("SectionErrorBoundary — containment", function () {
57
51
  expect(screen.getByText("contenu normal")).toBeInTheDocument();
58
52
  expect(screen.queryByRole("alert")).not.toBeInTheDocument();
59
53
  });
60
- test("catches a render exception and keeps its SIBLINGS mounted", function () {
54
+ test("catches a render exception and keeps its SIBLINGS mounted", () => {
61
55
  /* THE contract. The assertion that matters is not that the banner appears —
62
56
  * it is that `sibling` is still in the document. Without a boundary React
63
57
  * unmounts the entire tree and BOTH would be gone: that is the blank screen
@@ -73,22 +67,22 @@ describe("SectionErrorBoundary — containment", function () {
73
67
  expect(screen.getByText("sibling")).toBeInTheDocument();
74
68
  expect(screen.getByRole("alert")).toBeInTheDocument();
75
69
  });
76
- test("names the failing section so the user knows WHAT broke", function () {
70
+ test("names the failing section so the user knows WHAT broke", () => {
77
71
  render(/*#__PURE__*/_jsx(SectionErrorBoundary, {
78
72
  title: "Marchandises",
79
73
  children: /*#__PURE__*/_jsx(Boom, {})
80
74
  }));
81
75
  expect(screen.getByRole("alert")).toHaveTextContent("Marchandises");
82
76
  });
83
- test("falls back to a generic label when no title is supplied", function () {
77
+ test("falls back to a generic label when no title is supplied", () => {
84
78
  render(/*#__PURE__*/_jsx(SectionErrorBoundary, {
85
79
  children: /*#__PURE__*/_jsx(Boom, {})
86
80
  }));
87
81
  expect(screen.getByRole("alert")).toHaveTextContent("Section");
88
82
  });
89
83
  });
90
- describe("SectionErrorBoundary — user-facing copy (§09.3)", function () {
91
- test("shows French recovery copy, never a raw exception message", function () {
84
+ describe("SectionErrorBoundary — user-facing copy (§09.3)", () => {
85
+ test("shows French recovery copy, never a raw exception message", () => {
92
86
  /* Charter §09.3 forbids exposing technical detail to the user, and a raw JS
93
87
  * exception is worse than the "Erreur HTTP 422" the charter uses as its DON'T
94
88
  * example. The reference implementation this was promoted from rendered
@@ -104,8 +98,8 @@ describe("SectionErrorBoundary — user-facing copy (§09.3)", function () {
104
98
  }));
105
99
  expect(screen.getByRole("alert")).toHaveTextContent(/Cette section n'a pas pu s'afficher/);
106
100
  });
107
- test("suppresses the technical detail in production", function () {
108
- var previous = process.env["NODE_ENV"];
101
+ test("suppresses the technical detail in production", () => {
102
+ const previous = process.env["NODE_ENV"];
109
103
  /* Bracket access throughout, matching the component: `process.env` is an index
110
104
  * signature and `noPropertyAccessFromIndexSignature` is mandatory. Tests are
111
105
  * outside tsconfig.build.json's scope so dot access would have compiled here —
@@ -122,18 +116,18 @@ describe("SectionErrorBoundary — user-facing copy (§09.3)", function () {
122
116
  expect(screen.getByRole("alert")).toHaveTextContent(/Cette section n'a pas pu s'afficher/);
123
117
  expect(screen.getByRole("alert")).not.toHaveTextContent(/articles\.map/);
124
118
  } finally {
125
- process.env["NODE_ENV"] = previous !== null && previous !== void 0 ? previous : "test";
119
+ process.env["NODE_ENV"] = previous ?? "test";
126
120
  }
127
121
  });
128
122
  });
129
- describe("SectionErrorBoundary — retry REMOUNTS", function () {
130
- test("retry clears the error and re-renders the subtree", function () {
123
+ describe("SectionErrorBoundary — retry REMOUNTS", () => {
124
+ test("retry clears the error and re-renders the subtree", () => {
131
125
  /* The re-key on `attempt` is what makes this work. Without it React reuses
132
126
  * the instance that threw and retry fails identically — a retry button that
133
127
  * cannot succeed is worse than no retry button. `shouldThrow` is read from a
134
128
  * mutable holder so the same element throws first and succeeds second,
135
129
  * exactly as a transient payload problem would. */
136
- var holder = {
130
+ const holder = {
137
131
  shouldThrow: true
138
132
  };
139
133
  function Flaky() {
@@ -153,7 +147,7 @@ describe("SectionErrorBoundary — retry REMOUNTS", function () {
153
147
  expect(screen.getByText("contenu rétabli")).toBeInTheDocument();
154
148
  expect(screen.queryByRole("alert")).not.toBeInTheDocument();
155
149
  });
156
- test("a custom retryLabel is used on the button and in the copy", function () {
150
+ test("a custom retryLabel is used on the button and in the copy", () => {
157
151
  render(/*#__PURE__*/_jsx(SectionErrorBoundary, {
158
152
  title: "Marchandises",
159
153
  retryLabel: "Recharger",
@@ -165,44 +159,39 @@ describe("SectionErrorBoundary — retry REMOUNTS", function () {
165
159
  expect(screen.getByRole("alert")).toHaveTextContent(/Recharger/);
166
160
  });
167
161
  });
168
- describe("SectionErrorBoundary — reporting and second exit", function () {
169
- test("calls onError with the error and the component info", function () {
162
+ describe("SectionErrorBoundary — reporting and second exit", () => {
163
+ test("calls onError with the error and the component info", () => {
170
164
  /* console.error is invisible in production, so without this hook a boundary
171
165
  * silently swallows the only signal an operator would ever get. */
172
- var onError = jest.fn();
166
+ const onError = jest.fn();
173
167
  render(/*#__PURE__*/_jsx(SectionErrorBoundary, {
174
168
  title: "Marchandises",
175
169
  onError: onError,
176
170
  children: /*#__PURE__*/_jsx(Boom, {})
177
171
  }));
178
172
  expect(onError).toHaveBeenCalledTimes(1);
179
- var _ref2 = onError.mock.calls[0],
180
- _ref3 = _slicedToArray(_ref2, 2),
181
- err = _ref3[0],
182
- info = _ref3[1];
173
+ const [err, info] = onError.mock.calls[0];
183
174
  expect(err).toBeInstanceOf(Error);
184
175
  expect(err.message).toMatch(/articles\.map/);
185
176
  expect(info).toHaveProperty("componentStack");
186
177
  });
187
- test("a throwing onError does not take the boundary down with it", function () {
178
+ test("a throwing onError does not take the boundary down with it", () => {
188
179
  /* Guard on the guard. A reporter that throws must not defeat the component
189
180
  * whose entire purpose is stopping one failure from causing another. */
190
- var onError = jest.fn(function () {
181
+ const onError = jest.fn(() => {
191
182
  throw new Error("APM indisponible");
192
183
  });
193
- expect(function () {
194
- return render(/*#__PURE__*/_jsx(SectionErrorBoundary, {
195
- title: "Marchandises",
196
- onError: onError,
197
- children: /*#__PURE__*/_jsx(Boom, {})
198
- }));
199
- }).not.toThrow();
184
+ expect(() => render(/*#__PURE__*/_jsx(SectionErrorBoundary, {
185
+ title: "Marchandises",
186
+ onError: onError,
187
+ children: /*#__PURE__*/_jsx(Boom, {})
188
+ }))).not.toThrow();
200
189
  expect(screen.getByRole("alert")).toBeInTheDocument();
201
190
  });
202
- test("renders the optional secondary exit when supplied", function () {
191
+ test("renders the optional secondary exit when supplied", () => {
203
192
  /* Only possible since Banner gained secondaryAction (gap G-19). The reference
204
193
  * implementation offered no way out when retrying could not help. */
205
- var onEscape = jest.fn();
194
+ const onEscape = jest.fn();
206
195
  render(/*#__PURE__*/_jsx(SectionErrorBoundary, {
207
196
  title: "Marchandises",
208
197
  secondaryAction: {
@@ -211,24 +200,20 @@ describe("SectionErrorBoundary — reporting and second exit", function () {
211
200
  },
212
201
  children: /*#__PURE__*/_jsx(Boom, {})
213
202
  }));
214
- var escape = screen.getByRole("button", {
203
+ const escape = screen.getByRole("button", {
215
204
  name: /Retour à la liste/
216
205
  });
217
206
  fireEvent.click(escape);
218
207
  expect(onEscape).toHaveBeenCalledTimes(1);
219
208
  });
220
- test("logs the section title and the component stack", function () {
209
+ test("logs the section title and the component stack", () => {
221
210
  render(/*#__PURE__*/_jsx(SectionErrorBoundary, {
222
211
  title: "Marchandises",
223
212
  children: /*#__PURE__*/_jsx(Boom, {})
224
213
  }));
225
214
  /* Asserted loosely — the point is that an operator grepping logs can find
226
215
  * WHICH section failed, not the exact format of the line. */
227
- var logged = consoleErrorSpy.mock.calls.some(function (args) {
228
- return args.some(function (a) {
229
- return typeof a === "string" && a.includes("Marchandises");
230
- });
231
- });
216
+ const logged = consoleErrorSpy.mock.calls.some(args => args.some(a => typeof a === "string" && a.includes("Marchandises")));
232
217
  expect(logged).toBe(true);
233
218
  });
234
219
  });
@@ -1 +1 @@
1
- {"version":3,"file":"SectionErrorBoundary.test.js","names":["React","render","screen","fireEvent","SectionErrorBoundary","jsx","_jsx","jsxs","_jsxs","Boom","_ref","_ref$shouldThrow","shouldThrow","Error","children","consoleErrorSpy","beforeEach","jest","spyOn","console","mockImplementation","afterEach","mockRestore","describe","test","title","expect","getByText","toBeInTheDocument","queryByRole","not","getByRole","toHaveTextContent","previous","process","env","holder","Flaky","click","name","retryLabel","onError","fn","toHaveBeenCalledTimes","_ref2","mock","calls","_ref3","_slicedToArray","err","info","toBeInstanceOf","message","toMatch","toHaveProperty","toThrow","onEscape","secondaryAction","label","onClick","escape","logged","some","args","a","includes","toBe"],"sources":["../../../../src/lib/v2/__tests__/SectionErrorBoundary.test.tsx"],"sourcesContent":["import \"@testing-library/jest-dom\";\r\nimport * as React from \"react\";\r\nimport { render, screen, fireEvent } from \"@testing-library/react\";\r\nimport SectionErrorBoundary from \"../components/SectionErrorBoundary\";\r\n\r\n/**\r\n * SectionErrorBoundary — behaviour tests.\r\n *\r\n * WHY THIS FILE MATTERS MORE THAN MOST\r\n * ------------------------------------\r\n * §10.3 R-G.6 MUST, but the real reason is that this is the one component in the\r\n * library whose ENTIRE contract is a failure path. Every other component can be\r\n * eyeballed in Storybook; this one only does its job when something throws, which\r\n * nobody exercises by hand. And its failure mode is total: if the boundary does\r\n * not catch, React unmounts the whole tree and the user gets a blank screen\r\n * (ISO/IEC 25010 § Reliability — fault tolerance).\r\n *\r\n * jsdom is the right tool here, unusually: catching, re-mounting, logging and\r\n * conditional detail are all logic, not layout.\r\n *\r\n * NOTE ON CONSOLE NOISE — React logs caught errors to console.error itself, on\r\n * top of the boundary's own log. Both are silenced per-test rather than globally\r\n * so a genuine unexpected console.error still surfaces in the other suites.\r\n */\r\n\r\n/** A component that throws on render, controlled by a prop. */\r\nfunction Boom({ shouldThrow = true }: { shouldThrow?: boolean }) {\r\n if (shouldThrow) throw new Error(\"payload inattendu: articles.map n'est pas une fonction\");\r\n return <div>contenu rétabli</div>;\r\n}\r\n\r\nlet consoleErrorSpy: jest.SpyInstance;\r\n\r\nbeforeEach(() => {\r\n consoleErrorSpy = jest.spyOn(console, \"error\").mockImplementation(() => {});\r\n});\r\n\r\nafterEach(() => {\r\n consoleErrorSpy.mockRestore();\r\n});\r\n\r\ndescribe(\"SectionErrorBoundary — containment\", () => {\r\n test(\"renders children untouched when nothing throws\", () => {\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\">\r\n <div>contenu normal</div>\r\n </SectionErrorBoundary>\r\n );\r\n expect(screen.getByText(\"contenu normal\")).toBeInTheDocument();\r\n expect(screen.queryByRole(\"alert\")).not.toBeInTheDocument();\r\n });\r\n\r\n test(\"catches a render exception and keeps its SIBLINGS mounted\", () => {\r\n /* THE contract. The assertion that matters is not that the banner appears —\r\n * it is that `sibling` is still in the document. Without a boundary React\r\n * unmounts the entire tree and BOTH would be gone: that is the blank screen\r\n * this component exists to prevent. */\r\n render(\r\n <div>\r\n <div>sibling</div>\r\n <SectionErrorBoundary title=\"Marchandises\">\r\n <Boom />\r\n </SectionErrorBoundary>\r\n </div>\r\n );\r\n\r\n expect(screen.getByText(\"sibling\")).toBeInTheDocument();\r\n expect(screen.getByRole(\"alert\")).toBeInTheDocument();\r\n });\r\n\r\n test(\"names the failing section so the user knows WHAT broke\", () => {\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\">\r\n <Boom />\r\n </SectionErrorBoundary>\r\n );\r\n expect(screen.getByRole(\"alert\")).toHaveTextContent(\"Marchandises\");\r\n });\r\n\r\n test(\"falls back to a generic label when no title is supplied\", () => {\r\n render(\r\n <SectionErrorBoundary>\r\n <Boom />\r\n </SectionErrorBoundary>\r\n );\r\n expect(screen.getByRole(\"alert\")).toHaveTextContent(\"Section\");\r\n });\r\n});\r\n\r\ndescribe(\"SectionErrorBoundary — user-facing copy (§09.3)\", () => {\r\n test(\"shows French recovery copy, never a raw exception message\", () => {\r\n /* Charter §09.3 forbids exposing technical detail to the user, and a raw JS\r\n * exception is worse than the \"Erreur HTTP 422\" the charter uses as its DON'T\r\n * example. The reference implementation this was promoted from rendered\r\n * error.message straight into the banner body; this asserts we do not.\r\n *\r\n * NODE_ENV is \"test\" here, not \"production\", so the dev detail block DOES\r\n * render — which is why this test targets the recovery sentence rather than\r\n * asserting the absence of the message. The production-only behaviour is\r\n * asserted separately below. */\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\">\r\n <Boom />\r\n </SectionErrorBoundary>\r\n );\r\n expect(screen.getByRole(\"alert\")).toHaveTextContent(\r\n /Cette section n'a pas pu s'afficher/\r\n );\r\n });\r\n\r\n test(\"suppresses the technical detail in production\", () => {\r\n const previous = process.env[\"NODE_ENV\"];\r\n /* Bracket access throughout, matching the component: `process.env` is an index\r\n * signature and `noPropertyAccessFromIndexSignature` is mandatory. Tests are\r\n * outside tsconfig.build.json's scope so dot access would have compiled here —\r\n * two conventions in neighbouring files is the drift this audit exists to stop.\r\n *\r\n * Assigned rather than replaced wholesale: other suites read NODE_ENV, and the\r\n * finally block restores it even if the assertion throws. */\r\n (process.env as Record<string, string>)[\"NODE_ENV\"] = \"production\";\r\n try {\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\">\r\n <Boom />\r\n </SectionErrorBoundary>\r\n );\r\n expect(screen.getByRole(\"alert\")).toHaveTextContent(\r\n /Cette section n'a pas pu s'afficher/\r\n );\r\n expect(screen.getByRole(\"alert\")).not.toHaveTextContent(/articles\\.map/);\r\n } finally {\r\n (process.env as Record<string, string>)[\"NODE_ENV\"] = previous ?? \"test\";\r\n }\r\n });\r\n});\r\n\r\ndescribe(\"SectionErrorBoundary — retry REMOUNTS\", () => {\r\n test(\"retry clears the error and re-renders the subtree\", () => {\r\n /* The re-key on `attempt` is what makes this work. Without it React reuses\r\n * the instance that threw and retry fails identically — a retry button that\r\n * cannot succeed is worse than no retry button. `shouldThrow` is read from a\r\n * mutable holder so the same element throws first and succeeds second,\r\n * exactly as a transient payload problem would. */\r\n const holder = { shouldThrow: true };\r\n function Flaky() {\r\n return <Boom shouldThrow={holder.shouldThrow} />;\r\n }\r\n\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\">\r\n <Flaky />\r\n </SectionErrorBoundary>\r\n );\r\n expect(screen.getByRole(\"alert\")).toBeInTheDocument();\r\n\r\n holder.shouldThrow = false;\r\n fireEvent.click(screen.getByRole(\"button\", { name: /Réessayer/ }));\r\n\r\n expect(screen.getByText(\"contenu rétabli\")).toBeInTheDocument();\r\n expect(screen.queryByRole(\"alert\")).not.toBeInTheDocument();\r\n });\r\n\r\n test(\"a custom retryLabel is used on the button and in the copy\", () => {\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\" retryLabel=\"Recharger\">\r\n <Boom />\r\n </SectionErrorBoundary>\r\n );\r\n expect(screen.getByRole(\"button\", { name: /Recharger/ })).toBeInTheDocument();\r\n expect(screen.getByRole(\"alert\")).toHaveTextContent(/Recharger/);\r\n });\r\n});\r\n\r\ndescribe(\"SectionErrorBoundary — reporting and second exit\", () => {\r\n test(\"calls onError with the error and the component info\", () => {\r\n /* console.error is invisible in production, so without this hook a boundary\r\n * silently swallows the only signal an operator would ever get. */\r\n const onError = jest.fn();\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\" onError={onError}>\r\n <Boom />\r\n </SectionErrorBoundary>\r\n );\r\n\r\n expect(onError).toHaveBeenCalledTimes(1);\r\n const [err, info] = onError.mock.calls[0] as [Error, React.ErrorInfo];\r\n expect(err).toBeInstanceOf(Error);\r\n expect(err.message).toMatch(/articles\\.map/);\r\n expect(info).toHaveProperty(\"componentStack\");\r\n });\r\n\r\n test(\"a throwing onError does not take the boundary down with it\", () => {\r\n /* Guard on the guard. A reporter that throws must not defeat the component\r\n * whose entire purpose is stopping one failure from causing another. */\r\n const onError = jest.fn(() => {\r\n throw new Error(\"APM indisponible\");\r\n });\r\n\r\n expect(() =>\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\" onError={onError}>\r\n <Boom />\r\n </SectionErrorBoundary>\r\n )\r\n ).not.toThrow();\r\n\r\n expect(screen.getByRole(\"alert\")).toBeInTheDocument();\r\n });\r\n\r\n test(\"renders the optional secondary exit when supplied\", () => {\r\n /* Only possible since Banner gained secondaryAction (gap G-19). The reference\r\n * implementation offered no way out when retrying could not help. */\r\n const onEscape = jest.fn();\r\n render(\r\n <SectionErrorBoundary\r\n title=\"Marchandises\"\r\n secondaryAction={{ label: \"Retour à la liste\", onClick: onEscape }}\r\n >\r\n <Boom />\r\n </SectionErrorBoundary>\r\n );\r\n\r\n const escape = screen.getByRole(\"button\", { name: /Retour à la liste/ });\r\n fireEvent.click(escape);\r\n expect(onEscape).toHaveBeenCalledTimes(1);\r\n });\r\n\r\n test(\"logs the section title and the component stack\", () => {\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\">\r\n <Boom />\r\n </SectionErrorBoundary>\r\n );\r\n /* Asserted loosely — the point is that an operator grepping logs can find\r\n * WHICH section failed, not the exact format of the line. */\r\n const logged = consoleErrorSpy.mock.calls.some((args) =>\r\n args.some((a) => typeof a === \"string\" && a.includes(\"Marchandises\"))\r\n );\r\n expect(logged).toBe(true);\r\n });\r\n});\r\n"],"mappings":";;;;;;AAAA,OAAO,2BAA2B;AAClC,OAAO,KAAKA,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AAC;IAC1BzC,MAAM,cACJK,IAAA,CAACF,oBAAoB;MACnBqB,KAAK,EAAC,cAAc;MACpBgC,eAAe,EAAE;QAAEC,KAAK,EAAE,mBAAmB;QAAEC,OAAO,EAAEH;MAAS,CAAE;MAAA1C,QAAA,eAEnER,IAAA,CAACG,IAAI,IAAE;IAAC,CACY,CACxB,CAAC;IAED,IAAMmD,MAAM,GAAG1D,MAAM,CAAC6B,SAAS,CAAC,QAAQ,EAAE;MAAEQ,IAAI,EAAE;IAAoB,CAAC,CAAC;IACxEpC,SAAS,CAACmC,KAAK,CAACsB,MAAM,CAAC;IACvBlC,MAAM,CAAC8B,QAAQ,CAAC,CAACb,qBAAqB,CAAC,CAAC,CAAC;EAC3C,CAAC,CAAC;EAEFnB,IAAI,CAAC,gDAAgD,EAAE,YAAM;IAC3DvB,MAAM,cACJK,IAAA,CAACF,oBAAoB;MAACqB,KAAK,EAAC,cAAc;MAAAX,QAAA,eACxCR,IAAA,CAACG,IAAI,IAAE;IAAC,CACY,CACxB,CAAC;IACD;AACJ;IACI,IAAMoD,MAAM,GAAG9C,eAAe,CAAC8B,IAAI,CAACC,KAAK,CAACgB,IAAI,CAAC,UAACC,IAAI;MAAA,OAClDA,IAAI,CAACD,IAAI,CAAC,UAACE,CAAC;QAAA,OAAK,OAAOA,CAAC,KAAK,QAAQ,IAAIA,CAAC,CAACC,QAAQ,CAAC,cAAc,CAAC;MAAA,EAAC;IAAA,CACvE,CAAC;IACDvC,MAAM,CAACmC,MAAM,CAAC,CAACK,IAAI,CAAC,IAAI,CAAC;EAC3B,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"SectionErrorBoundary.test.js","names":["React","render","screen","fireEvent","SectionErrorBoundary","jsx","_jsx","jsxs","_jsxs","Boom","shouldThrow","Error","children","consoleErrorSpy","beforeEach","jest","spyOn","console","mockImplementation","afterEach","mockRestore","describe","test","title","expect","getByText","toBeInTheDocument","queryByRole","not","getByRole","toHaveTextContent","previous","process","env","holder","Flaky","click","name","retryLabel","onError","fn","toHaveBeenCalledTimes","err","info","mock","calls","toBeInstanceOf","message","toMatch","toHaveProperty","toThrow","onEscape","secondaryAction","label","onClick","escape","logged","some","args","a","includes","toBe"],"sources":["../../../../src/lib/v2/__tests__/SectionErrorBoundary.test.tsx"],"sourcesContent":["import \"@testing-library/jest-dom\";\r\nimport * as React from \"react\";\r\nimport { render, screen, fireEvent } from \"@testing-library/react\";\r\nimport SectionErrorBoundary from \"../components/SectionErrorBoundary\";\r\n\r\n/**\r\n * SectionErrorBoundary — behaviour tests.\r\n *\r\n * WHY THIS FILE MATTERS MORE THAN MOST\r\n * ------------------------------------\r\n * §10.3 R-G.6 MUST, but the real reason is that this is the one component in the\r\n * library whose ENTIRE contract is a failure path. Every other component can be\r\n * eyeballed in Storybook; this one only does its job when something throws, which\r\n * nobody exercises by hand. And its failure mode is total: if the boundary does\r\n * not catch, React unmounts the whole tree and the user gets a blank screen\r\n * (ISO/IEC 25010 § Reliability — fault tolerance).\r\n *\r\n * jsdom is the right tool here, unusually: catching, re-mounting, logging and\r\n * conditional detail are all logic, not layout.\r\n *\r\n * NOTE ON CONSOLE NOISE — React logs caught errors to console.error itself, on\r\n * top of the boundary's own log. Both are silenced per-test rather than globally\r\n * so a genuine unexpected console.error still surfaces in the other suites.\r\n */\r\n\r\n/** A component that throws on render, controlled by a prop. */\r\nfunction Boom({ shouldThrow = true }: { shouldThrow?: boolean }) {\r\n if (shouldThrow) throw new Error(\"payload inattendu: articles.map n'est pas une fonction\");\r\n return <div>contenu rétabli</div>;\r\n}\r\n\r\nlet consoleErrorSpy: jest.SpyInstance;\r\n\r\nbeforeEach(() => {\r\n consoleErrorSpy = jest.spyOn(console, \"error\").mockImplementation(() => {});\r\n});\r\n\r\nafterEach(() => {\r\n consoleErrorSpy.mockRestore();\r\n});\r\n\r\ndescribe(\"SectionErrorBoundary — containment\", () => {\r\n test(\"renders children untouched when nothing throws\", () => {\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\">\r\n <div>contenu normal</div>\r\n </SectionErrorBoundary>\r\n );\r\n expect(screen.getByText(\"contenu normal\")).toBeInTheDocument();\r\n expect(screen.queryByRole(\"alert\")).not.toBeInTheDocument();\r\n });\r\n\r\n test(\"catches a render exception and keeps its SIBLINGS mounted\", () => {\r\n /* THE contract. The assertion that matters is not that the banner appears —\r\n * it is that `sibling` is still in the document. Without a boundary React\r\n * unmounts the entire tree and BOTH would be gone: that is the blank screen\r\n * this component exists to prevent. */\r\n render(\r\n <div>\r\n <div>sibling</div>\r\n <SectionErrorBoundary title=\"Marchandises\">\r\n <Boom />\r\n </SectionErrorBoundary>\r\n </div>\r\n );\r\n\r\n expect(screen.getByText(\"sibling\")).toBeInTheDocument();\r\n expect(screen.getByRole(\"alert\")).toBeInTheDocument();\r\n });\r\n\r\n test(\"names the failing section so the user knows WHAT broke\", () => {\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\">\r\n <Boom />\r\n </SectionErrorBoundary>\r\n );\r\n expect(screen.getByRole(\"alert\")).toHaveTextContent(\"Marchandises\");\r\n });\r\n\r\n test(\"falls back to a generic label when no title is supplied\", () => {\r\n render(\r\n <SectionErrorBoundary>\r\n <Boom />\r\n </SectionErrorBoundary>\r\n );\r\n expect(screen.getByRole(\"alert\")).toHaveTextContent(\"Section\");\r\n });\r\n});\r\n\r\ndescribe(\"SectionErrorBoundary — user-facing copy (§09.3)\", () => {\r\n test(\"shows French recovery copy, never a raw exception message\", () => {\r\n /* Charter §09.3 forbids exposing technical detail to the user, and a raw JS\r\n * exception is worse than the \"Erreur HTTP 422\" the charter uses as its DON'T\r\n * example. The reference implementation this was promoted from rendered\r\n * error.message straight into the banner body; this asserts we do not.\r\n *\r\n * NODE_ENV is \"test\" here, not \"production\", so the dev detail block DOES\r\n * render — which is why this test targets the recovery sentence rather than\r\n * asserting the absence of the message. The production-only behaviour is\r\n * asserted separately below. */\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\">\r\n <Boom />\r\n </SectionErrorBoundary>\r\n );\r\n expect(screen.getByRole(\"alert\")).toHaveTextContent(\r\n /Cette section n'a pas pu s'afficher/\r\n );\r\n });\r\n\r\n test(\"suppresses the technical detail in production\", () => {\r\n const previous = process.env[\"NODE_ENV\"];\r\n /* Bracket access throughout, matching the component: `process.env` is an index\r\n * signature and `noPropertyAccessFromIndexSignature` is mandatory. Tests are\r\n * outside tsconfig.build.json's scope so dot access would have compiled here —\r\n * two conventions in neighbouring files is the drift this audit exists to stop.\r\n *\r\n * Assigned rather than replaced wholesale: other suites read NODE_ENV, and the\r\n * finally block restores it even if the assertion throws. */\r\n (process.env as Record<string, string>)[\"NODE_ENV\"] = \"production\";\r\n try {\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\">\r\n <Boom />\r\n </SectionErrorBoundary>\r\n );\r\n expect(screen.getByRole(\"alert\")).toHaveTextContent(\r\n /Cette section n'a pas pu s'afficher/\r\n );\r\n expect(screen.getByRole(\"alert\")).not.toHaveTextContent(/articles\\.map/);\r\n } finally {\r\n (process.env as Record<string, string>)[\"NODE_ENV\"] = previous ?? \"test\";\r\n }\r\n });\r\n});\r\n\r\ndescribe(\"SectionErrorBoundary — retry REMOUNTS\", () => {\r\n test(\"retry clears the error and re-renders the subtree\", () => {\r\n /* The re-key on `attempt` is what makes this work. Without it React reuses\r\n * the instance that threw and retry fails identically — a retry button that\r\n * cannot succeed is worse than no retry button. `shouldThrow` is read from a\r\n * mutable holder so the same element throws first and succeeds second,\r\n * exactly as a transient payload problem would. */\r\n const holder = { shouldThrow: true };\r\n function Flaky() {\r\n return <Boom shouldThrow={holder.shouldThrow} />;\r\n }\r\n\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\">\r\n <Flaky />\r\n </SectionErrorBoundary>\r\n );\r\n expect(screen.getByRole(\"alert\")).toBeInTheDocument();\r\n\r\n holder.shouldThrow = false;\r\n fireEvent.click(screen.getByRole(\"button\", { name: /Réessayer/ }));\r\n\r\n expect(screen.getByText(\"contenu rétabli\")).toBeInTheDocument();\r\n expect(screen.queryByRole(\"alert\")).not.toBeInTheDocument();\r\n });\r\n\r\n test(\"a custom retryLabel is used on the button and in the copy\", () => {\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\" retryLabel=\"Recharger\">\r\n <Boom />\r\n </SectionErrorBoundary>\r\n );\r\n expect(screen.getByRole(\"button\", { name: /Recharger/ })).toBeInTheDocument();\r\n expect(screen.getByRole(\"alert\")).toHaveTextContent(/Recharger/);\r\n });\r\n});\r\n\r\ndescribe(\"SectionErrorBoundary — reporting and second exit\", () => {\r\n test(\"calls onError with the error and the component info\", () => {\r\n /* console.error is invisible in production, so without this hook a boundary\r\n * silently swallows the only signal an operator would ever get. */\r\n const onError = jest.fn();\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\" onError={onError}>\r\n <Boom />\r\n </SectionErrorBoundary>\r\n );\r\n\r\n expect(onError).toHaveBeenCalledTimes(1);\r\n const [err, info] = onError.mock.calls[0] as [Error, React.ErrorInfo];\r\n expect(err).toBeInstanceOf(Error);\r\n expect(err.message).toMatch(/articles\\.map/);\r\n expect(info).toHaveProperty(\"componentStack\");\r\n });\r\n\r\n test(\"a throwing onError does not take the boundary down with it\", () => {\r\n /* Guard on the guard. A reporter that throws must not defeat the component\r\n * whose entire purpose is stopping one failure from causing another. */\r\n const onError = jest.fn(() => {\r\n throw new Error(\"APM indisponible\");\r\n });\r\n\r\n expect(() =>\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\" onError={onError}>\r\n <Boom />\r\n </SectionErrorBoundary>\r\n )\r\n ).not.toThrow();\r\n\r\n expect(screen.getByRole(\"alert\")).toBeInTheDocument();\r\n });\r\n\r\n test(\"renders the optional secondary exit when supplied\", () => {\r\n /* Only possible since Banner gained secondaryAction (gap G-19). The reference\r\n * implementation offered no way out when retrying could not help. */\r\n const onEscape = jest.fn();\r\n render(\r\n <SectionErrorBoundary\r\n title=\"Marchandises\"\r\n secondaryAction={{ label: \"Retour à la liste\", onClick: onEscape }}\r\n >\r\n <Boom />\r\n </SectionErrorBoundary>\r\n );\r\n\r\n const escape = screen.getByRole(\"button\", { name: /Retour à la liste/ });\r\n fireEvent.click(escape);\r\n expect(onEscape).toHaveBeenCalledTimes(1);\r\n });\r\n\r\n test(\"logs the section title and the component stack\", () => {\r\n render(\r\n <SectionErrorBoundary title=\"Marchandises\">\r\n <Boom />\r\n </SectionErrorBoundary>\r\n );\r\n /* Asserted loosely — the point is that an operator grepping logs can find\r\n * WHICH section failed, not the exact format of the line. */\r\n const logged = consoleErrorSpy.mock.calls.some((args) =>\r\n args.some((a: unknown) => typeof a === \"string\" && a.includes(\"Marchandises\"))\r\n );\r\n expect(logged).toBe(true);\r\n });\r\n});\r\n"],"mappings":"AAAA,OAAO,2BAA2B;AAClC,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,MAAM,EAAEC,MAAM,EAAEC,SAAS,QAAQ,wBAAwB;AAClE,OAAOC,oBAAoB,MAAM,oCAAoC;;AAErE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AACA,SAASC,IAAIA,CAAC;EAAEC,WAAW,GAAG;AAAgC,CAAC,EAAE;EAC/D,IAAIA,WAAW,EAAE,MAAM,IAAIC,KAAK,CAAC,wDAAwD,CAAC;EAC1F,oBAAOL,IAAA;IAAAM,QAAA,EAAK;EAAe,CAAK,CAAC;AACnC;AAEA,IAAIC,eAAiC;AAErCC,UAAU,CAAC,MAAM;EACfD,eAAe,GAAGE,IAAI,CAACC,KAAK,CAACC,OAAO,EAAE,OAAO,CAAC,CAACC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;AAC7E,CAAC,CAAC;AAEFC,SAAS,CAAC,MAAM;EACdN,eAAe,CAACO,WAAW,CAAC,CAAC;AAC/B,CAAC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EAC3B,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,9 +1,3 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
1
  import { DEFAULT_API_ERROR_MESSAGE, getApiErrorDetail, getApiErrorMessage, getApiErrorStatus } from "../utils/apiError";
8
2
 
9
3
  /**
@@ -29,65 +23,52 @@ import { DEFAULT_API_ERROR_MESSAGE, getApiErrorDetail, getApiErrorMessage, getAp
29
23
  */
30
24
 
31
25
  /** Minimal axios-shaped rejection. Duck-typed on purpose — see the file header. */
32
- var axiosLike = function axiosLike(status, message, dataMessage) {
33
- return {
34
- message: message,
35
- response: _objectSpread({
36
- status: status
37
- }, dataMessage === undefined ? {} : {
26
+ const axiosLike = (status, message, dataMessage) => ({
27
+ message,
28
+ response: {
29
+ status,
30
+ ...(dataMessage === undefined ? {} : {
38
31
  data: {
39
32
  message: dataMessage
40
33
  }
41
34
  })
42
- };
43
- };
44
- describe("getApiErrorMessage — resolution order", function () {
45
- test("a non-empty string rejection is returned as-is", function () {
35
+ }
36
+ });
37
+ describe("getApiErrorMessage — resolution order", () => {
38
+ test("a non-empty string rejection is returned as-is", () => {
46
39
  expect(getApiErrorMessage("Trop de tentatives.")).toBe("Trop de tentatives.");
47
40
  });
48
- test("the backend message wins over everything else", function () {
49
- var err = axiosLike(422, "Request failed with status code 422", "Le numéro de titre est invalide.");
41
+ test("the backend message wins over everything else", () => {
42
+ const err = axiosLike(422, "Request failed with status code 422", "Le numéro de titre est invalide.");
50
43
  expect(getApiErrorMessage(err, "Échec.")).toBe("Le numéro de titre est invalide.");
51
44
  });
52
- test("falls back when nothing usable is present", function () {
45
+ test("falls back when nothing usable is present", () => {
53
46
  expect(getApiErrorMessage({}, "Échec de l'envoi.")).toBe("Échec de l'envoi.");
54
47
  });
55
- test("uses the platform default when no fallback is supplied", function () {
48
+ test("uses the platform default when no fallback is supplied", () => {
56
49
  expect(getApiErrorMessage({})).toBe(DEFAULT_API_ERROR_MESSAGE);
57
50
  });
58
- test("never returns an empty string", function () {
51
+ test("never returns an empty string", () => {
59
52
  expect(getApiErrorMessage("")).toBe(DEFAULT_API_ERROR_MESSAGE);
60
53
  expect(getApiErrorMessage({
61
54
  message: ""
62
55
  })).toBe(DEFAULT_API_ERROR_MESSAGE);
63
56
  });
64
- test("never throws on hostile input", function () {
65
- expect(function () {
66
- return getApiErrorMessage(null);
67
- }).not.toThrow();
68
- expect(function () {
69
- return getApiErrorMessage(undefined);
70
- }).not.toThrow();
71
- expect(function () {
72
- return getApiErrorMessage(0);
73
- }).not.toThrow();
74
- expect(function () {
75
- return getApiErrorMessage([]);
76
- }).not.toThrow();
77
- expect(function () {
78
- return getApiErrorMessage({
79
- response: null
80
- });
81
- }).not.toThrow();
82
- expect(function () {
83
- return getApiErrorMessage({
84
- response: {
85
- data: {
86
- message: 42
87
- }
57
+ test("never throws on hostile input", () => {
58
+ expect(() => getApiErrorMessage(null)).not.toThrow();
59
+ expect(() => getApiErrorMessage(undefined)).not.toThrow();
60
+ expect(() => getApiErrorMessage(0)).not.toThrow();
61
+ expect(() => getApiErrorMessage([])).not.toThrow();
62
+ expect(() => getApiErrorMessage({
63
+ response: null
64
+ })).not.toThrow();
65
+ expect(() => getApiErrorMessage({
66
+ response: {
67
+ data: {
68
+ message: 42
88
69
  }
89
- });
90
- }).not.toThrow();
70
+ }
71
+ })).not.toThrow();
91
72
  });
92
73
  });
93
74
 
@@ -95,20 +76,20 @@ describe("getApiErrorMessage — resolution order", function () {
95
76
  * G-07 — THE REGRESSION GUARD. If any of these fail, a transport string is
96
77
  * reaching end users again.
97
78
  */
98
- describe("getApiErrorMessage — transport strings are suppressed (G-07)", function () {
99
- var FALLBACK = "Le service est momentanément indisponible.";
100
- test.each(["Request failed with status code 500", "Request failed with status code 404", "Network Error", "timeout of 15000ms exceeded", "timeout exceeded", "Request aborted", "canceled", "socket hang up", "ECONNREFUSED", "ETIMEDOUT", "ECONNRESET", "ENOTFOUND", "EPIPE", "ERR_NETWORK", "ERR_CANCELED", "ERR_BAD_RESPONSE"])("suppresses %p in favour of the caller's copy", function (message) {
79
+ describe("getApiErrorMessage — transport strings are suppressed (G-07)", () => {
80
+ const FALLBACK = "Le service est momentanément indisponible.";
81
+ test.each(["Request failed with status code 500", "Request failed with status code 404", "Network Error", "timeout of 15000ms exceeded", "timeout exceeded", "Request aborted", "canceled", "socket hang up", "ECONNREFUSED", "ETIMEDOUT", "ECONNRESET", "ENOTFOUND", "EPIPE", "ERR_NETWORK", "ERR_CANCELED", "ERR_BAD_RESPONSE"])("suppresses %p in favour of the caller's copy", message => {
101
82
  expect(getApiErrorMessage({
102
- message: message
83
+ message
103
84
  }, FALLBACK)).toBe(FALLBACK);
104
85
  });
105
- test("matching is case-insensitive and tolerates padding", function () {
86
+ test("matching is case-insensitive and tolerates padding", () => {
106
87
  expect(getApiErrorMessage({
107
88
  message: " network error "
108
89
  }, FALLBACK)).toBe(FALLBACK);
109
90
  });
110
- test("a 500 with an empty body falls back rather than leaking the status line", function () {
111
- var err = axiosLike(500, "Request failed with status code 500");
91
+ test("a 500 with an empty body falls back rather than leaking the status line", () => {
92
+ const err = axiosLike(500, "Request failed with status code 500");
112
93
  expect(getApiErrorMessage(err, FALLBACK)).toBe(FALLBACK);
113
94
  });
114
95
  });
@@ -118,14 +99,14 @@ describe("getApiErrorMessage — transport strings are suppressed (G-07)", funct
118
99
  * false positive silently replaces a real business message with a generic one,
119
100
  * which is more damaging than showing one ugly string.
120
101
  */
121
- describe("getApiErrorMessage — deliberate messages still pass through", function () {
102
+ describe("getApiErrorMessage — deliberate messages still pass through", () => {
122
103
  test.each(["Ce titre ne peut pas être supprimé car il est en cours de validation.", "Le quota de dossiers est atteint.", "Session expirée. Reconnectez-vous.",
123
104
  // Mentions a status but is human-written — must NOT be suppressed.
124
105
  "Le service a répondu par une erreur (500). Réessayez.",
125
106
  // Contains a transport phrase but is not one — anchored patterns only.
126
- "Network Error détecté par la passerelle, contactez le support."])("passes %p through", function (message) {
107
+ "Network Error détecté par la passerelle, contactez le support."])("passes %p through", message => {
127
108
  expect(getApiErrorMessage({
128
- message: message
109
+ message
129
110
  }, "unused")).toBe(message);
130
111
  });
131
112
 
@@ -139,38 +120,38 @@ describe("getApiErrorMessage — deliberate messages still pass through", functi
139
120
  * business message is lost. That failure is silent in production — the user
140
121
  * simply sees the wrong text — so it has to fail here instead.
141
122
  */
142
- test.each(["erreur", "expiré", "échec", "envoi", "erreurs"])("does not mistake the French word %p for an errno code", function (message) {
123
+ test.each(["erreur", "expiré", "échec", "envoi", "erreurs"])("does not mistake the French word %p for an errno code", message => {
143
124
  expect(getApiErrorMessage({
144
- message: message
125
+ message
145
126
  }, "unused")).toBe(message);
146
127
  });
147
- test("a module-thrown Error keeps its message", function () {
148
- var err = new Error("Le montant FOB doit être positif.");
128
+ test("a module-thrown Error keeps its message", () => {
129
+ const err = new Error("Le montant FOB doit être positif.");
149
130
  expect(getApiErrorMessage(err, "unused")).toBe("Le montant FOB doit être positif.");
150
131
  });
151
132
  });
152
- describe("getApiErrorDetail — unfiltered, for logs", function () {
153
- test("returns the transport string that getApiErrorMessage hides", function () {
154
- var err = axiosLike(502, "Request failed with status code 502");
133
+ describe("getApiErrorDetail — unfiltered, for logs", () => {
134
+ test("returns the transport string that getApiErrorMessage hides", () => {
135
+ const err = axiosLike(502, "Request failed with status code 502");
155
136
  expect(getApiErrorMessage(err, "Indisponible.")).toBe("Indisponible.");
156
137
  expect(getApiErrorDetail(err)).toBe("Request failed with status code 502");
157
138
  });
158
- test("returns undefined when there is nothing to log", function () {
139
+ test("returns undefined when there is nothing to log", () => {
159
140
  expect(getApiErrorDetail({})).toBeUndefined();
160
141
  expect(getApiErrorDetail(null)).toBeUndefined();
161
142
  });
162
143
  });
163
- describe("getApiErrorStatus", function () {
164
- test("returns the HTTP status when the server answered", function () {
144
+ describe("getApiErrorStatus", () => {
145
+ test("returns the HTTP status when the server answered", () => {
165
146
  expect(getApiErrorStatus(axiosLike(404, "Not Found"))).toBe(404);
166
147
  });
167
- test("returns undefined when there was no answer at all (R-4.3)", function () {
148
+ test("returns undefined when there was no answer at all (R-4.3)", () => {
168
149
  expect(getApiErrorStatus({
169
150
  message: "Network Error"
170
151
  })).toBeUndefined();
171
152
  expect(getApiErrorStatus(null)).toBeUndefined();
172
153
  });
173
- test("ignores a non-numeric status", function () {
154
+ test("ignores a non-numeric status", () => {
174
155
  expect(getApiErrorStatus({
175
156
  response: {
176
157
  status: "500"
@@ -1 +1 @@
1
- {"version":3,"file":"apiError.test.js","names":["DEFAULT_API_ERROR_MESSAGE","getApiErrorDetail","getApiErrorMessage","getApiErrorStatus","axiosLike","status","message","dataMessage","response","_objectSpread","undefined","data","describe","test","expect","toBe","err","not","toThrow","FALLBACK","each","Error","toBeUndefined"],"sources":["../../../../src/lib/v2/__tests__/apiError.test.ts"],"sourcesContent":["import {\r\n DEFAULT_API_ERROR_MESSAGE,\r\n getApiErrorDetail,\r\n getApiErrorMessage,\r\n getApiErrorStatus,\r\n} from \"../utils/apiError\";\r\n\r\n/**\r\n * Contract tests for apiError — the platform's `unknown`-rejection narrower.\r\n *\r\n * Two contracts are load-bearing here, and both were regressions waiting to\r\n * happen:\r\n *\r\n * 1. G-04 — this helper exists so consuming sagas do not hand-roll\r\n * `(error as { response?: … })` to get around `useUnknownInCatchVariables`.\r\n * Two modules had already done exactly that before it was added.\r\n *\r\n * 2. G-07 — `error.message` must NOT reach a user when it is an axios\r\n * transport artefact. Before the fix, any server error without a\r\n * `response.data.message` rendered \"Request failed with status code 500\"\r\n * into a toast (Charter §09.3 forbids raw technical detail), and every\r\n * consumer's French fallback was effectively unreachable.\r\n *\r\n * The second contract is invisible to `tsc` and to the build: suppressing a\r\n * string is a behavioural property, so without these tests the fix would\r\n * silently rot the first time someone \"simplified\" the resolution chain back to\r\n * a plain `asNonEmptyString`.\r\n */\r\n\r\n/** Minimal axios-shaped rejection. Duck-typed on purpose — see the file header. */\r\nconst axiosLike = (status: number, message: string, dataMessage?: string) => ({\r\n message,\r\n response: {\r\n status,\r\n ...(dataMessage === undefined ? {} : { data: { message: dataMessage } }),\r\n },\r\n});\r\n\r\ndescribe(\"getApiErrorMessage — resolution order\", () => {\r\n test(\"a non-empty string rejection is returned as-is\", () => {\r\n expect(getApiErrorMessage(\"Trop de tentatives.\")).toBe(\r\n \"Trop de tentatives.\"\r\n );\r\n });\r\n\r\n test(\"the backend message wins over everything else\", () => {\r\n const err = axiosLike(\r\n 422,\r\n \"Request failed with status code 422\",\r\n \"Le numéro de titre est invalide.\"\r\n );\r\n expect(getApiErrorMessage(err, \"Échec.\")).toBe(\r\n \"Le numéro de titre est invalide.\"\r\n );\r\n });\r\n\r\n test(\"falls back when nothing usable is present\", () => {\r\n expect(getApiErrorMessage({}, \"Échec de l'envoi.\")).toBe(\r\n \"Échec de l'envoi.\"\r\n );\r\n });\r\n\r\n test(\"uses the platform default when no fallback is supplied\", () => {\r\n expect(getApiErrorMessage({})).toBe(DEFAULT_API_ERROR_MESSAGE);\r\n });\r\n\r\n test(\"never returns an empty string\", () => {\r\n expect(getApiErrorMessage(\"\")).toBe(DEFAULT_API_ERROR_MESSAGE);\r\n expect(getApiErrorMessage({ message: \"\" })).toBe(DEFAULT_API_ERROR_MESSAGE);\r\n });\r\n\r\n test(\"never throws on hostile input\", () => {\r\n expect(() => getApiErrorMessage(null)).not.toThrow();\r\n expect(() => getApiErrorMessage(undefined)).not.toThrow();\r\n expect(() => getApiErrorMessage(0)).not.toThrow();\r\n expect(() => getApiErrorMessage([])).not.toThrow();\r\n expect(() => getApiErrorMessage({ response: null })).not.toThrow();\r\n expect(() =>\r\n getApiErrorMessage({ response: { data: { message: 42 } } })\r\n ).not.toThrow();\r\n });\r\n});\r\n\r\n/**\r\n * G-07 — THE REGRESSION GUARD. If any of these fail, a transport string is\r\n * reaching end users again.\r\n */\r\ndescribe(\"getApiErrorMessage — transport strings are suppressed (G-07)\", () => {\r\n const FALLBACK = \"Le service est momentanément indisponible.\";\r\n\r\n test.each([\r\n \"Request failed with status code 500\",\r\n \"Request failed with status code 404\",\r\n \"Network Error\",\r\n \"timeout of 15000ms exceeded\",\r\n \"timeout exceeded\",\r\n \"Request aborted\",\r\n \"canceled\",\r\n \"socket hang up\",\r\n \"ECONNREFUSED\",\r\n \"ETIMEDOUT\",\r\n \"ECONNRESET\",\r\n \"ENOTFOUND\",\r\n \"EPIPE\",\r\n \"ERR_NETWORK\",\r\n \"ERR_CANCELED\",\r\n \"ERR_BAD_RESPONSE\",\r\n ])(\"suppresses %p in favour of the caller's copy\", (message) => {\r\n expect(getApiErrorMessage({ message }, FALLBACK)).toBe(FALLBACK);\r\n });\r\n\r\n test(\"matching is case-insensitive and tolerates padding\", () => {\r\n expect(\r\n getApiErrorMessage({ message: \" network error \" }, FALLBACK)\r\n ).toBe(FALLBACK);\r\n });\r\n\r\n test(\"a 500 with an empty body falls back rather than leaking the status line\", () => {\r\n const err = axiosLike(500, \"Request failed with status code 500\");\r\n expect(getApiErrorMessage(err, FALLBACK)).toBe(FALLBACK);\r\n });\r\n});\r\n\r\n/**\r\n * The other half of the same contract: the deny-list must stay CONSERVATIVE. A\r\n * false positive silently replaces a real business message with a generic one,\r\n * which is more damaging than showing one ugly string.\r\n */\r\ndescribe(\"getApiErrorMessage — deliberate messages still pass through\", () => {\r\n test.each([\r\n \"Ce titre ne peut pas être supprimé car il est en cours de validation.\",\r\n \"Le quota de dossiers est atteint.\",\r\n \"Session expirée. Reconnectez-vous.\",\r\n // Mentions a status but is human-written — must NOT be suppressed.\r\n \"Le service a répondu par une erreur (500). Réessayez.\",\r\n // Contains a transport phrase but is not one — anchored patterns only.\r\n \"Network Error détecté par la passerelle, contactez le support.\",\r\n ])(\"passes %p through\", (message) => {\r\n expect(getApiErrorMessage({ message }, \"unused\")).toBe(message);\r\n });\r\n\r\n /**\r\n * Guards the CASE-SENSITIVITY of the two errno patterns.\r\n *\r\n * They are the only patterns in the list without `/i`, precisely so that a\r\n * lowercase French word beginning with \"e\" is not mistaken for an errno\r\n * constant. If someone \"tidies\" them to `/^e[a-z]+$/i` for consistency with\r\n * their neighbours, every one of these becomes a generic fallback and a real\r\n * business message is lost. That failure is silent in production — the user\r\n * simply sees the wrong text — so it has to fail here instead.\r\n */\r\n test.each([\"erreur\", \"expiré\", \"échec\", \"envoi\", \"erreurs\"])(\r\n \"does not mistake the French word %p for an errno code\",\r\n (message) => {\r\n expect(getApiErrorMessage({ message }, \"unused\")).toBe(message);\r\n }\r\n );\r\n\r\n test(\"a module-thrown Error keeps its message\", () => {\r\n const err = new Error(\"Le montant FOB doit être positif.\");\r\n expect(getApiErrorMessage(err, \"unused\")).toBe(\r\n \"Le montant FOB doit être positif.\"\r\n );\r\n });\r\n});\r\n\r\ndescribe(\"getApiErrorDetail — unfiltered, for logs\", () => {\r\n test(\"returns the transport string that getApiErrorMessage hides\", () => {\r\n const err = axiosLike(502, \"Request failed with status code 502\");\r\n expect(getApiErrorMessage(err, \"Indisponible.\")).toBe(\"Indisponible.\");\r\n expect(getApiErrorDetail(err)).toBe(\"Request failed with status code 502\");\r\n });\r\n\r\n test(\"returns undefined when there is nothing to log\", () => {\r\n expect(getApiErrorDetail({})).toBeUndefined();\r\n expect(getApiErrorDetail(null)).toBeUndefined();\r\n });\r\n});\r\n\r\ndescribe(\"getApiErrorStatus\", () => {\r\n test(\"returns the HTTP status when the server answered\", () => {\r\n expect(getApiErrorStatus(axiosLike(404, \"Not Found\"))).toBe(404);\r\n });\r\n\r\n test(\"returns undefined when there was no answer at all (R-4.3)\", () => {\r\n expect(getApiErrorStatus({ message: \"Network Error\" })).toBeUndefined();\r\n expect(getApiErrorStatus(null)).toBeUndefined();\r\n });\r\n\r\n test(\"ignores a non-numeric status\", () => {\r\n expect(\r\n getApiErrorStatus({ response: { status: \"500\" } })\r\n ).toBeUndefined();\r\n });\r\n});\r\n"],"mappings":";;;;;;AAAA,SACEA,yBAAyB,EACzBC,iBAAiB,EACjBC,kBAAkB,EAClBC,iBAAiB,QACZ,mBAAmB;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAIC,MAAc,EAAEC,OAAe,EAAEC,WAAoB;EAAA,OAAM;IAC5ED,OAAO,EAAPA,OAAO;IACPE,QAAQ,EAAAC,aAAA;MACNJ,MAAM,EAANA;IA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AM;IACzCC,MAAM,CACJX,iBAAiB,CAAC;MAAEK,QAAQ,EAAE;QAAEH,MAAM,EAAE;MAAM;IAAE,CAAC,CACnD,CAAC,CAACiB,aAAa,CAAC,CAAC;EACnB,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"apiError.test.js","names":["DEFAULT_API_ERROR_MESSAGE","getApiErrorDetail","getApiErrorMessage","getApiErrorStatus","axiosLike","status","message","dataMessage","response","undefined","data","describe","test","expect","toBe","err","not","toThrow","FALLBACK","each","Error","toBeUndefined"],"sources":["../../../../src/lib/v2/__tests__/apiError.test.ts"],"sourcesContent":["import {\r\n DEFAULT_API_ERROR_MESSAGE,\r\n getApiErrorDetail,\r\n getApiErrorMessage,\r\n getApiErrorStatus,\r\n} from \"../utils/apiError\";\r\n\r\n/**\r\n * Contract tests for apiError — the platform's `unknown`-rejection narrower.\r\n *\r\n * Two contracts are load-bearing here, and both were regressions waiting to\r\n * happen:\r\n *\r\n * 1. G-04 — this helper exists so consuming sagas do not hand-roll\r\n * `(error as { response?: … })` to get around `useUnknownInCatchVariables`.\r\n * Two modules had already done exactly that before it was added.\r\n *\r\n * 2. G-07 — `error.message` must NOT reach a user when it is an axios\r\n * transport artefact. Before the fix, any server error without a\r\n * `response.data.message` rendered \"Request failed with status code 500\"\r\n * into a toast (Charter §09.3 forbids raw technical detail), and every\r\n * consumer's French fallback was effectively unreachable.\r\n *\r\n * The second contract is invisible to `tsc` and to the build: suppressing a\r\n * string is a behavioural property, so without these tests the fix would\r\n * silently rot the first time someone \"simplified\" the resolution chain back to\r\n * a plain `asNonEmptyString`.\r\n */\r\n\r\n/** Minimal axios-shaped rejection. Duck-typed on purpose — see the file header. */\r\nconst axiosLike = (status: number, message: string, dataMessage?: string) => ({\r\n message,\r\n response: {\r\n status,\r\n ...(dataMessage === undefined ? {} : { data: { message: dataMessage } }),\r\n },\r\n});\r\n\r\ndescribe(\"getApiErrorMessage — resolution order\", () => {\r\n test(\"a non-empty string rejection is returned as-is\", () => {\r\n expect(getApiErrorMessage(\"Trop de tentatives.\")).toBe(\r\n \"Trop de tentatives.\"\r\n );\r\n });\r\n\r\n test(\"the backend message wins over everything else\", () => {\r\n const err = axiosLike(\r\n 422,\r\n \"Request failed with status code 422\",\r\n \"Le numéro de titre est invalide.\"\r\n );\r\n expect(getApiErrorMessage(err, \"Échec.\")).toBe(\r\n \"Le numéro de titre est invalide.\"\r\n );\r\n });\r\n\r\n test(\"falls back when nothing usable is present\", () => {\r\n expect(getApiErrorMessage({}, \"Échec de l'envoi.\")).toBe(\r\n \"Échec de l'envoi.\"\r\n );\r\n });\r\n\r\n test(\"uses the platform default when no fallback is supplied\", () => {\r\n expect(getApiErrorMessage({})).toBe(DEFAULT_API_ERROR_MESSAGE);\r\n });\r\n\r\n test(\"never returns an empty string\", () => {\r\n expect(getApiErrorMessage(\"\")).toBe(DEFAULT_API_ERROR_MESSAGE);\r\n expect(getApiErrorMessage({ message: \"\" })).toBe(DEFAULT_API_ERROR_MESSAGE);\r\n });\r\n\r\n test(\"never throws on hostile input\", () => {\r\n expect(() => getApiErrorMessage(null)).not.toThrow();\r\n expect(() => getApiErrorMessage(undefined)).not.toThrow();\r\n expect(() => getApiErrorMessage(0)).not.toThrow();\r\n expect(() => getApiErrorMessage([])).not.toThrow();\r\n expect(() => getApiErrorMessage({ response: null })).not.toThrow();\r\n expect(() =>\r\n getApiErrorMessage({ response: { data: { message: 42 } } })\r\n ).not.toThrow();\r\n });\r\n});\r\n\r\n/**\r\n * G-07 — THE REGRESSION GUARD. If any of these fail, a transport string is\r\n * reaching end users again.\r\n */\r\ndescribe(\"getApiErrorMessage — transport strings are suppressed (G-07)\", () => {\r\n const FALLBACK = \"Le service est momentanément indisponible.\";\r\n\r\n test.each([\r\n \"Request failed with status code 500\",\r\n \"Request failed with status code 404\",\r\n \"Network Error\",\r\n \"timeout of 15000ms exceeded\",\r\n \"timeout exceeded\",\r\n \"Request aborted\",\r\n \"canceled\",\r\n \"socket hang up\",\r\n \"ECONNREFUSED\",\r\n \"ETIMEDOUT\",\r\n \"ECONNRESET\",\r\n \"ENOTFOUND\",\r\n \"EPIPE\",\r\n \"ERR_NETWORK\",\r\n \"ERR_CANCELED\",\r\n \"ERR_BAD_RESPONSE\",\r\n ])(\"suppresses %p in favour of the caller's copy\", (message) => {\r\n expect(getApiErrorMessage({ message }, FALLBACK)).toBe(FALLBACK);\r\n });\r\n\r\n test(\"matching is case-insensitive and tolerates padding\", () => {\r\n expect(\r\n getApiErrorMessage({ message: \" network error \" }, FALLBACK)\r\n ).toBe(FALLBACK);\r\n });\r\n\r\n test(\"a 500 with an empty body falls back rather than leaking the status line\", () => {\r\n const err = axiosLike(500, \"Request failed with status code 500\");\r\n expect(getApiErrorMessage(err, FALLBACK)).toBe(FALLBACK);\r\n });\r\n});\r\n\r\n/**\r\n * The other half of the same contract: the deny-list must stay CONSERVATIVE. A\r\n * false positive silently replaces a real business message with a generic one,\r\n * which is more damaging than showing one ugly string.\r\n */\r\ndescribe(\"getApiErrorMessage — deliberate messages still pass through\", () => {\r\n test.each([\r\n \"Ce titre ne peut pas être supprimé car il est en cours de validation.\",\r\n \"Le quota de dossiers est atteint.\",\r\n \"Session expirée. Reconnectez-vous.\",\r\n // Mentions a status but is human-written — must NOT be suppressed.\r\n \"Le service a répondu par une erreur (500). Réessayez.\",\r\n // Contains a transport phrase but is not one — anchored patterns only.\r\n \"Network Error détecté par la passerelle, contactez le support.\",\r\n ])(\"passes %p through\", (message) => {\r\n expect(getApiErrorMessage({ message }, \"unused\")).toBe(message);\r\n });\r\n\r\n /**\r\n * Guards the CASE-SENSITIVITY of the two errno patterns.\r\n *\r\n * They are the only patterns in the list without `/i`, precisely so that a\r\n * lowercase French word beginning with \"e\" is not mistaken for an errno\r\n * constant. If someone \"tidies\" them to `/^e[a-z]+$/i` for consistency with\r\n * their neighbours, every one of these becomes a generic fallback and a real\r\n * business message is lost. That failure is silent in production — the user\r\n * simply sees the wrong text — so it has to fail here instead.\r\n */\r\n test.each([\"erreur\", \"expiré\", \"échec\", \"envoi\", \"erreurs\"])(\r\n \"does not mistake the French word %p for an errno code\",\r\n (message) => {\r\n expect(getApiErrorMessage({ message }, \"unused\")).toBe(message);\r\n }\r\n );\r\n\r\n test(\"a module-thrown Error keeps its message\", () => {\r\n const err = new Error(\"Le montant FOB doit être positif.\");\r\n expect(getApiErrorMessage(err, \"unused\")).toBe(\r\n \"Le montant FOB doit être positif.\"\r\n );\r\n });\r\n});\r\n\r\ndescribe(\"getApiErrorDetail — unfiltered, for logs\", () => {\r\n test(\"returns the transport string that getApiErrorMessage hides\", () => {\r\n const err = axiosLike(502, \"Request failed with status code 502\");\r\n expect(getApiErrorMessage(err, \"Indisponible.\")).toBe(\"Indisponible.\");\r\n expect(getApiErrorDetail(err)).toBe(\"Request failed with status code 502\");\r\n });\r\n\r\n test(\"returns undefined when there is nothing to log\", () => {\r\n expect(getApiErrorDetail({})).toBeUndefined();\r\n expect(getApiErrorDetail(null)).toBeUndefined();\r\n });\r\n});\r\n\r\ndescribe(\"getApiErrorStatus\", () => {\r\n test(\"returns the HTTP status when the server answered\", () => {\r\n expect(getApiErrorStatus(axiosLike(404, \"Not Found\"))).toBe(404);\r\n });\r\n\r\n test(\"returns undefined when there was no answer at all (R-4.3)\", () => {\r\n expect(getApiErrorStatus({ message: \"Network Error\" })).toBeUndefined();\r\n expect(getApiErrorStatus(null)).toBeUndefined();\r\n });\r\n\r\n test(\"ignores a non-numeric status\", () => {\r\n expect(\r\n getApiErrorStatus({ response: { status: \"500\" } })\r\n ).toBeUndefined();\r\n });\r\n});\r\n"],"mappings":"AAAA,SACEA,yBAAyB,EACzBC,iBAAiB,EACjBC,kBAAkB,EAClBC,iBAAiB,QACZ,mBAAmB;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAMC,SAAS,GAAGA,C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