@inseefr/lunatic 3.5.7 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/components/shared/Combobox/Combobox.stories.d.ts +3 -2
  2. package/components/shared/Combobox/Combobox.stories.js +26 -21
  3. package/components/shared/Combobox/Combobox.stories.js.map +1 -1
  4. package/esm/components/shared/Combobox/Combobox.stories.d.ts +3 -2
  5. package/esm/components/shared/Combobox/Combobox.stories.js +28 -24
  6. package/esm/components/shared/Combobox/Combobox.stories.js.map +1 -1
  7. package/esm/hooks/useLocalStorage.d.ts +1 -0
  8. package/esm/hooks/useLocalStorage.js +31 -0
  9. package/esm/hooks/useLocalStorage.js.map +1 -0
  10. package/esm/type.source.d.ts +8 -1
  11. package/esm/use-lunatic/commons/compile-controls.js +22 -14
  12. package/esm/use-lunatic/commons/compile-controls.js.map +1 -1
  13. package/esm/use-lunatic/commons/fill-components/fill-component-expressions.d.ts +1 -1
  14. package/esm/use-lunatic/commons/fill-components/fill-component-expressions.js +5 -2
  15. package/esm/use-lunatic/commons/fill-components/fill-component-expressions.js.map +1 -1
  16. package/esm/use-lunatic/commons/fill-components/fill-component.spec.js +42 -0
  17. package/esm/use-lunatic/commons/fill-components/fill-component.spec.js.map +1 -1
  18. package/esm/use-lunatic/commons/fill-components/fill-components.d.ts +2 -2
  19. package/esm/use-lunatic/commons/fill-components/fill-components.js +15 -3
  20. package/esm/use-lunatic/commons/fill-components/fill-components.js.map +1 -1
  21. package/esm/use-lunatic/hooks/use-page-has-response.js +1 -1
  22. package/esm/use-lunatic/hooks/use-page-has-response.js.map +1 -1
  23. package/esm/use-lunatic/hooks/useOverview.spec.js +2 -2
  24. package/esm/use-lunatic/hooks/useOverview.spec.js.map +1 -1
  25. package/esm/use-lunatic/props/getComponentTypeProps.js +1 -1
  26. package/esm/use-lunatic/props/getComponentTypeProps.js.map +1 -1
  27. package/esm/utils/number.d.ts +4 -0
  28. package/esm/utils/number.js +12 -0
  29. package/esm/utils/number.js.map +1 -1
  30. package/esm/utils/object.d.ts +10 -0
  31. package/esm/utils/object.js +26 -0
  32. package/esm/utils/object.js.map +1 -1
  33. package/hooks/useLocalStorage.d.ts +1 -0
  34. package/hooks/useLocalStorage.js +34 -0
  35. package/hooks/useLocalStorage.js.map +1 -0
  36. package/package.json +76 -137
  37. package/src/components/shared/Combobox/Combobox.stories.tsx +48 -49
  38. package/src/hooks/useLocalStorage.ts +37 -0
  39. package/src/json.d.ts +16 -0
  40. package/src/stories/accordion/accordion.stories.tsx +21 -0
  41. package/src/stories/behaviour/cleaning/cleaning.stories.tsx +40 -0
  42. package/src/stories/behaviour/controls/controls.stories.tsx +51 -0
  43. package/src/stories/behaviour/disabled/disabled.stories.tsx +29 -0
  44. package/src/stories/behaviour/filter/filter.stories.tsx +34 -0
  45. package/src/stories/behaviour/missing/missing.stories.tsx +31 -0
  46. package/src/stories/behaviour/overview/overview.stories.tsx +61 -0
  47. package/src/stories/{overview/sourceWithHierarchy.json → behaviour/overview/source.json} +1 -1
  48. package/src/stories/{overview → behaviour/overview}/sourceLoop.json +1 -1
  49. package/src/stories/behaviour/performance/performance.stories.tsx +29 -0
  50. package/src/stories/behaviour/resizing/resizing.stories.tsx +34 -0
  51. package/src/stories/behaviour/slots.stories.tsx +34 -0
  52. package/src/stories/checkbox/checkbox.stories.tsx +75 -0
  53. package/src/stories/{checkbox-group/sourceLoop.json → checkbox/sourceGroupLoop.json} +1 -1
  54. package/src/stories/datepicker/datepicker.stories.tsx +21 -0
  55. package/src/stories/declaration/declaration.stories.tsx +27 -0
  56. package/src/stories/dropdown/dropdown.stories.tsx +27 -0
  57. package/src/stories/duration/duration.stories.tsx +27 -0
  58. package/src/stories/filter-description/filter-description.stories.tsx +28 -0
  59. package/src/stories/input/input.stories.tsx +21 -0
  60. package/src/stories/input-number/input-number.stories.tsx +35 -0
  61. package/src/stories/loop/loop.stories.tsx +35 -0
  62. package/src/stories/loop/roster-for-loop.stories.tsx +59 -0
  63. package/src/stories/pairwise/pairwise.stories.tsx +30 -0
  64. package/src/stories/paste.stories.tsx +85 -0
  65. package/src/stories/question/question.stories.tsx +21 -0
  66. package/src/stories/questionnaires/logement/logement.stories.tsx +26 -0
  67. package/src/stories/questionnaires/recensement/recensement.stories.tsx +28 -0
  68. package/src/stories/questionnaires/rp/rp.stories.tsx +21 -0
  69. package/src/stories/questionnaires/simpsons/simpsons.stories.tsx +31 -0
  70. package/src/stories/radio/radio.stories.tsx +53 -0
  71. package/src/stories/roundabout/roundabout.stories.tsx +37 -0
  72. package/src/stories/roundabout/source.json +1 -0
  73. package/src/stories/sequence/sequence.stories.tsx +28 -0
  74. package/src/stories/suggester/source-option-responses.json +1 -1
  75. package/src/stories/suggester/suggester.stories.tsx +68 -0
  76. package/src/stories/summary/source.json +22 -1
  77. package/src/stories/summary/summary.stories.tsx +31 -0
  78. package/src/stories/table/table.stories.tsx +35 -0
  79. package/src/stories/text/text.stories.tsx +38 -0
  80. package/src/stories/textarea/textarea.stories.tsx +21 -0
  81. package/src/stories/utils/Orchestrator.tsx +310 -0
  82. package/src/stories/utils/OrchestratorData.tsx +176 -0
  83. package/src/stories/utils/OrchestratorOverview.tsx +70 -0
  84. package/src/stories/utils/OrchestratorSidebar.tsx +119 -0
  85. package/src/stories/utils/SchemaValidator.tsx +29 -0
  86. package/src/stories/utils/referentiel.ts +9 -0
  87. package/src/type.source.ts +8 -1
  88. package/src/use-lunatic/commons/compile-controls.ts +36 -18
  89. package/src/use-lunatic/commons/fill-components/fill-component-expressions.ts +6 -2
  90. package/src/use-lunatic/commons/fill-components/fill-component.spec.ts +52 -0
  91. package/src/use-lunatic/commons/fill-components/fill-components.ts +19 -3
  92. package/src/use-lunatic/hooks/use-page-has-response.ts +1 -1
  93. package/src/use-lunatic/hooks/useOverview.spec.ts +3 -2
  94. package/src/use-lunatic/props/getComponentTypeProps.ts +2 -1
  95. package/src/use-lunatic/use-lunatic.test.ts +53 -40
  96. package/src/utils/number.ts +13 -0
  97. package/src/utils/object.ts +40 -0
  98. package/tsconfig.build.tsbuildinfo +1 -1
  99. package/type.source.d.ts +8 -1
  100. package/use-lunatic/commons/compile-controls.js +21 -13
  101. package/use-lunatic/commons/compile-controls.js.map +1 -1
  102. package/use-lunatic/commons/fill-components/fill-component-expressions.d.ts +1 -1
  103. package/use-lunatic/commons/fill-components/fill-component-expressions.js +6 -3
  104. package/use-lunatic/commons/fill-components/fill-component-expressions.js.map +1 -1
  105. package/use-lunatic/commons/fill-components/fill-component.spec.js +42 -0
  106. package/use-lunatic/commons/fill-components/fill-component.spec.js.map +1 -1
  107. package/use-lunatic/commons/fill-components/fill-components.d.ts +2 -2
  108. package/use-lunatic/commons/fill-components/fill-components.js +15 -3
  109. package/use-lunatic/commons/fill-components/fill-components.js.map +1 -1
  110. package/use-lunatic/hooks/use-page-has-response.js +2 -2
  111. package/use-lunatic/hooks/use-page-has-response.js.map +1 -1
  112. package/use-lunatic/hooks/useOverview.spec.js +8 -8
  113. package/use-lunatic/hooks/useOverview.spec.js.map +1 -1
  114. package/use-lunatic/props/getComponentTypeProps.js +1 -1
  115. package/use-lunatic/props/getComponentTypeProps.js.map +1 -1
  116. package/utils/number.d.ts +4 -0
  117. package/utils/number.js +13 -0
  118. package/utils/number.js.map +1 -1
  119. package/utils/object.d.ts +10 -0
  120. package/utils/object.js +30 -0
  121. package/utils/object.js.map +1 -1
  122. package/esm/stories/overview/sourceWithHierarchy.json +0 -5151
  123. package/esm/tests/utils/lunatic.d.ts +0 -15
  124. package/esm/tests/utils/lunatic.js +0 -27
  125. package/esm/tests/utils/lunatic.js.map +0 -1
  126. package/esm/use-lunatic/replace-component-sequence.d.ts +0 -36
  127. package/esm/use-lunatic/replace-component-sequence.js +0 -19
  128. package/esm/use-lunatic/replace-component-sequence.js.map +0 -1
  129. package/esm/use-lunatic/test.utils.d.ts +0 -2
  130. package/esm/use-lunatic/test.utils.js +0 -13
  131. package/esm/use-lunatic/test.utils.js.map +0 -1
  132. package/esm/utils/is-object.d.ts +0 -4
  133. package/esm/utils/is-object.js +0 -7
  134. package/esm/utils/is-object.js.map +0 -1
  135. package/esm/utils/to-number.d.ts +0 -4
  136. package/esm/utils/to-number.js +0 -13
  137. package/esm/utils/to-number.js.map +0 -1
  138. package/src/stories/accordion/accordion.stories.jsx +0 -17
  139. package/src/stories/behaviour/cleaning/cleaning.stories.jsx +0 -69
  140. package/src/stories/behaviour/controls/controls.stories.jsx +0 -81
  141. package/src/stories/behaviour/filter/dataLoop.json +0 -14
  142. package/src/stories/behaviour/filter/filter.stories.jsx +0 -36
  143. package/src/stories/behaviour/missing/missing.stories.jsx +0 -69
  144. package/src/stories/behaviour/others/V2_DeclarationsSimples.json +0 -908
  145. package/src/stories/behaviour/others/V2_MinMaxSum_Boucles.json +0 -489
  146. package/src/stories/behaviour/others/V2_QuestSimple_Boucles.json +0 -3919
  147. package/src/stories/behaviour/others/V2_TCMRallyeGames.json +0 -2760
  148. package/src/stories/behaviour/others/test-dylan.json +0 -538
  149. package/src/stories/behaviour/others/test.stories.jsx +0 -78
  150. package/src/stories/behaviour/paste/source.json +0 -32
  151. package/src/stories/behaviour/paste/test.stories.jsx +0 -62
  152. package/src/stories/behaviour/performance/performance.stories.jsx +0 -26
  153. package/src/stories/behaviour/resizing/resizing.stories.jsx +0 -60
  154. package/src/stories/behaviour/slots.stories.jsx +0 -32
  155. package/src/stories/checkbox-boolean/checkboxBoolean.stories.jsx +0 -17
  156. package/src/stories/checkbox-group/checkbox-group.stories.jsx +0 -77
  157. package/src/stories/checkbox-one/checkboxOne.stories.jsx +0 -53
  158. package/src/stories/date-picker/data.json +0 -3
  159. package/src/stories/date-picker/datepicker.stories.jsx +0 -26
  160. package/src/stories/declaration/data.json +0 -1
  161. package/src/stories/declaration/input.stories.jsx +0 -18
  162. package/src/stories/disabled/data.json +0 -16
  163. package/src/stories/disabled/disabled.stories.jsx +0 -18
  164. package/src/stories/dropdown/data.json +0 -8
  165. package/src/stories/dropdown/dropdown.stories.jsx +0 -25
  166. package/src/stories/duration/duration.stories.jsx +0 -25
  167. package/src/stories/filter-description/filter-description.stories.jsx +0 -37
  168. package/src/stories/input/data.json +0 -1
  169. package/src/stories/input/input.stories.jsx +0 -18
  170. package/src/stories/input-number/input-number.stories.jsx +0 -23
  171. package/src/stories/loop/loop.stories.jsx +0 -29
  172. package/src/stories/loop/roster-for-loop.stories.jsx +0 -46
  173. package/src/stories/markdown/markdown.stories.jsx +0 -20
  174. package/src/stories/overview/data.json +0 -1
  175. package/src/stories/overview/dataLoop.json +0 -93
  176. package/src/stories/overview/overview.stories.jsx +0 -44
  177. package/src/stories/overview/source.json +0 -25
  178. package/src/stories/pairwise/data.json +0 -12
  179. package/src/stories/pairwise/pairwise-links.stories.jsx +0 -48
  180. package/src/stories/question/question.stories.jsx +0 -16
  181. package/src/stories/questionnaires/logement/logement.stories.jsx +0 -59
  182. package/src/stories/questionnaires/recensement/data.json +0 -12
  183. package/src/stories/questionnaires/recensement/recensement.stories.jsx +0 -35
  184. package/src/stories/questionnaires/rp/data.json +0 -5
  185. package/src/stories/questionnaires/rp/rp.stories.jsx +0 -23
  186. package/src/stories/questionnaires/simpsons/simpsons.stories.jsx +0 -246
  187. package/src/stories/radio/radio.stories.jsx +0 -78
  188. package/src/stories/roundabout/data1.json +0 -13
  189. package/src/stories/roundabout/data2.json +0 -16
  190. package/src/stories/roundabout/roundabout.stories.jsx +0 -32
  191. package/src/stories/sequence/sequence.stories.jsx +0 -29
  192. package/src/stories/suggester/suggester.stories.jsx +0 -71
  193. package/src/stories/summary/data.json +0 -16
  194. package/src/stories/summary/summary.stories.jsx +0 -23
  195. package/src/stories/switch/README.md +0 -29
  196. package/src/stories/switch/data-forced.json +0 -40
  197. package/src/stories/switch/source.json +0 -64
  198. package/src/stories/switch/switch.stories.jsx +0 -17
  199. package/src/stories/table/data.json +0 -1
  200. package/src/stories/table/table.stories.jsx +0 -30
  201. package/src/stories/text/data-roster.json +0 -5
  202. package/src/stories/text/text.stories.jsx +0 -20
  203. package/src/stories/textarea/data.json +0 -1
  204. package/src/stories/textarea/textarea.stories.jsx +0 -18
  205. package/src/stories/utils/SchemaValidator.jsx +0 -40
  206. package/src/stories/utils/default-arg-types.js +0 -39
  207. package/src/stories/utils/default-args.js +0 -3
  208. package/src/stories/utils/options.js +0 -19
  209. package/src/stories/utils/orchestrator.jsx +0 -267
  210. package/src/stories/utils/orchestrator.scss +0 -66
  211. package/src/stories/utils/overview.jsx +0 -39
  212. package/src/stories/utils/overview.scss +0 -37
  213. package/src/stories/utils/referentiel.js +0 -7
  214. package/src/tests/utils/e2e.js +0 -91
  215. package/src/tests/utils/lunatic.ts +0 -33
  216. package/src/use-lunatic/replace-component-sequence.ts +0 -25
  217. package/src/use-lunatic/test.utils.ts +0 -17
  218. package/src/utils/is-object.ts +0 -6
  219. package/src/utils/to-number.ts +0 -12
  220. package/stories/overview/sourceWithHierarchy.json +0 -5151
  221. package/tests/utils/lunatic.d.ts +0 -15
  222. package/tests/utils/lunatic.js +0 -31
  223. package/tests/utils/lunatic.js.map +0 -1
  224. package/use-lunatic/replace-component-sequence.d.ts +0 -36
  225. package/use-lunatic/replace-component-sequence.js +0 -22
  226. package/use-lunatic/replace-component-sequence.js.map +0 -1
  227. package/use-lunatic/test.utils.d.ts +0 -2
  228. package/use-lunatic/test.utils.js +0 -17
  229. package/use-lunatic/test.utils.js.map +0 -1
  230. package/utils/is-object.d.ts +0 -4
  231. package/utils/is-object.js +0 -10
  232. package/utils/is-object.js.map +0 -1
  233. package/utils/to-number.d.ts +0 -4
  234. package/utils/to-number.js +0 -16
  235. package/utils/to-number.js.map +0 -1
  236. /package/src/stories/behaviour/cleaning/{loop.json → source-loop-scopes.json} +0 -0
  237. /package/src/stories/behaviour/controls/{boucles-n.json → source-boucles-n.json} +0 -0
  238. /package/src/stories/behaviour/controls/{loop.json → source-loop.json} +0 -0
  239. /package/src/stories/behaviour/controls/{roundabout.json → source-roundabout.json} +0 -0
  240. /package/src/stories/behaviour/controls/{simple-numeric.json → source-simple-numeric.json} +0 -0
  241. /package/src/stories/behaviour/controls/{simple.json → source-simple.json} +0 -0
  242. /package/src/stories/{disabled → behaviour/disabled}/source.json +0 -0
  243. /package/src/stories/{checkbox-boolean → checkbox}/source.json +0 -0
  244. /package/src/stories/{checkbox-group/source.json → checkbox/sourceGroup.json} +0 -0
  245. /package/src/stories/{checkbox-group/sourceCondition.json → checkbox/sourceGroupCondition.json} +0 -0
  246. /package/src/stories/{checkbox-group/sourceDetail.json → checkbox/sourceGroupDetail.json} +0 -0
  247. /package/src/stories/{checkbox-one/source.json → checkbox/sourceOne.json} +0 -0
  248. /package/src/stories/{checkbox-one/sourceDetail.json → checkbox/sourceOneDetail.json} +0 -0
  249. /package/src/stories/{date-picker → datepicker}/source.json +0 -0
  250. /package/src/stories/{markdown/source.json → declaration/sourceMarkdown.json} +0 -0
  251. /package/src/stories/duration/{mois.json → sourceMonths.json} +0 -0
  252. /package/src/stories/duration/{time.json → sourceTime.json} +0 -0
  253. /package/src/stories/filter-description/{source-options.json → sourceOptions.json} +0 -0
  254. /package/src/stories/table/{table-dynamique.json → source-dynamic.json} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inseefr/lunatic",
3
- "version": "3.5.7",
3
+ "version": "3.6.0",
4
4
  "description": "Library of questionnaire components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -222,6 +222,7 @@
222
222
  "src/hooks/useDocumentEvent.ts",
223
223
  "src/hooks/useKeyboardKey.ts",
224
224
  "src/hooks/useListKeyboardHandler.ts",
225
+ "src/hooks/useLocalStorage.ts",
225
226
  "src/hooks/useRefSync.ts",
226
227
  "src/i18n/build-dictionary.ts",
227
228
  "src/i18n/dictionary.ts",
@@ -229,114 +230,91 @@
229
230
  "src/i18n/inputNumberProps.ts",
230
231
  "src/index.ts",
231
232
  "src/insee.d.ts",
232
- "src/stories/accordion/accordion.stories.jsx",
233
+ "src/json.d.ts",
234
+ "src/stories/accordion/accordion.stories.tsx",
233
235
  "src/stories/accordion/source.json",
234
- "src/stories/behaviour/cleaning/cleaning.stories.jsx",
235
- "src/stories/behaviour/cleaning/loop.json",
236
+ "src/stories/behaviour/cleaning/cleaning.stories.tsx",
237
+ "src/stories/behaviour/cleaning/source-loop-scopes.json",
236
238
  "src/stories/behaviour/cleaning/source-loop.json",
237
239
  "src/stories/behaviour/cleaning/source.json",
238
- "src/stories/behaviour/controls/boucles-n.json",
239
- "src/stories/behaviour/controls/controls.stories.jsx",
240
- "src/stories/behaviour/controls/loop.json",
241
- "src/stories/behaviour/controls/roundabout.json",
242
- "src/stories/behaviour/controls/simple-numeric.json",
243
- "src/stories/behaviour/controls/simple.json",
244
- "src/stories/behaviour/filter/dataLoop.json",
245
- "src/stories/behaviour/filter/filter.stories.jsx",
240
+ "src/stories/behaviour/controls/controls.stories.tsx",
241
+ "src/stories/behaviour/controls/source-boucles-n.json",
242
+ "src/stories/behaviour/controls/source-loop.json",
243
+ "src/stories/behaviour/controls/source-roundabout.json",
244
+ "src/stories/behaviour/controls/source-simple-numeric.json",
245
+ "src/stories/behaviour/controls/source-simple.json",
246
+ "src/stories/behaviour/disabled/disabled.stories.tsx",
247
+ "src/stories/behaviour/disabled/source.json",
248
+ "src/stories/behaviour/filter/filter.stories.tsx",
246
249
  "src/stories/behaviour/filter/source.json",
247
250
  "src/stories/behaviour/filter/sourceLoop.json",
248
- "src/stories/behaviour/missing/missing.stories.jsx",
251
+ "src/stories/behaviour/missing/missing.stories.tsx",
249
252
  "src/stories/behaviour/missing/source.json",
250
- "src/stories/behaviour/others/V2_DeclarationsSimples.json",
251
- "src/stories/behaviour/others/V2_MinMaxSum_Boucles.json",
252
- "src/stories/behaviour/others/V2_QuestSimple_Boucles.json",
253
- "src/stories/behaviour/others/V2_TCMRallyeGames.json",
254
- "src/stories/behaviour/others/test-dylan.json",
255
- "src/stories/behaviour/others/test.stories.jsx",
256
- "src/stories/behaviour/paste/source.json",
257
- "src/stories/behaviour/paste/test.stories.jsx",
258
- "src/stories/behaviour/performance/performance.stories.jsx",
253
+ "src/stories/behaviour/overview/overview.stories.tsx",
254
+ "src/stories/behaviour/overview/source.json",
255
+ "src/stories/behaviour/overview/sourceLoop.json",
256
+ "src/stories/behaviour/performance/performance.stories.tsx",
259
257
  "src/stories/behaviour/performance/source.json",
260
- "src/stories/behaviour/resizing/resizing.stories.jsx",
258
+ "src/stories/behaviour/resizing/resizing.stories.tsx",
261
259
  "src/stories/behaviour/resizing/source-resizing-cleaning.json",
262
260
  "src/stories/behaviour/resizing/source.json",
263
- "src/stories/behaviour/slots.stories.jsx",
264
- "src/stories/checkbox-boolean/checkboxBoolean.stories.jsx",
265
- "src/stories/checkbox-boolean/source.json",
266
- "src/stories/checkbox-group/checkbox-group.stories.jsx",
267
- "src/stories/checkbox-group/source.json",
268
- "src/stories/checkbox-group/sourceCondition.json",
269
- "src/stories/checkbox-group/sourceDetail.json",
270
- "src/stories/checkbox-group/sourceLoop.json",
271
- "src/stories/checkbox-one/checkboxOne.stories.jsx",
272
- "src/stories/checkbox-one/source.json",
273
- "src/stories/checkbox-one/sourceDetail.json",
274
- "src/stories/date-picker/data.json",
275
- "src/stories/date-picker/datepicker.stories.jsx",
276
- "src/stories/date-picker/source.json",
277
- "src/stories/declaration/data.json",
278
- "src/stories/declaration/input.stories.jsx",
261
+ "src/stories/behaviour/slots.stories.tsx",
262
+ "src/stories/checkbox/checkbox.stories.tsx",
263
+ "src/stories/checkbox/source.json",
264
+ "src/stories/checkbox/sourceGroup.json",
265
+ "src/stories/checkbox/sourceGroupCondition.json",
266
+ "src/stories/checkbox/sourceGroupDetail.json",
267
+ "src/stories/checkbox/sourceGroupLoop.json",
268
+ "src/stories/checkbox/sourceOne.json",
269
+ "src/stories/checkbox/sourceOneDetail.json",
270
+ "src/stories/datepicker/datepicker.stories.tsx",
271
+ "src/stories/datepicker/source.json",
272
+ "src/stories/declaration/declaration.stories.tsx",
279
273
  "src/stories/declaration/source.json",
280
- "src/stories/disabled/data.json",
281
- "src/stories/disabled/disabled.stories.jsx",
282
- "src/stories/disabled/source.json",
283
- "src/stories/dropdown/data.json",
284
- "src/stories/dropdown/dropdown.stories.jsx",
274
+ "src/stories/declaration/sourceMarkdown.json",
275
+ "src/stories/dropdown/dropdown.stories.tsx",
285
276
  "src/stories/dropdown/source.json",
286
- "src/stories/duration/duration.stories.jsx",
287
- "src/stories/duration/mois.json",
288
- "src/stories/duration/time.json",
289
- "src/stories/filter-description/filter-description.stories.jsx",
290
- "src/stories/filter-description/source-options.json",
277
+ "src/stories/duration/duration.stories.tsx",
278
+ "src/stories/duration/sourceMonths.json",
279
+ "src/stories/duration/sourceTime.json",
280
+ "src/stories/filter-description/filter-description.stories.tsx",
291
281
  "src/stories/filter-description/source.json",
292
- "src/stories/input/data.json",
293
- "src/stories/input/input.stories.jsx",
282
+ "src/stories/filter-description/sourceOptions.json",
283
+ "src/stories/input/input.stories.tsx",
294
284
  "src/stories/input/source.json",
295
- "src/stories/input-number/input-number.stories.jsx",
285
+ "src/stories/input-number/input-number.stories.tsx",
296
286
  "src/stories/input-number/source-big-number.json",
297
287
  "src/stories/input-number/source-euro.json",
298
288
  "src/stories/input-number/source.json",
299
- "src/stories/loop/loop.stories.jsx",
300
- "src/stories/loop/roster-for-loop.stories.jsx",
289
+ "src/stories/loop/loop.stories.tsx",
290
+ "src/stories/loop/roster-for-loop.stories.tsx",
301
291
  "src/stories/loop/source-bloc.json",
302
292
  "src/stories/loop/source-paginated.json",
303
293
  "src/stories/loop/source-roster.json",
304
- "src/stories/markdown/markdown.stories.jsx",
305
- "src/stories/markdown/source.json",
306
- "src/stories/overview/data.json",
307
- "src/stories/overview/dataLoop.json",
308
- "src/stories/overview/overview.stories.jsx",
309
- "src/stories/overview/source.json",
310
- "src/stories/overview/sourceLoop.json",
311
- "src/stories/overview/sourceWithHierarchy.json",
312
- "src/stories/pairwise/data.json",
313
- "src/stories/pairwise/pairwise-links.stories.jsx",
294
+ "src/stories/pairwise/pairwise.stories.tsx",
314
295
  "src/stories/pairwise/source.json",
315
- "src/stories/question/question.stories.jsx",
296
+ "src/stories/paste.stories.tsx",
297
+ "src/stories/question/question.stories.tsx",
316
298
  "src/stories/question/source.json",
317
299
  "src/stories/questionnaires/logement/data.json",
318
- "src/stories/questionnaires/logement/logement.stories.jsx",
300
+ "src/stories/questionnaires/logement/logement.stories.tsx",
319
301
  "src/stories/questionnaires/logement/source-sequence.json",
320
302
  "src/stories/questionnaires/logement/source-sum.json",
321
303
  "src/stories/questionnaires/logement/source.json",
322
- "src/stories/questionnaires/recensement/data.json",
323
- "src/stories/questionnaires/recensement/recensement.stories.jsx",
304
+ "src/stories/questionnaires/recensement/recensement.stories.tsx",
324
305
  "src/stories/questionnaires/recensement/source.json",
325
- "src/stories/questionnaires/rp/data.json",
326
- "src/stories/questionnaires/rp/rp.stories.jsx",
306
+ "src/stories/questionnaires/rp/rp.stories.tsx",
327
307
  "src/stories/questionnaires/rp/source.json",
328
- "src/stories/questionnaires/simpsons/simpsons.stories.jsx",
308
+ "src/stories/questionnaires/simpsons/simpsons.stories.tsx",
329
309
  "src/stories/questionnaires/simpsons/source.json",
330
- "src/stories/radio/radio.stories.jsx",
310
+ "src/stories/radio/radio.stories.tsx",
331
311
  "src/stories/radio/source.json",
332
312
  "src/stories/radio/sourceCondition.json",
333
313
  "src/stories/radio/sourceDetail.json",
334
314
  "src/stories/radio/sourceHorizontal.json",
335
- "src/stories/roundabout/data1.json",
336
- "src/stories/roundabout/data2.json",
337
- "src/stories/roundabout/roundabout.stories.jsx",
315
+ "src/stories/roundabout/roundabout.stories.tsx",
338
316
  "src/stories/roundabout/source.json",
339
- "src/stories/sequence/sequence.stories.jsx",
317
+ "src/stories/sequence/sequence.stories.tsx",
340
318
  "src/stories/sequence/source-declarations.json",
341
319
  "src/stories/sequence/source.json",
342
320
  "src/stories/suggester/fakeReferentiel.json",
@@ -345,41 +323,28 @@
345
323
  "src/stories/suggester/source-multiline.json",
346
324
  "src/stories/suggester/source-option-responses.json",
347
325
  "src/stories/suggester/source.json",
348
- "src/stories/suggester/suggester.stories.jsx",
349
- "src/stories/summary/data.json",
326
+ "src/stories/suggester/suggester.stories.tsx",
350
327
  "src/stories/summary/source.json",
351
- "src/stories/summary/summary.stories.jsx",
352
- "src/stories/switch/README.md",
353
- "src/stories/switch/data-forced.json",
354
- "src/stories/switch/source.json",
355
- "src/stories/switch/switch.stories.jsx",
356
- "src/stories/table/data.json",
328
+ "src/stories/summary/summary.stories.tsx",
357
329
  "src/stories/table/source-colspan.json",
330
+ "src/stories/table/source-dynamic.json",
358
331
  "src/stories/table/source.json",
359
- "src/stories/table/table-dynamique.json",
360
- "src/stories/table/table.stories.jsx",
361
- "src/stories/text/data-roster.json",
332
+ "src/stories/table/table.stories.tsx",
362
333
  "src/stories/text/source-roster.json",
363
334
  "src/stories/text/source-table.json",
364
335
  "src/stories/text/source.json",
365
- "src/stories/text/text.stories.jsx",
366
- "src/stories/textarea/data.json",
336
+ "src/stories/text/text.stories.tsx",
367
337
  "src/stories/textarea/source.json",
368
- "src/stories/textarea/textarea.stories.jsx",
369
- "src/stories/utils/SchemaValidator.jsx",
338
+ "src/stories/textarea/textarea.stories.tsx",
339
+ "src/stories/utils/Orchestrator.tsx",
340
+ "src/stories/utils/OrchestratorData.tsx",
341
+ "src/stories/utils/OrchestratorOverview.tsx",
342
+ "src/stories/utils/OrchestratorSidebar.tsx",
343
+ "src/stories/utils/SchemaValidator.tsx",
370
344
  "src/stories/utils/custom-lunatic.scss",
371
- "src/stories/utils/default-arg-types.js",
372
- "src/stories/utils/default-args.js",
373
- "src/stories/utils/options.js",
374
- "src/stories/utils/orchestrator.jsx",
375
- "src/stories/utils/orchestrator.scss",
376
- "src/stories/utils/overview.jsx",
377
- "src/stories/utils/overview.scss",
378
- "src/stories/utils/referentiel.js",
345
+ "src/stories/utils/referentiel.ts",
379
346
  "src/test.d.ts",
380
347
  "src/tests/setup.ts",
381
- "src/tests/utils/e2e.js",
382
- "src/tests/utils/lunatic.ts",
383
348
  "src/tests/utils/timer.ts",
384
349
  "src/type.source.ts",
385
350
  "src/type.utils.ts",
@@ -442,8 +407,6 @@
442
407
  "src/use-lunatic/reducer/reduce-handle-changes.ts",
443
408
  "src/use-lunatic/reducer/reducer.ts",
444
409
  "src/use-lunatic/reducer/reducerInitializer.tsx",
445
- "src/use-lunatic/replace-component-sequence.ts",
446
- "src/use-lunatic/test.utils.ts",
447
410
  "src/use-lunatic/type.ts",
448
411
  "src/use-lunatic/use-lunatic.test.ts",
449
412
  "src/use-lunatic/use-lunatic.ts",
@@ -461,7 +424,6 @@
461
424
  "src/utils/env.ts",
462
425
  "src/utils/function.ts",
463
426
  "src/utils/is-element.ts",
464
- "src/utils/is-object.ts",
465
427
  "src/utils/logger.ts",
466
428
  "src/utils/number.spec.ts",
467
429
  "src/utils/number.ts",
@@ -474,7 +436,6 @@
474
436
  "src/utils/search/melauto.ts",
475
437
  "src/utils/search/tokenizer.spec.ts",
476
438
  "src/utils/search/tokenizer.ts",
477
- "src/utils/to-number.ts",
478
439
  "src/utils/variables.spec.ts",
479
440
  "src/utils/variables.ts",
480
441
  "src/utils/vtl.ts",
@@ -1345,6 +1306,9 @@
1345
1306
  "esm/hooks/useListKeyboardHandler.d.ts",
1346
1307
  "esm/hooks/useListKeyboardHandler.js",
1347
1308
  "esm/hooks/useListKeyboardHandler.js.map",
1309
+ "esm/hooks/useLocalStorage.d.ts",
1310
+ "esm/hooks/useLocalStorage.js",
1311
+ "esm/hooks/useLocalStorage.js.map",
1348
1312
  "esm/hooks/useRefSync.d.ts",
1349
1313
  "esm/hooks/useRefSync.js",
1350
1314
  "esm/hooks/useRefSync.js.map",
@@ -1368,13 +1332,9 @@
1368
1332
  "esm/index.js.map",
1369
1333
  "esm/main.css",
1370
1334
  "esm/main.css.map",
1371
- "esm/stories/overview/sourceWithHierarchy.json",
1372
1335
  "esm/tests/setup.d.ts",
1373
1336
  "esm/tests/setup.js",
1374
1337
  "esm/tests/setup.js.map",
1375
- "esm/tests/utils/lunatic.d.ts",
1376
- "esm/tests/utils/lunatic.js",
1377
- "esm/tests/utils/lunatic.js.map",
1378
1338
  "esm/tests/utils/timer.d.ts",
1379
1339
  "esm/tests/utils/timer.js",
1380
1340
  "esm/tests/utils/timer.js.map",
@@ -1555,12 +1515,6 @@
1555
1515
  "esm/use-lunatic/reducer/reducerInitializer.d.ts",
1556
1516
  "esm/use-lunatic/reducer/reducerInitializer.js",
1557
1517
  "esm/use-lunatic/reducer/reducerInitializer.js.map",
1558
- "esm/use-lunatic/replace-component-sequence.d.ts",
1559
- "esm/use-lunatic/replace-component-sequence.js",
1560
- "esm/use-lunatic/replace-component-sequence.js.map",
1561
- "esm/use-lunatic/test.utils.d.ts",
1562
- "esm/use-lunatic/test.utils.js",
1563
- "esm/use-lunatic/test.utils.js.map",
1564
1518
  "esm/use-lunatic/type.d.ts",
1565
1519
  "esm/use-lunatic/type.js",
1566
1520
  "esm/use-lunatic/type.js.map",
@@ -1609,9 +1563,6 @@
1609
1563
  "esm/utils/is-element.d.ts",
1610
1564
  "esm/utils/is-element.js",
1611
1565
  "esm/utils/is-element.js.map",
1612
- "esm/utils/is-object.d.ts",
1613
- "esm/utils/is-object.js",
1614
- "esm/utils/is-object.js.map",
1615
1566
  "esm/utils/logger.d.ts",
1616
1567
  "esm/utils/logger.js",
1617
1568
  "esm/utils/logger.js.map",
@@ -1648,9 +1599,6 @@
1648
1599
  "esm/utils/search/tokenizer.spec.d.ts",
1649
1600
  "esm/utils/search/tokenizer.spec.js",
1650
1601
  "esm/utils/search/tokenizer.spec.js.map",
1651
- "esm/utils/to-number.d.ts",
1652
- "esm/utils/to-number.js",
1653
- "esm/utils/to-number.js.map",
1654
1602
  "esm/utils/variables.d.ts",
1655
1603
  "esm/utils/variables.js",
1656
1604
  "esm/utils/variables.js.map",
@@ -1681,6 +1629,9 @@
1681
1629
  "hooks/useListKeyboardHandler.d.ts",
1682
1630
  "hooks/useListKeyboardHandler.js",
1683
1631
  "hooks/useListKeyboardHandler.js.map",
1632
+ "hooks/useLocalStorage.d.ts",
1633
+ "hooks/useLocalStorage.js",
1634
+ "hooks/useLocalStorage.js.map",
1684
1635
  "hooks/useRefSync.d.ts",
1685
1636
  "hooks/useRefSync.js",
1686
1637
  "hooks/useRefSync.js.map",
@@ -1704,13 +1655,9 @@
1704
1655
  "index.js.map",
1705
1656
  "main.css",
1706
1657
  "main.css.map",
1707
- "stories/overview/sourceWithHierarchy.json",
1708
1658
  "tests/setup.d.ts",
1709
1659
  "tests/setup.js",
1710
1660
  "tests/setup.js.map",
1711
- "tests/utils/lunatic.d.ts",
1712
- "tests/utils/lunatic.js",
1713
- "tests/utils/lunatic.js.map",
1714
1661
  "tests/utils/timer.d.ts",
1715
1662
  "tests/utils/timer.js",
1716
1663
  "tests/utils/timer.js.map",
@@ -1892,12 +1839,6 @@
1892
1839
  "use-lunatic/reducer/reducerInitializer.d.ts",
1893
1840
  "use-lunatic/reducer/reducerInitializer.js",
1894
1841
  "use-lunatic/reducer/reducerInitializer.js.map",
1895
- "use-lunatic/replace-component-sequence.d.ts",
1896
- "use-lunatic/replace-component-sequence.js",
1897
- "use-lunatic/replace-component-sequence.js.map",
1898
- "use-lunatic/test.utils.d.ts",
1899
- "use-lunatic/test.utils.js",
1900
- "use-lunatic/test.utils.js.map",
1901
1842
  "use-lunatic/type.d.ts",
1902
1843
  "use-lunatic/type.js",
1903
1844
  "use-lunatic/type.js.map",
@@ -1946,9 +1887,6 @@
1946
1887
  "utils/is-element.d.ts",
1947
1888
  "utils/is-element.js",
1948
1889
  "utils/is-element.js.map",
1949
- "utils/is-object.d.ts",
1950
- "utils/is-object.js",
1951
- "utils/is-object.js.map",
1952
1890
  "utils/logger.d.ts",
1953
1891
  "utils/logger.js",
1954
1892
  "utils/logger.js.map",
@@ -1985,9 +1923,6 @@
1985
1923
  "utils/search/tokenizer.spec.d.ts",
1986
1924
  "utils/search/tokenizer.spec.js",
1987
1925
  "utils/search/tokenizer.spec.js.map",
1988
- "utils/to-number.d.ts",
1989
- "utils/to-number.js",
1990
- "utils/to-number.js.map",
1991
1926
  "utils/variables.d.ts",
1992
1927
  "utils/variables.js",
1993
1928
  "utils/variables.js.map",
@@ -2040,6 +1975,7 @@
2040
1975
  "@storybook/react-vite": "^8.2.9",
2041
1976
  "@storybook/test": "^8.2.9",
2042
1977
  "@storybook/test-runner": "^0.19.1",
1978
+ "@tailwindcss/vite": "^4.1.4",
2043
1979
  "@testing-library/jest-dom": "^6.4.8",
2044
1980
  "@testing-library/react": "^16.0.0",
2045
1981
  "@types/node": "^22.8.0",
@@ -2047,8 +1983,10 @@
2047
1983
  "@types/react-dom": "^18.3.0",
2048
1984
  "@vitejs/plugin-react": "^4.3.1",
2049
1985
  "@vitest/coverage-v8": "2.1.2",
1986
+ "@xyflow/react": "^12.6.0",
2050
1987
  "ajv": "^8.17.1",
2051
1988
  "concurrently": "^8.2.2",
1989
+ "daisyui": "^5.0.28",
2052
1990
  "eslint": "^9.9.0",
2053
1991
  "eslint-plugin-react-hooks": "^5.1.0-rc.0",
2054
1992
  "eslint-plugin-react-refresh": "^0.4.9",
@@ -2059,6 +1997,7 @@
2059
1997
  "react": "^18.3.1",
2060
1998
  "react-dom": "^18.3.1",
2061
1999
  "storybook": "^8.2.9",
2000
+ "tailwindcss": "^4.1.4",
2062
2001
  "tsx": "^4.19.1",
2063
2002
  "typescript": "^5.4.5",
2064
2003
  "typescript-eslint": "^8.11.0",
@@ -1,62 +1,61 @@
1
1
  import { type Meta, type StoryObj } from '@storybook/react';
2
2
  import { useState } from 'react';
3
3
  import { Combobox } from './Combobox';
4
- import type { ComboboxOptionType } from './ComboboxType';
4
+ import { fn } from '@storybook/test';
5
5
 
6
6
  const meta: Meta<typeof Combobox> = {
7
- title: 'Components/Shared/ComboBox',
7
+ title: 'Components/ComboBox',
8
8
  component: Combobox,
9
9
  };
10
10
 
11
11
  export default meta;
12
+ type Story = StoryObj<typeof Combobox>;
12
13
 
13
- const LabelRenderer = ({
14
- option,
15
- placeholder,
16
- }: {
17
- option?: ComboboxOptionType;
18
- placeholder?: string;
19
- }) => <>{option?.label ?? placeholder}</>;
20
-
21
- const Template: typeof Combobox = (args) => {
22
- const [localValue, setLocalValue] = useState(args.value);
23
- const [search, setSearch] = useState<string | null>('');
24
- // Simulate a search
25
- const options = search
26
- ? args.options.filter((v) =>
27
- v.value.toLowerCase().includes(search.toLowerCase())
28
- )
29
- : args.options;
30
-
31
- return (
32
- <fieldset>
33
- <legend>Select an option : {localValue}</legend>
34
- <Combobox
35
- {...args}
36
- value={localValue}
37
- onSelect={(v) => {
38
- setLocalValue(v);
39
- args.onSelect?.(v);
40
- }}
41
- onChange={(v) => {
42
- setSearch(v);
43
- args.onChange?.(v);
44
- }}
45
- options={options}
46
- labelRenderer={LabelRenderer}
47
- optionRenderer={LabelRenderer}
48
- />
49
- <button onClick={() => setLocalValue('4')}>Sélectionner paris</button>
50
- </fieldset>
51
- );
52
- };
53
-
54
- export const Default: StoryObj<typeof Combobox> = {
55
- render: (args) => <Template {...args} />,
14
+ export const Default: Story = {
15
+ render(args) {
16
+ // eslint-disable-next-line react-hooks/rules-of-hooks
17
+ const [localValue, setLocalValue] = useState(args.value);
18
+ // eslint-disable-next-line react-hooks/rules-of-hooks
19
+ const [search, setSearch] = useState<string | null>('');
20
+ // Simulate a search
21
+ const options = search
22
+ ? args.options.filter((v) =>
23
+ v.value.toLowerCase().includes(search.toLowerCase())
24
+ )
25
+ : args.options;
26
+ return (
27
+ <fieldset>
28
+ <legend>Select an option : {localValue}</legend>
29
+ <Combobox
30
+ {...args}
31
+ value={localValue}
32
+ onSelect={(v) => {
33
+ console.log('onSelect', v);
34
+ setLocalValue(v);
35
+ args.onSelect(v);
36
+ }}
37
+ onChange={(v) => {
38
+ console.log('onChange', v);
39
+ setSearch(v);
40
+ args.onChange?.(v);
41
+ }}
42
+ options={options}
43
+ />
44
+ <button
45
+ className="btn btn-primary"
46
+ onClick={() => setLocalValue('paris')}
47
+ >
48
+ Sélectionner paris
49
+ </button>
50
+ </fieldset>
51
+ );
52
+ },
56
53
  args: {
57
54
  value: '1',
55
+ onSelect: fn(),
56
+ onChange: fn(),
58
57
  options: [
59
- { id: '1', value: 'Option 1', label: <strong>Option 1</strong> },
58
+ { id: '1', value: 'Option 1', label: 'Option 1' },
60
59
  { id: '2', value: 'Option 2', label: 'Option 2' },
61
60
  { id: '3', value: 'Option 3', label: 'Option 3' },
62
61
  { id: 'paris', value: 'Paris', label: 'Paris' },
@@ -65,10 +64,10 @@ export const Default: StoryObj<typeof Combobox> = {
65
64
  },
66
65
  };
67
66
 
68
- export const Editable: StoryObj<typeof Combobox> = {
69
- ...Default,
67
+ export const Editable: Story = {
68
+ render: Default.render,
70
69
  args: {
71
- ...Default.parameters,
70
+ ...Default.args,
72
71
  editable: true,
73
72
  },
74
73
  };
@@ -0,0 +1,37 @@
1
+ import { useCallback, useMemo, useState } from 'react';
2
+
3
+ export function useLocalStorage<T>(
4
+ key: string
5
+ ): [T | null, (value: string) => void, string] {
6
+ const [storedValue, setStoredValue] = useState<T | null>(() => {
7
+ try {
8
+ const item = window.localStorage.getItem(key);
9
+ return item ? JSON.parse(item) : null;
10
+ } catch (error) {
11
+ console.error(`Error reading localStorage key "${key}":`, error);
12
+ return null;
13
+ }
14
+ });
15
+
16
+ const setValue = useCallback(
17
+ (value: string) => {
18
+ try {
19
+ const parsedValue = JSON.parse(value);
20
+ setStoredValue(parsedValue);
21
+ window.localStorage.setItem(key, value);
22
+ } catch (error) {
23
+ console.error(`Error setting localStorage key "${key}":`, error);
24
+ }
25
+ },
26
+ [key]
27
+ );
28
+
29
+ const stringValue = useMemo(() => {
30
+ if (!storedValue) {
31
+ return '';
32
+ }
33
+ return JSON.stringify(storedValue, null, 2);
34
+ }, [storedValue]);
35
+
36
+ return [storedValue, setValue, stringValue];
37
+ }
package/src/json.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ declare module './data*.json' {
2
+ import type { LunaticData } from './use-lunatic/type';
3
+ const value: LunaticData;
4
+ export default value;
5
+ }
6
+
7
+ declare module '*-schema.json' {
8
+ const value: any;
9
+ export default value;
10
+ }
11
+
12
+ declare module '*.json' {
13
+ import type { LunaticSource } from './type.source';
14
+ const value: LunaticSource;
15
+ export default value;
16
+ }
@@ -0,0 +1,21 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../utils/Orchestrator';
6
+ import source from './source.json';
7
+
8
+ import { Meta } from '@storybook/react';
9
+
10
+ const meta: Meta<typeof Orchestrator> = {
11
+ title: 'Components/Accordion',
12
+ ...OrchestratorMeta,
13
+ };
14
+
15
+ export default meta;
16
+
17
+ export const Default: OrchestratorStory = {
18
+ args: {
19
+ source,
20
+ },
21
+ };
@@ -0,0 +1,40 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../../utils/Orchestrator';
6
+ import source from './source.json';
7
+ import sourceLoop from './source-loop.json';
8
+ import sourceLoopScopes from './source-loop-scopes.json';
9
+
10
+ import { Meta } from '@storybook/react';
11
+
12
+ import { dataFromObject } from '../../../utils/object';
13
+
14
+ const meta: Meta<typeof Orchestrator> = {
15
+ title: 'Behaviour/Cleaning',
16
+ ...OrchestratorMeta,
17
+ };
18
+
19
+ export default meta;
20
+
21
+ export const Default: OrchestratorStory = {
22
+ args: {
23
+ source,
24
+ },
25
+ };
26
+
27
+ export const Loop: OrchestratorStory = {
28
+ args: {
29
+ source: sourceLoop,
30
+ },
31
+ };
32
+
33
+ export const LoopWithMixedScopes: OrchestratorStory = {
34
+ args: {
35
+ source: sourceLoopScopes,
36
+ data: dataFromObject({
37
+ PRENOM: ['Laurent', 'Alain', 'toto'],
38
+ }),
39
+ },
40
+ };