@inseefr/lunatic 0.1.0-hackathon → 0.1.0-prisme

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 (421) hide show
  1. package/README.md +2 -0
  2. package/lib/index.js +1184 -468
  3. package/lib/index.js.map +1 -1
  4. package/package.json +6 -4
  5. package/src/components/breadcrumb/component.js +29 -29
  6. package/src/components/breadcrumb/index.js +1 -1
  7. package/src/components/button/button.scss +24 -24
  8. package/src/components/button/component.js +53 -53
  9. package/src/components/button/index.js +1 -1
  10. package/src/components/checkbox/boolean.js +2 -2
  11. package/src/components/checkbox/group.js +2 -2
  12. package/src/components/checkbox/index.js +3 -3
  13. package/src/components/checkbox/one.js +2 -2
  14. package/src/components/component-wrapper/controls/component.js +70 -0
  15. package/src/components/component-wrapper/controls/controls.scss +6 -0
  16. package/src/components/component-wrapper/controls/index.js +1 -0
  17. package/src/components/component-wrapper/controls/validators/datepicker.js +44 -0
  18. package/src/components/component-wrapper/controls/validators/index.js +16 -0
  19. package/src/components/component-wrapper/controls/validators/input-number.js +23 -0
  20. package/src/components/{missing-wrapper → component-wrapper}/index.js +1 -1
  21. package/src/components/component-wrapper/missing/component.js +200 -0
  22. package/src/components/component-wrapper/missing/index.js +1 -0
  23. package/src/components/{missing-wrapper → component-wrapper/missing}/missing.scss +0 -0
  24. package/src/components/component-wrapper/wrapper.js +23 -0
  25. package/src/components/components.js +19 -18
  26. package/src/components/datepicker/component.js +18 -3
  27. package/src/components/datepicker/datepicker.scss +1 -1
  28. package/src/components/datepicker/index.js +1 -1
  29. package/src/components/declarations/index.js +1 -1
  30. package/src/components/declarations/wrappers/index.js +3 -3
  31. package/src/components/declarations/wrappers/input-declarations-wrapper.js +65 -16
  32. package/src/components/declarations/wrappers/list-declarations-wrapper.js +232 -232
  33. package/src/components/dropdown/commons/actions.js +40 -31
  34. package/src/components/dropdown/commons/components/dropdown-field.js +46 -46
  35. package/src/components/dropdown/commons/components/dropdown.js +21 -0
  36. package/src/components/dropdown/commons/components/label.js +28 -28
  37. package/src/components/dropdown/commons/components/panel.js +78 -78
  38. package/src/components/dropdown/commons/event-callbacks/index.js +5 -5
  39. package/src/components/dropdown/commons/event-callbacks/on-keydown-callback.js +29 -29
  40. package/src/components/dropdown/commons/reducer.js +152 -149
  41. package/src/components/dropdown/component.js +2 -2
  42. package/src/components/dropdown/dropdown-edit/dropdown-edit.js +10 -1
  43. package/src/components/dropdown/dropdown-edit/icone.js +33 -33
  44. package/src/components/dropdown/dropdown-edit/option.js +62 -62
  45. package/src/components/dropdown/dropdown-edit/prefix-tools.js +51 -51
  46. package/src/components/dropdown/dropdown-simple/dropdown.js +11 -2
  47. package/src/components/dropdown/dropdown-simple/option.js +15 -15
  48. package/src/components/dropdown/index.js +1 -1
  49. package/src/components/filter-description/component.js +42 -42
  50. package/src/components/filter-description/index.js +1 -1
  51. package/src/components/icon/assets/checkbox-checked.js +16 -16
  52. package/src/components/icon/assets/checkbox-unchecked.js +16 -16
  53. package/src/components/icon/assets/index.js +4 -4
  54. package/src/components/icon/assets/radio-checked.js +16 -16
  55. package/src/components/icon/assets/radio-unchecked.js +16 -16
  56. package/src/components/icon/component.js +33 -33
  57. package/src/components/icon/index.js +1 -1
  58. package/src/components/index.js +5 -3
  59. package/src/components/index.scss +5 -3
  60. package/src/components/input/index.js +2 -2
  61. package/src/components/input/input-number.js +14 -39
  62. package/src/components/input/input.js +2 -2
  63. package/src/components/input/input.scss +0 -6
  64. package/src/components/loop/component.js +1 -0
  65. package/src/components/loop/index.js +1 -1
  66. package/src/components/loop/wrapper.js +15 -15
  67. package/src/components/loop-constructor/block/component.js +2 -2
  68. package/src/components/loop-constructor/block/index.js +1 -1
  69. package/src/components/loop-constructor/index.js +1 -1
  70. package/src/components/loop-constructor/roster/component.js +2 -2
  71. package/src/components/loop-constructor/roster/index.js +1 -1
  72. package/src/components/loop-constructor/wrapper/body-component.js +21 -0
  73. package/src/components/loop-constructor/wrapper/build-components.js +33 -33
  74. package/src/components/loop-constructor/wrapper/index.js +1 -1
  75. package/src/components/modal/component.js +36 -0
  76. package/src/components/modal/index.js +1 -0
  77. package/src/components/modal/modal.scss +33 -0
  78. package/src/components/progress-bar/component.js +28 -28
  79. package/src/components/progress-bar/index.js +1 -1
  80. package/src/components/radio/component.js +2 -2
  81. package/src/components/radio/index.js +1 -1
  82. package/src/components/sequence/index.js +1 -1
  83. package/src/components/subsequence/index.js +1 -1
  84. package/src/components/suggester/check-store.js +68 -70
  85. package/src/components/suggester/commons-tools/binded-keys.js +11 -11
  86. package/src/components/suggester/commons-tools/index.js +1 -1
  87. package/src/components/suggester/components/create-on-keydown-callback.js +28 -28
  88. package/src/components/suggester/components/index.js +2 -2
  89. package/src/components/suggester/components/panel/index.js +2 -2
  90. package/src/components/suggester/components/panel/option-container.js +1 -1
  91. package/src/components/suggester/components/panel/panel-container.js +21 -21
  92. package/src/components/suggester/components/selection/delete.js +38 -38
  93. package/src/components/suggester/components/selection/index.js +1 -1
  94. package/src/components/suggester/components/selection/selection.js +1 -1
  95. package/src/components/suggester/components/suggester-content.js +42 -42
  96. package/src/components/suggester/components/suggester.js +43 -3
  97. package/src/components/suggester/find-best-label/find-best-label.js +3 -1
  98. package/src/components/suggester/idb-suggester.js +7 -1
  99. package/src/components/suggester/index.js +1 -1
  100. package/src/components/suggester/lunatic-suggester.js +6 -3
  101. package/src/components/suggester/searching/create-searching.js +3 -1
  102. package/src/components/suggester/state-management/index.js +6 -6
  103. package/src/components/suggester/state-management/intial-state.js +13 -13
  104. package/src/components/suggester/state-management/reducer/index.js +1 -1
  105. package/src/components/suggester/state-management/reducer/reduce-on-blur.js +5 -5
  106. package/src/components/suggester/state-management/reducer/reduce-on-change-search.js +8 -8
  107. package/src/components/suggester/state-management/reducer/reduce-on-click-option.js +8 -8
  108. package/src/components/suggester/state-management/reducer/reduce-on-error.js +8 -8
  109. package/src/components/suggester/state-management/reducer/reduce-on-focus.js +5 -5
  110. package/src/components/suggester/state-management/reducer/reduce-on-key-down.js +73 -73
  111. package/src/components/suggester/state-management/reducer/reduce-on-unexpected-error.js +7 -7
  112. package/src/components/suggester/state-management/reducer/reduce-on-update-options.js +11 -11
  113. package/src/components/suggester/state-management/suggester-context.js +4 -4
  114. package/src/components/suggester/state-management/use-dispatch.js +11 -11
  115. package/src/components/suggester/suggester-wrapper.js +9 -3
  116. package/src/components/suggester-loader-widget/index.js +1 -1
  117. package/src/components/suggester-loader-widget/loader-row.js +102 -102
  118. package/src/components/suggester-loader-widget/progress.js +25 -25
  119. package/src/components/suggester-loader-widget/tools/action-tool.js +20 -20
  120. package/src/components/suggester-loader-widget/tools/index.js +2 -2
  121. package/src/components/suggester-loader-widget/tools/tools.js +7 -7
  122. package/src/components/suggester-loader-widget/widget-container.js +35 -35
  123. package/src/components/suggester-loader-widget/widget.scss +176 -176
  124. package/src/components/table/index.js +1 -1
  125. package/src/components/table/table.js +5 -3
  126. package/src/components/textarea/component.js +2 -2
  127. package/src/components/textarea/index.js +1 -1
  128. package/src/components/tooltip/img/index.js +4 -4
  129. package/src/components/tooltip/index.js +1 -1
  130. package/src/components/tooltip/response.js +52 -52
  131. package/src/constants/component-types.js +1 -1
  132. package/src/constants/declarations.js +14 -14
  133. package/src/constants/event-types.js +13 -13
  134. package/src/constants/index.js +5 -5
  135. package/src/constants/supported-preferences.js +10 -10
  136. package/src/constants/value-types.js +5 -5
  137. package/src/constants/variable-types.js +4 -4
  138. package/src/stories/breadcrumb/README.md +14 -14
  139. package/src/stories/button/README.md +14 -14
  140. package/src/stories/button/button.stories.js +27 -27
  141. package/src/stories/checkbox-boolean/README.md +27 -27
  142. package/src/stories/checkbox-boolean/checkbox-boolean.stories.js +54 -54
  143. package/src/stories/checkbox-boolean/data-forced.json +48 -48
  144. package/src/stories/checkbox-group/README.md +29 -29
  145. package/src/stories/checkbox-group/checkbox-group.stories.js +60 -60
  146. package/src/stories/checkbox-group/data-forced.json +89 -89
  147. package/src/stories/checkbox-group/data-vtl.json +102 -102
  148. package/src/stories/checkbox-group/data.json +89 -89
  149. package/src/stories/checkbox-one/README.md +31 -31
  150. package/src/stories/checkbox-one/checkbox-one.stories.js +57 -57
  151. package/src/stories/checkbox-one/data-forced.json +33 -33
  152. package/src/stories/checkbox-one/data-vtl.json +48 -48
  153. package/src/stories/checkbox-one/data.json +33 -33
  154. package/src/stories/datepicker/README.md +31 -31
  155. package/src/stories/datepicker/data-forced.json +28 -28
  156. package/src/stories/datepicker/data.json +45 -43
  157. package/src/stories/datepicker/datepicker.stories.js +60 -60
  158. package/src/stories/declarations/README.md +19 -19
  159. package/src/stories/dropdown/data-forced.json +81 -81
  160. package/src/stories/dropdown/data-naf.json +6963 -6963
  161. package/src/stories/dropdown/data-props.json +111 -111
  162. package/src/stories/filter-description/README.md +15 -15
  163. package/src/stories/filter-description/filter-description.stories.js +53 -53
  164. package/src/stories/icons/icons.stories.js +16 -16
  165. package/src/stories/icons/lunatic-icon.scss +10 -10
  166. package/src/stories/input/README.md +33 -33
  167. package/src/stories/input/data-forced.json +41 -41
  168. package/src/stories/input/data.json +41 -41
  169. package/src/stories/input/input.stories.js +72 -72
  170. package/src/stories/input-number/README.md +37 -37
  171. package/src/stories/input-number/data-forced.json +27 -27
  172. package/src/stories/input-number/data.json +42 -42
  173. package/src/stories/input-number/input-number.stories.js +81 -81
  174. package/src/stories/loop/README.md +25 -25
  175. package/src/stories/loop/loop.stories.js +88 -88
  176. package/src/stories/loop/with-loop/data-loop-deeper.json +298 -298
  177. package/src/stories/loop/with-loop/data-loop.json +336 -336
  178. package/src/stories/loop/with-loop/index.js +2 -2
  179. package/src/stories/loop/with-roster/data-forced.json +213 -213
  180. package/src/stories/loop/with-roster/data-loop-deeper.json +298 -298
  181. package/src/stories/loop/with-roster/data-loop.json +288 -288
  182. package/src/stories/loop/with-roster/index.js +3 -3
  183. package/src/stories/loop-constructor/README.md +27 -27
  184. package/src/stories/loop-constructor/data-input-forced.json +64 -64
  185. package/src/stories/loop-constructor/data-input.json +100 -100
  186. package/src/stories/loop-constructor/data-loop-forced.json +66 -66
  187. package/src/stories/loop-constructor/data-loop-static-forced.json +66 -66
  188. package/src/stories/loop-constructor/data-loop-static.json +81 -81
  189. package/src/stories/loop-constructor/data-loop.json +81 -81
  190. package/src/stories/loop-constructor/data-roster-forced.json +68 -68
  191. package/src/stories/loop-constructor/data-roster.json +83 -83
  192. package/src/stories/loop-constructor/loop-constructor.stories.js +180 -180
  193. package/src/stories/pagination/deeper-loop.json +327 -327
  194. package/src/stories/pagination/pagination.stories.js +60 -60
  195. package/src/stories/pagination/simple-loop.json +277 -277
  196. package/src/stories/pagination/simpsons-question.json +4952 -4952
  197. package/src/stories/pagination/simpsons-sequence.json +4362 -4362
  198. package/src/stories/progress-bar/README.md +13 -13
  199. package/src/stories/questionnaire/arithmetic-management.json +47 -0
  200. package/src/stories/questionnaire/kish.json +275 -0
  201. package/src/stories/questionnaire/logement-queen.json +23390 -0
  202. package/src/stories/questionnaire/logement-s2.json +46027 -44536
  203. package/src/stories/questionnaire/logement.json +20347 -26087
  204. package/src/stories/questionnaire/loop-and-controls.json +481 -0
  205. package/src/stories/questionnaire/questionnaire.stories.js +94 -12
  206. package/src/stories/questionnaire/simpsons.json +4816 -4816
  207. package/src/stories/questionnaire/update-external/data.json +1 -0
  208. package/src/stories/questionnaire/update-external/questionnaire.json +75 -0
  209. package/src/stories/radio/README.md +31 -31
  210. package/src/stories/radio/data-forced.json +32 -32
  211. package/src/stories/radio/data-vtl.json +47 -47
  212. package/src/stories/radio/data.json +32 -32
  213. package/src/stories/radio/radio.stories.js +64 -64
  214. package/src/stories/sequence/README.md +18 -18
  215. package/src/stories/subsequence/README.md +18 -18
  216. package/src/stories/suggester/bailleurs-sociaux-2021/fetch-bailleurs.js +12 -0
  217. package/src/stories/suggester/bailleurs-sociaux-2021/index.js +1 -0
  218. package/src/stories/suggester/cog-communes/index.js +2 -2
  219. package/src/stories/suggester/cog-communes/option-cog-renderer.js +15 -15
  220. package/src/stories/suggester/cog-communes/theme.scss +12 -12
  221. package/src/stories/suggester/data-auto.json +1 -0
  222. package/src/stories/suggester/data.json +35 -2
  223. package/src/stories/suggester/naf-rev2/fetch-naf.js +57 -57
  224. package/src/stories/suggester/naf-rev2/theme.scss +36 -36
  225. package/src/stories/suggester/suggester-workers.stories.js +48 -1
  226. package/src/stories/suggester/suggester.stories.js +5 -0
  227. package/src/stories/table/README.md +29 -29
  228. package/src/stories/table/data-default.json +19 -19
  229. package/src/stories/table/data-one-axis-one-measure.json +139 -139
  230. package/src/stories/table/data-one-axis-two-measures.json +208 -208
  231. package/src/stories/table/data-one-hierarchical-axis.json +219 -219
  232. package/src/stories/table/data-roster.json +486 -486
  233. package/src/stories/table/data-two-axis-one-measure.json +507 -507
  234. package/src/stories/table/table.stories.js +82 -82
  235. package/src/stories/textarea/README.md +33 -33
  236. package/src/stories/textarea/data-forced.json +28 -28
  237. package/src/stories/textarea/data.json +43 -43
  238. package/src/stories/textarea/textarea.stories.js +68 -68
  239. package/src/stories/tooltip-response/README.md +14 -14
  240. package/src/stories/tooltip-response/md-link.json +31 -31
  241. package/src/stories/tooltip-response/md-tooltip.json +31 -31
  242. package/src/stories/tooltip-response/tooltip.stories.js +83 -83
  243. package/src/stories/utils/custom-lunatic.scss +23 -23
  244. package/src/stories/utils/options.js +25 -25
  245. package/src/stories/utils/orchestrator-split.js +119 -0
  246. package/src/stories/utils/orchestrator.js +14 -3
  247. package/src/tests/components/breadcrumb.spec.js +13 -13
  248. package/src/tests/components/button.spec.js +11 -11
  249. package/src/tests/components/checkbox-boolean.spec.js +45 -45
  250. package/src/tests/components/checkbox-group.spec.js +53 -53
  251. package/src/tests/components/checkbox-one.spec.js +32 -32
  252. package/src/tests/components/datepicker.spec.js +22 -22
  253. package/src/tests/components/declarations-wrappers/input-declarations-wrapper.spec.js +67 -67
  254. package/src/tests/components/declarations-wrappers/list-declarations-wrapper.spec.js +52 -52
  255. package/src/tests/components/declarations-wrappers/simple-declarations-wrapper.spec.js +21 -21
  256. package/src/tests/components/declarations.spec.js +46 -46
  257. package/src/tests/components/input-number.spec.js +188 -194
  258. package/src/tests/components/input.spec.js +18 -18
  259. package/src/tests/components/loops/loop-static.json +66 -66
  260. package/src/tests/components/loops/loop.json +258 -258
  261. package/src/tests/components/loops/loop.spec.js +30 -30
  262. package/src/tests/components/loops/roster-for-loop.spec.js +18 -18
  263. package/src/tests/components/missing-wrapper.spec.js +32 -33
  264. package/src/tests/components/progress-bar.spec.js +15 -15
  265. package/src/tests/components/radio.spec.js +27 -27
  266. package/src/tests/components/sequence.spec.js +9 -9
  267. package/src/tests/components/subsequence.spec.js +9 -9
  268. package/src/tests/components/table.spec.js +11 -11
  269. package/src/tests/components/textarea.spec.js +18 -18
  270. package/src/tests/components/tooltip.spec.js +25 -25
  271. package/src/tests/setup/setupTests.js +4 -4
  272. package/src/tests/utils/lib/alphabet.spec.js +36 -36
  273. package/src/tests/utils/lib/array.spec.js +22 -22
  274. package/src/tests/utils/lib/checkbox/group.spec.js +72 -72
  275. package/src/tests/utils/lib/decorator/title-decorator.spec.js +12 -12
  276. package/src/tests/utils/lib/input-number.spec.js +18 -18
  277. package/src/tests/utils/lib/items-positioning.spec.js +17 -17
  278. package/src/tests/utils/lib/label-position.spec.js +22 -22
  279. package/src/tests/utils/lib/loops/bindings.spec.js +75 -75
  280. package/src/tests/utils/lib/loops/shared.spec.js +82 -82
  281. package/src/tests/utils/lib/missing/missing.spec.js +74 -74
  282. package/src/tests/utils/lib/missing/mock.js +137 -137
  283. package/src/tests/utils/lib/pagination/shared.spec.js +42 -42
  284. package/src/tests/utils/lib/responses.spec.js +64 -64
  285. package/src/tests/utils/lib/style.spec.js +26 -26
  286. package/src/tests/utils/lib/tooltip/build-response.spec.js +95 -95
  287. package/src/tests/utils/lib/tooltip/content.spec.js +109 -109
  288. package/src/tests/utils/to-expose/handler/handler.spec.js +94 -94
  289. package/src/tests/utils/to-expose/handler/questionnaire.json +158 -158
  290. package/src/tests/utils/to-expose/handler/results/index.js +6 -6
  291. package/src/tests/utils/to-expose/handler/results/res-double.json +158 -158
  292. package/src/tests/utils/to-expose/handler/results/res-input-collected.json +158 -158
  293. package/src/tests/utils/to-expose/handler/results/res-input-edited.json +158 -158
  294. package/src/tests/utils/to-expose/handler/results/res-loop.json +158 -158
  295. package/src/tests/utils/to-expose/handler/results/res-matrix.json +158 -158
  296. package/src/tests/utils/to-expose/handler/results/res-responses.json +158 -158
  297. package/src/tests/utils/to-expose/init-questionnaire/data.json +12 -12
  298. package/src/tests/utils/to-expose/init-questionnaire/init-questionnaire.spec.js +19 -19
  299. package/src/tests/utils/to-expose/interpret/interpret.spec.js +48 -48
  300. package/src/tests/utils/to-expose/state/questionnaire.json +61 -61
  301. package/src/tests/utils/to-expose/state/results.js +78 -78
  302. package/src/tests/utils/to-expose/state/state.spec.js +59 -59
  303. package/src/utils/components/dragger/dragger.js +64 -64
  304. package/src/utils/components/dragger/index.js +1 -1
  305. package/src/utils/components/fab/fab.js +50 -50
  306. package/src/utils/components/fab/fab.scss +32 -32
  307. package/src/utils/components/fab/index.js +1 -1
  308. package/src/utils/components/field-wrapper.js +23 -23
  309. package/src/utils/components/is-network/index.js +1 -1
  310. package/src/utils/components/is-network/is-network.js +39 -39
  311. package/src/utils/components/is-network/use-online-status.js +51 -51
  312. package/src/utils/components/label-wrapper.js +45 -45
  313. package/src/utils/icons/closed.icon.js +24 -24
  314. package/src/utils/icons/cross.icon.js +24 -24
  315. package/src/utils/icons/load.icon.js +24 -24
  316. package/src/utils/icons/lunatic-icon.js +9 -9
  317. package/src/utils/icons/lunatic-icon.scss +4 -4
  318. package/src/utils/icons/network.icon.js +24 -24
  319. package/src/utils/icons/on-drag.icon.js +24 -24
  320. package/src/utils/icons/opened.icon.js +24 -24
  321. package/src/utils/idb-tools/clear-store.js +16 -16
  322. package/src/utils/idb-tools/get-entity.js +15 -15
  323. package/src/utils/idb-tools/get-idb.js +12 -12
  324. package/src/utils/lib/alphabet.js +1 -1
  325. package/src/utils/lib/array.js +7 -7
  326. package/src/utils/lib/checkbox/group.js +21 -21
  327. package/src/utils/lib/checkbox/index.js +1 -1
  328. package/src/utils/lib/controls/index.js +1 -0
  329. package/src/utils/lib/controls/utils.js +152 -0
  330. package/src/utils/lib/decorator/index.js +1 -1
  331. package/src/utils/lib/env.js +2 -2
  332. package/src/utils/lib/event.js +15 -15
  333. package/src/utils/lib/function.js +1 -1
  334. package/src/utils/lib/index.js +21 -19
  335. package/src/utils/lib/input-number.js +6 -6
  336. package/src/utils/lib/label-position.js +12 -12
  337. package/src/utils/lib/loops/bindings.js +66 -66
  338. package/src/utils/lib/loops/build-components.js +33 -33
  339. package/src/utils/lib/loops/index.js +3 -3
  340. package/src/utils/lib/loops/shared.js +55 -55
  341. package/src/utils/lib/memo-check.js +24 -24
  342. package/src/utils/lib/missing.js +52 -52
  343. package/src/utils/lib/pagination/flow.js +2 -2
  344. package/src/utils/lib/pagination/index.js +2 -2
  345. package/src/utils/lib/pagination/navigation/index.js +1 -1
  346. package/src/utils/lib/pagination/navigation/shared.js +12 -9
  347. package/src/utils/lib/prop-types/declarations.js +22 -22
  348. package/src/utils/lib/prop-types/index.js +5 -5
  349. package/src/utils/lib/prop-types/options.js +8 -8
  350. package/src/utils/lib/prop-types/response.js +6 -6
  351. package/src/utils/lib/prop-types/value-type.js +9 -9
  352. package/src/utils/lib/responses.js +9 -7
  353. package/src/utils/lib/splitting.js +142 -0
  354. package/src/utils/lib/table/index.js +1 -1
  355. package/src/utils/lib/table/roster.js +23 -23
  356. package/src/utils/lib/tooltip/build-response.js +41 -41
  357. package/src/utils/lib/tooltip/content.js +55 -55
  358. package/src/utils/lib/tooltip/index.js +6 -6
  359. package/src/utils/store-tools/auto-load.js +2 -1
  360. package/src/utils/store-tools/clear-store-data.js +8 -8
  361. package/src/utils/store-tools/clear-store-info.js +8 -8
  362. package/src/utils/store-tools/constantes.js +20 -20
  363. package/src/utils/store-tools/create/create.js +19 -19
  364. package/src/utils/store-tools/create/index.js +1 -1
  365. package/src/utils/store-tools/create/update-store-info.js +26 -26
  366. package/src/utils/store-tools/get-store-count.js +22 -22
  367. package/src/utils/store-tools/index.js +5 -5
  368. package/src/utils/store-tools/open-or-create-store.js +47 -47
  369. package/src/utils/store-tools/use-store-index.js +24 -24
  370. package/src/utils/suggester-workers/append-to-index/create-append-task.js +3 -1
  371. package/src/utils/suggester-workers/commons-tokenizer/create-entity-tokenizer.js +56 -0
  372. package/src/utils/suggester-workers/commons-tokenizer/create-fields-tokenizer.js +56 -0
  373. package/src/utils/suggester-workers/commons-tokenizer/create-filter-stop-words.js +11 -11
  374. package/src/utils/suggester-workers/commons-tokenizer/filters/compose-filters.js +10 -0
  375. package/src/utils/suggester-workers/commons-tokenizer/filters/create-filter-stop-words.js +17 -0
  376. package/src/utils/suggester-workers/commons-tokenizer/filters/create-filter-stop-words.spec.js +14 -0
  377. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-accents.js +12 -0
  378. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-accents.spec.js +12 -0
  379. package/src/utils/suggester-workers/commons-tokenizer/{filter-double.js → filters/filter-double.js} +0 -0
  380. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-double.spec.js +20 -0
  381. package/src/utils/suggester-workers/commons-tokenizer/{filter-length.js → filters/filter-length.js} +0 -0
  382. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-length.spec.js +18 -0
  383. package/src/utils/suggester-workers/commons-tokenizer/{filter-stemmer.js → filters/filter-stemmer.js} +2 -2
  384. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-stemmer.spec.js +12 -0
  385. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.js +36 -0
  386. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.spec.js +12 -0
  387. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.js +10 -0
  388. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.spec.js +12 -0
  389. package/src/utils/suggester-workers/commons-tokenizer/filters/index.js +2 -0
  390. package/src/utils/suggester-workers/commons-tokenizer/{stop-words.js → filters/stop-words.js} +0 -0
  391. package/src/utils/suggester-workers/commons-tokenizer/index.js +6 -5
  392. package/src/utils/suggester-workers/commons-tokenizer/prepare-string-indexation.js +7 -3
  393. package/src/utils/suggester-workers/commons-tokenizer/soft-tokenizer.js +1 -1
  394. package/src/utils/suggester-workers/create-worker.js +56 -0
  395. package/src/utils/suggester-workers/find-best-label/tokenize.js +2 -5
  396. package/src/utils/suggester-workers/{query-parser → searching/query-parser}/index.js +0 -0
  397. package/src/utils/suggester-workers/searching/query-parser/query-parser-soft.js +7 -0
  398. package/src/utils/suggester-workers/{query-parser → searching/query-parser}/query-parser-soft.spec.js +0 -0
  399. package/src/utils/suggester-workers/searching/query-parser/query-parser-tokenized.js +34 -0
  400. package/src/utils/suggester-workers/searching/resolve-query-parser.js +2 -2
  401. package/src/utils/suggester-workers/searching/searching.js +2 -2
  402. package/src/utils/to-expose/handler.js +68 -31
  403. package/src/utils/to-expose/hooks/filter-components.js +121 -106
  404. package/src/utils/to-expose/hooks/index.js +2 -1
  405. package/src/utils/to-expose/hooks/lunatic-split.js +428 -0
  406. package/src/utils/to-expose/hooks/lunatic.js +107 -11
  407. package/src/utils/to-expose/hooks/use-document-add-event-listener.js +63 -63
  408. package/src/utils/to-expose/index.js +11 -11
  409. package/src/utils/to-expose/interpret/index.js +1 -1
  410. package/src/utils/to-expose/interpret/main.js +16 -16
  411. package/src/utils/to-expose/interpret/md.js +65 -65
  412. package/src/utils/to-expose/state.js +23 -15
  413. package/src/components/missing-wrapper/component.js +0 -120
  414. package/src/components/missing-wrapper/wrapper.js +0 -10
  415. package/src/tests/utils/to-expose/hooks/use-lunatic.spec.js +0 -46
  416. package/src/utils/suggester-workers/commons-tokenizer/create-tokenizer.js +0 -103
  417. package/src/utils/suggester-workers/commons-tokenizer/filter-accents-to-lower.js +0 -9
  418. package/src/utils/suggester-workers/commons-tokenizer/filter-synonyms.js +0 -10
  419. package/src/utils/suggester-workers/query-parser/query-parser-soft.js +0 -7
  420. package/src/utils/suggester-workers/query-parser/query-parser-tokenized.js +0 -31
  421. package/src/utils/suggester-workers/query-parser/query-parser-tokenized.spec.js +0 -32
@@ -1,5 +1,5 @@
1
- export * from './component-types';
2
- export * from './declarations';
3
- export * from './value-types';
4
- export * from './variable-types';
5
- export * from './event-types';
1
+ export * from './component-types';
2
+ export * from './declarations';
3
+ export * from './value-types';
4
+ export * from './variable-types';
5
+ export * from './event-types';
@@ -1,10 +1,10 @@
1
- import * as C from './value-types';
2
-
3
- // ORDERED ARRAY
4
- export const supportedPreferences = [
5
- C.PREVIOUS,
6
- C.COLLECTED,
7
- C.FORCED,
8
- C.EDITED,
9
- C.INPUTED,
10
- ];
1
+ import * as C from './value-types';
2
+
3
+ // ORDERED ARRAY
4
+ export const supportedPreferences = [
5
+ C.PREVIOUS,
6
+ C.COLLECTED,
7
+ C.FORCED,
8
+ C.EDITED,
9
+ C.INPUTED,
10
+ ];
@@ -1,5 +1,5 @@
1
- export const PREVIOUS = 'PREVIOUS';
2
- export const COLLECTED = 'COLLECTED';
3
- export const FORCED = 'FORCED';
4
- export const EDITED = 'EDITED';
5
- export const INPUTED = 'INPUTED';
1
+ export const PREVIOUS = 'PREVIOUS';
2
+ export const COLLECTED = 'COLLECTED';
3
+ export const FORCED = 'FORCED';
4
+ export const EDITED = 'EDITED';
5
+ export const INPUTED = 'INPUTED';
@@ -1,4 +1,4 @@
1
- export const EXTERNAL = 'EXTERNAL';
2
- export const CALCULATED = 'CALCULATED';
3
- // Already define in value-types
4
- //export const COLLECTED = 'COLLECTED';
1
+ export const EXTERNAL = 'EXTERNAL';
2
+ export const CALCULATED = 'CALCULATED';
3
+ // Already define in value-types
4
+ //export const COLLECTED = 'COLLECTED';
@@ -1,14 +1,14 @@
1
- # Breadcrumb component
2
-
3
- ## Props
4
-
5
- | Props | Type | Default value | Required | Description |
6
- | :---------: | :----: | :-----------: | :------: | -------------------------- |
7
- | elements \* | array | [ ] | | Elements of the breadcrumb |
8
- | style | object | { } | | Style of the breadcrumb |
9
-
10
- - `elements` props has to be an array composed of ordered strings
11
-
12
- ## Styles
13
-
14
- **Breadcrumb** component has for class `breadcrumb-lunatic`.
1
+ # Breadcrumb component
2
+
3
+ ## Props
4
+
5
+ | Props | Type | Default value | Required | Description |
6
+ | :---------: | :----: | :-----------: | :------: | -------------------------- |
7
+ | elements \* | array | [ ] | | Elements of the breadcrumb |
8
+ | style | object | { } | | Style of the breadcrumb |
9
+
10
+ - `elements` props has to be an array composed of ordered strings
11
+
12
+ ## Styles
13
+
14
+ **Breadcrumb** component has for class `breadcrumb-lunatic`.
@@ -1,14 +1,14 @@
1
- # Button component
2
-
3
- ## Props
4
-
5
- | Props | Type | Default value | Required | Description |
6
- | :------: | :------: | :-----------: | :------: | ----------------------------- |
7
- | label | string | "button" | | Aria label |
8
- | value | string | - | ✓ | Label of the button |
9
- | onClick | function | - | ✓ | Callback |
10
- | disabled | boolean | false | | Boolean to disable the button |
11
-
12
- ## Styles
13
-
14
- **Button** component has for class `button-lunatic`.
1
+ # Button component
2
+
3
+ ## Props
4
+
5
+ | Props | Type | Default value | Required | Description |
6
+ | :------: | :------: | :-----------: | :------: | ----------------------------- |
7
+ | label | string | "button" | | Aria label |
8
+ | value | string | - | ✓ | Label of the button |
9
+ | onClick | function | - | ✓ | Callback |
10
+ | disabled | boolean | false | | Boolean to disable the button |
11
+
12
+ ## Styles
13
+
14
+ **Button** component has for class `button-lunatic`.
@@ -1,27 +1,27 @@
1
- import React from 'react';
2
- import { storiesOf } from '@storybook/react';
3
- import { withReadme } from 'storybook-readme';
4
- import { Button } from 'components';
5
- import readme from './README.md';
6
- import { titleDecorator } from 'utils/lib';
7
- import { text, boolean } from '@storybook/addon-knobs/react';
8
-
9
- const stories = storiesOf('Button', module)
10
- .addDecorator(withReadme(readme))
11
- .addDecorator((Component) => {
12
- const WrappedComponent = titleDecorator(Component);
13
- return <WrappedComponent title="<Button />" />;
14
- });
15
-
16
- stories.addWithJSX('Default', () => (
17
- <Button label="button-default" value="Click me !" onClick={console.log} />
18
- ));
19
-
20
- stories.addWithJSX('Props', () => (
21
- <Button
22
- label="disabled-button"
23
- value={text('Value', 'Click me !')}
24
- onClick={console.log}
25
- disabled={boolean('Disabled', false)}
26
- />
27
- ));
1
+ import React from 'react';
2
+ import { storiesOf } from '@storybook/react';
3
+ import { withReadme } from 'storybook-readme';
4
+ import { Button } from 'components';
5
+ import readme from './README.md';
6
+ import { titleDecorator } from 'utils/lib';
7
+ import { text, boolean } from '@storybook/addon-knobs/react';
8
+
9
+ const stories = storiesOf('Button', module)
10
+ .addDecorator(withReadme(readme))
11
+ .addDecorator((Component) => {
12
+ const WrappedComponent = titleDecorator(Component);
13
+ return <WrappedComponent title="<Button />" />;
14
+ });
15
+
16
+ stories.addWithJSX('Default', () => (
17
+ <Button label="button-default" value="Click me !" onClick={console.log} />
18
+ ));
19
+
20
+ stories.addWithJSX('Props', () => (
21
+ <Button
22
+ label="disabled-button"
23
+ value={text('Value', 'Click me !')}
24
+ onClick={console.log}
25
+ disabled={boolean('Disabled', false)}
26
+ />
27
+ ));
@@ -1,27 +1,27 @@
1
- # CheckboxBoolean component
2
-
3
- ## Props
4
-
5
- | Props | Type | Default value | Required | Description |
6
- | :-------------: | :----: | :-----------: | :------: | --------------------------------------- |
7
- | id | string | - | ✓ | Id of the checkbox |
8
- | label | string | "" | | Fieldset label of the checkbox |
9
- | preferences \* | array | ["COLLECTED"] | | Preferences to manage checkbox response |
10
- | response \* | object | { } | | Response concerned by the component |
11
- | handleChange | func | - | ✓ | Handler of the checkbox |
12
- | disabled | bool | false | | Is the checkbox item disabled |
13
- | positioning \* | string | "DEFAULT" | | Checkbox item positioning |
14
- | focused | bool | false | | Is the checkbox item focused |
15
- | declarations \* | array | [ ] | | Declarations of the checkbox |
16
- | features | array | [ ] | | Component features for labels |
17
- | bindings | object | [ ] | | Questionnaire bindings |
18
- | management | bool | false | | Management mode of the checkbox |
19
- | style | object | { } | | Style of the checkbox |
20
-
21
- - `preferences` props has to be an ordered array of `COLLECTED`, `FORCED` or `EDITED`
22
- - `response` props has to be a shape of `{name: string, values: object}`
23
- - `declarations` are documented in the `Declarations` component
24
-
25
- ## Styles
26
-
27
- **CheckboxBoolean** component has for classes `checkbox-lunatic` and `checkbox-boolean-modality`.
1
+ # CheckboxBoolean component
2
+
3
+ ## Props
4
+
5
+ | Props | Type | Default value | Required | Description |
6
+ | :-------------: | :----: | :-----------: | :------: | --------------------------------------- |
7
+ | id | string | - | ✓ | Id of the checkbox |
8
+ | label | string | "" | | Fieldset label of the checkbox |
9
+ | preferences \* | array | ["COLLECTED"] | | Preferences to manage checkbox response |
10
+ | response \* | object | { } | | Response concerned by the component |
11
+ | handleChange | func | - | ✓ | Handler of the checkbox |
12
+ | disabled | bool | false | | Is the checkbox item disabled |
13
+ | positioning \* | string | "DEFAULT" | | Checkbox item positioning |
14
+ | focused | bool | false | | Is the checkbox item focused |
15
+ | declarations \* | array | [ ] | | Declarations of the checkbox |
16
+ | features | array | [ ] | | Component features for labels |
17
+ | bindings | object | [ ] | | Questionnaire bindings |
18
+ | management | bool | false | | Management mode of the checkbox |
19
+ | style | object | { } | | Style of the checkbox |
20
+
21
+ - `preferences` props has to be an ordered array of `COLLECTED`, `FORCED` or `EDITED`
22
+ - `response` props has to be a shape of `{name: string, values: object}`
23
+ - `declarations` are documented in the `Declarations` component
24
+
25
+ ## Styles
26
+
27
+ **CheckboxBoolean** component has for classes `checkbox-lunatic` and `checkbox-boolean-modality`.
@@ -1,54 +1,54 @@
1
- import React, { useState } from 'react';
2
- import { storiesOf } from '@storybook/react';
3
- import { withReadme } from 'storybook-readme';
4
- import Orchestrator from '../utils/orchestrator';
5
- import readme from './README.md';
6
- import { titleDecorator } from 'utils/lib';
7
- import data from './data';
8
- import dataForced from './data-forced';
9
- import { boolean, select, object } from '@storybook/addon-knobs/react';
10
- import { positioningOptions, featuresOptions } from '../utils/options';
11
-
12
- const stories = storiesOf('CheckboxBoolean', module)
13
- .addDecorator(withReadme(readme))
14
- .addDecorator((Component) => {
15
- const WrappedComponent = titleDecorator(Component);
16
- return <WrappedComponent title="<CheckboxBoolean />" />;
17
- });
18
-
19
- stories.addWithJSX('Default', () => <Orchestrator source={data} />);
20
-
21
- stories.addWithJSX('Props', () => (
22
- <Orchestrator
23
- source={data}
24
- positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
25
- features={select('Features', featuresOptions, ['VTL', 'MD'])}
26
- missing={boolean('Missing', false)}
27
- bindings={object('Bindings', { test: 'test' })}
28
- disabled={boolean('Disabled', false)}
29
- focused={boolean('Focused', false)}
30
- management={boolean('Management', false)}
31
- />
32
- ));
33
-
34
- stories.addWithJSX('External update', () => {
35
- const Fake = () => {
36
- const [up, setUp] = useState(false);
37
- return (
38
- <>
39
- <button
40
- type="button"
41
- onClick={() => {
42
- setUp(true);
43
- }}
44
- disabled={up}
45
- >
46
- Force external update
47
- </button>
48
-
49
- <Orchestrator id="default" source={up ? dataForced : data} />
50
- </>
51
- );
52
- };
53
- return <Fake />;
54
- });
1
+ import React, { useState } from 'react';
2
+ import { storiesOf } from '@storybook/react';
3
+ import { withReadme } from 'storybook-readme';
4
+ import Orchestrator from '../utils/orchestrator';
5
+ import readme from './README.md';
6
+ import { titleDecorator } from 'utils/lib';
7
+ import data from './data';
8
+ import dataForced from './data-forced';
9
+ import { boolean, select, object } from '@storybook/addon-knobs/react';
10
+ import { positioningOptions, featuresOptions } from '../utils/options';
11
+
12
+ const stories = storiesOf('CheckboxBoolean', module)
13
+ .addDecorator(withReadme(readme))
14
+ .addDecorator((Component) => {
15
+ const WrappedComponent = titleDecorator(Component);
16
+ return <WrappedComponent title="<CheckboxBoolean />" />;
17
+ });
18
+
19
+ stories.addWithJSX('Default', () => <Orchestrator source={data} />);
20
+
21
+ stories.addWithJSX('Props', () => (
22
+ <Orchestrator
23
+ source={data}
24
+ positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
25
+ features={select('Features', featuresOptions, ['VTL', 'MD'])}
26
+ missing={boolean('Missing', false)}
27
+ bindings={object('Bindings', { test: 'test' })}
28
+ disabled={boolean('Disabled', false)}
29
+ focused={boolean('Focused', false)}
30
+ management={boolean('Management', false)}
31
+ />
32
+ ));
33
+
34
+ stories.addWithJSX('External update', () => {
35
+ const Fake = () => {
36
+ const [up, setUp] = useState(false);
37
+ return (
38
+ <>
39
+ <button
40
+ type="button"
41
+ onClick={() => {
42
+ setUp(true);
43
+ }}
44
+ disabled={up}
45
+ >
46
+ Force external update
47
+ </button>
48
+
49
+ <Orchestrator id="default" source={up ? dataForced : data} />
50
+ </>
51
+ );
52
+ };
53
+ return <Fake />;
54
+ });
@@ -1,48 +1,48 @@
1
- {
2
- "components": [
3
- {
4
- "id": "1",
5
- "componentType": "CheckboxBoolean",
6
- "mandatory": false,
7
- "label": "➡ 1. Are you ready?",
8
- "response": {
9
- "name": "READY"
10
- }
11
- },
12
- {
13
- "id": "2",
14
- "componentType": "CheckboxBoolean",
15
- "mandatory": false,
16
- "label": "➡ 2. Are you always ready?",
17
- "response": {
18
- "name": "READY2"
19
- }
20
- }
21
- ],
22
- "variables": [
23
- {
24
- "variableType": "COLLECTED",
25
- "name": "READY",
26
- "componentRef": "1",
27
- "values": {
28
- "PREVIOUS": null,
29
- "COLLECTED": true,
30
- "FORCED": null,
31
- "EDITED": null,
32
- "INPUTED": null
33
- }
34
- },
35
- {
36
- "variableType": "COLLECTED",
37
- "name": "READY2",
38
- "componentRef": "2",
39
- "values": {
40
- "PREVIOUS": null,
41
- "COLLECTED": true,
42
- "FORCED": null,
43
- "EDITED": null,
44
- "INPUTED": null
45
- }
46
- }
47
- ]
48
- }
1
+ {
2
+ "components": [
3
+ {
4
+ "id": "1",
5
+ "componentType": "CheckboxBoolean",
6
+ "mandatory": false,
7
+ "label": "➡ 1. Are you ready?",
8
+ "response": {
9
+ "name": "READY"
10
+ }
11
+ },
12
+ {
13
+ "id": "2",
14
+ "componentType": "CheckboxBoolean",
15
+ "mandatory": false,
16
+ "label": "➡ 2. Are you always ready?",
17
+ "response": {
18
+ "name": "READY2"
19
+ }
20
+ }
21
+ ],
22
+ "variables": [
23
+ {
24
+ "variableType": "COLLECTED",
25
+ "name": "READY",
26
+ "componentRef": "1",
27
+ "values": {
28
+ "PREVIOUS": null,
29
+ "COLLECTED": true,
30
+ "FORCED": null,
31
+ "EDITED": null,
32
+ "INPUTED": null
33
+ }
34
+ },
35
+ {
36
+ "variableType": "COLLECTED",
37
+ "name": "READY2",
38
+ "componentRef": "2",
39
+ "values": {
40
+ "PREVIOUS": null,
41
+ "COLLECTED": true,
42
+ "FORCED": null,
43
+ "EDITED": null,
44
+ "INPUTED": null
45
+ }
46
+ }
47
+ ]
48
+ }
@@ -1,29 +1,29 @@
1
- # CheckboxGroup component
2
-
3
- ## Props
4
-
5
- | Props | Type | Default value | Required | Description |
6
- | :-------------: | :----: | :--------------------------------------: | :------: | --------------------------------------- |
7
- | id | string | - | ✓ | Id of the checkbox |
8
- | label | string | "" | | Fieldset label of the checkbox |
9
- | preferences \* | array | ["COLLECTED"] | | Preferences to manage checkbox response |
10
- | responses \* | object | [] | | Responses concerned by the component |
11
- | handleChange | func | - | ✓ | Handler of the checkbox |
12
- | disabled | bool | false | | Is the checkbox responses disabled |
13
- | focused | bool | false | | Is the checkbox responses focused |
14
- | positioning \* | string | "DEFAULT" | | CheckboxGroup responses positioning |
15
- | declarations \* | array | [] | | Declarations of the checkbox |
16
- | features | array | [ ] | | Component features for labels |
17
- | bindings | object | [ ] | | Questionnaire bindings |
18
- | management | bool | false | | Management mode of the input |
19
- | style \* | object | { fieldsetStyle: {}, modalityStyle: {} } | | Style of the checkbox |
20
-
21
- - `preferences` props has to be an ordered array of `COLLECTED`, `FORCED` or `EDITED`
22
- - `responses` props has to be an array of shape of `{id: string, label: string, response: {name: string, values: object}}`
23
- - `positioning` props has to be one of `DEFAULT`, `HORIZONTAL` or `VERTICAL`
24
- - `declarations` are documented in the `Declarations` component
25
- - `style` props has to be composed of `fieldsetStyle` and `modalityStyle`
26
-
27
- ## Styles
28
-
29
- **CheckboxGroup** component has for classes `checkbox-group-list`, `checkbox-modality` and `checkbox-lunatic`.
1
+ # CheckboxGroup component
2
+
3
+ ## Props
4
+
5
+ | Props | Type | Default value | Required | Description |
6
+ | :-------------: | :----: | :--------------------------------------: | :------: | --------------------------------------- |
7
+ | id | string | - | ✓ | Id of the checkbox |
8
+ | label | string | "" | | Fieldset label of the checkbox |
9
+ | preferences \* | array | ["COLLECTED"] | | Preferences to manage checkbox response |
10
+ | responses \* | object | [] | | Responses concerned by the component |
11
+ | handleChange | func | - | ✓ | Handler of the checkbox |
12
+ | disabled | bool | false | | Is the checkbox responses disabled |
13
+ | focused | bool | false | | Is the checkbox responses focused |
14
+ | positioning \* | string | "DEFAULT" | | CheckboxGroup responses positioning |
15
+ | declarations \* | array | [] | | Declarations of the checkbox |
16
+ | features | array | [ ] | | Component features for labels |
17
+ | bindings | object | [ ] | | Questionnaire bindings |
18
+ | management | bool | false | | Management mode of the input |
19
+ | style \* | object | { fieldsetStyle: {}, modalityStyle: {} } | | Style of the checkbox |
20
+
21
+ - `preferences` props has to be an ordered array of `COLLECTED`, `FORCED` or `EDITED`
22
+ - `responses` props has to be an array of shape of `{id: string, label: string, response: {name: string, values: object}}`
23
+ - `positioning` props has to be one of `DEFAULT`, `HORIZONTAL` or `VERTICAL`
24
+ - `declarations` are documented in the `Declarations` component
25
+ - `style` props has to be composed of `fieldsetStyle` and `modalityStyle`
26
+
27
+ ## Styles
28
+
29
+ **CheckboxGroup** component has for classes `checkbox-group-list`, `checkbox-modality` and `checkbox-lunatic`.
@@ -1,60 +1,60 @@
1
- import React, { useState } from 'react';
2
- import { storiesOf } from '@storybook/react';
3
- import { withReadme } from 'storybook-readme';
4
- import Orchestrator from '../utils/orchestrator';
5
- import readme from './README.md';
6
- import { titleDecorator } from 'utils/lib';
7
- import data from './data';
8
- import dataVTL from './data-vtl';
9
- import dataForced from './data-forced';
10
- import { positioningOptions, featuresOptions } from '../utils/options';
11
- import { text, boolean, object, select } from '@storybook/addon-knobs/react';
12
-
13
- const stories = storiesOf('CheckboxGroup', module)
14
- .addDecorator(withReadme(readme))
15
- .addDecorator((Component) => {
16
- const WrappedComponent = titleDecorator(Component);
17
- return <WrappedComponent title="<CheckboxGroup />" />;
18
- });
19
-
20
- stories.addWithJSX('Default', () => (
21
- <Orchestrator id="default" source={data} />
22
- ));
23
-
24
- stories.addWithJSX('Props', () => (
25
- <Orchestrator
26
- id="props"
27
- source={dataVTL}
28
- label={text('Label', '"I\'m the label of the checkbox group"')}
29
- missing={boolean('Missing', false)}
30
- shortcut={boolean('Shortcut', false)}
31
- positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
32
- features={select('Features', featuresOptions, ['VTL', 'MD'])}
33
- bindings={object('Bindings', { NAME: 'Mojo' })}
34
- disabled={boolean('Disabled', false)}
35
- focused={boolean('Focused', false)}
36
- management={boolean('Management', false)}
37
- />
38
- ));
39
-
40
- stories.addWithJSX('External update', () => {
41
- const Fake = () => {
42
- const [up, setUp] = useState(false);
43
- return (
44
- <>
45
- <button
46
- type="button"
47
- onClick={() => {
48
- setUp(true);
49
- }}
50
- disabled={up}
51
- >
52
- Force external update
53
- </button>
54
-
55
- <Orchestrator id="default" source={up ? dataForced : dataVTL} />
56
- </>
57
- );
58
- };
59
- return <Fake />;
60
- });
1
+ import React, { useState } from 'react';
2
+ import { storiesOf } from '@storybook/react';
3
+ import { withReadme } from 'storybook-readme';
4
+ import Orchestrator from '../utils/orchestrator';
5
+ import readme from './README.md';
6
+ import { titleDecorator } from 'utils/lib';
7
+ import data from './data';
8
+ import dataVTL from './data-vtl';
9
+ import dataForced from './data-forced';
10
+ import { positioningOptions, featuresOptions } from '../utils/options';
11
+ import { text, boolean, object, select } from '@storybook/addon-knobs/react';
12
+
13
+ const stories = storiesOf('CheckboxGroup', module)
14
+ .addDecorator(withReadme(readme))
15
+ .addDecorator((Component) => {
16
+ const WrappedComponent = titleDecorator(Component);
17
+ return <WrappedComponent title="<CheckboxGroup />" />;
18
+ });
19
+
20
+ stories.addWithJSX('Default', () => (
21
+ <Orchestrator id="default" source={data} />
22
+ ));
23
+
24
+ stories.addWithJSX('Props', () => (
25
+ <Orchestrator
26
+ id="props"
27
+ source={dataVTL}
28
+ label={text('Label', '"I\'m the label of the checkbox group"')}
29
+ missing={boolean('Missing', false)}
30
+ shortcut={boolean('Shortcut', false)}
31
+ positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
32
+ features={select('Features', featuresOptions, ['VTL', 'MD'])}
33
+ bindings={object('Bindings', { NAME: 'Mojo' })}
34
+ disabled={boolean('Disabled', false)}
35
+ focused={boolean('Focused', false)}
36
+ management={boolean('Management', false)}
37
+ />
38
+ ));
39
+
40
+ stories.addWithJSX('External update', () => {
41
+ const Fake = () => {
42
+ const [up, setUp] = useState(false);
43
+ return (
44
+ <>
45
+ <button
46
+ type="button"
47
+ onClick={() => {
48
+ setUp(true);
49
+ }}
50
+ disabled={up}
51
+ >
52
+ Force external update
53
+ </button>
54
+
55
+ <Orchestrator id="default" source={up ? dataForced : dataVTL} />
56
+ </>
57
+ );
58
+ };
59
+ return <Fake />;
60
+ });