@inseefr/lunatic 0.1.0-hackathon → 0.1.0-prisme
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/lib/index.js +1184 -468
- package/lib/index.js.map +1 -1
- package/package.json +6 -4
- package/src/components/breadcrumb/component.js +29 -29
- package/src/components/breadcrumb/index.js +1 -1
- package/src/components/button/button.scss +24 -24
- package/src/components/button/component.js +53 -53
- package/src/components/button/index.js +1 -1
- package/src/components/checkbox/boolean.js +2 -2
- package/src/components/checkbox/group.js +2 -2
- package/src/components/checkbox/index.js +3 -3
- package/src/components/checkbox/one.js +2 -2
- 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 +44 -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/component-wrapper/missing/component.js +200 -0
- 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 +19 -18
- package/src/components/datepicker/component.js +18 -3
- package/src/components/datepicker/datepicker.scss +1 -1
- package/src/components/datepicker/index.js +1 -1
- package/src/components/declarations/index.js +1 -1
- package/src/components/declarations/wrappers/index.js +3 -3
- package/src/components/declarations/wrappers/input-declarations-wrapper.js +65 -16
- package/src/components/declarations/wrappers/list-declarations-wrapper.js +232 -232
- package/src/components/dropdown/commons/actions.js +40 -31
- package/src/components/dropdown/commons/components/dropdown-field.js +46 -46
- package/src/components/dropdown/commons/components/dropdown.js +21 -0
- package/src/components/dropdown/commons/components/label.js +28 -28
- package/src/components/dropdown/commons/components/panel.js +78 -78
- package/src/components/dropdown/commons/event-callbacks/index.js +5 -5
- package/src/components/dropdown/commons/event-callbacks/on-keydown-callback.js +29 -29
- package/src/components/dropdown/commons/reducer.js +152 -149
- package/src/components/dropdown/component.js +2 -2
- package/src/components/dropdown/dropdown-edit/dropdown-edit.js +10 -1
- package/src/components/dropdown/dropdown-edit/icone.js +33 -33
- package/src/components/dropdown/dropdown-edit/option.js +62 -62
- package/src/components/dropdown/dropdown-edit/prefix-tools.js +51 -51
- package/src/components/dropdown/dropdown-simple/dropdown.js +11 -2
- package/src/components/dropdown/dropdown-simple/option.js +15 -15
- package/src/components/dropdown/index.js +1 -1
- package/src/components/filter-description/component.js +42 -42
- package/src/components/filter-description/index.js +1 -1
- package/src/components/icon/assets/checkbox-checked.js +16 -16
- package/src/components/icon/assets/checkbox-unchecked.js +16 -16
- package/src/components/icon/assets/index.js +4 -4
- package/src/components/icon/assets/radio-checked.js +16 -16
- package/src/components/icon/assets/radio-unchecked.js +16 -16
- package/src/components/icon/component.js +33 -33
- package/src/components/icon/index.js +1 -1
- package/src/components/index.js +5 -3
- package/src/components/index.scss +5 -3
- package/src/components/input/index.js +2 -2
- package/src/components/input/input-number.js +14 -39
- package/src/components/input/input.js +2 -2
- package/src/components/input/input.scss +0 -6
- package/src/components/loop/component.js +1 -0
- package/src/components/loop/index.js +1 -1
- package/src/components/loop/wrapper.js +15 -15
- 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 +21 -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 +36 -0
- package/src/components/modal/index.js +1 -0
- package/src/components/modal/modal.scss +33 -0
- package/src/components/progress-bar/component.js +28 -28
- package/src/components/progress-bar/index.js +1 -1
- package/src/components/radio/component.js +2 -2
- package/src/components/radio/index.js +1 -1
- package/src/components/sequence/index.js +1 -1
- package/src/components/subsequence/index.js +1 -1
- package/src/components/suggester/check-store.js +68 -70
- package/src/components/suggester/commons-tools/binded-keys.js +11 -11
- package/src/components/suggester/commons-tools/index.js +1 -1
- package/src/components/suggester/components/create-on-keydown-callback.js +28 -28
- package/src/components/suggester/components/index.js +2 -2
- package/src/components/suggester/components/panel/index.js +2 -2
- package/src/components/suggester/components/panel/option-container.js +1 -1
- package/src/components/suggester/components/panel/panel-container.js +21 -21
- package/src/components/suggester/components/selection/delete.js +38 -38
- package/src/components/suggester/components/selection/index.js +1 -1
- package/src/components/suggester/components/selection/selection.js +1 -1
- package/src/components/suggester/components/suggester-content.js +42 -42
- package/src/components/suggester/components/suggester.js +43 -3
- package/src/components/suggester/find-best-label/find-best-label.js +3 -1
- package/src/components/suggester/idb-suggester.js +7 -1
- package/src/components/suggester/index.js +1 -1
- package/src/components/suggester/lunatic-suggester.js +6 -3
- package/src/components/suggester/searching/create-searching.js +3 -1
- package/src/components/suggester/state-management/index.js +6 -6
- package/src/components/suggester/state-management/intial-state.js +13 -13
- package/src/components/suggester/state-management/reducer/index.js +1 -1
- package/src/components/suggester/state-management/reducer/reduce-on-blur.js +5 -5
- package/src/components/suggester/state-management/reducer/reduce-on-change-search.js +8 -8
- package/src/components/suggester/state-management/reducer/reduce-on-click-option.js +8 -8
- package/src/components/suggester/state-management/reducer/reduce-on-error.js +8 -8
- package/src/components/suggester/state-management/reducer/reduce-on-focus.js +5 -5
- package/src/components/suggester/state-management/reducer/reduce-on-key-down.js +73 -73
- package/src/components/suggester/state-management/reducer/reduce-on-unexpected-error.js +7 -7
- package/src/components/suggester/state-management/reducer/reduce-on-update-options.js +11 -11
- package/src/components/suggester/state-management/suggester-context.js +4 -4
- package/src/components/suggester/state-management/use-dispatch.js +11 -11
- package/src/components/suggester/suggester-wrapper.js +9 -3
- package/src/components/suggester-loader-widget/index.js +1 -1
- package/src/components/suggester-loader-widget/loader-row.js +102 -102
- package/src/components/suggester-loader-widget/progress.js +25 -25
- package/src/components/suggester-loader-widget/tools/action-tool.js +20 -20
- package/src/components/suggester-loader-widget/tools/index.js +2 -2
- package/src/components/suggester-loader-widget/tools/tools.js +7 -7
- package/src/components/suggester-loader-widget/widget-container.js +35 -35
- package/src/components/suggester-loader-widget/widget.scss +176 -176
- package/src/components/table/index.js +1 -1
- package/src/components/table/table.js +5 -3
- package/src/components/textarea/component.js +2 -2
- package/src/components/textarea/index.js +1 -1
- package/src/components/tooltip/img/index.js +4 -4
- package/src/components/tooltip/index.js +1 -1
- package/src/components/tooltip/response.js +52 -52
- package/src/constants/component-types.js +1 -1
- package/src/constants/declarations.js +14 -14
- package/src/constants/event-types.js +13 -13
- package/src/constants/index.js +5 -5
- package/src/constants/supported-preferences.js +10 -10
- package/src/constants/value-types.js +5 -5
- package/src/constants/variable-types.js +4 -4
- package/src/stories/breadcrumb/README.md +14 -14
- package/src/stories/button/README.md +14 -14
- package/src/stories/button/button.stories.js +27 -27
- package/src/stories/checkbox-boolean/README.md +27 -27
- package/src/stories/checkbox-boolean/checkbox-boolean.stories.js +54 -54
- package/src/stories/checkbox-boolean/data-forced.json +48 -48
- package/src/stories/checkbox-group/README.md +29 -29
- package/src/stories/checkbox-group/checkbox-group.stories.js +60 -60
- package/src/stories/checkbox-group/data-forced.json +89 -89
- package/src/stories/checkbox-group/data-vtl.json +102 -102
- package/src/stories/checkbox-group/data.json +89 -89
- package/src/stories/checkbox-one/README.md +31 -31
- package/src/stories/checkbox-one/checkbox-one.stories.js +57 -57
- package/src/stories/checkbox-one/data-forced.json +33 -33
- package/src/stories/checkbox-one/data-vtl.json +48 -48
- package/src/stories/checkbox-one/data.json +33 -33
- package/src/stories/datepicker/README.md +31 -31
- package/src/stories/datepicker/data-forced.json +28 -28
- package/src/stories/datepicker/data.json +45 -43
- package/src/stories/datepicker/datepicker.stories.js +60 -60
- package/src/stories/declarations/README.md +19 -19
- package/src/stories/dropdown/data-forced.json +81 -81
- package/src/stories/dropdown/data-naf.json +6963 -6963
- package/src/stories/dropdown/data-props.json +111 -111
- package/src/stories/filter-description/README.md +15 -15
- package/src/stories/filter-description/filter-description.stories.js +53 -53
- package/src/stories/icons/icons.stories.js +16 -16
- package/src/stories/icons/lunatic-icon.scss +10 -10
- package/src/stories/input/README.md +33 -33
- package/src/stories/input/data-forced.json +41 -41
- package/src/stories/input/data.json +41 -41
- package/src/stories/input/input.stories.js +72 -72
- package/src/stories/input-number/README.md +37 -37
- package/src/stories/input-number/data-forced.json +27 -27
- package/src/stories/input-number/data.json +42 -42
- package/src/stories/input-number/input-number.stories.js +81 -81
- package/src/stories/loop/README.md +25 -25
- package/src/stories/loop/loop.stories.js +88 -88
- package/src/stories/loop/with-loop/data-loop-deeper.json +298 -298
- package/src/stories/loop/with-loop/data-loop.json +336 -336
- package/src/stories/loop/with-loop/index.js +2 -2
- package/src/stories/loop/with-roster/data-forced.json +213 -213
- package/src/stories/loop/with-roster/data-loop-deeper.json +298 -298
- package/src/stories/loop/with-roster/data-loop.json +288 -288
- package/src/stories/loop/with-roster/index.js +3 -3
- 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/pagination/deeper-loop.json +327 -327
- package/src/stories/pagination/pagination.stories.js +60 -60
- package/src/stories/pagination/simple-loop.json +277 -277
- package/src/stories/pagination/simpsons-question.json +4952 -4952
- package/src/stories/pagination/simpsons-sequence.json +4362 -4362
- package/src/stories/progress-bar/README.md +13 -13
- package/src/stories/questionnaire/arithmetic-management.json +47 -0
- package/src/stories/questionnaire/kish.json +275 -0
- package/src/stories/questionnaire/logement-queen.json +23390 -0
- package/src/stories/questionnaire/logement-s2.json +46027 -44536
- package/src/stories/questionnaire/logement.json +20347 -26087
- package/src/stories/questionnaire/loop-and-controls.json +481 -0
- package/src/stories/questionnaire/questionnaire.stories.js +94 -12
- package/src/stories/questionnaire/simpsons.json +4816 -4816
- package/src/stories/questionnaire/update-external/data.json +1 -0
- package/src/stories/questionnaire/update-external/questionnaire.json +75 -0
- package/src/stories/radio/README.md +31 -31
- package/src/stories/radio/data-forced.json +32 -32
- package/src/stories/radio/data-vtl.json +47 -47
- package/src/stories/radio/data.json +32 -32
- package/src/stories/radio/radio.stories.js +64 -64
- package/src/stories/sequence/README.md +18 -18
- package/src/stories/subsequence/README.md +18 -18
- 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/cog-communes/index.js +2 -2
- package/src/stories/suggester/cog-communes/option-cog-renderer.js +15 -15
- package/src/stories/suggester/cog-communes/theme.scss +12 -12
- package/src/stories/suggester/data-auto.json +1 -0
- package/src/stories/suggester/data.json +35 -2
- package/src/stories/suggester/naf-rev2/fetch-naf.js +57 -57
- package/src/stories/suggester/naf-rev2/theme.scss +36 -36
- package/src/stories/suggester/suggester-workers.stories.js +48 -1
- package/src/stories/suggester/suggester.stories.js +5 -0
- package/src/stories/table/README.md +29 -29
- package/src/stories/table/data-default.json +19 -19
- package/src/stories/table/data-one-axis-one-measure.json +139 -139
- package/src/stories/table/data-one-axis-two-measures.json +208 -208
- package/src/stories/table/data-one-hierarchical-axis.json +219 -219
- package/src/stories/table/data-roster.json +486 -486
- package/src/stories/table/data-two-axis-one-measure.json +507 -507
- package/src/stories/table/table.stories.js +82 -82
- package/src/stories/textarea/README.md +33 -33
- package/src/stories/textarea/data-forced.json +28 -28
- package/src/stories/textarea/data.json +43 -43
- package/src/stories/textarea/textarea.stories.js +68 -68
- package/src/stories/tooltip-response/README.md +14 -14
- package/src/stories/tooltip-response/md-link.json +31 -31
- package/src/stories/tooltip-response/md-tooltip.json +31 -31
- package/src/stories/tooltip-response/tooltip.stories.js +83 -83
- package/src/stories/utils/custom-lunatic.scss +23 -23
- package/src/stories/utils/options.js +25 -25
- package/src/stories/utils/orchestrator-split.js +119 -0
- package/src/stories/utils/orchestrator.js +14 -3
- package/src/tests/components/breadcrumb.spec.js +13 -13
- package/src/tests/components/button.spec.js +11 -11
- package/src/tests/components/checkbox-boolean.spec.js +45 -45
- package/src/tests/components/checkbox-group.spec.js +53 -53
- package/src/tests/components/checkbox-one.spec.js +32 -32
- package/src/tests/components/datepicker.spec.js +22 -22
- package/src/tests/components/declarations-wrappers/input-declarations-wrapper.spec.js +67 -67
- package/src/tests/components/declarations-wrappers/list-declarations-wrapper.spec.js +52 -52
- package/src/tests/components/declarations-wrappers/simple-declarations-wrapper.spec.js +21 -21
- package/src/tests/components/declarations.spec.js +46 -46
- package/src/tests/components/input-number.spec.js +188 -194
- package/src/tests/components/input.spec.js +18 -18
- package/src/tests/components/loops/loop-static.json +66 -66
- package/src/tests/components/loops/loop.json +258 -258
- package/src/tests/components/loops/loop.spec.js +30 -30
- package/src/tests/components/loops/roster-for-loop.spec.js +18 -18
- package/src/tests/components/missing-wrapper.spec.js +32 -33
- package/src/tests/components/progress-bar.spec.js +15 -15
- package/src/tests/components/radio.spec.js +27 -27
- package/src/tests/components/sequence.spec.js +9 -9
- package/src/tests/components/subsequence.spec.js +9 -9
- package/src/tests/components/table.spec.js +11 -11
- package/src/tests/components/textarea.spec.js +18 -18
- package/src/tests/components/tooltip.spec.js +25 -25
- package/src/tests/setup/setupTests.js +4 -4
- package/src/tests/utils/lib/alphabet.spec.js +36 -36
- package/src/tests/utils/lib/array.spec.js +22 -22
- package/src/tests/utils/lib/checkbox/group.spec.js +72 -72
- package/src/tests/utils/lib/decorator/title-decorator.spec.js +12 -12
- package/src/tests/utils/lib/input-number.spec.js +18 -18
- package/src/tests/utils/lib/items-positioning.spec.js +17 -17
- package/src/tests/utils/lib/label-position.spec.js +22 -22
- package/src/tests/utils/lib/loops/bindings.spec.js +75 -75
- package/src/tests/utils/lib/loops/shared.spec.js +82 -82
- package/src/tests/utils/lib/missing/missing.spec.js +74 -74
- package/src/tests/utils/lib/missing/mock.js +137 -137
- package/src/tests/utils/lib/pagination/shared.spec.js +42 -42
- package/src/tests/utils/lib/responses.spec.js +64 -64
- package/src/tests/utils/lib/style.spec.js +26 -26
- package/src/tests/utils/lib/tooltip/build-response.spec.js +95 -95
- package/src/tests/utils/lib/tooltip/content.spec.js +109 -109
- package/src/tests/utils/to-expose/handler/handler.spec.js +94 -94
- package/src/tests/utils/to-expose/handler/questionnaire.json +158 -158
- package/src/tests/utils/to-expose/handler/results/index.js +6 -6
- package/src/tests/utils/to-expose/handler/results/res-double.json +158 -158
- package/src/tests/utils/to-expose/handler/results/res-input-collected.json +158 -158
- package/src/tests/utils/to-expose/handler/results/res-input-edited.json +158 -158
- package/src/tests/utils/to-expose/handler/results/res-loop.json +158 -158
- package/src/tests/utils/to-expose/handler/results/res-matrix.json +158 -158
- package/src/tests/utils/to-expose/handler/results/res-responses.json +158 -158
- package/src/tests/utils/to-expose/init-questionnaire/data.json +12 -12
- package/src/tests/utils/to-expose/init-questionnaire/init-questionnaire.spec.js +19 -19
- package/src/tests/utils/to-expose/interpret/interpret.spec.js +48 -48
- package/src/tests/utils/to-expose/state/questionnaire.json +61 -61
- package/src/tests/utils/to-expose/state/results.js +78 -78
- package/src/tests/utils/to-expose/state/state.spec.js +59 -59
- package/src/utils/components/dragger/dragger.js +64 -64
- package/src/utils/components/dragger/index.js +1 -1
- package/src/utils/components/fab/fab.js +50 -50
- package/src/utils/components/fab/fab.scss +32 -32
- package/src/utils/components/fab/index.js +1 -1
- package/src/utils/components/field-wrapper.js +23 -23
- package/src/utils/components/is-network/index.js +1 -1
- package/src/utils/components/is-network/is-network.js +39 -39
- package/src/utils/components/is-network/use-online-status.js +51 -51
- package/src/utils/components/label-wrapper.js +45 -45
- package/src/utils/icons/closed.icon.js +24 -24
- package/src/utils/icons/cross.icon.js +24 -24
- package/src/utils/icons/load.icon.js +24 -24
- package/src/utils/icons/lunatic-icon.js +9 -9
- package/src/utils/icons/lunatic-icon.scss +4 -4
- package/src/utils/icons/network.icon.js +24 -24
- package/src/utils/icons/on-drag.icon.js +24 -24
- package/src/utils/icons/opened.icon.js +24 -24
- package/src/utils/idb-tools/clear-store.js +16 -16
- package/src/utils/idb-tools/get-entity.js +15 -15
- package/src/utils/idb-tools/get-idb.js +12 -12
- package/src/utils/lib/alphabet.js +1 -1
- package/src/utils/lib/array.js +7 -7
- package/src/utils/lib/checkbox/group.js +21 -21
- package/src/utils/lib/checkbox/index.js +1 -1
- package/src/utils/lib/controls/index.js +1 -0
- package/src/utils/lib/controls/utils.js +152 -0
- package/src/utils/lib/decorator/index.js +1 -1
- package/src/utils/lib/env.js +2 -2
- package/src/utils/lib/event.js +15 -15
- package/src/utils/lib/function.js +1 -1
- package/src/utils/lib/index.js +21 -19
- package/src/utils/lib/input-number.js +6 -6
- package/src/utils/lib/label-position.js +12 -12
- package/src/utils/lib/loops/bindings.js +66 -66
- package/src/utils/lib/loops/build-components.js +33 -33
- package/src/utils/lib/loops/index.js +3 -3
- package/src/utils/lib/loops/shared.js +55 -55
- package/src/utils/lib/memo-check.js +24 -24
- package/src/utils/lib/missing.js +52 -52
- package/src/utils/lib/pagination/flow.js +2 -2
- package/src/utils/lib/pagination/index.js +2 -2
- package/src/utils/lib/pagination/navigation/index.js +1 -1
- package/src/utils/lib/pagination/navigation/shared.js +12 -9
- package/src/utils/lib/prop-types/declarations.js +22 -22
- package/src/utils/lib/prop-types/index.js +5 -5
- package/src/utils/lib/prop-types/options.js +8 -8
- package/src/utils/lib/prop-types/response.js +6 -6
- package/src/utils/lib/prop-types/value-type.js +9 -9
- package/src/utils/lib/responses.js +9 -7
- package/src/utils/lib/splitting.js +142 -0
- package/src/utils/lib/table/index.js +1 -1
- package/src/utils/lib/table/roster.js +23 -23
- package/src/utils/lib/tooltip/build-response.js +41 -41
- package/src/utils/lib/tooltip/content.js +55 -55
- package/src/utils/lib/tooltip/index.js +6 -6
- package/src/utils/store-tools/auto-load.js +2 -1
- package/src/utils/store-tools/clear-store-data.js +8 -8
- package/src/utils/store-tools/clear-store-info.js +8 -8
- package/src/utils/store-tools/constantes.js +20 -20
- package/src/utils/store-tools/create/create.js +19 -19
- package/src/utils/store-tools/create/index.js +1 -1
- package/src/utils/store-tools/create/update-store-info.js +26 -26
- package/src/utils/store-tools/get-store-count.js +22 -22
- package/src/utils/store-tools/index.js +5 -5
- package/src/utils/store-tools/open-or-create-store.js +47 -47
- package/src/utils/store-tools/use-store-index.js +24 -24
- 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 +56 -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/handler.js +68 -31
- package/src/utils/to-expose/hooks/filter-components.js +121 -106
- package/src/utils/to-expose/hooks/index.js +2 -1
- package/src/utils/to-expose/hooks/lunatic-split.js +428 -0
- package/src/utils/to-expose/hooks/lunatic.js +107 -11
- package/src/utils/to-expose/hooks/use-document-add-event-listener.js +63 -63
- package/src/utils/to-expose/index.js +11 -11
- package/src/utils/to-expose/interpret/index.js +1 -1
- package/src/utils/to-expose/interpret/main.js +16 -16
- package/src/utils/to-expose/interpret/md.js +65 -65
- package/src/utils/to-expose/state.js +23 -15
- package/src/components/missing-wrapper/component.js +0 -120
- package/src/components/missing-wrapper/wrapper.js +0 -10
- package/src/tests/utils/to-expose/hooks/use-lunatic.spec.js +0 -46
- 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
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
|
-
import { withReadme } from 'storybook-readme';
|
|
4
|
-
import Orchestrator from '../utils/orchestrator';
|
|
5
|
-
import readme from './README.md';
|
|
6
|
-
import { titleDecorator } from 'utils/lib';
|
|
7
|
-
import dataDefault from './data-default';
|
|
8
|
-
import dataOneAxisOneMeasure from './data-one-axis-one-measure';
|
|
9
|
-
import dataOneAxisTwoMeasures from './data-one-axis-two-measures';
|
|
10
|
-
import dataOneHierarchicalAxis from './data-one-hierarchical-axis';
|
|
11
|
-
import dataTwoAxisOneMeasure from './data-two-axis-one-measure';
|
|
12
|
-
import dataRoster from './data-roster';
|
|
13
|
-
import { positioningOptions, featuresOptions } from '../utils/options';
|
|
14
|
-
import { text, boolean, select, object } from '@storybook/addon-knobs/react';
|
|
15
|
-
|
|
16
|
-
const stories = storiesOf('Table', module)
|
|
17
|
-
.addDecorator(withReadme(readme))
|
|
18
|
-
.addDecorator((Component) => {
|
|
19
|
-
const WrappedComponent = titleDecorator(Component);
|
|
20
|
-
return <WrappedComponent title="<Table />" />;
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
stories.addWithJSX('Default', () => (
|
|
24
|
-
<Orchestrator
|
|
25
|
-
id="default"
|
|
26
|
-
source={dataDefault}
|
|
27
|
-
label={text('Label', '"I\'m the label of the Table"')}
|
|
28
|
-
features={select('Features', featuresOptions, ['VTL', 'MD'])}
|
|
29
|
-
bindings={object('Bindings', { test: 'test' })}
|
|
30
|
-
/>
|
|
31
|
-
));
|
|
32
|
-
|
|
33
|
-
stories.addWithJSX('OneAxisOneMeasure', () => (
|
|
34
|
-
<Orchestrator
|
|
35
|
-
id="default"
|
|
36
|
-
source={dataOneAxisOneMeasure}
|
|
37
|
-
missing={boolean('Missing', false)}
|
|
38
|
-
management={boolean('Management', false)}
|
|
39
|
-
positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
|
|
40
|
-
/>
|
|
41
|
-
));
|
|
42
|
-
|
|
43
|
-
stories.addWithJSX('OneAxisTwoMeasure', () => (
|
|
44
|
-
<Orchestrator
|
|
45
|
-
id="default"
|
|
46
|
-
source={dataOneAxisTwoMeasures}
|
|
47
|
-
missing={boolean('Missing', false)}
|
|
48
|
-
management={boolean('Management', false)}
|
|
49
|
-
positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
|
|
50
|
-
/>
|
|
51
|
-
));
|
|
52
|
-
|
|
53
|
-
stories.addWithJSX('OneHierarchicalAxis', () => (
|
|
54
|
-
<Orchestrator
|
|
55
|
-
id="default"
|
|
56
|
-
source={dataOneHierarchicalAxis}
|
|
57
|
-
missing={boolean('Missing', false)}
|
|
58
|
-
management={boolean('Management', false)}
|
|
59
|
-
positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
|
|
60
|
-
/>
|
|
61
|
-
));
|
|
62
|
-
|
|
63
|
-
stories.addWithJSX('TwoAxisOneMeasure', () => (
|
|
64
|
-
<Orchestrator
|
|
65
|
-
id="default"
|
|
66
|
-
source={dataTwoAxisOneMeasure}
|
|
67
|
-
missing={boolean('Missing', false)}
|
|
68
|
-
management={boolean('Management', false)}
|
|
69
|
-
positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
|
|
70
|
-
/>
|
|
71
|
-
));
|
|
72
|
-
|
|
73
|
-
stories.addWithJSX('Roster', () => (
|
|
74
|
-
<Orchestrator
|
|
75
|
-
id="default"
|
|
76
|
-
source={dataRoster}
|
|
77
|
-
missing={boolean('Missing', false)}
|
|
78
|
-
management={boolean('Management', false)}
|
|
79
|
-
positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
|
|
80
|
-
hideBtn={boolean('Hide button', false)}
|
|
81
|
-
/>
|
|
82
|
-
));
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { withReadme } from 'storybook-readme';
|
|
4
|
+
import Orchestrator from '../utils/orchestrator';
|
|
5
|
+
import readme from './README.md';
|
|
6
|
+
import { titleDecorator } from 'utils/lib';
|
|
7
|
+
import dataDefault from './data-default';
|
|
8
|
+
import dataOneAxisOneMeasure from './data-one-axis-one-measure';
|
|
9
|
+
import dataOneAxisTwoMeasures from './data-one-axis-two-measures';
|
|
10
|
+
import dataOneHierarchicalAxis from './data-one-hierarchical-axis';
|
|
11
|
+
import dataTwoAxisOneMeasure from './data-two-axis-one-measure';
|
|
12
|
+
import dataRoster from './data-roster';
|
|
13
|
+
import { positioningOptions, featuresOptions } from '../utils/options';
|
|
14
|
+
import { text, boolean, select, object } from '@storybook/addon-knobs/react';
|
|
15
|
+
|
|
16
|
+
const stories = storiesOf('Table', module)
|
|
17
|
+
.addDecorator(withReadme(readme))
|
|
18
|
+
.addDecorator((Component) => {
|
|
19
|
+
const WrappedComponent = titleDecorator(Component);
|
|
20
|
+
return <WrappedComponent title="<Table />" />;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
stories.addWithJSX('Default', () => (
|
|
24
|
+
<Orchestrator
|
|
25
|
+
id="default"
|
|
26
|
+
source={dataDefault}
|
|
27
|
+
label={text('Label', '"I\'m the label of the Table"')}
|
|
28
|
+
features={select('Features', featuresOptions, ['VTL', 'MD'])}
|
|
29
|
+
bindings={object('Bindings', { test: 'test' })}
|
|
30
|
+
/>
|
|
31
|
+
));
|
|
32
|
+
|
|
33
|
+
stories.addWithJSX('OneAxisOneMeasure', () => (
|
|
34
|
+
<Orchestrator
|
|
35
|
+
id="default"
|
|
36
|
+
source={dataOneAxisOneMeasure}
|
|
37
|
+
missing={boolean('Missing', false)}
|
|
38
|
+
management={boolean('Management', false)}
|
|
39
|
+
positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
|
|
40
|
+
/>
|
|
41
|
+
));
|
|
42
|
+
|
|
43
|
+
stories.addWithJSX('OneAxisTwoMeasure', () => (
|
|
44
|
+
<Orchestrator
|
|
45
|
+
id="default"
|
|
46
|
+
source={dataOneAxisTwoMeasures}
|
|
47
|
+
missing={boolean('Missing', false)}
|
|
48
|
+
management={boolean('Management', false)}
|
|
49
|
+
positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
|
|
50
|
+
/>
|
|
51
|
+
));
|
|
52
|
+
|
|
53
|
+
stories.addWithJSX('OneHierarchicalAxis', () => (
|
|
54
|
+
<Orchestrator
|
|
55
|
+
id="default"
|
|
56
|
+
source={dataOneHierarchicalAxis}
|
|
57
|
+
missing={boolean('Missing', false)}
|
|
58
|
+
management={boolean('Management', false)}
|
|
59
|
+
positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
|
|
60
|
+
/>
|
|
61
|
+
));
|
|
62
|
+
|
|
63
|
+
stories.addWithJSX('TwoAxisOneMeasure', () => (
|
|
64
|
+
<Orchestrator
|
|
65
|
+
id="default"
|
|
66
|
+
source={dataTwoAxisOneMeasure}
|
|
67
|
+
missing={boolean('Missing', false)}
|
|
68
|
+
management={boolean('Management', false)}
|
|
69
|
+
positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
|
|
70
|
+
/>
|
|
71
|
+
));
|
|
72
|
+
|
|
73
|
+
stories.addWithJSX('Roster', () => (
|
|
74
|
+
<Orchestrator
|
|
75
|
+
id="default"
|
|
76
|
+
source={dataRoster}
|
|
77
|
+
missing={boolean('Missing', false)}
|
|
78
|
+
management={boolean('Management', false)}
|
|
79
|
+
positioning={select('Items positioning', positioningOptions, 'DEFAULT')}
|
|
80
|
+
hideBtn={boolean('Hide button', false)}
|
|
81
|
+
/>
|
|
82
|
+
));
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
# Textarea component
|
|
2
|
-
|
|
3
|
-
## Props
|
|
4
|
-
|
|
5
|
-
| Props | Type | Default value | Required | Description |
|
|
6
|
-
| :--------------: | :------------: | :-----------: | :------: | --------------------------------------- |
|
|
7
|
-
| id | string | - | ✓ | Id of the textarea |
|
|
8
|
-
| label | string | - | ✓ | Label of the textarea |
|
|
9
|
-
| preferences \* | array | ["COLLECTED"] | | Preferences to manage textarea response |
|
|
10
|
-
| response \* | object | {} | | Response concerned by the component |
|
|
11
|
-
| placeholder | string | "" | | Placeholder of the textarea |
|
|
12
|
-
| handleChange | func | - | ✓ | Handler of the textarea |
|
|
13
|
-
| rows | number | 5 | | Number of rows of the textarea |
|
|
14
|
-
| maxLength | number, string | 524288 | | Maximum length of the textarea |
|
|
15
|
-
| readOnly | bool | false | | Is the textarea read only |
|
|
16
|
-
| disabled | bool | false | | Is the textarea disabled |
|
|
17
|
-
| labelPosition \* | string | "DEFAULT" | | Position of the textarea label |
|
|
18
|
-
| mandatory | bool | false | | Is the textarea mandatory |
|
|
19
|
-
| focused | bool | false | | Is the textarea focused |
|
|
20
|
-
| declarations \* | array | [ ] | | Declarations of the textarea |
|
|
21
|
-
| features | array | [ ] | | Component features for labels |
|
|
22
|
-
| bindings | object | [ ] | | Questionnaire bindings |
|
|
23
|
-
| management | bool | false | | Management mode of the textarea |
|
|
24
|
-
| style | object | {} | | Style of the textarea |
|
|
25
|
-
|
|
26
|
-
- `preferences` props has to be an ordered array of `COLLECTED`, `FORCED` or `EDITED`
|
|
27
|
-
- `response` props has to be a shape of `{name: string, values: object}`
|
|
28
|
-
- `labelPosition` props has to be one of `DEFAULT`, `TOP`, `BOTTOM`, `RIGHT` or `LEFT`
|
|
29
|
-
- `declarations` are documented in the `Declarations` component
|
|
30
|
-
|
|
31
|
-
## Styles
|
|
32
|
-
|
|
33
|
-
**Textarea** component has for classes `textarea-lunatic`.
|
|
1
|
+
# Textarea component
|
|
2
|
+
|
|
3
|
+
## Props
|
|
4
|
+
|
|
5
|
+
| Props | Type | Default value | Required | Description |
|
|
6
|
+
| :--------------: | :------------: | :-----------: | :------: | --------------------------------------- |
|
|
7
|
+
| id | string | - | ✓ | Id of the textarea |
|
|
8
|
+
| label | string | - | ✓ | Label of the textarea |
|
|
9
|
+
| preferences \* | array | ["COLLECTED"] | | Preferences to manage textarea response |
|
|
10
|
+
| response \* | object | {} | | Response concerned by the component |
|
|
11
|
+
| placeholder | string | "" | | Placeholder of the textarea |
|
|
12
|
+
| handleChange | func | - | ✓ | Handler of the textarea |
|
|
13
|
+
| rows | number | 5 | | Number of rows of the textarea |
|
|
14
|
+
| maxLength | number, string | 524288 | | Maximum length of the textarea |
|
|
15
|
+
| readOnly | bool | false | | Is the textarea read only |
|
|
16
|
+
| disabled | bool | false | | Is the textarea disabled |
|
|
17
|
+
| labelPosition \* | string | "DEFAULT" | | Position of the textarea label |
|
|
18
|
+
| mandatory | bool | false | | Is the textarea mandatory |
|
|
19
|
+
| focused | bool | false | | Is the textarea focused |
|
|
20
|
+
| declarations \* | array | [ ] | | Declarations of the textarea |
|
|
21
|
+
| features | array | [ ] | | Component features for labels |
|
|
22
|
+
| bindings | object | [ ] | | Questionnaire bindings |
|
|
23
|
+
| management | bool | false | | Management mode of the textarea |
|
|
24
|
+
| style | object | {} | | Style of the textarea |
|
|
25
|
+
|
|
26
|
+
- `preferences` props has to be an ordered array of `COLLECTED`, `FORCED` or `EDITED`
|
|
27
|
+
- `response` props has to be a shape of `{name: string, values: object}`
|
|
28
|
+
- `labelPosition` props has to be one of `DEFAULT`, `TOP`, `BOTTOM`, `RIGHT` or `LEFT`
|
|
29
|
+
- `declarations` are documented in the `Declarations` component
|
|
30
|
+
|
|
31
|
+
## Styles
|
|
32
|
+
|
|
33
|
+
**Textarea** component has for classes `textarea-lunatic`.
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"components": [
|
|
3
|
-
{
|
|
4
|
-
"id": "ta",
|
|
5
|
-
"componentType": "Textarea",
|
|
6
|
-
"mandatory": false,
|
|
7
|
-
"maxLength": "500",
|
|
8
|
-
"label": "➡ 1. Before starting, do you have any comments about the Simpsons family?",
|
|
9
|
-
"response": {
|
|
10
|
-
"name": "COMMENT"
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
"variables": [
|
|
15
|
-
{
|
|
16
|
-
"variableType": "COLLECTED",
|
|
17
|
-
"name": "COMMENT",
|
|
18
|
-
"componentRef": "ta",
|
|
19
|
-
"values": {
|
|
20
|
-
"PREVIOUS": null,
|
|
21
|
-
"COLLECTED": "Forced value",
|
|
22
|
-
"FORCED": "Hello",
|
|
23
|
-
"EDITED": null,
|
|
24
|
-
"INPUTED": null
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"components": [
|
|
3
|
+
{
|
|
4
|
+
"id": "ta",
|
|
5
|
+
"componentType": "Textarea",
|
|
6
|
+
"mandatory": false,
|
|
7
|
+
"maxLength": "500",
|
|
8
|
+
"label": "➡ 1. Before starting, do you have any comments about the Simpsons family?",
|
|
9
|
+
"response": {
|
|
10
|
+
"name": "COMMENT"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"variables": [
|
|
15
|
+
{
|
|
16
|
+
"variableType": "COLLECTED",
|
|
17
|
+
"name": "COMMENT",
|
|
18
|
+
"componentRef": "ta",
|
|
19
|
+
"values": {
|
|
20
|
+
"PREVIOUS": null,
|
|
21
|
+
"COLLECTED": "Forced value",
|
|
22
|
+
"FORCED": "Hello",
|
|
23
|
+
"EDITED": null,
|
|
24
|
+
"INPUTED": null
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
{
|
|
2
|
-
"components": [
|
|
3
|
-
{
|
|
4
|
-
"id": "ta",
|
|
5
|
-
"componentType": "Textarea",
|
|
6
|
-
"mandatory": false,
|
|
7
|
-
"maxLength": "500",
|
|
8
|
-
"label": "➡ 1. Before starting, do you have any comments about the Simpsons family?",
|
|
9
|
-
"response": {
|
|
10
|
-
"name": "COMMENT"
|
|
11
|
-
},
|
|
12
|
-
"missingResponse": {
|
|
13
|
-
"name": "COMMENT_MISSING"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"variables": [
|
|
18
|
-
{
|
|
19
|
-
"variableType": "COLLECTED",
|
|
20
|
-
"name": "COMMENT",
|
|
21
|
-
"componentRef": "ta",
|
|
22
|
-
"values": {
|
|
23
|
-
"PREVIOUS": null,
|
|
24
|
-
"COLLECTED": "Simpsons family is the most famous family in the world for sure. Funny, crazy and full of societal references.",
|
|
25
|
-
"FORCED": "Hello",
|
|
26
|
-
"EDITED": null,
|
|
27
|
-
"INPUTED": null
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"variableType": "COLLECTED",
|
|
32
|
-
"name": "COMMENT_MISSING",
|
|
33
|
-
"componentRef": "ta",
|
|
34
|
-
"values": {
|
|
35
|
-
"PREVIOUS": null,
|
|
36
|
-
"COLLECTED": null,
|
|
37
|
-
"FORCED": null,
|
|
38
|
-
"EDITED": null,
|
|
39
|
-
"INPUTED": null
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"components": [
|
|
3
|
+
{
|
|
4
|
+
"id": "ta",
|
|
5
|
+
"componentType": "Textarea",
|
|
6
|
+
"mandatory": false,
|
|
7
|
+
"maxLength": "500",
|
|
8
|
+
"label": "➡ 1. Before starting, do you have any comments about the Simpsons family?",
|
|
9
|
+
"response": {
|
|
10
|
+
"name": "COMMENT"
|
|
11
|
+
},
|
|
12
|
+
"missingResponse": {
|
|
13
|
+
"name": "COMMENT_MISSING"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"variables": [
|
|
18
|
+
{
|
|
19
|
+
"variableType": "COLLECTED",
|
|
20
|
+
"name": "COMMENT",
|
|
21
|
+
"componentRef": "ta",
|
|
22
|
+
"values": {
|
|
23
|
+
"PREVIOUS": null,
|
|
24
|
+
"COLLECTED": "Simpsons family is the most famous family in the world for sure. Funny, crazy and full of societal references.",
|
|
25
|
+
"FORCED": "Hello",
|
|
26
|
+
"EDITED": null,
|
|
27
|
+
"INPUTED": null
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"variableType": "COLLECTED",
|
|
32
|
+
"name": "COMMENT_MISSING",
|
|
33
|
+
"componentRef": "ta",
|
|
34
|
+
"values": {
|
|
35
|
+
"PREVIOUS": null,
|
|
36
|
+
"COLLECTED": null,
|
|
37
|
+
"FORCED": null,
|
|
38
|
+
"EDITED": null,
|
|
39
|
+
"INPUTED": null
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
|
-
import { withReadme } from 'storybook-readme';
|
|
4
|
-
import Orchestrator from '../utils/orchestrator';
|
|
5
|
-
import readme from './README.md';
|
|
6
|
-
import { titleDecorator } from 'utils/lib';
|
|
7
|
-
import data from './data';
|
|
8
|
-
import dataForced from './data-forced';
|
|
9
|
-
import { labelPositionOptions, featuresOptions } from '../utils/options';
|
|
10
|
-
import {
|
|
11
|
-
text,
|
|
12
|
-
boolean,
|
|
13
|
-
number,
|
|
14
|
-
object,
|
|
15
|
-
select,
|
|
16
|
-
} from '@storybook/addon-knobs/react';
|
|
17
|
-
|
|
18
|
-
const stories = storiesOf('Textarea', module)
|
|
19
|
-
.addDecorator(withReadme(readme))
|
|
20
|
-
.addDecorator((Component) => {
|
|
21
|
-
const WrappedComponent = titleDecorator(Component);
|
|
22
|
-
return <WrappedComponent title="<Textarea />" />;
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
stories.addWithJSX('Default', () => (
|
|
26
|
-
<Orchestrator id="default" source={data} />
|
|
27
|
-
));
|
|
28
|
-
|
|
29
|
-
stories.addWithJSX('Props', () => (
|
|
30
|
-
<Orchestrator
|
|
31
|
-
id="props"
|
|
32
|
-
source={data}
|
|
33
|
-
label={text('Label', '"Hello " || NAME')}
|
|
34
|
-
missing={boolean('Missing', false)}
|
|
35
|
-
placeholder={text('Placeholder', 'Placeholder')}
|
|
36
|
-
rows={number('Rows', 5)}
|
|
37
|
-
maxLength={number('Max length', 500)}
|
|
38
|
-
readOnly={boolean('Read only', false)}
|
|
39
|
-
mandatory={boolean('Mandatory', false)}
|
|
40
|
-
features={select('Features', featuresOptions, ['VTL', 'MD'])}
|
|
41
|
-
bindings={object('Bindings', { NAME: 'Mauro' })}
|
|
42
|
-
management={boolean('Management', false)}
|
|
43
|
-
focused={boolean('Focused', false)}
|
|
44
|
-
labelPosition={select('Label position', labelPositionOptions, 'DEFAULT')}
|
|
45
|
-
/>
|
|
46
|
-
));
|
|
47
|
-
|
|
48
|
-
stories.addWithJSX('External update', () => {
|
|
49
|
-
const Fake = () => {
|
|
50
|
-
const [up, setUp] = useState(false);
|
|
51
|
-
return (
|
|
52
|
-
<>
|
|
53
|
-
<button
|
|
54
|
-
type="button"
|
|
55
|
-
onClick={() => {
|
|
56
|
-
setUp(true);
|
|
57
|
-
}}
|
|
58
|
-
disabled={up}
|
|
59
|
-
>
|
|
60
|
-
Force external update
|
|
61
|
-
</button>
|
|
62
|
-
|
|
63
|
-
<Orchestrator id="default" source={up ? dataForced : data} />
|
|
64
|
-
</>
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
return <Fake />;
|
|
68
|
-
});
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { withReadme } from 'storybook-readme';
|
|
4
|
+
import Orchestrator from '../utils/orchestrator';
|
|
5
|
+
import readme from './README.md';
|
|
6
|
+
import { titleDecorator } from 'utils/lib';
|
|
7
|
+
import data from './data';
|
|
8
|
+
import dataForced from './data-forced';
|
|
9
|
+
import { labelPositionOptions, featuresOptions } from '../utils/options';
|
|
10
|
+
import {
|
|
11
|
+
text,
|
|
12
|
+
boolean,
|
|
13
|
+
number,
|
|
14
|
+
object,
|
|
15
|
+
select,
|
|
16
|
+
} from '@storybook/addon-knobs/react';
|
|
17
|
+
|
|
18
|
+
const stories = storiesOf('Textarea', module)
|
|
19
|
+
.addDecorator(withReadme(readme))
|
|
20
|
+
.addDecorator((Component) => {
|
|
21
|
+
const WrappedComponent = titleDecorator(Component);
|
|
22
|
+
return <WrappedComponent title="<Textarea />" />;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
stories.addWithJSX('Default', () => (
|
|
26
|
+
<Orchestrator id="default" source={data} />
|
|
27
|
+
));
|
|
28
|
+
|
|
29
|
+
stories.addWithJSX('Props', () => (
|
|
30
|
+
<Orchestrator
|
|
31
|
+
id="props"
|
|
32
|
+
source={data}
|
|
33
|
+
label={text('Label', '"Hello " || NAME')}
|
|
34
|
+
missing={boolean('Missing', false)}
|
|
35
|
+
placeholder={text('Placeholder', 'Placeholder')}
|
|
36
|
+
rows={number('Rows', 5)}
|
|
37
|
+
maxLength={number('Max length', 500)}
|
|
38
|
+
readOnly={boolean('Read only', false)}
|
|
39
|
+
mandatory={boolean('Mandatory', false)}
|
|
40
|
+
features={select('Features', featuresOptions, ['VTL', 'MD'])}
|
|
41
|
+
bindings={object('Bindings', { NAME: 'Mauro' })}
|
|
42
|
+
management={boolean('Management', false)}
|
|
43
|
+
focused={boolean('Focused', false)}
|
|
44
|
+
labelPosition={select('Label position', labelPositionOptions, 'DEFAULT')}
|
|
45
|
+
/>
|
|
46
|
+
));
|
|
47
|
+
|
|
48
|
+
stories.addWithJSX('External update', () => {
|
|
49
|
+
const Fake = () => {
|
|
50
|
+
const [up, setUp] = useState(false);
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
<button
|
|
54
|
+
type="button"
|
|
55
|
+
onClick={() => {
|
|
56
|
+
setUp(true);
|
|
57
|
+
}}
|
|
58
|
+
disabled={up}
|
|
59
|
+
>
|
|
60
|
+
Force external update
|
|
61
|
+
</button>
|
|
62
|
+
|
|
63
|
+
<Orchestrator id="default" source={up ? dataForced : data} />
|
|
64
|
+
</>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
return <Fake />;
|
|
68
|
+
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# TooltipResponse component
|
|
2
|
-
|
|
3
|
-
## Props
|
|
4
|
-
|
|
5
|
-
| Props | Type | Default value | Required | Description |
|
|
6
|
-
| :---------: | :----: | :-----------: | :------: | ----------------------- |
|
|
7
|
-
| id | string | - | ✓ | Id of the |
|
|
8
|
-
| response \* | string | " " | | Response of the tooltip |
|
|
9
|
-
|
|
10
|
-
- `response` props has to be a shape of `{name: string, values: object}`
|
|
11
|
-
|
|
12
|
-
## Styles
|
|
13
|
-
|
|
14
|
-
**TooltipResponse** component has for classes `tooltip-lunatic`.
|
|
1
|
+
# TooltipResponse component
|
|
2
|
+
|
|
3
|
+
## Props
|
|
4
|
+
|
|
5
|
+
| Props | Type | Default value | Required | Description |
|
|
6
|
+
| :---------: | :----: | :-----------: | :------: | ----------------------- |
|
|
7
|
+
| id | string | - | ✓ | Id of the |
|
|
8
|
+
| response \* | string | " " | | Response of the tooltip |
|
|
9
|
+
|
|
10
|
+
- `response` props has to be a shape of `{name: string, values: object}`
|
|
11
|
+
|
|
12
|
+
## Styles
|
|
13
|
+
|
|
14
|
+
**TooltipResponse** component has for classes `tooltip-lunatic`.
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
{
|
|
2
|
-
"components": [
|
|
3
|
-
{
|
|
4
|
-
"id": "uu",
|
|
5
|
-
"componentType": "Radio",
|
|
6
|
-
"mandatory": false,
|
|
7
|
-
"label": "NAME || \", êtes-vous au [chômage](https://www.insee.fr/fr/metadonnees/definition/c1303) ?\"",
|
|
8
|
-
"response": {
|
|
9
|
-
"name": "UNEMPLOYMENT"
|
|
10
|
-
},
|
|
11
|
-
"options": [
|
|
12
|
-
{ "value": "0", "label": "Non" },
|
|
13
|
-
{ "value": "1", "label": "Yes" }
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"variables": [
|
|
18
|
-
{
|
|
19
|
-
"variableType": "COLLECTED",
|
|
20
|
-
"name": "UNEMPLOYMENT",
|
|
21
|
-
"componentRef": "uu",
|
|
22
|
-
"values": {
|
|
23
|
-
"PREVIOUS": null,
|
|
24
|
-
"COLLECTED": null,
|
|
25
|
-
"FORCED": "1",
|
|
26
|
-
"EDITED": null,
|
|
27
|
-
"INPUTED": null
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"components": [
|
|
3
|
+
{
|
|
4
|
+
"id": "uu",
|
|
5
|
+
"componentType": "Radio",
|
|
6
|
+
"mandatory": false,
|
|
7
|
+
"label": "NAME || \", êtes-vous au [chômage](https://www.insee.fr/fr/metadonnees/definition/c1303) ?\"",
|
|
8
|
+
"response": {
|
|
9
|
+
"name": "UNEMPLOYMENT"
|
|
10
|
+
},
|
|
11
|
+
"options": [
|
|
12
|
+
{ "value": "0", "label": "Non" },
|
|
13
|
+
{ "value": "1", "label": "Yes" }
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"variables": [
|
|
18
|
+
{
|
|
19
|
+
"variableType": "COLLECTED",
|
|
20
|
+
"name": "UNEMPLOYMENT",
|
|
21
|
+
"componentRef": "uu",
|
|
22
|
+
"values": {
|
|
23
|
+
"PREVIOUS": null,
|
|
24
|
+
"COLLECTED": null,
|
|
25
|
+
"FORCED": "1",
|
|
26
|
+
"EDITED": null,
|
|
27
|
+
"INPUTED": null
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|