@inseefr/lunatic 0.3.0-experimental → 0.3.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 (225) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +25 -23
  3. package/lib/index.esm.js +3539 -0
  4. package/lib/index.esm.js.map +1 -0
  5. package/lib/index.js +240 -282
  6. package/lib/index.js.map +1 -1
  7. package/package.json +179 -173
  8. package/src/components/breadcrumb/breadcrumb.scss +22 -22
  9. package/src/components/checkbox/boolean.js +172 -172
  10. package/src/components/checkbox/checkbox.scss +73 -73
  11. package/src/components/checkbox/group.js +231 -231
  12. package/src/components/checkbox/one.js +11 -11
  13. package/src/components/component-wrapper/controls/component.js +70 -70
  14. package/src/components/component-wrapper/controls/controls.scss +6 -6
  15. package/src/components/component-wrapper/controls/index.js +1 -1
  16. package/src/components/component-wrapper/controls/validators/datepicker.js +44 -33
  17. package/src/components/component-wrapper/controls/validators/index.js +16 -16
  18. package/src/components/component-wrapper/controls/validators/input-number.js +23 -23
  19. package/src/components/component-wrapper/index.js +1 -1
  20. package/src/components/component-wrapper/missing/component.js +200 -180
  21. package/src/components/component-wrapper/missing/index.js +1 -1
  22. package/src/components/component-wrapper/missing/missing.scss +32 -32
  23. package/src/components/component-wrapper/wrapper.js +23 -23
  24. package/src/components/components.js +19 -19
  25. package/src/components/datepicker/component.js +26 -30
  26. package/src/components/declarations/component.js +46 -46
  27. package/src/components/declarations/declarations.scss +40 -40
  28. package/src/components/declarations/wrappers/input-declarations-wrapper.js +328 -302
  29. package/src/components/declarations/wrappers/simple-declarations-wrapper.js +54 -54
  30. package/src/components/dropdown/commons/actions.js +65 -65
  31. package/src/components/dropdown/commons/children-to-option.js +9 -9
  32. package/src/components/dropdown/commons/cleaner-callbacks.js +58 -58
  33. package/src/components/dropdown/commons/components/dropdown-container.js +29 -29
  34. package/src/components/dropdown/commons/components/dropdown.js +204 -183
  35. package/src/components/dropdown/commons/components/panel.js +78 -78
  36. package/src/components/dropdown/commons/event-callbacks/on-mousedown-callback.js +15 -15
  37. package/src/components/dropdown/commons/reducer.js +152 -152
  38. package/src/components/dropdown/commons/tools/index.js +17 -17
  39. package/src/components/dropdown/component.js +135 -135
  40. package/src/components/dropdown/dropdown-edit/dropdown-edit.js +194 -191
  41. package/src/components/dropdown/dropdown-edit/index.js +11 -11
  42. package/src/components/dropdown/dropdown-simple/dropdown.js +173 -171
  43. package/src/components/dropdown/dropdown-simple/index.js +20 -20
  44. package/src/components/dropdown/dropdown.scss +178 -178
  45. package/src/components/icon/icon.scss +15 -15
  46. package/src/components/index.js +2 -0
  47. package/src/components/index.scss +177 -177
  48. package/src/components/input/input-number.js +30 -28
  49. package/src/components/input/input.js +11 -11
  50. package/src/components/input/input.scss +31 -31
  51. package/src/components/loop/component.js +170 -170
  52. package/src/components/loop/loop.scss +13 -13
  53. package/src/components/loop/wrapper.js +15 -15
  54. package/src/components/loop-constructor/block/block.scss +10 -10
  55. package/src/components/loop-constructor/block/component.js +9 -9
  56. package/src/components/loop-constructor/roster/component.js +8 -8
  57. package/src/components/loop-constructor/wrapper/body-component.js +146 -131
  58. package/src/components/loop-constructor/wrapper/component.js +190 -190
  59. package/src/components/modal/component.js +36 -36
  60. package/src/components/modal/index.js +1 -1
  61. package/src/components/modal/modal.scss +33 -33
  62. package/src/components/progress-bar/progress-bar.scss +54 -54
  63. package/src/components/radio/component.js +9 -9
  64. package/src/components/radio/radio.scss +59 -59
  65. package/src/components/sequence/component.js +50 -50
  66. package/src/components/sequence/sequence.scss +10 -10
  67. package/src/components/subsequence/component.js +49 -49
  68. package/src/components/suggester/check-store.js +2 -4
  69. package/src/components/suggester/components/panel/default-option-renderer.js +27 -27
  70. package/src/components/suggester/components/panel/option-container.js +61 -61
  71. package/src/components/suggester/components/panel/panel.js +47 -47
  72. package/src/components/suggester/components/selection/default-label-renderer.js +31 -31
  73. package/src/components/suggester/components/selection/label.js +35 -35
  74. package/src/components/suggester/components/selection/selection.js +50 -50
  75. package/src/components/suggester/components/suggester-content.js +2 -2
  76. package/src/components/suggester/components/suggester.js +128 -88
  77. package/src/components/suggester/components/suggester.scss +101 -101
  78. package/src/components/suggester/default-style.scss +125 -125
  79. package/src/components/suggester/find-best-label/find-best-label.js +51 -51
  80. package/src/components/suggester/find-best-label/index.js +1 -1
  81. package/src/components/suggester/idb-suggester.js +73 -67
  82. package/src/components/suggester/lunatic-suggester.js +140 -139
  83. package/src/components/suggester/searching/create-searching.js +49 -49
  84. package/src/components/suggester/searching/index.js +1 -1
  85. package/src/components/suggester/state-management/actions.js +38 -38
  86. package/src/components/suggester/state-management/reducer/reduce-on-delete-search.js +11 -11
  87. package/src/components/suggester/state-management/reducer/reduce-on-init.js +29 -29
  88. package/src/components/suggester/state-management/reducer/reducer.js +38 -38
  89. package/src/components/suggester/suggester-wrapper.js +127 -121
  90. package/src/components/suggester-loader-widget/loader.js +67 -67
  91. package/src/components/suggester-loader-widget/widget.js +123 -123
  92. package/src/components/table/table.js +173 -171
  93. package/src/components/table/table.scss +26 -26
  94. package/src/components/textarea/component.js +11 -11
  95. package/src/components/textarea/textarea.scss +8 -8
  96. package/src/components/tooltip/tooltip.scss +30 -30
  97. package/src/stories/breadcrumb/breadcrumb.stories.js +21 -21
  98. package/src/stories/checkbox-boolean/data.json +78 -78
  99. package/src/stories/datepicker/data.json +45 -45
  100. package/src/stories/declarations/declarations.stories.js +116 -116
  101. package/src/stories/dropdown/README.md +44 -44
  102. package/src/stories/dropdown/data.json +98 -98
  103. package/src/stories/dropdown/dropdown.stories.js +89 -89
  104. package/src/stories/progress-bar/progress-bar.stories.js +24 -24
  105. package/src/stories/questionnaire/arithmetic-management.json +47 -0
  106. package/src/stories/questionnaire/arithmetic.json +247 -247
  107. package/src/stories/questionnaire/calc-var.json +187 -187
  108. package/src/stories/questionnaire/data-logement.json +2691 -2691
  109. package/src/stories/questionnaire/kish.json +275 -0
  110. package/src/stories/questionnaire/logement-queen.json +23390 -22706
  111. package/src/stories/questionnaire/logement-s2.json +46028 -44537
  112. package/src/stories/questionnaire/logement-sequence.json +26741 -26741
  113. package/src/stories/questionnaire/logement.json +21072 -21072
  114. package/src/stories/questionnaire/loop-and-controls.json +481 -0
  115. package/src/stories/questionnaire/questionnaire.stories.js +236 -172
  116. package/src/stories/questionnaire/update-external/data.json +1 -0
  117. package/src/stories/questionnaire/update-external/questionnaire.json +75 -0
  118. package/src/stories/sequence/sequence.stories.js +32 -32
  119. package/src/stories/subsequence/subsequence.stories.js +32 -32
  120. package/src/stories/suggester/README.md +46 -46
  121. package/src/stories/suggester/bailleurs-sociaux/fetch-bailleurs.js +15 -15
  122. package/src/stories/suggester/bailleurs-sociaux/index.js +2 -2
  123. package/src/stories/suggester/bailleurs-sociaux/option-bailleur-renderer.js +58 -58
  124. package/src/stories/suggester/bailleurs-sociaux/preloader.svg +51 -51
  125. package/src/stories/suggester/bailleurs-sociaux/theme.scss +22 -22
  126. package/src/stories/suggester/bailleurs-sociaux-2021/fetch-bailleurs.js +12 -0
  127. package/src/stories/suggester/bailleurs-sociaux-2021/index.js +1 -0
  128. package/src/stories/suggester/cog-communes/fetch-cog.js +15 -15
  129. package/src/stories/suggester/data-auto.json +232 -232
  130. package/src/stories/suggester/data-vtl.json +82 -82
  131. package/src/stories/suggester/data.json +169 -136
  132. package/src/stories/suggester/naf-rev2/index.js +2 -2
  133. package/src/stories/suggester/naf-rev2/option-naf-renderer.js +17 -17
  134. package/src/stories/suggester/suggester-workers.stories.js +226 -179
  135. package/src/stories/suggester/suggester.stories.js +138 -133
  136. package/src/stories/utils/orchestrator-split.js +119 -0
  137. package/src/stories/utils/orchestrator.js +119 -110
  138. package/src/tests/components/input-number.spec.js +188 -188
  139. package/src/tests/components/loops/roster-loop.json +71 -71
  140. package/src/tests/components/missing-wrapper.spec.js +32 -32
  141. package/src/tests/utils/lib/table/roster.spec.js +25 -25
  142. package/src/tests/utils/to-expose/handler/results/res-input-edited.json +1 -1
  143. package/src/tests/utils/to-expose/init-questionnaire/questionnaire.json +148 -148
  144. package/src/tests/utils/to-expose/init-questionnaire/result.json +181 -181
  145. package/src/utils/components/dragger/dragger.scss +7 -7
  146. package/src/utils/idb-tools/create-db-opener.js +43 -43
  147. package/src/utils/idb-tools/create-open-db.js +25 -25
  148. package/src/utils/idb-tools/idb-bulk-insert.js +96 -96
  149. package/src/utils/idb-tools/index.js +10 -10
  150. package/src/utils/idb-tools/insert-entity.js +15 -15
  151. package/src/utils/idb-tools/open-db.js +13 -13
  152. package/src/utils/idb-tools/open-or-create-db.js +34 -34
  153. package/src/utils/lib/controls/index.js +1 -1
  154. package/src/utils/lib/controls/utils.js +152 -146
  155. package/src/utils/lib/decorator/title-decorator.js +16 -16
  156. package/src/utils/lib/env.js +2 -2
  157. package/src/utils/lib/index.js +21 -20
  158. package/src/utils/lib/input-number.js +1 -1
  159. package/src/utils/lib/options-positioning.js +9 -9
  160. package/src/utils/lib/pagination/navigation/shared.js +256 -256
  161. package/src/utils/lib/prop-types/lines.js +6 -6
  162. package/src/utils/lib/responses.js +11 -11
  163. package/src/utils/lib/splitting.js +142 -0
  164. package/src/utils/lib/style.js +10 -10
  165. package/src/utils/store-tools/auto-load.js +74 -74
  166. package/src/utils/suggester-workers/append-to-index/append.js +25 -25
  167. package/src/utils/suggester-workers/append-to-index/append.worker.js +16 -16
  168. package/src/utils/suggester-workers/append-to-index/create-append-task.js +45 -45
  169. package/src/utils/suggester-workers/append-to-index/index.js +2 -2
  170. package/src/utils/suggester-workers/append-to-index/prepare-entities.js +61 -61
  171. package/src/utils/suggester-workers/append-to-index/store-messages.js +21 -21
  172. package/src/utils/suggester-workers/commons-tokenizer/create-entity-tokenizer.js +56 -54
  173. package/src/utils/suggester-workers/commons-tokenizer/create-fields-tokenizer.js +56 -52
  174. package/src/utils/suggester-workers/commons-tokenizer/create-filter-stop-words.js +17 -17
  175. package/src/utils/suggester-workers/commons-tokenizer/filters/compose-filters.js +10 -10
  176. package/src/utils/suggester-workers/commons-tokenizer/filters/create-filter-stop-words.js +17 -17
  177. package/src/utils/suggester-workers/commons-tokenizer/filters/create-filter-stop-words.spec.js +14 -14
  178. package/src/utils/suggester-workers/commons-tokenizer/filters/{filter-accents-to-lower.js → filter-accents.js} +12 -12
  179. package/src/utils/suggester-workers/commons-tokenizer/filters/{filter-accents-to-lower.spec.js → filter-accents.spec.js} +12 -12
  180. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-double.js +12 -12
  181. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-double.spec.js +20 -20
  182. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-length.js +7 -7
  183. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-length.spec.js +18 -18
  184. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-stemmer.js +13 -13
  185. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-stemmer.spec.js +12 -12
  186. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.js +36 -10
  187. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.spec.js +12 -12
  188. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.js +10 -0
  189. package/src/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.spec.js +12 -0
  190. package/src/utils/suggester-workers/commons-tokenizer/filters/index.js +2 -2
  191. package/src/utils/suggester-workers/commons-tokenizer/filters/stop-words.js +118 -118
  192. package/src/utils/suggester-workers/commons-tokenizer/get-regexp-from-pattern.js +8 -8
  193. package/src/utils/suggester-workers/commons-tokenizer/get-stemmer.js +18 -18
  194. package/src/utils/suggester-workers/commons-tokenizer/index.js +9 -8
  195. package/src/utils/suggester-workers/commons-tokenizer/prepare-string-indexation.js +13 -13
  196. package/src/utils/suggester-workers/commons-tokenizer/soft-tokenizer.js +7 -7
  197. package/src/utils/suggester-workers/create-worker.js +56 -56
  198. package/src/utils/suggester-workers/find-best-label/find-best-label.js +39 -39
  199. package/src/utils/suggester-workers/find-best-label/find-best-label.worker.js +40 -40
  200. package/src/utils/suggester-workers/find-best-label/tokenize.js +30 -30
  201. package/src/utils/suggester-workers/find-best-label/tokenize.spec.js +19 -19
  202. package/src/utils/suggester-workers/searching/compute-score.js +33 -33
  203. package/src/utils/suggester-workers/searching/get-db.js +18 -18
  204. package/src/utils/suggester-workers/searching/index.js +1 -1
  205. package/src/utils/suggester-workers/searching/order/create-alphanumeric-orderer.js +20 -20
  206. package/src/utils/suggester-workers/searching/order/index.js +19 -19
  207. package/src/utils/suggester-workers/searching/query-parser/index.js +2 -2
  208. package/src/utils/suggester-workers/searching/query-parser/query-parser-soft.js +7 -7
  209. package/src/utils/suggester-workers/searching/query-parser/query-parser-soft.spec.js +24 -24
  210. package/src/utils/suggester-workers/searching/query-parser/query-parser-tokenized.js +34 -28
  211. package/src/utils/suggester-workers/searching/resolve-query-parser.js +27 -27
  212. package/src/utils/suggester-workers/searching/search-in-index.js +17 -17
  213. package/src/utils/suggester-workers/searching/searching.js +70 -70
  214. package/src/utils/suggester-workers/searching/searching.worker.js +11 -11
  215. package/src/utils/to-expose/calculated-variables.js +113 -113
  216. package/src/utils/to-expose/handler.js +149 -112
  217. package/src/utils/to-expose/hooks/filter-components.js +27 -12
  218. package/src/utils/to-expose/hooks/index.js +2 -1
  219. package/src/utils/to-expose/hooks/lunatic-split.js +428 -0
  220. package/src/utils/to-expose/hooks/lunatic.js +284 -235
  221. package/src/utils/to-expose/index.js +1 -1
  222. package/src/utils/to-expose/init-questionnaire.js +164 -164
  223. package/src/utils/to-expose/interpret/vtl.js +18 -18
  224. package/src/utils/to-expose/state.js +66 -58
  225. package/src/tests/utils/to-expose/hooks/use-lunatic.spec.js +0 -46
@@ -1,8 +1,8 @@
1
- // see input.scss
2
-
3
- .lunatic-component {
4
- .textarea-lunatic {
5
- height: 3em;
6
- width: 100%;
7
- }
8
- }
1
+ // see input.scss
2
+
3
+ .lunatic-component {
4
+ .textarea-lunatic {
5
+ height: 3em;
6
+ width: 100%;
7
+ }
8
+ }
@@ -1,30 +1,30 @@
1
- // Import index once for bundle
2
- @import 'src/components/index.scss';
3
-
4
- .lunatic-component {
5
- /* Tooltip container */
6
- .tooltip-lunatic {
7
- position: relative;
8
- display: inline-block;
9
- align-items: center;
10
- }
11
-
12
- /* Tooltip text */
13
- .tooltip-lunatic .tooltip-text {
14
- min-width: 10em;
15
- max-width: 20em;
16
- background-color: var(--color-primary-dark);
17
- color: #fff;
18
- padding: 0.5em;
19
- border-radius: 6px;
20
- font-size: 1em;
21
- &.place-left {
22
- &::before {
23
- border-left: 10px solid var(--color-primary-dark);
24
- }
25
- &::after {
26
- content: none;
27
- }
28
- }
29
- }
30
- }
1
+ // Import index once for bundle
2
+ @import 'src/components/index.scss';
3
+
4
+ .lunatic-component {
5
+ /* Tooltip container */
6
+ .tooltip-lunatic {
7
+ position: relative;
8
+ display: inline-block;
9
+ align-items: center;
10
+ }
11
+
12
+ /* Tooltip text */
13
+ .tooltip-lunatic .tooltip-text {
14
+ min-width: 10em;
15
+ max-width: 20em;
16
+ background-color: var(--color-primary-dark);
17
+ color: #fff;
18
+ padding: 0.5em;
19
+ border-radius: 6px;
20
+ font-size: 1em;
21
+ &.place-left {
22
+ &::before {
23
+ border-left: 10px solid var(--color-primary-dark);
24
+ }
25
+ &::after {
26
+ content: none;
27
+ }
28
+ }
29
+ }
30
+ }
@@ -1,21 +1,21 @@
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
- <div className="lunatic-component">
19
- <Breadcrumb id="default" elements={elements} />
20
- </div>
21
- ));
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
+ <div className="lunatic-component">
19
+ <Breadcrumb id="default" elements={elements} />
20
+ </div>
21
+ ));
@@ -1,78 +1,78 @@
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
- "missingResponse": {
12
- "name": "READY_MISSING"
13
- }
14
- },
15
- {
16
- "id": "2",
17
- "componentType": "CheckboxBoolean",
18
- "mandatory": false,
19
- "label": "➡ 2. Are you always ready?",
20
- "response": {
21
- "name": "READY2"
22
- },
23
- "missingResponse": {
24
- "name": "READY2_MISSING"
25
- }
26
- }
27
- ],
28
- "variables": [
29
- {
30
- "variableType": "COLLECTED",
31
- "name": "READY",
32
- "componentRef": "1",
33
- "values": {
34
- "PREVIOUS": null,
35
- "COLLECTED": null,
36
- "FORCED": null,
37
- "EDITED": null,
38
- "INPUTED": null
39
- }
40
- },
41
- {
42
- "variableType": "COLLECTED",
43
- "name": "READY_MISSING",
44
- "componentRef": "1",
45
- "values": {
46
- "PREVIOUS": null,
47
- "COLLECTED": null,
48
- "FORCED": null,
49
- "EDITED": null,
50
- "INPUTED": null
51
- }
52
- },
53
- {
54
- "variableType": "COLLECTED",
55
- "name": "READY2",
56
- "componentRef": "2",
57
- "values": {
58
- "PREVIOUS": null,
59
- "COLLECTED": true,
60
- "FORCED": null,
61
- "EDITED": null,
62
- "INPUTED": null
63
- }
64
- },
65
- {
66
- "variableType": "COLLECTED",
67
- "name": "READY2_MISSING",
68
- "componentRef": "2",
69
- "values": {
70
- "PREVIOUS": null,
71
- "COLLECTED": null,
72
- "FORCED": null,
73
- "EDITED": null,
74
- "INPUTED": null
75
- }
76
- }
77
- ]
78
- }
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
+ "missingResponse": {
12
+ "name": "READY_MISSING"
13
+ }
14
+ },
15
+ {
16
+ "id": "2",
17
+ "componentType": "CheckboxBoolean",
18
+ "mandatory": false,
19
+ "label": "➡ 2. Are you always ready?",
20
+ "response": {
21
+ "name": "READY2"
22
+ },
23
+ "missingResponse": {
24
+ "name": "READY2_MISSING"
25
+ }
26
+ }
27
+ ],
28
+ "variables": [
29
+ {
30
+ "variableType": "COLLECTED",
31
+ "name": "READY",
32
+ "componentRef": "1",
33
+ "values": {
34
+ "PREVIOUS": null,
35
+ "COLLECTED": null,
36
+ "FORCED": null,
37
+ "EDITED": null,
38
+ "INPUTED": null
39
+ }
40
+ },
41
+ {
42
+ "variableType": "COLLECTED",
43
+ "name": "READY_MISSING",
44
+ "componentRef": "1",
45
+ "values": {
46
+ "PREVIOUS": null,
47
+ "COLLECTED": null,
48
+ "FORCED": null,
49
+ "EDITED": null,
50
+ "INPUTED": null
51
+ }
52
+ },
53
+ {
54
+ "variableType": "COLLECTED",
55
+ "name": "READY2",
56
+ "componentRef": "2",
57
+ "values": {
58
+ "PREVIOUS": null,
59
+ "COLLECTED": true,
60
+ "FORCED": null,
61
+ "EDITED": null,
62
+ "INPUTED": null
63
+ }
64
+ },
65
+ {
66
+ "variableType": "COLLECTED",
67
+ "name": "READY2_MISSING",
68
+ "componentRef": "2",
69
+ "values": {
70
+ "PREVIOUS": null,
71
+ "COLLECTED": null,
72
+ "FORCED": null,
73
+ "EDITED": null,
74
+ "INPUTED": null
75
+ }
76
+ }
77
+ ]
78
+ }
@@ -1,45 +1,45 @@
1
- {
2
- "components": [
3
- {
4
- "id": "j334cyqb",
5
- "componentType": "Datepicker",
6
- "mandatory": false,
7
- "label": "➡ 5. When was the first episode of the Simpsons?",
8
- "response": {
9
- "name": "DATEFIRST"
10
- },
11
- "dateFormat": "jj/mm/aaaa",
12
- "missingResponse": {
13
- "name": "DATEFIRST_MISSING"
14
- },
15
- "min": "1900-01-01",
16
- "max": "2099-12-31"
17
- }
18
- ],
19
- "variables": [
20
- {
21
- "variableType": "COLLECTED",
22
- "name": "DATEFIRST",
23
- "componentRef": "j334cyqb",
24
- "values": {
25
- "PREVIOUS": null,
26
- "COLLECTED": "2000-07-12",
27
- "FORCED": "1989-12-17",
28
- "EDITED": null,
29
- "INPUTED": null
30
- }
31
- },
32
- {
33
- "variableType": "COLLECTED",
34
- "name": "DATEFIRST_MISSING",
35
- "componentRef": "j334cyqb",
36
- "values": {
37
- "PREVIOUS": null,
38
- "COLLECTED": null,
39
- "FORCED": null,
40
- "EDITED": null,
41
- "INPUTED": null
42
- }
43
- }
44
- ]
45
- }
1
+ {
2
+ "components": [
3
+ {
4
+ "id": "j334cyqb",
5
+ "componentType": "Datepicker",
6
+ "mandatory": false,
7
+ "label": "➡ 5. When was the first episode of the Simpsons?",
8
+ "response": {
9
+ "name": "DATEFIRST"
10
+ },
11
+ "dateFormat": "jj/mm/aaaa",
12
+ "missingResponse": {
13
+ "name": "DATEFIRST_MISSING"
14
+ },
15
+ "min": "1900-01-01",
16
+ "max": "2099-12-31"
17
+ }
18
+ ],
19
+ "variables": [
20
+ {
21
+ "variableType": "COLLECTED",
22
+ "name": "DATEFIRST",
23
+ "componentRef": "j334cyqb",
24
+ "values": {
25
+ "PREVIOUS": null,
26
+ "COLLECTED": "2000-07-12",
27
+ "FORCED": "1989-12-17",
28
+ "EDITED": null,
29
+ "INPUTED": null
30
+ }
31
+ },
32
+ {
33
+ "variableType": "COLLECTED",
34
+ "name": "DATEFIRST_MISSING",
35
+ "componentRef": "j334cyqb",
36
+ "values": {
37
+ "PREVIOUS": null,
38
+ "COLLECTED": null,
39
+ "FORCED": null,
40
+ "EDITED": null,
41
+ "INPUTED": null
42
+ }
43
+ }
44
+ ]
45
+ }
@@ -1,116 +1,116 @@
1
- import React from 'react';
2
- import { storiesOf } from '@storybook/react';
3
- import { withReadme } from 'storybook-readme';
4
- import { Declarations } from 'components';
5
- import readme from './README.md';
6
- import { titleDecorator } from 'utils/lib';
7
- import * as C from '../../constants';
8
- import { featuresOptions } from '../utils/options';
9
- import { object, select } from '@storybook/addon-knobs/react';
10
-
11
- const stories = storiesOf('Declarations', module)
12
- .addDecorator(withReadme(readme))
13
- .addDecorator((Component) => {
14
- const WrappedComponent = titleDecorator(Component);
15
- return <WrappedComponent title="<Declarations />" />;
16
- });
17
-
18
- stories.addWithJSX('Default', () => (
19
- <div className="lunatic-component">
20
- <Declarations
21
- id="default"
22
- type={C.BEFORE_QUESTION_TEXT}
23
- declarations={declarations}
24
- />
25
- </div>
26
- ));
27
-
28
- stories.addWithJSX('Props', () => (
29
- <div className="lunatic-component">
30
- <Declarations
31
- id="default"
32
- type={C.BEFORE_QUESTION_TEXT}
33
- declarations={declarationsVtl}
34
- features={select('Features', featuresOptions, ['VTL', 'MD'])}
35
- bindings={object('Bindings', { test: 'test' })}
36
- />
37
- </div>
38
- ));
39
-
40
- const declarations = [
41
- {
42
- id: '1',
43
- label: "I'm the label of the instruction declaration",
44
- position: C.BEFORE_QUESTION_TEXT,
45
- declarationType: C.INSTRUCTION,
46
- },
47
- {
48
- id: '2',
49
- label: "I'm the label of the comment declaration",
50
- position: C.BEFORE_QUESTION_TEXT,
51
- declarationType: C.COMMENT,
52
- },
53
- {
54
- id: '3',
55
- label: "I'm the label of the help declaration",
56
- position: C.BEFORE_QUESTION_TEXT,
57
- declarationType: C.HELP,
58
- },
59
- {
60
- id: '4',
61
- label: "I'm the label of the warning declaration",
62
- position: C.BEFORE_QUESTION_TEXT,
63
- declarationType: C.WARNING,
64
- },
65
- {
66
- id: '5',
67
- label: "I'm the label of the message filter declaration",
68
- position: C.BEFORE_QUESTION_TEXT,
69
- declarationType: C.MESSAGE_FILTER,
70
- },
71
- {
72
- id: '6',
73
- label: "I'm the label of the statement declaration",
74
- position: C.BEFORE_QUESTION_TEXT,
75
- declarationType: C.STATEMENT,
76
- },
77
- ];
78
-
79
- const declarationsVtl = [
80
- {
81
- id: '1',
82
- label: '"I\'m the label of the instruction declaration"',
83
- position: C.BEFORE_QUESTION_TEXT,
84
- declarationType: C.INSTRUCTION,
85
- },
86
- {
87
- id: '2',
88
- label: '"I\'m the label of the comment declaration"',
89
- position: C.BEFORE_QUESTION_TEXT,
90
- declarationType: C.COMMENT,
91
- },
92
- {
93
- id: '3',
94
- label: '"I\'m the label of the help declaration"',
95
- position: C.BEFORE_QUESTION_TEXT,
96
- declarationType: C.HELP,
97
- },
98
- {
99
- id: '4',
100
- label: '"I\'m the label of the warning declaration"',
101
- position: C.BEFORE_QUESTION_TEXT,
102
- declarationType: C.WARNING,
103
- },
104
- {
105
- id: '5',
106
- label: '"I\'m the label of the message filter declaration"',
107
- position: C.BEFORE_QUESTION_TEXT,
108
- declarationType: C.MESSAGE_FILTER,
109
- },
110
- {
111
- id: '6',
112
- label: '"I\'m the label of the statement declaration"',
113
- position: C.BEFORE_QUESTION_TEXT,
114
- declarationType: C.STATEMENT,
115
- },
116
- ];
1
+ import React from 'react';
2
+ import { storiesOf } from '@storybook/react';
3
+ import { withReadme } from 'storybook-readme';
4
+ import { Declarations } from 'components';
5
+ import readme from './README.md';
6
+ import { titleDecorator } from 'utils/lib';
7
+ import * as C from '../../constants';
8
+ import { featuresOptions } from '../utils/options';
9
+ import { object, select } from '@storybook/addon-knobs/react';
10
+
11
+ const stories = storiesOf('Declarations', module)
12
+ .addDecorator(withReadme(readme))
13
+ .addDecorator((Component) => {
14
+ const WrappedComponent = titleDecorator(Component);
15
+ return <WrappedComponent title="<Declarations />" />;
16
+ });
17
+
18
+ stories.addWithJSX('Default', () => (
19
+ <div className="lunatic-component">
20
+ <Declarations
21
+ id="default"
22
+ type={C.BEFORE_QUESTION_TEXT}
23
+ declarations={declarations}
24
+ />
25
+ </div>
26
+ ));
27
+
28
+ stories.addWithJSX('Props', () => (
29
+ <div className="lunatic-component">
30
+ <Declarations
31
+ id="default"
32
+ type={C.BEFORE_QUESTION_TEXT}
33
+ declarations={declarationsVtl}
34
+ features={select('Features', featuresOptions, ['VTL', 'MD'])}
35
+ bindings={object('Bindings', { test: 'test' })}
36
+ />
37
+ </div>
38
+ ));
39
+
40
+ const declarations = [
41
+ {
42
+ id: '1',
43
+ label: "I'm the label of the instruction declaration",
44
+ position: C.BEFORE_QUESTION_TEXT,
45
+ declarationType: C.INSTRUCTION,
46
+ },
47
+ {
48
+ id: '2',
49
+ label: "I'm the label of the comment declaration",
50
+ position: C.BEFORE_QUESTION_TEXT,
51
+ declarationType: C.COMMENT,
52
+ },
53
+ {
54
+ id: '3',
55
+ label: "I'm the label of the help declaration",
56
+ position: C.BEFORE_QUESTION_TEXT,
57
+ declarationType: C.HELP,
58
+ },
59
+ {
60
+ id: '4',
61
+ label: "I'm the label of the warning declaration",
62
+ position: C.BEFORE_QUESTION_TEXT,
63
+ declarationType: C.WARNING,
64
+ },
65
+ {
66
+ id: '5',
67
+ label: "I'm the label of the message filter declaration",
68
+ position: C.BEFORE_QUESTION_TEXT,
69
+ declarationType: C.MESSAGE_FILTER,
70
+ },
71
+ {
72
+ id: '6',
73
+ label: "I'm the label of the statement declaration",
74
+ position: C.BEFORE_QUESTION_TEXT,
75
+ declarationType: C.STATEMENT,
76
+ },
77
+ ];
78
+
79
+ const declarationsVtl = [
80
+ {
81
+ id: '1',
82
+ label: '"I\'m the label of the instruction declaration"',
83
+ position: C.BEFORE_QUESTION_TEXT,
84
+ declarationType: C.INSTRUCTION,
85
+ },
86
+ {
87
+ id: '2',
88
+ label: '"I\'m the label of the comment declaration"',
89
+ position: C.BEFORE_QUESTION_TEXT,
90
+ declarationType: C.COMMENT,
91
+ },
92
+ {
93
+ id: '3',
94
+ label: '"I\'m the label of the help declaration"',
95
+ position: C.BEFORE_QUESTION_TEXT,
96
+ declarationType: C.HELP,
97
+ },
98
+ {
99
+ id: '4',
100
+ label: '"I\'m the label of the warning declaration"',
101
+ position: C.BEFORE_QUESTION_TEXT,
102
+ declarationType: C.WARNING,
103
+ },
104
+ {
105
+ id: '5',
106
+ label: '"I\'m the label of the message filter declaration"',
107
+ position: C.BEFORE_QUESTION_TEXT,
108
+ declarationType: C.MESSAGE_FILTER,
109
+ },
110
+ {
111
+ id: '6',
112
+ label: '"I\'m the label of the statement declaration"',
113
+ position: C.BEFORE_QUESTION_TEXT,
114
+ declarationType: C.STATEMENT,
115
+ },
116
+ ];