@inseefr/lunatic 0.1.7 → 0.1.8-experimental

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 (427) hide show
  1. package/README.md +15 -2
  2. package/lib/index.js +2818 -596
  3. package/lib/index.js.map +1 -1
  4. package/package.json +87 -52
  5. package/src/components/breadcrumb/breadcrumb.scss +20 -0
  6. package/src/components/breadcrumb/component.js +29 -0
  7. package/src/components/breadcrumb/index.js +1 -0
  8. package/src/components/button/button.scss +11 -10
  9. package/src/components/button/component.js +43 -16
  10. package/src/components/checkbox/boolean.js +158 -45
  11. package/src/components/checkbox/checkbox.scss +55 -20
  12. package/src/components/checkbox/group.js +231 -0
  13. package/src/components/checkbox/index.js +1 -0
  14. package/src/components/checkbox/one.js +8 -90
  15. package/src/components/components.js +18 -0
  16. package/src/components/datepicker/component.js +11 -0
  17. package/src/components/datepicker/datepicker.scss +1 -0
  18. package/src/components/datepicker/index.js +1 -0
  19. package/src/components/declarations/component.js +45 -0
  20. package/src/components/declarations/declarations.scss +38 -0
  21. package/src/components/declarations/index.js +1 -0
  22. package/src/components/declarations/wrappers/index.js +3 -0
  23. package/src/components/declarations/wrappers/input-declarations-wrapper.js +269 -0
  24. package/src/components/declarations/wrappers/list-declarations-wrapper.js +232 -0
  25. package/src/components/declarations/wrappers/simple-declarations-wrapper.js +54 -0
  26. package/src/components/dropdown/commons/actions.js +56 -0
  27. package/src/components/dropdown/commons/children-to-option.js +9 -0
  28. package/src/components/dropdown/commons/cleaner-callbacks.js +58 -0
  29. package/src/components/dropdown/commons/components/dropdown-container.js +29 -0
  30. package/src/components/dropdown/commons/components/dropdown-field.js +46 -0
  31. package/src/components/dropdown/commons/components/dropdown.js +183 -0
  32. package/src/components/dropdown/commons/components/label.js +28 -0
  33. package/src/components/dropdown/commons/components/panel.js +78 -0
  34. package/src/components/dropdown/commons/event-callbacks/index.js +5 -0
  35. package/src/components/dropdown/commons/event-callbacks/on-keydown-callback.js +29 -0
  36. package/src/components/dropdown/commons/event-callbacks/on-mousedown-callback.js +11 -0
  37. package/src/components/dropdown/commons/reducer.js +149 -0
  38. package/src/components/dropdown/commons/tools/index.js +17 -0
  39. package/src/components/dropdown/component.js +128 -0
  40. package/src/components/dropdown/dropdown-edit/dropdown-edit.js +190 -0
  41. package/src/components/dropdown/dropdown-edit/icone.js +33 -0
  42. package/src/components/dropdown/dropdown-edit/index.js +11 -0
  43. package/src/components/dropdown/dropdown-edit/option.js +62 -0
  44. package/src/components/dropdown/dropdown-edit/prefix-tools.js +51 -0
  45. package/src/components/dropdown/dropdown-simple/dropdown.js +162 -0
  46. package/src/components/dropdown/dropdown-simple/index.js +20 -0
  47. package/src/components/dropdown/dropdown-simple/option.js +15 -0
  48. package/src/components/dropdown/dropdown.scss +176 -0
  49. package/src/components/dropdown/index.js +1 -0
  50. package/src/components/filter-description/component.js +42 -0
  51. package/src/components/filter-description/index.js +1 -0
  52. package/src/components/icon/assets/checkbox-checked.js +16 -0
  53. package/src/components/icon/assets/checkbox-unchecked.js +16 -0
  54. package/src/components/icon/assets/index.js +4 -0
  55. package/src/components/icon/assets/radio-checked.js +16 -0
  56. package/src/components/icon/assets/radio-unchecked.js +16 -0
  57. package/src/components/icon/component.js +33 -0
  58. package/src/components/icon/icon.scss +13 -0
  59. package/src/components/icon/index.js +1 -0
  60. package/src/components/index.js +3 -5
  61. package/src/components/index.scss +134 -12
  62. package/src/components/input/index.js +1 -0
  63. package/src/components/input/input-number.js +41 -106
  64. package/src/components/input/input.js +11 -0
  65. package/src/components/input/input.scss +30 -24
  66. package/src/components/loop/component.js +258 -0
  67. package/src/components/loop/index.js +1 -0
  68. package/src/components/loop/loop.scss +11 -0
  69. package/src/components/loop/wrapper.js +15 -0
  70. package/src/components/loop-constructor/block/block.scss +8 -0
  71. package/src/components/loop-constructor/block/component.js +9 -0
  72. package/src/components/loop-constructor/block/index.js +1 -0
  73. package/src/components/loop-constructor/index.js +1 -0
  74. package/src/components/loop-constructor/roster/component.js +8 -0
  75. package/src/components/loop-constructor/roster/index.js +1 -0
  76. package/src/components/loop-constructor/wrapper/body-component.js +122 -0
  77. package/src/components/loop-constructor/wrapper/build-components.js +33 -0
  78. package/src/components/loop-constructor/wrapper/component.js +189 -0
  79. package/src/components/loop-constructor/wrapper/index.js +1 -0
  80. package/src/components/missing-wrapper/component.js +119 -0
  81. package/src/components/missing-wrapper/index.js +1 -0
  82. package/src/components/missing-wrapper/missing.scss +30 -0
  83. package/src/components/missing-wrapper/wrapper.js +10 -0
  84. package/src/components/progress-bar/component.js +28 -0
  85. package/src/components/progress-bar/index.js +1 -0
  86. package/src/components/progress-bar/progress-bar.scss +52 -0
  87. package/src/components/radio/component.js +9 -0
  88. package/src/components/radio/index.js +1 -0
  89. package/src/components/radio/radio.scss +57 -0
  90. package/src/components/sequence/component.js +36 -13
  91. package/src/components/sequence/sequence.scss +6 -13
  92. package/src/components/subsequence/component.js +36 -14
  93. package/src/components/suggester/check-store.js +70 -0
  94. package/src/components/suggester/commons-tools/binded-keys.js +11 -0
  95. package/src/components/suggester/commons-tools/index.js +1 -0
  96. package/src/components/suggester/components/create-on-keydown-callback.js +28 -0
  97. package/src/components/suggester/components/index.js +2 -0
  98. package/src/components/suggester/components/panel/default-option-renderer.js +19 -0
  99. package/src/components/suggester/components/panel/index.js +2 -0
  100. package/src/components/suggester/components/panel/option-container.js +63 -0
  101. package/src/components/suggester/components/panel/panel-container.js +21 -0
  102. package/src/components/suggester/components/panel/panel.js +33 -0
  103. package/src/components/suggester/components/selection/default-label-renderer.js +31 -0
  104. package/src/components/suggester/components/selection/delete.js +38 -0
  105. package/src/components/suggester/components/selection/index.js +1 -0
  106. package/src/components/suggester/components/selection/label.js +31 -0
  107. package/src/components/suggester/components/selection/selection.js +50 -0
  108. package/src/components/suggester/components/suggester-content.js +42 -0
  109. package/src/components/suggester/components/suggester.js +87 -0
  110. package/src/components/suggester/components/suggester.scss +100 -0
  111. package/src/components/suggester/default-style.scss +122 -0
  112. package/src/components/suggester/idb-suggester.js +74 -0
  113. package/src/components/suggester/index.js +1 -0
  114. package/src/components/suggester/lunatic-suggester.js +148 -0
  115. package/src/components/suggester/searching/index.js +1 -0
  116. package/src/components/suggester/searching/searching.js +39 -0
  117. package/src/components/suggester/state-management/actions.js +35 -0
  118. package/src/components/suggester/state-management/index.js +6 -0
  119. package/src/components/suggester/state-management/intial-state.js +13 -0
  120. package/src/components/suggester/state-management/reducer/index.js +1 -0
  121. package/src/components/suggester/state-management/reducer/reduce-on-blur.js +5 -0
  122. package/src/components/suggester/state-management/reducer/reduce-on-change-search.js +8 -0
  123. package/src/components/suggester/state-management/reducer/reduce-on-click-option.js +8 -0
  124. package/src/components/suggester/state-management/reducer/reduce-on-error.js +8 -0
  125. package/src/components/suggester/state-management/reducer/reduce-on-focus.js +5 -0
  126. package/src/components/suggester/state-management/reducer/reduce-on-init.js +11 -0
  127. package/src/components/suggester/state-management/reducer/reduce-on-key-down.js +73 -0
  128. package/src/components/suggester/state-management/reducer/reduce-on-unexpected-error.js +7 -0
  129. package/src/components/suggester/state-management/reducer/reduce-on-update-options.js +11 -0
  130. package/src/components/suggester/state-management/reducer/reducer.js +35 -0
  131. package/src/components/suggester/state-management/suggester-context.js +4 -0
  132. package/src/components/suggester/state-management/use-dispatch.js +11 -0
  133. package/src/components/suggester/suggester-wrapper.js +101 -0
  134. package/src/components/suggester-loader-widget/create-append-task.js +43 -0
  135. package/src/components/suggester-loader-widget/index.js +1 -0
  136. package/src/components/suggester-loader-widget/loader-row.js +102 -0
  137. package/src/components/suggester-loader-widget/loader.js +67 -0
  138. package/src/components/suggester-loader-widget/progress.js +25 -0
  139. package/src/components/suggester-loader-widget/tools/action-tool.js +20 -0
  140. package/src/components/suggester-loader-widget/tools/index.js +2 -0
  141. package/src/components/suggester-loader-widget/tools/tools.js +7 -0
  142. package/src/components/suggester-loader-widget/widget-container.js +35 -0
  143. package/src/components/suggester-loader-widget/widget.js +125 -0
  144. package/src/components/suggester-loader-widget/widget.scss +176 -0
  145. package/src/components/table/index.js +1 -0
  146. package/src/components/table/table.js +171 -0
  147. package/src/components/table/table.scss +24 -0
  148. package/src/components/textarea/component.js +11 -0
  149. package/src/components/textarea/index.js +1 -0
  150. package/src/components/textarea/textarea.scss +6 -0
  151. package/src/components/tooltip/img/edited.png +0 -0
  152. package/src/components/tooltip/img/forced.png +0 -0
  153. package/src/components/tooltip/img/index.js +4 -0
  154. package/src/components/tooltip/index.js +1 -0
  155. package/src/components/tooltip/response.js +52 -0
  156. package/src/components/tooltip/tooltip.scss +27 -0
  157. package/src/constants/component-types.js +1 -0
  158. package/src/constants/declarations.js +14 -0
  159. package/src/constants/event-types.js +13 -0
  160. package/src/constants/index.js +5 -0
  161. package/src/constants/supported-preferences.js +10 -0
  162. package/src/constants/value-types.js +5 -0
  163. package/src/constants/variable-types.js +4 -0
  164. package/src/stories/breadcrumb/README.md +14 -0
  165. package/src/stories/breadcrumb/breadcrumb.stories.js +19 -0
  166. package/src/stories/button/button.stories.js +3 -39
  167. package/src/stories/checkbox-boolean/README.md +19 -12
  168. package/src/stories/checkbox-boolean/checkbox-boolean.stories.js +39 -19
  169. package/src/stories/checkbox-boolean/data-forced.json +48 -0
  170. package/src/stories/checkbox-boolean/data.json +78 -0
  171. package/src/stories/checkbox-group/README.md +29 -0
  172. package/src/stories/checkbox-group/checkbox-group.stories.js +60 -0
  173. package/src/stories/checkbox-group/data-forced.json +89 -0
  174. package/src/stories/checkbox-group/data-vtl.json +102 -0
  175. package/src/stories/checkbox-group/data.json +89 -0
  176. package/src/stories/checkbox-one/README.md +21 -12
  177. package/src/stories/checkbox-one/checkbox-one.stories.js +41 -80
  178. package/src/stories/checkbox-one/data-forced.json +33 -0
  179. package/src/stories/checkbox-one/data-vtl.json +48 -0
  180. package/src/stories/checkbox-one/data.json +33 -0
  181. package/src/stories/datepicker/README.md +31 -0
  182. package/src/stories/datepicker/data-forced.json +28 -0
  183. package/src/stories/datepicker/data.json +43 -0
  184. package/src/stories/datepicker/datepicker.stories.js +60 -0
  185. package/src/stories/declarations/README.md +19 -0
  186. package/src/stories/declarations/declarations.stories.js +112 -0
  187. package/src/stories/dropdown/README.md +44 -0
  188. package/src/stories/dropdown/data-forced.json +81 -0
  189. package/src/stories/dropdown/data-naf.json +6963 -0
  190. package/src/stories/dropdown/data-props.json +111 -0
  191. package/src/stories/dropdown/data.json +78 -0
  192. package/src/stories/dropdown/dropdown.stories.js +89 -0
  193. package/src/stories/filter-description/README.md +15 -0
  194. package/src/stories/filter-description/filter-description.stories.js +53 -0
  195. package/src/stories/icons/icons.stories.js +16 -0
  196. package/src/stories/icons/lunatic-icon.scss +10 -0
  197. package/src/stories/input/README.md +33 -0
  198. package/src/stories/input/data-forced.json +41 -0
  199. package/src/stories/input/data.json +41 -0
  200. package/src/stories/input/input.stories.js +72 -0
  201. package/src/stories/input-number/README.md +30 -15
  202. package/src/stories/input-number/data-forced.json +27 -0
  203. package/src/stories/input-number/data.json +42 -0
  204. package/src/stories/input-number/input-number.stories.js +52 -48
  205. package/src/stories/loop/README.md +25 -0
  206. package/src/stories/loop/loop.stories.js +88 -0
  207. package/src/stories/loop/with-loop/data-loop-deeper.json +298 -0
  208. package/src/stories/loop/with-loop/data-loop.json +336 -0
  209. package/src/stories/loop/with-loop/index.js +2 -0
  210. package/src/stories/loop/with-roster/data-forced.json +213 -0
  211. package/src/stories/loop/with-roster/data-loop-deeper.json +298 -0
  212. package/src/stories/loop/with-roster/data-loop.json +288 -0
  213. package/src/stories/loop/with-roster/index.js +3 -0
  214. package/src/stories/loop-constructor/README.md +27 -0
  215. package/src/stories/loop-constructor/data-input-forced.json +64 -0
  216. package/src/stories/loop-constructor/data-input.json +100 -0
  217. package/src/stories/loop-constructor/data-loop-forced.json +66 -0
  218. package/src/stories/loop-constructor/data-loop-static-forced.json +66 -0
  219. package/src/stories/loop-constructor/data-loop-static.json +81 -0
  220. package/src/stories/loop-constructor/data-loop.json +81 -0
  221. package/src/stories/loop-constructor/data-roster-forced.json +68 -0
  222. package/src/stories/loop-constructor/data-roster.json +83 -0
  223. package/src/stories/loop-constructor/loop-constructor.stories.js +180 -0
  224. package/src/stories/pagination/deeper-loop.json +327 -0
  225. package/src/stories/pagination/pagination.stories.js +60 -0
  226. package/src/stories/pagination/simple-loop.json +277 -0
  227. package/src/stories/pagination/simpsons-question.json +4952 -0
  228. package/src/stories/pagination/simpsons-sequence.json +4362 -0
  229. package/src/stories/progress-bar/README.md +13 -0
  230. package/src/stories/progress-bar/progress-bar.stories.js +24 -0
  231. package/src/stories/questionnaire/arithmetic.json +254 -0
  232. package/src/stories/questionnaire/calc-var.json +187 -0
  233. package/src/stories/questionnaire/logement.json +23402 -0
  234. package/src/stories/questionnaire/questionnaire.stories.js +119 -0
  235. package/src/stories/questionnaire/simpsons.json +4816 -0
  236. package/src/stories/radio/README.md +31 -0
  237. package/src/stories/radio/data-forced.json +32 -0
  238. package/src/stories/radio/data-vtl.json +47 -0
  239. package/src/stories/radio/data.json +32 -0
  240. package/src/stories/radio/radio.stories.js +64 -0
  241. package/src/stories/sequence/README.md +10 -5
  242. package/src/stories/sequence/sequence.stories.js +8 -26
  243. package/src/stories/subsequence/README.md +10 -5
  244. package/src/stories/subsequence/subsequence.stories.js +8 -26
  245. package/src/stories/suggester/README.md +29 -0
  246. package/src/stories/suggester/cog-communes/fetch-cog.js +11 -0
  247. package/src/stories/suggester/cog-communes/index.js +2 -0
  248. package/src/stories/suggester/cog-communes/option-cog-renderer.js +15 -0
  249. package/src/stories/suggester/cog-communes/theme.scss +12 -0
  250. package/src/stories/suggester/data-auto.json +231 -0
  251. package/src/stories/suggester/data-vtl.json +82 -0
  252. package/src/stories/suggester/data.json +83 -0
  253. package/src/stories/suggester/naf-rev2/fetch-naf.js +57 -0
  254. package/src/stories/suggester/naf-rev2/index.js +2 -0
  255. package/src/stories/suggester/naf-rev2/option-renderer.js +17 -0
  256. package/src/stories/suggester/naf-rev2/theme.scss +36 -0
  257. package/src/stories/suggester/suggester.stories.js +128 -0
  258. package/src/stories/table/README.md +29 -0
  259. package/src/stories/table/data-default.json +19 -0
  260. package/src/stories/table/data-one-axis-one-measure.json +139 -0
  261. package/src/stories/table/data-one-axis-two-measures.json +208 -0
  262. package/src/stories/table/data-one-hierarchical-axis.json +219 -0
  263. package/src/stories/table/data-roster.json +486 -0
  264. package/src/stories/table/data-two-axis-one-measure.json +507 -0
  265. package/src/stories/table/table.stories.js +82 -0
  266. package/src/stories/textarea/README.md +33 -0
  267. package/src/stories/textarea/data-forced.json +28 -0
  268. package/src/stories/textarea/data.json +43 -0
  269. package/src/stories/textarea/textarea.stories.js +68 -0
  270. package/src/stories/tooltip-response/README.md +14 -0
  271. package/src/stories/tooltip-response/md-link.json +31 -0
  272. package/src/stories/tooltip-response/md-tooltip.json +31 -0
  273. package/src/stories/tooltip-response/tooltip.stories.js +83 -0
  274. package/src/stories/utils/custom-lunatic.scss +23 -0
  275. package/src/stories/utils/img/arrow.png +0 -0
  276. package/src/stories/utils/img/check_box.svg +1 -0
  277. package/src/stories/utils/img/check_box_outline.svg +1 -0
  278. package/src/stories/utils/img/lunatic-logo.png +0 -0
  279. package/src/stories/utils/img/menu-down.svg +1 -0
  280. package/src/stories/utils/img/menu-up.svg +1 -0
  281. package/src/stories/utils/img/radio_button_checked.svg +1 -0
  282. package/src/stories/utils/img/radio_button_unchecked.svg +1 -0
  283. package/src/stories/utils/options.js +25 -0
  284. package/src/stories/utils/orchestrator.js +108 -0
  285. package/src/tests/components/breadcrumb.spec.js +13 -0
  286. package/src/tests/components/checkbox-boolean.spec.js +28 -40
  287. package/src/tests/components/checkbox-group.spec.js +53 -0
  288. package/src/tests/components/checkbox-one.spec.js +21 -39
  289. package/src/tests/components/datepicker.spec.js +22 -0
  290. package/src/tests/components/declarations-wrappers/input-declarations-wrapper.spec.js +67 -0
  291. package/src/tests/components/declarations-wrappers/list-declarations-wrapper.spec.js +52 -0
  292. package/src/tests/components/declarations-wrappers/simple-declarations-wrapper.spec.js +21 -0
  293. package/src/tests/components/declarations.spec.js +46 -0
  294. package/src/tests/components/input-number.spec.js +136 -37
  295. package/src/tests/components/input.spec.js +18 -0
  296. package/src/tests/components/loops/loop-static.json +66 -0
  297. package/src/tests/components/loops/loop.json +258 -0
  298. package/src/tests/components/loops/loop.spec.js +30 -0
  299. package/src/tests/components/loops/roster-for-loop.spec.js +18 -0
  300. package/src/tests/components/loops/roster-loop.json +69 -0
  301. package/src/tests/components/missing-wrapper.spec.js +33 -0
  302. package/src/tests/components/progress-bar.spec.js +15 -0
  303. package/src/tests/components/radio.spec.js +27 -0
  304. package/src/tests/components/table.spec.js +11 -0
  305. package/src/tests/components/textarea.spec.js +18 -0
  306. package/src/tests/components/tooltip.spec.js +25 -0
  307. package/src/tests/setup/setupTests.js +1 -1
  308. package/src/tests/utils/lib/alphabet.spec.js +36 -0
  309. package/src/tests/utils/lib/array.spec.js +22 -0
  310. package/src/tests/utils/lib/checkbox/group.spec.js +72 -0
  311. package/src/tests/utils/{decorator → lib/decorator}/title-decorator.spec.js +1 -1
  312. package/src/tests/utils/lib/input-number.spec.js +18 -0
  313. package/src/tests/utils/{items-positioning.spec.js → lib/items-positioning.spec.js} +3 -3
  314. package/src/tests/utils/{label-position.spec.js → lib/label-position.spec.js} +6 -3
  315. package/src/tests/utils/lib/loops/bindings.spec.js +75 -0
  316. package/src/tests/utils/lib/loops/shared.spec.js +82 -0
  317. package/src/tests/utils/lib/missing/missing.spec.js +74 -0
  318. package/src/tests/utils/lib/missing/mock.js +137 -0
  319. package/src/tests/utils/lib/pagination/shared.spec.js +42 -0
  320. package/src/tests/utils/lib/responses.spec.js +64 -0
  321. package/src/tests/utils/{string-utils.spec.js → lib/style.spec.js} +6 -6
  322. package/src/tests/utils/lib/table/roster.spec.js +25 -0
  323. package/src/tests/utils/lib/tooltip/build-response.spec.js +95 -0
  324. package/src/tests/utils/lib/tooltip/content.spec.js +109 -0
  325. package/src/tests/utils/to-expose/handler/handler.spec.js +94 -0
  326. package/src/tests/utils/to-expose/handler/questionnaire.json +158 -0
  327. package/src/tests/utils/to-expose/handler/results/index.js +6 -0
  328. package/src/tests/utils/to-expose/handler/results/res-double.json +158 -0
  329. package/src/tests/utils/to-expose/handler/results/res-input-collected.json +158 -0
  330. package/src/tests/utils/to-expose/handler/results/res-input-edited.json +158 -0
  331. package/src/tests/utils/to-expose/handler/results/res-loop.json +158 -0
  332. package/src/tests/utils/to-expose/handler/results/res-matrix.json +158 -0
  333. package/src/tests/utils/to-expose/handler/results/res-responses.json +158 -0
  334. package/src/tests/utils/to-expose/hooks/use-lunatic.spec.js +46 -0
  335. package/src/tests/utils/to-expose/init-questionnaire/data.json +12 -0
  336. package/src/tests/utils/to-expose/init-questionnaire/init-questionnaire.spec.js +19 -0
  337. package/src/tests/utils/to-expose/init-questionnaire/questionnaire.json +141 -0
  338. package/src/tests/utils/to-expose/init-questionnaire/result.json +174 -0
  339. package/src/tests/utils/to-expose/interpret/interpret.spec.js +48 -0
  340. package/src/tests/utils/to-expose/state/questionnaire.json +61 -0
  341. package/src/tests/utils/to-expose/state/results.js +78 -0
  342. package/src/tests/utils/to-expose/state/state.spec.js +59 -0
  343. package/src/utils/components/dragger/dragger.js +64 -0
  344. package/src/utils/components/dragger/dragger.scss +8 -0
  345. package/src/utils/components/dragger/index.js +1 -0
  346. package/src/utils/components/fab/fab.js +50 -0
  347. package/src/utils/components/fab/fab.scss +32 -0
  348. package/src/utils/components/fab/index.js +1 -0
  349. package/src/utils/components/field-wrapper.js +23 -0
  350. package/src/utils/components/is-network/index.js +1 -0
  351. package/src/utils/components/is-network/is-network.js +39 -0
  352. package/src/utils/components/is-network/use-online-status.js +51 -0
  353. package/src/utils/components/label-wrapper.js +45 -0
  354. package/src/utils/icons/closed.icon.js +24 -0
  355. package/src/utils/icons/cross.icon.js +24 -0
  356. package/src/utils/icons/load.icon.js +24 -0
  357. package/src/utils/icons/lunatic-icon.js +9 -0
  358. package/src/utils/icons/lunatic-icon.scss +4 -0
  359. package/src/utils/icons/network.icon.js +24 -0
  360. package/src/utils/icons/on-drag.icon.js +24 -0
  361. package/src/utils/icons/opened.icon.js +24 -0
  362. package/src/utils/idb-tools/clear-store.js +16 -0
  363. package/src/utils/idb-tools/get-entity.js +15 -0
  364. package/src/utils/idb-tools/get-idb.js +12 -0
  365. package/src/utils/idb-tools/index.js +4 -0
  366. package/src/utils/idb-tools/open-db.js +32 -0
  367. package/src/utils/lib/alphabet.js +1 -0
  368. package/src/utils/lib/array.js +7 -0
  369. package/src/utils/lib/checkbox/group.js +21 -0
  370. package/src/utils/lib/checkbox/index.js +1 -0
  371. package/src/utils/lib/decorator/index.js +1 -0
  372. package/src/utils/lib/decorator/title-decorator.js +16 -0
  373. package/src/utils/lib/env.js +2 -0
  374. package/src/utils/lib/event.js +15 -0
  375. package/src/utils/lib/function.js +1 -0
  376. package/src/utils/lib/index.js +19 -0
  377. package/src/utils/lib/input-number.js +6 -0
  378. package/src/utils/{label-position.js → lib/label-position.js} +4 -4
  379. package/src/utils/lib/loops/bindings.js +66 -0
  380. package/src/utils/lib/loops/build-components.js +33 -0
  381. package/src/utils/lib/loops/index.js +3 -0
  382. package/src/utils/lib/loops/shared.js +55 -0
  383. package/src/utils/lib/memo-check.js +24 -0
  384. package/src/utils/lib/missing.js +52 -0
  385. package/src/utils/{items-positioning.js → lib/options-positioning.js} +1 -1
  386. package/src/utils/lib/pagination/flow.js +2 -0
  387. package/src/utils/lib/pagination/index.js +2 -0
  388. package/src/utils/lib/pagination/navigation/index.js +1 -0
  389. package/src/utils/lib/pagination/navigation/shared.js +108 -0
  390. package/src/utils/lib/prop-types/declarations.js +22 -0
  391. package/src/utils/lib/prop-types/index.js +5 -0
  392. package/src/utils/lib/prop-types/lines.js +6 -0
  393. package/src/utils/lib/prop-types/options.js +8 -0
  394. package/src/utils/lib/prop-types/response.js +6 -0
  395. package/src/utils/lib/prop-types/value-type.js +9 -0
  396. package/src/utils/lib/responses.js +9 -0
  397. package/src/utils/{string-utils.js → lib/style.js} +0 -0
  398. package/src/utils/lib/table/index.js +1 -0
  399. package/src/utils/lib/table/roster.js +23 -0
  400. package/src/utils/lib/tooltip/build-response.js +41 -0
  401. package/src/utils/lib/tooltip/content.js +55 -0
  402. package/src/utils/lib/tooltip/index.js +6 -0
  403. package/src/utils/store-tools/auto-load.js +72 -0
  404. package/src/utils/store-tools/clear-store-data.js +8 -0
  405. package/src/utils/store-tools/clear-store-info.js +8 -0
  406. package/src/utils/store-tools/constantes.js +20 -0
  407. package/src/utils/store-tools/create/create.js +19 -0
  408. package/src/utils/store-tools/create/index.js +1 -0
  409. package/src/utils/store-tools/create/update-store-info.js +26 -0
  410. package/src/utils/store-tools/get-store-count.js +22 -0
  411. package/src/utils/store-tools/index.js +5 -0
  412. package/src/utils/store-tools/open-or-create-store.js +47 -0
  413. package/src/utils/store-tools/use-store-index.js +24 -0
  414. package/src/utils/to-expose/handler.js +137 -0
  415. package/src/utils/to-expose/hooks/filter-components.js +106 -0
  416. package/src/utils/to-expose/hooks/index.js +1 -0
  417. package/src/utils/to-expose/hooks/lunatic.js +191 -0
  418. package/src/utils/to-expose/hooks/use-document-add-event-listener.js +63 -0
  419. package/src/utils/to-expose/index.js +11 -0
  420. package/src/utils/to-expose/init-questionnaire.js +223 -0
  421. package/src/utils/to-expose/interpret/index.js +1 -0
  422. package/src/utils/to-expose/interpret/main.js +16 -0
  423. package/src/utils/to-expose/interpret/md.js +65 -0
  424. package/src/utils/to-expose/interpret/vtl.js +18 -0
  425. package/src/utils/to-expose/state.js +58 -0
  426. package/src/components/subsequence/subsequence.scss +0 -15
  427. package/src/utils/decorator/title-decorator.js +0 -18
@@ -0,0 +1,171 @@
1
+ import React, { useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import missingWrapper from '../missing-wrapper';
4
+ import * as lunatic from '../components';
5
+ import Declarations from '../declarations';
6
+ import * as U from '../../utils/lib';
7
+ import * as C from '../../constants';
8
+ import { interpret } from '../../utils/to-expose';
9
+ import './table.scss';
10
+
11
+ const Table = ({
12
+ id: tableId,
13
+ label: tableLabel,
14
+ preferences,
15
+ cells,
16
+ handleChange,
17
+ lines: initLines,
18
+ positioning,
19
+ declarations,
20
+ features,
21
+ bindings,
22
+ addBtnLabel,
23
+ hideBtn,
24
+ management,
25
+ numberAsTextfield,
26
+ logFunction,
27
+ }) => {
28
+ const minLines = initLines
29
+ ? Math.max(initLines.min, U.getRosterInitLines(cells))
30
+ : undefined;
31
+ const maxLines = initLines ? initLines.max : undefined;
32
+ const [lines, setLines] = useState(minLines);
33
+
34
+ const width = `${100 / Math.max(...cells.map((line) => line.length))}%`;
35
+ const Button = lunatic.Button;
36
+ return (
37
+ <>
38
+ <Declarations
39
+ id={tableId}
40
+ type={C.BEFORE_QUESTION_TEXT}
41
+ declarations={declarations}
42
+ features={features}
43
+ bindings={bindings}
44
+ />
45
+ {tableLabel && (
46
+ <label
47
+ htmlFor={`table-one-axis-${tableId}`}
48
+ id={`table-one-axis-label-${tableId}`}
49
+ >
50
+ {interpret(features, logFunction)(bindings)(tableLabel)}
51
+ </label>
52
+ )}
53
+ <Declarations
54
+ id={tableId}
55
+ type={C.AFTER_QUESTION_TEXT}
56
+ declarations={declarations}
57
+ features={features}
58
+ bindings={bindings}
59
+ />
60
+ <table id={`table-${tableId}`} className="table-lunatic">
61
+ <tbody>
62
+ {(minLines || minLines === 0 ? cells.slice(0, lines + 1) : cells).map(
63
+ (line, i) => (
64
+ <tr key={`table-${tableId}-line${i}`}>
65
+ {line.map((component, j) => {
66
+ const {
67
+ label,
68
+ headerCell,
69
+ colspan,
70
+ rowspan,
71
+ componentType,
72
+ ...componentProps
73
+ } = component;
74
+ if (componentType) {
75
+ const Component = lunatic[componentType];
76
+ return (
77
+ <td
78
+ key={`table-${tableId}-line${i}-cell-${j}`}
79
+ style={{ width }}
80
+ >
81
+ <Component
82
+ label={label || ' '}
83
+ handleChange={handleChange}
84
+ preferences={preferences}
85
+ positioning={positioning}
86
+ management={management}
87
+ features={features}
88
+ bindings={bindings}
89
+ {...componentProps}
90
+ zIndex={cells.length - i || 0}
91
+ numberAsTextfield
92
+ logFunction={logFunction}
93
+ shortcut={false}
94
+ />
95
+ </td>
96
+ );
97
+ }
98
+ const cellOptions = {
99
+ key: `table-${tableId}-line${i}-cell-${j}`,
100
+ style: { width },
101
+ colSpan: colspan || 1,
102
+ rowSpan: rowspan || 1,
103
+ };
104
+ const interpretedLabel = interpret(
105
+ features,
106
+ logFunction
107
+ )(bindings)(label);
108
+ return headerCell ? (
109
+ <th {...cellOptions}>{interpretedLabel}</th>
110
+ ) : (
111
+ <td {...cellOptions}>{interpretedLabel}</td>
112
+ );
113
+ })}
114
+ </tr>
115
+ )
116
+ )}
117
+ </tbody>
118
+ </table>
119
+ {Number.isInteger(minLines) && lines < maxLines && !hideBtn && (
120
+ <Button
121
+ label="addLine"
122
+ value={addBtnLabel}
123
+ onClick={() => setLines(lines + 1)}
124
+ id={tableId}
125
+ logFunction={logFunction}
126
+ />
127
+ )}
128
+ <Declarations
129
+ id={tableId}
130
+ type={C.DETACHABLE}
131
+ declarations={declarations}
132
+ features={features}
133
+ bindings={bindings}
134
+ />
135
+ </>
136
+ );
137
+ };
138
+
139
+ Table.defaultProps = {
140
+ label: '',
141
+ preferences: ['COLLECTED'],
142
+ cells: [],
143
+ lines: {},
144
+ positioning: 'DEFAULT',
145
+ declarations: [],
146
+ features: [],
147
+ bindings: {},
148
+ addBtnLabel: 'Add a line',
149
+ management: false,
150
+ hideBtn: false,
151
+ style: {},
152
+ };
153
+
154
+ Table.propTypes = {
155
+ id: PropTypes.string.isRequired,
156
+ label: PropTypes.string,
157
+ preferences: PropTypes.arrayOf(U.valueTypePropTypes),
158
+ cells: PropTypes.array,
159
+ handleChange: PropTypes.func.isRequired,
160
+ lines: U.linesPropTypes,
161
+ positioning: PropTypes.oneOf(['DEFAULT', 'HORIZONTAL', 'VERTICAL']),
162
+ declarations: U.declarationsPropTypes,
163
+ features: PropTypes.arrayOf(PropTypes.string),
164
+ bindings: PropTypes.object,
165
+ addBtnLabel: PropTypes.string,
166
+ hideBtn: PropTypes.bool,
167
+ management: PropTypes.bool,
168
+ style: PropTypes.object,
169
+ };
170
+
171
+ export default React.memo(missingWrapper(Table), U.areEqual);
@@ -0,0 +1,24 @@
1
+ .table-lunatic {
2
+ table-layout: fixed;
3
+ border-collapse: collapse;
4
+ margin-top: 0.3em;
5
+ margin-bottom: 0.3em;
6
+ & td,
7
+ th {
8
+ border: 0.15em solid var(--color-primary-dark);
9
+ padding: 0.2em;
10
+ }
11
+ & td {
12
+ .field,
13
+ .field-with-tooltip {
14
+ display: flex;
15
+ justify-content: center;
16
+ align-items: center;
17
+ }
18
+ }
19
+ }
20
+
21
+ .table-lunatic .tooltip-lunatic img {
22
+ height: 20px;
23
+ width: 20px;
24
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import missingWrapper from '../missing-wrapper';
3
+ import { InputDeclarationsWrapper } from '../declarations/wrappers';
4
+ import { areEqual } from '../../utils/lib';
5
+ import './textarea.scss';
6
+
7
+ const Textarea = (props) => (
8
+ <InputDeclarationsWrapper type={null} roleType="textarea" {...props} />
9
+ );
10
+
11
+ export default React.memo(missingWrapper(Textarea), areEqual);
@@ -0,0 +1 @@
1
+ export { default } from './component';
@@ -0,0 +1,6 @@
1
+ // see input.scss
2
+
3
+ .textarea-lunatic {
4
+ height: 3em;
5
+ width: 100%;
6
+ }
@@ -0,0 +1,4 @@
1
+ import editedImg from './edited.png';
2
+ import forcedImg from './forced.png';
3
+
4
+ export { editedImg, forcedImg };
@@ -0,0 +1 @@
1
+ export { default as TooltipResponse } from './response';
@@ -0,0 +1,52 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import ReactTooltip from 'react-tooltip';
4
+ import * as U from '../../utils/lib';
5
+ import * as img from './img';
6
+ import './tooltip.scss';
7
+
8
+ const TooltipResponse = ({ id, response }) => {
9
+ const [tooltipElements, setTooltipElements] = useState(() =>
10
+ U.buildTooltip(response)
11
+ );
12
+
13
+ useEffect(() => {
14
+ setTooltipElements(U.buildTooltip(response));
15
+ }, [response]);
16
+
17
+ const { content, imgName } = tooltipElements;
18
+
19
+ if (!content) return null;
20
+
21
+ const text = content
22
+ .map(({ key, value }) => `${key} : ${value}<br />`)
23
+ .join('');
24
+
25
+ return (
26
+ <div className="tooltip-lunatic">
27
+ <span
28
+ data-for={`${id}-management-tooltip`}
29
+ data-tip={text}
30
+ data-multiline
31
+ >
32
+ <img id={id} alt="img-tooltip" src={img[imgName].src || img[imgName]} />
33
+ </span>
34
+ <ReactTooltip
35
+ id={`${id}-management-tooltip`}
36
+ className="tooltip-text"
37
+ place="left"
38
+ />
39
+ </div>
40
+ );
41
+ };
42
+
43
+ TooltipResponse.defaultProps = {
44
+ response: {},
45
+ };
46
+
47
+ TooltipResponse.propTypes = {
48
+ id: PropTypes.string,
49
+ response: U.responsePropTypes,
50
+ };
51
+
52
+ export default TooltipResponse;
@@ -0,0 +1,27 @@
1
+ @import 'src/components/index.scss';
2
+
3
+ /* Tooltip container */
4
+ .tooltip-lunatic {
5
+ position: relative;
6
+ display: inline-block;
7
+ align-items: center;
8
+ }
9
+
10
+ /* Tooltip text */
11
+ .tooltip-lunatic .tooltip-text {
12
+ min-width: 10em;
13
+ max-width: 20em;
14
+ background-color: var(--color-primary-dark);
15
+ color: #fff;
16
+ padding: 0.5em;
17
+ border-radius: 6px;
18
+ font-size: 1em;
19
+ &.place-left {
20
+ &::before {
21
+ border-left: 10px solid var(--color-primary-dark);
22
+ }
23
+ &::after {
24
+ content: none;
25
+ }
26
+ }
27
+ }
@@ -0,0 +1 @@
1
+ export const CHECKBOX_GROUP = 'CheckboxGroup';
@@ -0,0 +1,14 @@
1
+ // Declaration position
2
+
3
+ export const BEFORE_QUESTION_TEXT = 'BEFORE_QUESTION_TEXT';
4
+ export const AFTER_QUESTION_TEXT = 'AFTER_QUESTION_TEXT';
5
+ export const DETACHABLE = 'DETACHABLE';
6
+
7
+ // Declaration types
8
+
9
+ export const INSTRUCTION = 'INSTRUCTION';
10
+ export const COMMENT = 'COMMENT';
11
+ export const HELP = 'HELP';
12
+ export const WARNING = 'WARNING';
13
+ export const MESSAGE_FILTER = 'MESSAGE_FILTER';
14
+ export const STATEMENT = 'STATEMENT';
@@ -0,0 +1,13 @@
1
+ // Event types for paradata
2
+ export const EVENT_FOCUS_IN = 'focus-in';
3
+ export const EVENT_FOCUS_OUT = 'focus-out';
4
+ export const EVENT_SELECTION = 'selection';
5
+ export const EVENT_CLICK = 'click';
6
+ export const EVENT_VALUE_CHANGE = 'value-changed';
7
+
8
+ // Category of object
9
+ export const INPUT_CATEGORY = 'lunatic-input';
10
+ export const BUTTON_CATEGORY = 'lunatic-button';
11
+ export const LINK_CATEGORY = 'lunatic-link';
12
+ export const TOOLTIP_CATEGORY = 'lunatic-tooltip';
13
+ export const CALCULATED_VAR_CATEGORY = 'lunatic-calculated-var';
@@ -0,0 +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';
@@ -0,0 +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
+ ];
@@ -0,0 +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';
@@ -0,0 +1,4 @@
1
+ export const EXTERNAL = 'EXTERNAL';
2
+ export const CALCULATED = 'CALCULATED';
3
+ // Already define in value-types
4
+ //export const COLLECTED = 'COLLECTED';
@@ -0,0 +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`.
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { storiesOf } from '@storybook/react';
3
+ import { Breadcrumb } from 'components';
4
+ import { withReadme } from 'storybook-readme';
5
+ import readme from './README.md';
6
+ import { titleDecorator } from 'utils/lib';
7
+
8
+ const elements = ['Sequence', 'Sub-sequence', 'Question'];
9
+
10
+ const stories = storiesOf('Breadcrumb', module)
11
+ .addDecorator(withReadme(readme))
12
+ .addDecorator((Component) => {
13
+ const WrappedComponent = titleDecorator(Component);
14
+ return <WrappedComponent title="<Breadcrumb />" />;
15
+ });
16
+
17
+ stories.addWithJSX('Default', () => (
18
+ <Breadcrumb id="default" elements={elements} />
19
+ ));
@@ -3,18 +3,12 @@ import { storiesOf } from '@storybook/react';
3
3
  import { withReadme } from 'storybook-readme';
4
4
  import { Button } from 'components';
5
5
  import readme from './README.md';
6
- import titleDecorator from 'utils/decorator/title-decorator';
7
- import {
8
- text,
9
- boolean,
10
- number,
11
- color,
12
- object,
13
- } from '@storybook/addon-knobs/react';
6
+ import { titleDecorator } from 'utils/lib';
7
+ import { text, boolean } from '@storybook/addon-knobs/react';
14
8
 
15
9
  const stories = storiesOf('Button', module)
16
10
  .addDecorator(withReadme(readme))
17
- .addDecorator(Component => {
11
+ .addDecorator((Component) => {
18
12
  const WrappedComponent = titleDecorator(Component);
19
13
  return <WrappedComponent title="<Button />" />;
20
14
  });
@@ -31,33 +25,3 @@ stories.addWithJSX('Props', () => (
31
25
  disabled={boolean('Disabled', false)}
32
26
  />
33
27
  ));
34
-
35
- stories.addWithJSX('Styled', () => (
36
- <Button
37
- label="styled-button"
38
- value="Click me !"
39
- onClick={console.log}
40
- style={object('Generated style', {
41
- 'border-width': number('Border-width', 5, {
42
- range: true,
43
- min: 0,
44
- max: 20,
45
- step: 1,
46
- }),
47
- 'border-radius': number('Border-radius', 10, {
48
- range: true,
49
- min: 0,
50
- max: 20,
51
- step: 1,
52
- }),
53
- color: color('Color', 'white'),
54
- 'background-color': color('Background color', '#e80a4d'),
55
- 'border-color': color('Border color', '#e80a4d'),
56
- ':hover': {
57
- color: color('Hover : color', '#e80a4d'),
58
- 'background-color': color('Hover : background color', 'white'),
59
- 'border-color': color('Hover : border color', '#e80a4d'),
60
- },
61
- })}
62
- />
63
- ));
@@ -2,19 +2,26 @@
2
2
 
3
3
  ## Props
4
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
- | handleChange | func | - || Handler of the checkbox |
10
- | disabled | bool | false | | Is the checkbox items disabled |
11
- | positioning \* | string | "DEFAULT" | | Checkbox items positioning |
12
- | style \* | object | { } | | Style of the checkbox |
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 |
13
20
 
14
- - `options` props has to be an array made by objects with a shape of `{label: string, value: string}`
15
- - `positioning` props has to be one of `DEFAULT`, `HORIZONTAL` or `VERTICAL`
16
- - `style` props has to be composed of `fieldsetStyle` and `checkboxStyle`
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
17
24
 
18
25
  ## Styles
19
26
 
20
- **CheckboxOne** component has for classes `lunatic-input-number > (.input-lunatic .warning)` and `.lunatic-input-number-errors > error`.
27
+ **CheckboxBoolean** component has for classes `checkbox-lunatic` and `checkbox-boolean-modality`.
@@ -1,34 +1,54 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { storiesOf } from '@storybook/react';
3
3
  import { withReadme } from 'storybook-readme';
4
- import { CheckboxBoolean } from 'components';
4
+ import Orchestrator from '../utils/orchestrator';
5
5
  import readme from './README.md';
6
- import titleDecorator from 'utils/decorator/title-decorator';
7
- import { text, boolean, select } from '@storybook/addon-knobs/react';
8
-
9
- const positioningOptions = {
10
- DEFAULT: 'Default',
11
- HORIZONTAL: 'Horizontal',
12
- VERTICAL: 'Vertical',
13
- };
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';
14
11
 
15
12
  const stories = storiesOf('CheckboxBoolean', module)
16
13
  .addDecorator(withReadme(readme))
17
- .addDecorator(Component => {
14
+ .addDecorator((Component) => {
18
15
  const WrappedComponent = titleDecorator(Component);
19
16
  return <WrappedComponent title="<CheckboxBoolean />" />;
20
17
  });
21
18
 
22
- stories.addWithJSX('Default', () => (
23
- <CheckboxBoolean id="default" handleChange={console.log} />
24
- ));
19
+ stories.addWithJSX('Default', () => <Orchestrator source={data} />);
25
20
 
26
21
  stories.addWithJSX('Props', () => (
27
- <CheckboxBoolean
28
- id="props"
29
- label={text('Label', "I'm the label of the boolean checkbox")}
30
- positioning={select('Items positioning', positioningOptions)}
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' })}
31
28
  disabled={boolean('Disabled', false)}
32
- handleChange={console.log}
29
+ focused={boolean('Focused', false)}
30
+ management={boolean('Management', false)}
33
31
  />
34
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
+ });
@@ -0,0 +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
+ }