@inseefr/lunatic 0.1.0-hackathon → 0.1.0-v2
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.
- package/lib/index.js +1433 -835
- package/lib/index.js.map +1 -1
- package/package.json +11 -8
- package/src/components/breadcrumb/component.js +29 -29
- package/src/components/button/index.js +1 -1
- package/src/components/button/lunatic-button.js +32 -0
- package/src/components/checkbox/checkbox-boolean/index.js +1 -0
- package/src/components/checkbox/checkbox-boolean/lunatic-checkbox-boolean.js +44 -0
- package/src/components/checkbox/checkbox-group/checkbox-group.js +78 -0
- package/src/components/checkbox/checkbox-group/checkbox-option.js +46 -0
- package/src/components/checkbox/checkbox-group/index.js +1 -0
- package/src/components/checkbox/checkbox-group/lunatic-checkbox-group.js +32 -0
- package/src/components/checkbox/checkbox-one/index.js +1 -0
- package/src/components/checkbox/checkbox-one/lunatic-checkbox-one.js +7 -0
- package/src/components/checkbox/checkbox.scss +1 -73
- package/src/components/checkbox/commons/checkbox-option.js +49 -0
- package/src/components/checkbox/commons/index.js +1 -0
- package/src/components/checkbox/index.js +3 -3
- package/src/components/commons/components/field-container/field-container.js +28 -0
- package/src/components/commons/components/field-container/field-container.scss +0 -0
- package/src/components/commons/components/field-container/index.js +1 -0
- package/src/components/commons/components/fieldset.js +12 -0
- package/src/components/commons/components/input-container.js +30 -0
- package/src/components/commons/components/label.js +14 -0
- package/src/components/commons/components/lunatic-field.js +35 -0
- package/src/components/commons/create-customizable-field.js +13 -0
- package/src/components/commons/index.js +9 -0
- package/src/components/commons/use-on-handle-change.js +16 -0
- package/src/components/commons/use-options-keydown.js +22 -0
- package/src/components/commons/use-previous.js +11 -0
- package/src/components/component-wrapper/controls/component.js +70 -0
- package/src/components/component-wrapper/controls/controls.scss +6 -0
- package/src/components/component-wrapper/controls/index.js +1 -0
- package/src/components/component-wrapper/controls/validators/datepicker.js +33 -0
- package/src/components/component-wrapper/controls/validators/index.js +16 -0
- package/src/components/component-wrapper/controls/validators/input-number.js +23 -0
- package/src/components/{missing-wrapper → component-wrapper}/index.js +1 -1
- package/src/components/{missing-wrapper → component-wrapper/missing}/component.js +72 -12
- package/src/components/component-wrapper/missing/index.js +1 -0
- package/src/components/{missing-wrapper → component-wrapper/missing}/missing.scss +0 -0
- package/src/components/component-wrapper/wrapper.js +23 -0
- package/src/components/components.js +22 -18
- package/src/components/datepicker/datepicker.js +25 -0
- package/src/components/datepicker/index.js +1 -1
- package/src/components/datepicker/lunatic-datepicker.js +50 -0
- package/src/components/declarations/declaration.js +11 -0
- package/src/components/declarations/declarations-after-text.js +8 -0
- package/src/components/declarations/declarations-before-text.js +8 -0
- package/src/components/declarations/declarations-detachable.js +8 -0
- package/src/components/declarations/declarations.js +35 -0
- package/src/components/declarations/index.js +4 -1
- package/src/components/declarations/wrappers/input-declarations-wrapper.js +40 -12
- package/src/components/declarations/wrappers/list-declarations-wrapper.js +235 -232
- package/src/components/dropdown/commons/actions.js +40 -31
- package/src/components/dropdown/commons/components/panel.js +78 -78
- package/src/components/dropdown/commons/reducer.js +152 -149
- package/src/components/dropdown/component.js +121 -115
- package/src/components/dropdown/dropdown-edit/dropdown-edit.js +6 -0
- package/src/components/dropdown/dropdown-simple/dropdown.js +8 -1
- package/src/components/filter-description/component.js +48 -42
- package/src/components/icon/component.js +31 -33
- package/src/components/index.scss +5 -3
- package/src/components/input/index.js +1 -2
- package/src/components/input/input.js +45 -9
- package/src/components/input/input.scss +0 -6
- package/src/components/input/lunatic-input.js +53 -0
- package/src/components/input-number/index.js +1 -0
- package/src/components/input-number/input-number.js +38 -0
- package/src/components/input-number/input-number.scss +0 -0
- package/src/components/input-number/lunatic-input-number.js +50 -0
- package/src/components/loop/{component.js → _old/component.js} +1 -0
- package/src/components/loop/{loop.scss → _old/loop.scss} +0 -0
- package/src/components/loop/{wrapper.js → _old/wrapper.js} +15 -15
- package/src/components/loop/block-for-loop/block-for-loop-ochestrator.js +6 -0
- package/src/components/loop/block-for-loop/block-for-loop.js +91 -0
- package/src/components/loop/block-for-loop/index.js +1 -0
- package/src/components/loop/block-for-loop/row.js +52 -0
- package/src/components/loop/commons/create-loop-orchestrator.js +36 -0
- package/src/components/loop/commons/index.js +2 -0
- package/src/components/loop/commons/row-component.js +52 -0
- package/src/components/loop/index.js +1 -1
- package/src/components/loop/loop.js +78 -0
- package/src/components/loop/roster-for-loop/add-row-button.js +12 -0
- package/src/components/loop/roster-for-loop/body.js +44 -0
- package/src/components/loop/roster-for-loop/header.js +25 -0
- package/src/components/loop/roster-for-loop/html-table/table.js +11 -0
- package/src/components/loop/roster-for-loop/html-table/tbody.js +11 -0
- package/src/components/loop/roster-for-loop/html-table/td.js +14 -0
- package/src/components/loop/roster-for-loop/html-table/th.js +11 -0
- package/src/components/loop/roster-for-loop/html-table/thead.js +11 -0
- package/src/components/loop/roster-for-loop/html-table/tr.js +11 -0
- package/src/components/loop/roster-for-loop/index.js +1 -0
- package/src/components/loop/roster-for-loop/roster-for-loop-orchestrator.js +6 -0
- package/src/components/loop/roster-for-loop/roster-for-loop.js +90 -0
- package/src/components/loop/roster-for-loop/roster-table.js +39 -0
- package/src/components/loop/roster-for-loop/roster.scss +42 -0
- package/src/components/loop/roster-for-loop/row.js +65 -0
- package/src/components/loop-constructor/block/component.js +2 -2
- package/src/components/loop-constructor/block/index.js +1 -1
- package/src/components/loop-constructor/index.js +1 -1
- package/src/components/loop-constructor/roster/component.js +2 -2
- package/src/components/loop-constructor/roster/index.js +1 -1
- package/src/components/loop-constructor/wrapper/body-component.js +6 -0
- package/src/components/loop-constructor/wrapper/build-components.js +33 -33
- package/src/components/loop-constructor/wrapper/index.js +1 -1
- package/src/components/modal/component.js +42 -0
- package/src/components/modal/index.js +1 -0
- package/src/components/modal/modal.scss +33 -0
- package/src/components/radio/index.js +1 -1
- package/src/components/radio/lunatic-radio-group.js +45 -0
- package/src/components/radio/radio-group.js +33 -0
- package/src/components/radio/radio-option.js +87 -0
- package/src/components/radio/radio.scss +52 -52
- package/src/components/sequence/index.js +1 -1
- package/src/components/sequence/sequence.js +75 -0
- package/src/components/subsequence/index.js +1 -1
- package/src/components/subsequence/subsequence.js +73 -0
- package/src/components/suggester/check-store.js +70 -70
- package/src/components/suggester/components/panel/option-container.js +11 -10
- package/src/components/suggester/components/panel/panel.js +20 -6
- package/src/components/suggester/components/selection/label.js +7 -6
- package/src/components/suggester/components/selection/selection.js +36 -11
- package/src/components/suggester/components/suggester-content.js +35 -42
- package/src/components/suggester/components/suggester.js +45 -26
- package/src/components/suggester/{components/create-on-keydown-callback.js → create-on-keydown-callback.js} +28 -28
- package/src/components/suggester/find-best-label/find-best-label.js +3 -1
- package/src/components/suggester/idb-suggester.js +2 -1
- package/src/components/suggester/lunatic-suggester.js +48 -96
- package/src/components/suggester/searching/create-searching.js +3 -1
- package/src/components/suggester/suggester-wrapper.js +75 -9
- package/src/components/switch/index.js +1 -0
- package/src/components/switch/lunatic-switch.js +49 -0
- package/src/components/switch/switch.js +72 -0
- package/src/components/switch/switch.scss +47 -0
- package/src/components/table/table.js +164 -158
- package/src/components/textarea/component.js +11 -5
- package/src/components/tooltip/response.js +58 -52
- package/src/stories/checkbox-boolean/data-forced.json +48 -48
- package/src/stories/checkbox-group/data-vtl.json +102 -102
- package/src/stories/cleaning/cleaning.stories.js +39 -0
- package/src/stories/cleaning/simple-loop.json +911 -0
- package/src/stories/cleaning/simpsons.json +5839 -0
- package/src/stories/datepicker/data.json +45 -43
- package/src/stories/declarations/declarations.stories.js +20 -13
- package/src/stories/icons/icons.stories.js +24 -16
- package/src/stories/loop-constructor/README.md +27 -27
- package/src/stories/loop-constructor/data-input-forced.json +64 -64
- package/src/stories/loop-constructor/data-input.json +100 -100
- package/src/stories/loop-constructor/data-loop-forced.json +66 -66
- package/src/stories/loop-constructor/data-loop-static-forced.json +66 -66
- package/src/stories/loop-constructor/data-loop-static.json +81 -81
- package/src/stories/loop-constructor/data-loop.json +81 -81
- package/src/stories/loop-constructor/data-roster-forced.json +68 -68
- package/src/stories/loop-constructor/data-roster.json +83 -83
- package/src/stories/loop-constructor/loop-constructor.stories.js +180 -180
- package/src/stories/questionnaire/logement-queen.json +23234 -0
- package/src/stories/questionnaire/logement.json +22068 -26812
- package/src/stories/questionnaire/questionnaire.stories.js +86 -29
- package/src/stories/questionnaire/update-external/data.json +1 -0
- package/src/stories/questionnaire/update-external/questionnaire.json +75 -0
- package/src/stories/suggester/bailleurs-sociaux-2021/fetch-bailleurs.js +12 -0
- package/src/stories/suggester/bailleurs-sociaux-2021/index.js +1 -0
- package/src/stories/suggester/data-auto.json +1 -0
- package/src/stories/suggester/data.json +35 -2
- package/src/stories/suggester/lunatic-suggester-mui.scss +27 -0
- package/src/stories/suggester/suggester-material-ui.js +148 -0
- package/src/stories/suggester/suggester-workers.stories.js +48 -1
- package/src/stories/suggester/suggester.stories.js +27 -1
- package/src/stories/switch/README.md +31 -0
- package/src/stories/switch/SwitchMaterialUI.js +35 -0
- package/src/stories/switch/data-forced.json +48 -0
- package/src/stories/switch/data.json +80 -0
- package/src/stories/switch/switch.stories.js +78 -0
- package/src/stories/utils/custom-lunatic.scss +28 -23
- package/src/stories/utils/orchestrator.js +151 -58
- package/src/stories/utils/waiting/index.js +1 -0
- package/src/stories/utils/waiting/preloader.svg +1 -0
- package/src/stories/utils/waiting/waiting.js +21 -0
- package/src/stories/utils/waiting/waiting.scss +21 -0
- package/src/tests/sample.spec.js +5 -0
- package/src/utils/icons/checkbox-checked.icon.js +25 -0
- package/src/utils/icons/checkbox-unchecked.icon.js +25 -0
- package/src/utils/icons/radio-checked.icon.js +25 -0
- package/src/utils/icons/radio-unchecked.icon.js +25 -0
- package/src/utils/lib/controls/index.js +1 -0
- package/src/utils/lib/controls/utils.js +146 -0
- package/src/utils/lib/index.js +20 -19
- package/src/utils/lib/pagination/navigation/shared.js +7 -4
- package/src/utils/lib/responses.js +9 -7
- package/src/utils/lib/tooltip/build-response.js +53 -41
- package/src/utils/store-tools/auto-load.js +2 -1
- package/src/utils/store-tools/create/index.js +2 -1
- package/src/utils/store-tools/create/update-store-info.js +26 -26
- package/src/utils/store-tools/index.js +7 -5
- package/src/utils/suggester-workers/append-to-index/create-append-task.js +3 -1
- package/src/utils/suggester-workers/commons-tokenizer/create-entity-tokenizer.js +56 -0
- package/src/utils/suggester-workers/commons-tokenizer/create-fields-tokenizer.js +56 -0
- package/src/utils/suggester-workers/commons-tokenizer/create-filter-stop-words.js +11 -11
- package/src/utils/suggester-workers/commons-tokenizer/filters/compose-filters.js +10 -0
- package/src/utils/suggester-workers/commons-tokenizer/filters/create-filter-stop-words.js +17 -0
- package/src/utils/suggester-workers/commons-tokenizer/filters/create-filter-stop-words.spec.js +14 -0
- package/src/utils/suggester-workers/commons-tokenizer/filters/filter-accents.js +12 -0
- package/src/utils/suggester-workers/commons-tokenizer/filters/filter-accents.spec.js +12 -0
- package/src/utils/suggester-workers/commons-tokenizer/{filter-double.js → filters/filter-double.js} +0 -0
- package/src/utils/suggester-workers/commons-tokenizer/filters/filter-double.spec.js +20 -0
- package/src/utils/suggester-workers/commons-tokenizer/{filter-length.js → filters/filter-length.js} +0 -0
- package/src/utils/suggester-workers/commons-tokenizer/filters/filter-length.spec.js +18 -0
- package/src/utils/suggester-workers/commons-tokenizer/{filter-stemmer.js → filters/filter-stemmer.js} +2 -2
- package/src/utils/suggester-workers/commons-tokenizer/filters/filter-stemmer.spec.js +12 -0
- package/src/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.js +36 -0
- package/src/utils/suggester-workers/commons-tokenizer/filters/filter-synonyms.spec.js +12 -0
- package/src/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.js +10 -0
- package/src/utils/suggester-workers/commons-tokenizer/filters/filter-to-lower.spec.js +12 -0
- package/src/utils/suggester-workers/commons-tokenizer/filters/index.js +2 -0
- package/src/utils/suggester-workers/commons-tokenizer/{stop-words.js → filters/stop-words.js} +0 -0
- package/src/utils/suggester-workers/commons-tokenizer/index.js +6 -5
- package/src/utils/suggester-workers/commons-tokenizer/prepare-string-indexation.js +7 -3
- package/src/utils/suggester-workers/commons-tokenizer/soft-tokenizer.js +1 -1
- package/src/utils/suggester-workers/create-worker.js +55 -0
- package/src/utils/suggester-workers/find-best-label/tokenize.js +2 -5
- package/src/utils/suggester-workers/{query-parser → searching/query-parser}/index.js +0 -0
- package/src/utils/suggester-workers/searching/query-parser/query-parser-soft.js +7 -0
- package/src/utils/suggester-workers/{query-parser → searching/query-parser}/query-parser-soft.spec.js +0 -0
- package/src/utils/suggester-workers/searching/query-parser/query-parser-tokenized.js +34 -0
- package/src/utils/suggester-workers/searching/resolve-query-parser.js +2 -2
- package/src/utils/suggester-workers/searching/searching.js +2 -2
- package/src/utils/to-expose/{calculated-variables.js → _old/calculated-variables.js} +0 -0
- package/src/utils/to-expose/{handler.js → _old/handler.js} +22 -0
- package/src/utils/to-expose/{init-questionnaire.js → _old/init-questionnaire.js} +0 -0
- package/src/utils/to-expose/{state.js → _old/state.js} +13 -14
- package/src/utils/to-expose/hooks/filter-components.js +106 -106
- package/src/utils/to-expose/hooks/index.js +1 -1
- package/src/utils/to-expose/hooks/lunatic.js +68 -7
- package/src/utils/to-expose/hooks/use-lunatic/actions.js +23 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/check-loops.js +61 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/create-map-pages.js +69 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/execute-condition-filter.js +16 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/execute-expression/create-execute-expression.js +182 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/execute-expression/create-memoizer.js +42 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/execute-expression/create-refresh-calculated.js +50 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/execute-expression/execute-expression.js +60 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/execute-expression/get-expressions-variables.js +22 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/execute-expression/index.js +1 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/fill-component-expressions.js +113 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/fill-components.js +31 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/get-compatible-vtl-expression.js +14 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/get-component-value/get-component-value.js +161 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/get-component-value/index.js +1 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/get-components-from-state.js +24 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/get-page-tag.js +10 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/index.js +12 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/is-First-last-page.js +8 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/is-paginated-loop.js +6 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/load-suggesters.js +59 -0
- package/src/utils/to-expose/hooks/use-lunatic/commons/use-components-from-state.js +20 -0
- package/src/utils/to-expose/hooks/use-lunatic/index.js +1 -0
- package/src/utils/to-expose/hooks/use-lunatic/initial-state.js +22 -0
- package/src/utils/to-expose/hooks/use-lunatic/reducer/commons/index.js +3 -0
- package/src/utils/to-expose/hooks/use-lunatic/reducer/commons/is-empty-on-empty-page.js +29 -0
- package/src/utils/to-expose/hooks/use-lunatic/reducer/commons/resize-array-variable.js +26 -0
- package/src/utils/to-expose/hooks/use-lunatic/reducer/commons/validate-loop-condition-filter.js +20 -0
- package/src/utils/to-expose/hooks/use-lunatic/reducer/index.js +1 -0
- package/src/utils/to-expose/hooks/use-lunatic/reducer/reduce-go-next-page.js +129 -0
- package/src/utils/to-expose/hooks/use-lunatic/reducer/reduce-go-previous-page.js +131 -0
- package/src/utils/to-expose/hooks/use-lunatic/reducer/reduce-handle-change/index.js +1 -0
- package/src/utils/to-expose/hooks/use-lunatic/reducer/reduce-handle-change/reduce-handle-change.js +69 -0
- package/src/utils/to-expose/hooks/use-lunatic/reducer/reduce-handle-change/reduce-variables-array.js +22 -0
- package/src/utils/to-expose/hooks/use-lunatic/reducer/reduce-handle-change/reduce-variables-simple.js +13 -0
- package/src/utils/to-expose/hooks/use-lunatic/reducer/reduce-on-init.js +166 -0
- package/src/utils/to-expose/hooks/use-lunatic/reducer/reduce-on-set-waiting.js +7 -0
- package/src/utils/to-expose/hooks/use-lunatic/reducer/reducer.js +26 -0
- package/src/utils/to-expose/hooks/use-lunatic/use-lunatic.js +79 -0
- package/src/utils/to-expose/index.js +16 -11
- package/src/components/button/component.js +0 -53
- package/src/components/checkbox/boolean.js +0 -172
- package/src/components/checkbox/group.js +0 -231
- package/src/components/checkbox/one.js +0 -11
- package/src/components/datepicker/component.js +0 -11
- package/src/components/input/input-number.js +0 -54
- package/src/components/missing-wrapper/wrapper.js +0 -10
- package/src/components/radio/component.js +0 -9
- package/src/components/sequence/component.js +0 -50
- package/src/components/subsequence/component.js +0 -49
- package/src/tests/components/breadcrumb.spec.js +0 -13
- package/src/tests/components/button.spec.js +0 -11
- package/src/tests/components/checkbox-boolean.spec.js +0 -45
- package/src/tests/components/checkbox-group.spec.js +0 -53
- package/src/tests/components/checkbox-one.spec.js +0 -32
- package/src/tests/components/datepicker.spec.js +0 -22
- package/src/tests/components/declarations-wrappers/input-declarations-wrapper.spec.js +0 -67
- package/src/tests/components/declarations-wrappers/list-declarations-wrapper.spec.js +0 -52
- package/src/tests/components/declarations-wrappers/simple-declarations-wrapper.spec.js +0 -21
- package/src/tests/components/declarations.spec.js +0 -46
- package/src/tests/components/input-number.spec.js +0 -194
- package/src/tests/components/input.spec.js +0 -18
- package/src/tests/components/loops/loop-static.json +0 -66
- package/src/tests/components/loops/loop.json +0 -258
- package/src/tests/components/loops/loop.spec.js +0 -30
- package/src/tests/components/loops/roster-for-loop.spec.js +0 -18
- package/src/tests/components/loops/roster-loop.json +0 -71
- package/src/tests/components/missing-wrapper.spec.js +0 -33
- package/src/tests/components/progress-bar.spec.js +0 -15
- package/src/tests/components/radio.spec.js +0 -27
- package/src/tests/components/sequence.spec.js +0 -9
- package/src/tests/components/subsequence.spec.js +0 -9
- package/src/tests/components/table.spec.js +0 -11
- package/src/tests/components/textarea.spec.js +0 -18
- package/src/tests/components/tooltip.spec.js +0 -25
- package/src/tests/setup/setupTests.js +0 -4
- package/src/tests/utils/lib/alphabet.spec.js +0 -36
- package/src/tests/utils/lib/array.spec.js +0 -22
- package/src/tests/utils/lib/checkbox/group.spec.js +0 -72
- package/src/tests/utils/lib/decorator/title-decorator.spec.js +0 -12
- package/src/tests/utils/lib/input-number.spec.js +0 -18
- package/src/tests/utils/lib/items-positioning.spec.js +0 -17
- package/src/tests/utils/lib/label-position.spec.js +0 -22
- package/src/tests/utils/lib/loops/bindings.spec.js +0 -75
- package/src/tests/utils/lib/loops/shared.spec.js +0 -82
- package/src/tests/utils/lib/missing/missing.spec.js +0 -74
- package/src/tests/utils/lib/missing/mock.js +0 -137
- package/src/tests/utils/lib/pagination/shared.spec.js +0 -42
- package/src/tests/utils/lib/responses.spec.js +0 -64
- package/src/tests/utils/lib/style.spec.js +0 -26
- package/src/tests/utils/lib/table/roster.spec.js +0 -25
- package/src/tests/utils/lib/tooltip/build-response.spec.js +0 -95
- package/src/tests/utils/lib/tooltip/content.spec.js +0 -109
- package/src/tests/utils/to-expose/handler/handler.spec.js +0 -94
- package/src/tests/utils/to-expose/handler/questionnaire.json +0 -158
- package/src/tests/utils/to-expose/handler/results/index.js +0 -6
- package/src/tests/utils/to-expose/handler/results/res-double.json +0 -158
- package/src/tests/utils/to-expose/handler/results/res-input-collected.json +0 -158
- package/src/tests/utils/to-expose/handler/results/res-input-edited.json +0 -158
- package/src/tests/utils/to-expose/handler/results/res-loop.json +0 -158
- package/src/tests/utils/to-expose/handler/results/res-matrix.json +0 -158
- package/src/tests/utils/to-expose/handler/results/res-responses.json +0 -158
- package/src/tests/utils/to-expose/hooks/use-lunatic.spec.js +0 -46
- package/src/tests/utils/to-expose/init-questionnaire/data.json +0 -12
- package/src/tests/utils/to-expose/init-questionnaire/init-questionnaire.spec.js +0 -19
- package/src/tests/utils/to-expose/init-questionnaire/questionnaire.json +0 -148
- package/src/tests/utils/to-expose/init-questionnaire/result.json +0 -181
- package/src/tests/utils/to-expose/interpret/interpret.spec.js +0 -48
- package/src/tests/utils/to-expose/state/questionnaire.json +0 -61
- package/src/tests/utils/to-expose/state/results.js +0 -78
- package/src/tests/utils/to-expose/state/state.spec.js +0 -59
- package/src/utils/suggester-workers/commons-tokenizer/create-tokenizer.js +0 -103
- package/src/utils/suggester-workers/commons-tokenizer/filter-accents-to-lower.js +0 -9
- package/src/utils/suggester-workers/commons-tokenizer/filter-synonyms.js +0 -10
- package/src/utils/suggester-workers/query-parser/query-parser-soft.js +0 -7
- package/src/utils/suggester-workers/query-parser/query-parser-tokenized.js +0 -31
- package/src/utils/suggester-workers/query-parser/query-parser-tokenized.spec.js +0 -32
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inseefr/lunatic",
|
|
3
|
-
"version": "0.1.0-
|
|
4
|
-
"workersVersion": "0.2.
|
|
3
|
+
"version": "0.1.0-v2",
|
|
4
|
+
"workersVersion": "0.2.4-experimental",
|
|
5
5
|
"description": "Library of questionnaire components",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"test": "cross-env NODE_PATH=src/ jest",
|
|
34
34
|
"test-watch": "cross-env NODE_PATH=src/ jest --watchAll",
|
|
35
35
|
"test-coverage": "cross-env NODE_PATH=src/ jest --coverage",
|
|
36
|
-
"
|
|
36
|
+
"storybook": "cross-env NODE_PATH=src/ start-storybook -s ./public -p 9999",
|
|
37
37
|
"build-storybook": "cross-env NODE_PATH=src/ build-storybook -o built-storybook/storybook",
|
|
38
38
|
"build": "rollup -c rollup.config.js",
|
|
39
39
|
"prepublish": "npm test && npm run build",
|
|
@@ -51,9 +51,13 @@
|
|
|
51
51
|
],
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@inseefr/trevas": "^0.1.10",
|
|
54
|
+
"@inseefr/vtl-2.0-antlr-tools": "^0.1.0",
|
|
55
|
+
"antlr4": "^4.9.3",
|
|
56
|
+
"date-fns": "^2.25.0",
|
|
54
57
|
"lodash.camelcase": "^4.3.0",
|
|
55
58
|
"lodash.debounce": "^4.0.8",
|
|
56
59
|
"lodash.isequal": "^4.5.0",
|
|
60
|
+
"object-hash": "^2.2.0",
|
|
57
61
|
"prop-types": "^15.7.2",
|
|
58
62
|
"react-keyboard-event-handler": "^1.5.4",
|
|
59
63
|
"react-markdown": "^5.0.3",
|
|
@@ -70,6 +74,10 @@
|
|
|
70
74
|
"@babel/plugin-transform-runtime": "^7.15.0",
|
|
71
75
|
"@babel/preset-env": "^7.9.5",
|
|
72
76
|
"@babel/preset-react": "^7.9.0",
|
|
77
|
+
"@emotion/react": "^11.8.1",
|
|
78
|
+
"@emotion/styled": "^11.8.1",
|
|
79
|
+
"@mui/icons-material": "^5.5.0",
|
|
80
|
+
"@mui/material": "^5.5.0",
|
|
73
81
|
"@storybook/addon-a11y": "^5.2.8",
|
|
74
82
|
"@storybook/addon-knobs": "^5.2.8",
|
|
75
83
|
"@storybook/addon-options": "^5.2.8",
|
|
@@ -77,7 +85,6 @@
|
|
|
77
85
|
"@storybook/react": "^5.2.8",
|
|
78
86
|
"@testing-library/react-hooks": "^7.0.0",
|
|
79
87
|
"@timdp/rollup-plugin-image": "^1.0.3",
|
|
80
|
-
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.2",
|
|
81
88
|
"babel-eslint": "^10.0.3",
|
|
82
89
|
"babel-loader": "^8.0.6",
|
|
83
90
|
"classnames": "^2.2.5",
|
|
@@ -85,7 +92,6 @@
|
|
|
85
92
|
"cross-env": "^7.0.2",
|
|
86
93
|
"css-loader": "^5.0.0",
|
|
87
94
|
"damerau-levenshtein": "^1.0.7",
|
|
88
|
-
"enzyme": "^3.7.0",
|
|
89
95
|
"eslint": "7.30.0",
|
|
90
96
|
"eslint-config-prettier": "^7.2.0",
|
|
91
97
|
"eslint-config-react-app": "^6.0.0",
|
|
@@ -146,9 +152,6 @@
|
|
|
146
152
|
"^.+\\.js$": "babel-jest",
|
|
147
153
|
".+\\.(png|jpg)$": "jest-transform-stub"
|
|
148
154
|
},
|
|
149
|
-
"setupFilesAfterEnv": [
|
|
150
|
-
"<rootDir>/src/tests/setup/setupTests.js"
|
|
151
|
-
],
|
|
152
155
|
"coverageProvider": "v8",
|
|
153
156
|
"testResultsProcessor": "jest-sonar-reporter",
|
|
154
157
|
"coveragePathIgnorePatterns": [
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { buildStyleObject } from '../../utils/lib';
|
|
4
|
-
import './breadcrumb.scss';
|
|
5
|
-
|
|
6
|
-
const Breadcrumb = ({ elements, style }) =>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Breadcrumb.propTypes = {
|
|
25
|
-
elements: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
26
|
-
style: PropTypes.object,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default Breadcrumb;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { buildStyleObject } from '../../utils/lib';
|
|
4
|
+
import './breadcrumb.scss';
|
|
5
|
+
|
|
6
|
+
const Breadcrumb = ({ elements, style }) =>
|
|
7
|
+
null;
|
|
8
|
+
// <div
|
|
9
|
+
// aria-label={`breadcrumb`}
|
|
10
|
+
// className="breadcrumb-lunatic"
|
|
11
|
+
// style={buildStyleObject(style)}
|
|
12
|
+
// >
|
|
13
|
+
// {elements.map((e, i) => (
|
|
14
|
+
// <React.Fragment key={`breadcrumb-${e.toLowerCase()}`}>
|
|
15
|
+
// {e && (
|
|
16
|
+
// <span className={i !== 0 ? 'breadcrumb-element-lunatic' : undefined}>
|
|
17
|
+
// {e}
|
|
18
|
+
// </span>
|
|
19
|
+
// )}
|
|
20
|
+
// </React.Fragment>
|
|
21
|
+
// ))}
|
|
22
|
+
// </div>
|
|
23
|
+
|
|
24
|
+
Breadcrumb.propTypes = {
|
|
25
|
+
elements: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
26
|
+
style: PropTypes.object,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default Breadcrumb;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './
|
|
1
|
+
export { default } from './lunatic-button';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import './button.scss';
|
|
4
|
+
|
|
5
|
+
function Button({ children, onClick, disabled, label }) {
|
|
6
|
+
const handleClick = useCallback(
|
|
7
|
+
function (e) {
|
|
8
|
+
e.stopPropagation();
|
|
9
|
+
e.preventDefault();
|
|
10
|
+
onClick(e);
|
|
11
|
+
},
|
|
12
|
+
[onClick]
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<input
|
|
17
|
+
disabled={disabled}
|
|
18
|
+
type="button"
|
|
19
|
+
className="button-lunatic"
|
|
20
|
+
value={label || children}
|
|
21
|
+
onClick={handleClick}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
Button.propTypes = {
|
|
27
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
|
|
28
|
+
disabled: PropTypes.bool,
|
|
29
|
+
onClick: PropTypes.func.isRequired,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default Button;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './lunatic-checkbox-boolean';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CheckboxOption } from '../commons';
|
|
3
|
+
import { useOnHandleChange, LunaticField } from '../../commons';
|
|
4
|
+
|
|
5
|
+
function LunaticCheckboxBoolean({
|
|
6
|
+
value,
|
|
7
|
+
declarations,
|
|
8
|
+
label,
|
|
9
|
+
response,
|
|
10
|
+
id,
|
|
11
|
+
disabled,
|
|
12
|
+
handleChange,
|
|
13
|
+
}) {
|
|
14
|
+
const onClick = useOnHandleChange({ handleChange, response, value });
|
|
15
|
+
|
|
16
|
+
const contentId = `lunatic-checkbox-boolean-${id}`;
|
|
17
|
+
const labelId = `lunatic-checkbox-boolean-label-${id}`;
|
|
18
|
+
const booleanValue = value === true ? value : false;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<LunaticField
|
|
22
|
+
label={label}
|
|
23
|
+
contentId={contentId}
|
|
24
|
+
labelId={labelId}
|
|
25
|
+
declarations={declarations}
|
|
26
|
+
id={id}
|
|
27
|
+
value={value}
|
|
28
|
+
className="lunatic-checkbox-boolean"
|
|
29
|
+
>
|
|
30
|
+
<CheckboxOption
|
|
31
|
+
disabled={disabled}
|
|
32
|
+
checked={booleanValue}
|
|
33
|
+
id={id}
|
|
34
|
+
value={!booleanValue}
|
|
35
|
+
onClick={onClick}
|
|
36
|
+
labelledBy={labelId}
|
|
37
|
+
/>
|
|
38
|
+
</LunaticField>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
LunaticCheckboxBoolean.defaultProps = { value: false };
|
|
43
|
+
|
|
44
|
+
export default LunaticCheckboxBoolean;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { CheckboxOption } from '../commons';
|
|
3
|
+
import { Label } from '../../commons';
|
|
4
|
+
|
|
5
|
+
function onClick() {}
|
|
6
|
+
|
|
7
|
+
function CheckBoxOptionWrapper({
|
|
8
|
+
checkboxId,
|
|
9
|
+
index,
|
|
10
|
+
labelId,
|
|
11
|
+
checked,
|
|
12
|
+
value,
|
|
13
|
+
onKeyDown,
|
|
14
|
+
handleChange,
|
|
15
|
+
response,
|
|
16
|
+
}) {
|
|
17
|
+
const booleanValue = value || false;
|
|
18
|
+
|
|
19
|
+
const onClickOption = useCallback(
|
|
20
|
+
function (valueOption) {
|
|
21
|
+
handleChange(response, !valueOption);
|
|
22
|
+
},
|
|
23
|
+
[handleChange, response]
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<CheckboxOption
|
|
28
|
+
id={checkboxId}
|
|
29
|
+
labelledBy={labelId}
|
|
30
|
+
index={index}
|
|
31
|
+
checked={checked}
|
|
32
|
+
onClick={onClickOption}
|
|
33
|
+
value={booleanValue}
|
|
34
|
+
onKeyDown={onKeyDown}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function CheckboxGroupContainer({ children }) {
|
|
40
|
+
return <div className="lunatic-checkbox-group-option">{children}</div>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function CheckboxGroup({ options, value, id, handleChange }) {
|
|
44
|
+
return options.map(function (option, index) {
|
|
45
|
+
const { label, response } = option;
|
|
46
|
+
|
|
47
|
+
if (response && value) {
|
|
48
|
+
const { name } = response;
|
|
49
|
+
|
|
50
|
+
if (name in value) {
|
|
51
|
+
const optionValue = value[name];
|
|
52
|
+
const checkboxId = `lunatic-checkbox-${id}-${name}`;
|
|
53
|
+
const labelId = `lunatic-checkbox-label-${id}-${name}`;
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<CheckboxGroupContainer key={checkboxId}>
|
|
57
|
+
<Label id={labelId} htmlFor={checkboxId}>
|
|
58
|
+
{label}
|
|
59
|
+
</Label>
|
|
60
|
+
<CheckBoxOptionWrapper
|
|
61
|
+
checkboxId={checkboxId}
|
|
62
|
+
index={index}
|
|
63
|
+
labelId={labelId}
|
|
64
|
+
checked={optionValue}
|
|
65
|
+
value={optionValue}
|
|
66
|
+
onKeyDown={onClick}
|
|
67
|
+
response={response}
|
|
68
|
+
handleChange={handleChange}
|
|
69
|
+
/>
|
|
70
|
+
</CheckboxGroupContainer>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default CheckboxGroup;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import CheckboxChecked from '../../../utils/icons/checkbox-checked.icon';
|
|
4
|
+
import CheckboxUnchecked from '../../../utils/icons/checkbox-unchecked.icon';
|
|
5
|
+
|
|
6
|
+
function CheckboxOption({ disabled, checked, id, value, onClick, labelledBy }) {
|
|
7
|
+
const onClickOption = useCallback(
|
|
8
|
+
function () {
|
|
9
|
+
onClick(value);
|
|
10
|
+
},
|
|
11
|
+
[value, onClick]
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const handleKeyDown = useCallback(function (e) {
|
|
15
|
+
const { key } = e;
|
|
16
|
+
if (key === 'Space') {
|
|
17
|
+
// TODO
|
|
18
|
+
}
|
|
19
|
+
}, []);
|
|
20
|
+
|
|
21
|
+
const Icon = checked ? CheckboxChecked : CheckboxUnchecked;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
className={classnames('checkbox-modality', 'checkbox-modality-block', {
|
|
26
|
+
checked,
|
|
27
|
+
disabled,
|
|
28
|
+
})}
|
|
29
|
+
>
|
|
30
|
+
<span
|
|
31
|
+
id={id}
|
|
32
|
+
role="checkbox"
|
|
33
|
+
className={`lunatic-input-checkbox`}
|
|
34
|
+
aria-checked={checked}
|
|
35
|
+
tabIndex="0"
|
|
36
|
+
onClick={onClickOption}
|
|
37
|
+
onKeyDown={handleKeyDown}
|
|
38
|
+
aria-labelledby={labelledBy}
|
|
39
|
+
>
|
|
40
|
+
<Icon />
|
|
41
|
+
</span>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default CheckboxOption;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './lunatic-checkbox-group';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FieldContainer, Fieldset } from '../../commons';
|
|
3
|
+
import CheckboxGroup from './checkbox-group';
|
|
4
|
+
import {
|
|
5
|
+
DeclarationsBeforeText,
|
|
6
|
+
DeclarationsAfterText,
|
|
7
|
+
DeclarationsDetachable,
|
|
8
|
+
} from '../../declarations';
|
|
9
|
+
|
|
10
|
+
function LunaticCheckboxGroup(props) {
|
|
11
|
+
const { id, declarations, value, label, handleChange, responses } = props;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<DeclarationsBeforeText declarations={declarations} />
|
|
16
|
+
<FieldContainer id={id} value={value}>
|
|
17
|
+
<Fieldset legend={label}>
|
|
18
|
+
<DeclarationsAfterText declarations={declarations} />
|
|
19
|
+
<CheckboxGroup
|
|
20
|
+
id={id}
|
|
21
|
+
options={responses}
|
|
22
|
+
value={value}
|
|
23
|
+
handleChange={handleChange}
|
|
24
|
+
/>
|
|
25
|
+
</Fieldset>
|
|
26
|
+
</FieldContainer>
|
|
27
|
+
<DeclarationsDetachable declarations={declarations} />
|
|
28
|
+
</>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default LunaticCheckboxGroup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './lunatic-checkbox-one';
|
|
@@ -1,73 +1 @@
|
|
|
1
|
-
.lunatic-
|
|
2
|
-
.checkbox-group,
|
|
3
|
-
.checkbox-group-list {
|
|
4
|
-
border: 0;
|
|
5
|
-
outline: 0;
|
|
6
|
-
padding: 0;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.checkbox-lunatic,
|
|
10
|
-
.checkbox-boolean-lunatic {
|
|
11
|
-
position: absolute;
|
|
12
|
-
opacity: 0;
|
|
13
|
-
margin-bottom: 0;
|
|
14
|
-
margin-top: 0.15rem;
|
|
15
|
-
margin-left: 0.2rem;
|
|
16
|
-
height: 18px;
|
|
17
|
-
width: 18px;
|
|
18
|
-
+ label {
|
|
19
|
-
margin-left: 2rem;
|
|
20
|
-
}
|
|
21
|
-
&:focus {
|
|
22
|
-
+ label {
|
|
23
|
-
background-color: rgba(0, 0, 0, 0.05);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.checkbox-boolean-lunatic + label::before {
|
|
29
|
-
margin-right: -0.3rem;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.checkbox-modality,
|
|
33
|
-
.checkbox-boolean-modality {
|
|
34
|
-
margin-bottom: 0.6rem;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.field,
|
|
38
|
-
.field-with-tooltip {
|
|
39
|
-
.checkbox-group-list .checkbox-modality {
|
|
40
|
-
height: 1.375em;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.checkbox-group,
|
|
45
|
-
.checkbox-group-list {
|
|
46
|
-
.modality_NR {
|
|
47
|
-
margin-top: 1.5em;
|
|
48
|
-
}
|
|
49
|
-
.horizontal-options.modality_NR {
|
|
50
|
-
margin-top: 0;
|
|
51
|
-
}
|
|
52
|
-
.checkbox-modality {
|
|
53
|
-
label {
|
|
54
|
-
display: flex;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
.checkbox-modality.checkbox-modality-block label {
|
|
58
|
-
padding-top: 0.325em;
|
|
59
|
-
}
|
|
60
|
-
.checkbox-modality.checkbox-modality-block.horizontal-options label {
|
|
61
|
-
padding-top: 0;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.checkbox-lunatic + label {
|
|
66
|
-
margin-top: 0.325em;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.checkbox-alone {
|
|
70
|
-
margin-left: 0;
|
|
71
|
-
margin-top: 0.5em;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
1
|
+
.lunatic-checkbox-boolean{}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import CheckboxChecked from '../../../utils/icons/checkbox-checked.icon';
|
|
4
|
+
import CheckboxUnchecked from '../../../utils/icons/checkbox-unchecked.icon';
|
|
5
|
+
|
|
6
|
+
function CheckboxOption({ disabled, checked, id, value, onClick, labelledBy }) {
|
|
7
|
+
const onClickOption = useCallback(
|
|
8
|
+
function () {
|
|
9
|
+
onClick(value);
|
|
10
|
+
},
|
|
11
|
+
[value, onClick]
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const handleKeyDown = useCallback(
|
|
15
|
+
function (e) {
|
|
16
|
+
const { code } = e;
|
|
17
|
+
if (code === 'Space') {
|
|
18
|
+
onClickOption();
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
[onClickOption]
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const Icon = checked ? CheckboxChecked : CheckboxUnchecked;
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div
|
|
28
|
+
className={classnames('checkbox-modality', 'checkbox-modality-block', {
|
|
29
|
+
checked,
|
|
30
|
+
disabled,
|
|
31
|
+
})}
|
|
32
|
+
>
|
|
33
|
+
<span
|
|
34
|
+
id={id}
|
|
35
|
+
role="checkbox"
|
|
36
|
+
className={`lunatic-input-checkbox`}
|
|
37
|
+
aria-checked={checked}
|
|
38
|
+
tabIndex="0"
|
|
39
|
+
onClick={onClickOption}
|
|
40
|
+
onKeyDown={handleKeyDown}
|
|
41
|
+
aria-labelledby={labelledBy}
|
|
42
|
+
>
|
|
43
|
+
<Icon />
|
|
44
|
+
</span>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default CheckboxOption;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CheckboxOption } from './checkbox-option';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as CheckboxGroup } from './group';
|
|
2
|
-
export { default as CheckboxBoolean } from './boolean';
|
|
3
|
-
export { default as CheckboxOne } from './one';
|
|
1
|
+
export { default as CheckboxGroup } from './checkbox-group';
|
|
2
|
+
export { default as CheckboxBoolean } from './checkbox-boolean';
|
|
3
|
+
export { default as CheckboxOne } from './checkbox-one';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import './field-container.scss';
|
|
4
|
+
|
|
5
|
+
function Tooltip({ management, id }) {
|
|
6
|
+
if (management) {
|
|
7
|
+
return <div className="tooltip"></div>;
|
|
8
|
+
}
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function FieldContainer({ children, management, value, id }) {
|
|
13
|
+
return (
|
|
14
|
+
<div className="field-container">
|
|
15
|
+
<div
|
|
16
|
+
className={classnames({
|
|
17
|
+
'field-with-tooltip': management,
|
|
18
|
+
field: !management,
|
|
19
|
+
})}
|
|
20
|
+
>
|
|
21
|
+
{children}
|
|
22
|
+
</div>
|
|
23
|
+
<Tooltip management={management} value={value} id={id} />
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default FieldContainer;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './field-container';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import LunaticField from './lunatic-field';
|
|
3
|
+
|
|
4
|
+
function InputContainer({
|
|
5
|
+
declarations,
|
|
6
|
+
label,
|
|
7
|
+
id,
|
|
8
|
+
value,
|
|
9
|
+
inputId,
|
|
10
|
+
labelId,
|
|
11
|
+
children,
|
|
12
|
+
labelClassName,
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<LunaticField
|
|
16
|
+
label={label}
|
|
17
|
+
labelClassName={labelClassName}
|
|
18
|
+
contentId={inputId}
|
|
19
|
+
labelId={labelId}
|
|
20
|
+
declarations={declarations}
|
|
21
|
+
id={id}
|
|
22
|
+
value={value}
|
|
23
|
+
className={labelClassName}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</LunaticField>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default InputContainer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
function Label({ children, id, htmlFor, className }) {
|
|
4
|
+
if (children) {
|
|
5
|
+
return (
|
|
6
|
+
<label htmlFor={htmlFor} id={id} className={className}>
|
|
7
|
+
{children}
|
|
8
|
+
</label>
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default Label;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Label from './label';
|
|
3
|
+
import FieldContainer from './field-container';
|
|
4
|
+
import {
|
|
5
|
+
DeclarationsBeforeText,
|
|
6
|
+
DeclarationsAfterText,
|
|
7
|
+
DeclarationsDetachable,
|
|
8
|
+
} from '../../declarations';
|
|
9
|
+
|
|
10
|
+
function LunaticFields({
|
|
11
|
+
label,
|
|
12
|
+
contentId,
|
|
13
|
+
labelId,
|
|
14
|
+
declarations,
|
|
15
|
+
id,
|
|
16
|
+
value,
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
}) {
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
<DeclarationsBeforeText declarations={declarations} />
|
|
23
|
+
<Label id={labelId} htmlFor={contentId} className={className}>
|
|
24
|
+
{label}
|
|
25
|
+
</Label>
|
|
26
|
+
<DeclarationsAfterText declarations={declarations} />
|
|
27
|
+
<FieldContainer value={value} id={id}>
|
|
28
|
+
{children}
|
|
29
|
+
</FieldContainer>
|
|
30
|
+
<DeclarationsDetachable declarations={declarations} />
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default LunaticFields;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
function createCustomizableLunaticField(LunaticField) {
|
|
4
|
+
return function OverlayField(props) {
|
|
5
|
+
const { custom: Custom, ...rest } = props;
|
|
6
|
+
if (typeof Custom === 'function') {
|
|
7
|
+
return <Custom {...rest} />;
|
|
8
|
+
}
|
|
9
|
+
return <LunaticField {...rest} />;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default createCustomizableLunaticField;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as FieldContainer } from './components/field-container';
|
|
2
|
+
export { default as Label } from './components/label';
|
|
3
|
+
export { default as InputContainer } from './components/input-container';
|
|
4
|
+
export { default as Fieldset } from './components/fieldset';
|
|
5
|
+
export { default as LunaticField } from './components/lunatic-field';
|
|
6
|
+
export { default as usePrevious } from './use-previous';
|
|
7
|
+
export { default as useOnHandleChange } from './use-on-handle-change';
|
|
8
|
+
export { default as useOptionsKeydown } from './use-options-keydown';
|
|
9
|
+
export { default as createCustomizableLunaticField } from './create-customizable-field';
|