@inseefr/lunatic 0.1.6 → 0.1.8-experimental
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -2
- package/lib/index.js +2818 -596
- package/lib/index.js.map +1 -1
- package/package.json +90 -53
- package/src/components/breadcrumb/breadcrumb.scss +20 -0
- package/src/components/breadcrumb/component.js +29 -0
- package/src/components/breadcrumb/index.js +1 -0
- package/src/components/button/button.scss +24 -0
- package/src/components/button/component.js +53 -0
- package/src/components/button/index.js +1 -0
- package/src/components/checkbox/boolean.js +172 -0
- package/src/components/checkbox/checkbox.scss +71 -0
- package/src/components/checkbox/group.js +231 -0
- package/src/components/checkbox/index.js +3 -0
- package/src/components/checkbox/one.js +11 -0
- package/src/components/components.js +18 -0
- package/src/components/datepicker/component.js +11 -0
- package/src/components/datepicker/datepicker.scss +1 -0
- package/src/components/datepicker/index.js +1 -0
- package/src/components/declarations/component.js +45 -0
- package/src/components/declarations/declarations.scss +38 -0
- package/src/components/declarations/index.js +1 -0
- package/src/components/declarations/wrappers/index.js +3 -0
- package/src/components/declarations/wrappers/input-declarations-wrapper.js +269 -0
- package/src/components/declarations/wrappers/list-declarations-wrapper.js +232 -0
- package/src/components/declarations/wrappers/simple-declarations-wrapper.js +54 -0
- package/src/components/dropdown/commons/actions.js +56 -0
- package/src/components/dropdown/commons/children-to-option.js +9 -0
- package/src/components/dropdown/commons/cleaner-callbacks.js +58 -0
- package/src/components/dropdown/commons/components/dropdown-container.js +29 -0
- package/src/components/dropdown/commons/components/dropdown-field.js +46 -0
- package/src/components/dropdown/commons/components/dropdown.js +183 -0
- package/src/components/dropdown/commons/components/label.js +28 -0
- package/src/components/dropdown/commons/components/panel.js +78 -0
- package/src/components/dropdown/commons/event-callbacks/index.js +5 -0
- package/src/components/dropdown/commons/event-callbacks/on-keydown-callback.js +29 -0
- package/src/components/dropdown/commons/event-callbacks/on-mousedown-callback.js +11 -0
- package/src/components/dropdown/commons/reducer.js +149 -0
- package/src/components/dropdown/commons/tools/index.js +17 -0
- package/src/components/dropdown/component.js +128 -0
- package/src/components/dropdown/dropdown-edit/dropdown-edit.js +190 -0
- package/src/components/dropdown/dropdown-edit/icone.js +33 -0
- package/src/components/dropdown/dropdown-edit/index.js +11 -0
- package/src/components/dropdown/dropdown-edit/option.js +62 -0
- package/src/components/dropdown/dropdown-edit/prefix-tools.js +51 -0
- package/src/components/dropdown/dropdown-simple/dropdown.js +162 -0
- package/src/components/dropdown/dropdown-simple/index.js +20 -0
- package/src/components/dropdown/dropdown-simple/option.js +15 -0
- package/src/components/dropdown/dropdown.scss +176 -0
- package/src/components/dropdown/index.js +1 -0
- package/src/components/filter-description/component.js +42 -0
- package/src/components/filter-description/index.js +1 -0
- package/src/components/icon/assets/checkbox-checked.js +16 -0
- package/src/components/icon/assets/checkbox-unchecked.js +16 -0
- package/src/components/icon/assets/index.js +4 -0
- package/src/components/icon/assets/radio-checked.js +16 -0
- package/src/components/icon/assets/radio-unchecked.js +16 -0
- package/src/components/icon/component.js +33 -0
- package/src/components/icon/icon.scss +13 -0
- package/src/components/icon/index.js +1 -0
- package/src/components/index.js +3 -0
- package/src/components/index.scss +173 -0
- package/src/components/input/index.js +2 -0
- package/src/components/input/input-number.js +54 -0
- package/src/components/input/input.js +11 -0
- package/src/components/input/input.scss +35 -0
- package/src/components/loop/component.js +258 -0
- package/src/components/loop/index.js +1 -0
- package/src/components/loop/loop.scss +11 -0
- package/src/components/loop/wrapper.js +15 -0
- package/src/components/loop-constructor/block/block.scss +8 -0
- package/src/components/loop-constructor/block/component.js +9 -0
- package/src/components/loop-constructor/block/index.js +1 -0
- package/src/components/loop-constructor/index.js +1 -0
- package/src/components/loop-constructor/roster/component.js +8 -0
- package/src/components/loop-constructor/roster/index.js +1 -0
- package/src/components/loop-constructor/wrapper/body-component.js +122 -0
- package/src/components/loop-constructor/wrapper/build-components.js +33 -0
- package/src/components/loop-constructor/wrapper/component.js +189 -0
- package/src/components/loop-constructor/wrapper/index.js +1 -0
- package/src/components/missing-wrapper/component.js +119 -0
- package/src/components/missing-wrapper/index.js +1 -0
- package/src/components/missing-wrapper/missing.scss +30 -0
- package/src/components/missing-wrapper/wrapper.js +10 -0
- package/src/components/progress-bar/component.js +28 -0
- package/src/components/progress-bar/index.js +1 -0
- package/src/components/progress-bar/progress-bar.scss +52 -0
- package/src/components/radio/component.js +9 -0
- package/src/components/radio/index.js +1 -0
- package/src/components/radio/radio.scss +57 -0
- package/src/components/sequence/component.js +49 -0
- package/src/components/sequence/index.js +1 -0
- package/src/components/sequence/sequence.scss +8 -0
- package/src/components/subsequence/component.js +48 -0
- package/src/components/subsequence/index.js +1 -0
- package/src/components/suggester/check-store.js +70 -0
- package/src/components/suggester/commons-tools/binded-keys.js +11 -0
- package/src/components/suggester/commons-tools/index.js +1 -0
- package/src/components/suggester/components/create-on-keydown-callback.js +28 -0
- package/src/components/suggester/components/index.js +2 -0
- package/src/components/suggester/components/panel/default-option-renderer.js +19 -0
- package/src/components/suggester/components/panel/index.js +2 -0
- package/src/components/suggester/components/panel/option-container.js +63 -0
- package/src/components/suggester/components/panel/panel-container.js +21 -0
- package/src/components/suggester/components/panel/panel.js +33 -0
- package/src/components/suggester/components/selection/default-label-renderer.js +31 -0
- package/src/components/suggester/components/selection/delete.js +38 -0
- package/src/components/suggester/components/selection/index.js +1 -0
- package/src/components/suggester/components/selection/label.js +31 -0
- package/src/components/suggester/components/selection/selection.js +50 -0
- package/src/components/suggester/components/suggester-content.js +42 -0
- package/src/components/suggester/components/suggester.js +87 -0
- package/src/components/suggester/components/suggester.scss +100 -0
- package/src/components/suggester/default-style.scss +122 -0
- package/src/components/suggester/idb-suggester.js +74 -0
- package/src/components/suggester/index.js +1 -0
- package/src/components/suggester/lunatic-suggester.js +148 -0
- package/src/components/suggester/searching/index.js +1 -0
- package/src/components/suggester/searching/searching.js +39 -0
- package/src/components/suggester/state-management/actions.js +35 -0
- package/src/components/suggester/state-management/index.js +6 -0
- package/src/components/suggester/state-management/intial-state.js +13 -0
- package/src/components/suggester/state-management/reducer/index.js +1 -0
- package/src/components/suggester/state-management/reducer/reduce-on-blur.js +5 -0
- package/src/components/suggester/state-management/reducer/reduce-on-change-search.js +8 -0
- package/src/components/suggester/state-management/reducer/reduce-on-click-option.js +8 -0
- package/src/components/suggester/state-management/reducer/reduce-on-error.js +8 -0
- package/src/components/suggester/state-management/reducer/reduce-on-focus.js +5 -0
- package/src/components/suggester/state-management/reducer/reduce-on-init.js +11 -0
- package/src/components/suggester/state-management/reducer/reduce-on-key-down.js +73 -0
- package/src/components/suggester/state-management/reducer/reduce-on-unexpected-error.js +7 -0
- package/src/components/suggester/state-management/reducer/reduce-on-update-options.js +11 -0
- package/src/components/suggester/state-management/reducer/reducer.js +35 -0
- package/src/components/suggester/state-management/suggester-context.js +4 -0
- package/src/components/suggester/state-management/use-dispatch.js +11 -0
- package/src/components/suggester/suggester-wrapper.js +101 -0
- package/src/components/suggester-loader-widget/create-append-task.js +43 -0
- package/src/components/suggester-loader-widget/index.js +1 -0
- package/src/components/suggester-loader-widget/loader-row.js +102 -0
- package/src/components/suggester-loader-widget/loader.js +67 -0
- package/src/components/suggester-loader-widget/progress.js +25 -0
- package/src/components/suggester-loader-widget/tools/action-tool.js +20 -0
- package/src/components/suggester-loader-widget/tools/index.js +2 -0
- package/src/components/suggester-loader-widget/tools/tools.js +7 -0
- package/src/components/suggester-loader-widget/widget-container.js +35 -0
- package/src/components/suggester-loader-widget/widget.js +125 -0
- package/src/components/suggester-loader-widget/widget.scss +176 -0
- package/src/components/table/index.js +1 -0
- package/src/components/table/table.js +171 -0
- package/src/components/table/table.scss +24 -0
- package/src/components/textarea/component.js +11 -0
- package/src/components/textarea/index.js +1 -0
- package/src/components/textarea/textarea.scss +6 -0
- package/src/components/tooltip/img/edited.png +0 -0
- package/src/components/tooltip/img/forced.png +0 -0
- package/src/components/tooltip/img/index.js +4 -0
- package/src/components/tooltip/index.js +1 -0
- package/src/components/tooltip/response.js +52 -0
- package/src/components/tooltip/tooltip.scss +27 -0
- package/src/constants/component-types.js +1 -0
- package/src/constants/declarations.js +14 -0
- package/src/constants/event-types.js +13 -0
- package/src/constants/index.js +5 -0
- package/src/constants/supported-preferences.js +10 -0
- package/src/constants/value-types.js +5 -0
- package/src/constants/variable-types.js +4 -0
- package/src/stories/breadcrumb/README.md +14 -0
- package/src/stories/breadcrumb/breadcrumb.stories.js +19 -0
- package/src/stories/button/README.md +14 -0
- package/src/stories/button/button.stories.js +27 -0
- package/src/stories/checkbox-boolean/README.md +27 -0
- package/src/stories/checkbox-boolean/checkbox-boolean.stories.js +54 -0
- package/src/stories/checkbox-boolean/data-forced.json +48 -0
- package/src/stories/checkbox-boolean/data.json +78 -0
- package/src/stories/checkbox-group/README.md +29 -0
- package/src/stories/checkbox-group/checkbox-group.stories.js +60 -0
- package/src/stories/checkbox-group/data-forced.json +89 -0
- package/src/stories/checkbox-group/data-vtl.json +102 -0
- package/src/stories/checkbox-group/data.json +89 -0
- package/src/stories/checkbox-one/README.md +31 -0
- package/src/stories/checkbox-one/checkbox-one.stories.js +57 -0
- package/src/stories/checkbox-one/data-forced.json +33 -0
- package/src/stories/checkbox-one/data-vtl.json +48 -0
- package/src/stories/checkbox-one/data.json +33 -0
- package/src/stories/datepicker/README.md +31 -0
- package/src/stories/datepicker/data-forced.json +28 -0
- package/src/stories/datepicker/data.json +43 -0
- package/src/stories/datepicker/datepicker.stories.js +60 -0
- package/src/stories/declarations/README.md +19 -0
- package/src/stories/declarations/declarations.stories.js +112 -0
- package/src/stories/dropdown/README.md +44 -0
- package/src/stories/dropdown/data-forced.json +81 -0
- package/src/stories/dropdown/data-naf.json +6963 -0
- package/src/stories/dropdown/data-props.json +111 -0
- package/src/stories/dropdown/data.json +78 -0
- package/src/stories/dropdown/dropdown.stories.js +89 -0
- package/src/stories/filter-description/README.md +15 -0
- package/src/stories/filter-description/filter-description.stories.js +53 -0
- package/src/stories/icons/icons.stories.js +16 -0
- package/src/stories/icons/lunatic-icon.scss +10 -0
- package/src/stories/input/README.md +33 -0
- package/src/stories/input/data-forced.json +41 -0
- package/src/stories/input/data.json +41 -0
- package/src/stories/input/input.stories.js +72 -0
- package/src/stories/input-number/README.md +37 -0
- package/src/stories/input-number/data-forced.json +27 -0
- package/src/stories/input-number/data.json +42 -0
- package/src/stories/input-number/input-number.stories.js +81 -0
- package/src/stories/loop/README.md +25 -0
- package/src/stories/loop/loop.stories.js +88 -0
- package/src/stories/loop/with-loop/data-loop-deeper.json +298 -0
- package/src/stories/loop/with-loop/data-loop.json +336 -0
- package/src/stories/loop/with-loop/index.js +2 -0
- package/src/stories/loop/with-roster/data-forced.json +213 -0
- package/src/stories/loop/with-roster/data-loop-deeper.json +298 -0
- package/src/stories/loop/with-roster/data-loop.json +288 -0
- package/src/stories/loop/with-roster/index.js +3 -0
- package/src/stories/loop-constructor/README.md +27 -0
- package/src/stories/loop-constructor/data-input-forced.json +64 -0
- package/src/stories/loop-constructor/data-input.json +100 -0
- package/src/stories/loop-constructor/data-loop-forced.json +66 -0
- package/src/stories/loop-constructor/data-loop-static-forced.json +66 -0
- package/src/stories/loop-constructor/data-loop-static.json +81 -0
- package/src/stories/loop-constructor/data-loop.json +81 -0
- package/src/stories/loop-constructor/data-roster-forced.json +68 -0
- package/src/stories/loop-constructor/data-roster.json +83 -0
- package/src/stories/loop-constructor/loop-constructor.stories.js +180 -0
- package/src/stories/pagination/deeper-loop.json +327 -0
- package/src/stories/pagination/pagination.stories.js +60 -0
- package/src/stories/pagination/simple-loop.json +277 -0
- package/src/stories/pagination/simpsons-question.json +4952 -0
- package/src/stories/pagination/simpsons-sequence.json +4362 -0
- package/src/stories/progress-bar/README.md +13 -0
- package/src/stories/progress-bar/progress-bar.stories.js +24 -0
- package/src/stories/questionnaire/arithmetic.json +254 -0
- package/src/stories/questionnaire/calc-var.json +187 -0
- package/src/stories/questionnaire/logement.json +23402 -0
- package/src/stories/questionnaire/questionnaire.stories.js +119 -0
- package/src/stories/questionnaire/simpsons.json +4816 -0
- package/src/stories/radio/README.md +31 -0
- package/src/stories/radio/data-forced.json +32 -0
- package/src/stories/radio/data-vtl.json +47 -0
- package/src/stories/radio/data.json +32 -0
- package/src/stories/radio/radio.stories.js +64 -0
- package/src/stories/sequence/README.md +18 -0
- package/src/stories/sequence/sequence.stories.js +28 -0
- package/src/stories/subsequence/README.md +18 -0
- package/src/stories/subsequence/subsequence.stories.js +28 -0
- package/src/stories/suggester/README.md +29 -0
- package/src/stories/suggester/cog-communes/fetch-cog.js +11 -0
- package/src/stories/suggester/cog-communes/index.js +2 -0
- package/src/stories/suggester/cog-communes/option-cog-renderer.js +15 -0
- package/src/stories/suggester/cog-communes/theme.scss +12 -0
- package/src/stories/suggester/data-auto.json +231 -0
- package/src/stories/suggester/data-vtl.json +82 -0
- package/src/stories/suggester/data.json +83 -0
- package/src/stories/suggester/naf-rev2/fetch-naf.js +57 -0
- package/src/stories/suggester/naf-rev2/index.js +2 -0
- package/src/stories/suggester/naf-rev2/option-renderer.js +17 -0
- package/src/stories/suggester/naf-rev2/theme.scss +36 -0
- package/src/stories/suggester/suggester.stories.js +128 -0
- package/src/stories/table/README.md +29 -0
- package/src/stories/table/data-default.json +19 -0
- package/src/stories/table/data-one-axis-one-measure.json +139 -0
- package/src/stories/table/data-one-axis-two-measures.json +208 -0
- package/src/stories/table/data-one-hierarchical-axis.json +219 -0
- package/src/stories/table/data-roster.json +486 -0
- package/src/stories/table/data-two-axis-one-measure.json +507 -0
- package/src/stories/table/table.stories.js +82 -0
- package/src/stories/textarea/README.md +33 -0
- package/src/stories/textarea/data-forced.json +28 -0
- package/src/stories/textarea/data.json +43 -0
- package/src/stories/textarea/textarea.stories.js +68 -0
- package/src/stories/tooltip-response/README.md +14 -0
- package/src/stories/tooltip-response/md-link.json +31 -0
- package/src/stories/tooltip-response/md-tooltip.json +31 -0
- package/src/stories/tooltip-response/tooltip.stories.js +83 -0
- package/src/stories/utils/custom-lunatic.scss +23 -0
- package/src/stories/utils/img/arrow.png +0 -0
- package/src/stories/utils/img/check_box.svg +1 -0
- package/src/stories/utils/img/check_box_outline.svg +1 -0
- package/src/stories/utils/img/lunatic-logo.png +0 -0
- package/src/stories/utils/img/menu-down.svg +1 -0
- package/src/stories/utils/img/menu-up.svg +1 -0
- package/src/stories/utils/img/radio_button_checked.svg +1 -0
- package/src/stories/utils/img/radio_button_unchecked.svg +1 -0
- package/src/stories/utils/options.js +25 -0
- package/src/stories/utils/orchestrator.js +108 -0
- package/src/tests/components/breadcrumb.spec.js +13 -0
- package/src/tests/components/button.spec.js +11 -0
- package/src/tests/components/checkbox-boolean.spec.js +45 -0
- package/src/tests/components/checkbox-group.spec.js +53 -0
- package/src/tests/components/checkbox-one.spec.js +32 -0
- package/src/tests/components/datepicker.spec.js +22 -0
- package/src/tests/components/declarations-wrappers/input-declarations-wrapper.spec.js +67 -0
- package/src/tests/components/declarations-wrappers/list-declarations-wrapper.spec.js +52 -0
- package/src/tests/components/declarations-wrappers/simple-declarations-wrapper.spec.js +21 -0
- package/src/tests/components/declarations.spec.js +46 -0
- package/src/tests/components/input-number.spec.js +194 -0
- package/src/tests/components/input.spec.js +18 -0
- package/src/tests/components/loops/loop-static.json +66 -0
- package/src/tests/components/loops/loop.json +258 -0
- package/src/tests/components/loops/loop.spec.js +30 -0
- package/src/tests/components/loops/roster-for-loop.spec.js +18 -0
- package/src/tests/components/loops/roster-loop.json +69 -0
- package/src/tests/components/missing-wrapper.spec.js +33 -0
- package/src/tests/components/progress-bar.spec.js +15 -0
- package/src/tests/components/radio.spec.js +27 -0
- package/src/tests/components/sequence.spec.js +9 -0
- package/src/tests/components/subsequence.spec.js +9 -0
- package/src/tests/components/table.spec.js +11 -0
- package/src/tests/components/textarea.spec.js +18 -0
- package/src/tests/components/tooltip.spec.js +25 -0
- package/src/tests/setup/setupTests.js +4 -0
- package/src/tests/utils/lib/alphabet.spec.js +36 -0
- package/src/tests/utils/lib/array.spec.js +22 -0
- package/src/tests/utils/lib/checkbox/group.spec.js +72 -0
- package/src/tests/utils/lib/decorator/title-decorator.spec.js +12 -0
- package/src/tests/utils/lib/input-number.spec.js +18 -0
- package/src/tests/utils/lib/items-positioning.spec.js +17 -0
- package/src/tests/utils/lib/label-position.spec.js +22 -0
- package/src/tests/utils/lib/loops/bindings.spec.js +75 -0
- package/src/tests/utils/lib/loops/shared.spec.js +82 -0
- package/src/tests/utils/lib/missing/missing.spec.js +74 -0
- package/src/tests/utils/lib/missing/mock.js +137 -0
- package/src/tests/utils/lib/pagination/shared.spec.js +42 -0
- package/src/tests/utils/lib/responses.spec.js +64 -0
- package/src/tests/utils/lib/style.spec.js +26 -0
- package/src/tests/utils/lib/table/roster.spec.js +25 -0
- package/src/tests/utils/lib/tooltip/build-response.spec.js +95 -0
- package/src/tests/utils/lib/tooltip/content.spec.js +109 -0
- package/src/tests/utils/to-expose/handler/handler.spec.js +94 -0
- package/src/tests/utils/to-expose/handler/questionnaire.json +158 -0
- package/src/tests/utils/to-expose/handler/results/index.js +6 -0
- package/src/tests/utils/to-expose/handler/results/res-double.json +158 -0
- package/src/tests/utils/to-expose/handler/results/res-input-collected.json +158 -0
- package/src/tests/utils/to-expose/handler/results/res-input-edited.json +158 -0
- package/src/tests/utils/to-expose/handler/results/res-loop.json +158 -0
- package/src/tests/utils/to-expose/handler/results/res-matrix.json +158 -0
- package/src/tests/utils/to-expose/handler/results/res-responses.json +158 -0
- package/src/tests/utils/to-expose/hooks/use-lunatic.spec.js +46 -0
- package/src/tests/utils/to-expose/init-questionnaire/data.json +12 -0
- package/src/tests/utils/to-expose/init-questionnaire/init-questionnaire.spec.js +19 -0
- package/src/tests/utils/to-expose/init-questionnaire/questionnaire.json +141 -0
- package/src/tests/utils/to-expose/init-questionnaire/result.json +174 -0
- package/src/tests/utils/to-expose/interpret/interpret.spec.js +48 -0
- package/src/tests/utils/to-expose/state/questionnaire.json +61 -0
- package/src/tests/utils/to-expose/state/results.js +78 -0
- package/src/tests/utils/to-expose/state/state.spec.js +59 -0
- package/src/utils/components/dragger/dragger.js +64 -0
- package/src/utils/components/dragger/dragger.scss +8 -0
- package/src/utils/components/dragger/index.js +1 -0
- package/src/utils/components/fab/fab.js +50 -0
- package/src/utils/components/fab/fab.scss +32 -0
- package/src/utils/components/fab/index.js +1 -0
- package/src/utils/components/field-wrapper.js +23 -0
- package/src/utils/components/is-network/index.js +1 -0
- package/src/utils/components/is-network/is-network.js +39 -0
- package/src/utils/components/is-network/use-online-status.js +51 -0
- package/src/utils/components/label-wrapper.js +45 -0
- package/src/utils/icons/closed.icon.js +24 -0
- package/src/utils/icons/cross.icon.js +24 -0
- package/src/utils/icons/load.icon.js +24 -0
- package/src/utils/icons/lunatic-icon.js +9 -0
- package/src/utils/icons/lunatic-icon.scss +4 -0
- package/src/utils/icons/network.icon.js +24 -0
- package/src/utils/icons/on-drag.icon.js +24 -0
- package/src/utils/icons/opened.icon.js +24 -0
- package/src/utils/idb-tools/clear-store.js +16 -0
- package/src/utils/idb-tools/get-entity.js +15 -0
- package/src/utils/idb-tools/get-idb.js +12 -0
- package/src/utils/idb-tools/index.js +4 -0
- package/src/utils/idb-tools/open-db.js +32 -0
- package/src/utils/lib/alphabet.js +1 -0
- package/src/utils/lib/array.js +7 -0
- package/src/utils/lib/checkbox/group.js +21 -0
- package/src/utils/lib/checkbox/index.js +1 -0
- package/src/utils/lib/decorator/index.js +1 -0
- package/src/utils/lib/decorator/title-decorator.js +16 -0
- package/src/utils/lib/env.js +2 -0
- package/src/utils/lib/event.js +15 -0
- package/src/utils/lib/function.js +1 -0
- package/src/utils/lib/index.js +19 -0
- package/src/utils/lib/input-number.js +6 -0
- package/src/utils/lib/label-position.js +12 -0
- package/src/utils/lib/loops/bindings.js +66 -0
- package/src/utils/lib/loops/build-components.js +33 -0
- package/src/utils/lib/loops/index.js +3 -0
- package/src/utils/lib/loops/shared.js +55 -0
- package/src/utils/lib/memo-check.js +24 -0
- package/src/utils/lib/missing.js +52 -0
- package/src/utils/lib/options-positioning.js +9 -0
- package/src/utils/lib/pagination/flow.js +2 -0
- package/src/utils/lib/pagination/index.js +2 -0
- package/src/utils/lib/pagination/navigation/index.js +1 -0
- package/src/utils/lib/pagination/navigation/shared.js +108 -0
- package/src/utils/lib/prop-types/declarations.js +22 -0
- package/src/utils/lib/prop-types/index.js +5 -0
- package/src/utils/lib/prop-types/lines.js +6 -0
- package/src/utils/lib/prop-types/options.js +8 -0
- package/src/utils/lib/prop-types/response.js +6 -0
- package/src/utils/lib/prop-types/value-type.js +9 -0
- package/src/utils/lib/responses.js +9 -0
- package/src/utils/lib/style.js +10 -0
- package/src/utils/lib/table/index.js +1 -0
- package/src/utils/lib/table/roster.js +23 -0
- package/src/utils/lib/tooltip/build-response.js +41 -0
- package/src/utils/lib/tooltip/content.js +55 -0
- package/src/utils/lib/tooltip/index.js +6 -0
- package/src/utils/store-tools/auto-load.js +72 -0
- package/src/utils/store-tools/clear-store-data.js +8 -0
- package/src/utils/store-tools/clear-store-info.js +8 -0
- package/src/utils/store-tools/constantes.js +20 -0
- package/src/utils/store-tools/create/create.js +19 -0
- package/src/utils/store-tools/create/index.js +1 -0
- package/src/utils/store-tools/create/update-store-info.js +26 -0
- package/src/utils/store-tools/get-store-count.js +22 -0
- package/src/utils/store-tools/index.js +5 -0
- package/src/utils/store-tools/open-or-create-store.js +47 -0
- package/src/utils/store-tools/use-store-index.js +24 -0
- package/src/utils/to-expose/handler.js +137 -0
- package/src/utils/to-expose/hooks/filter-components.js +106 -0
- package/src/utils/to-expose/hooks/index.js +1 -0
- package/src/utils/to-expose/hooks/lunatic.js +191 -0
- package/src/utils/to-expose/hooks/use-document-add-event-listener.js +63 -0
- package/src/utils/to-expose/index.js +11 -0
- package/src/utils/to-expose/init-questionnaire.js +223 -0
- package/src/utils/to-expose/interpret/index.js +1 -0
- package/src/utils/to-expose/interpret/main.js +16 -0
- package/src/utils/to-expose/interpret/md.js +65 -0
- package/src/utils/to-expose/interpret/vtl.js +18 -0
- package/src/utils/to-expose/state.js +58 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
$colorA: #e9d0d0;
|
|
2
|
+
$colorB: darkred;
|
|
3
|
+
$colorC: #320000;
|
|
4
|
+
$colorD: goldenrod;
|
|
5
|
+
|
|
6
|
+
@mixin preventSelect() {
|
|
7
|
+
-moz-user-select: -moz-none;
|
|
8
|
+
-khtml-user-select: none;
|
|
9
|
+
-webkit-user-select: none;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@mixin onDrag() {
|
|
13
|
+
&.drag {
|
|
14
|
+
box-shadow: $colorD 0px 3px 8px;
|
|
15
|
+
transition: box-shadow 0.5s;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.lunatic-suggester-widget-container {
|
|
20
|
+
&.absolute {
|
|
21
|
+
position: fixed;
|
|
22
|
+
z-index: 1;
|
|
23
|
+
}
|
|
24
|
+
.lunatic-suggester-widget {
|
|
25
|
+
position: relative;
|
|
26
|
+
border: solid $colorB 2px;
|
|
27
|
+
background-color: $colorA;
|
|
28
|
+
padding: 4px 4px;
|
|
29
|
+
border: 2px 2px;
|
|
30
|
+
width: 400px;
|
|
31
|
+
box-shadow: $colorC 0px 3px 8px;
|
|
32
|
+
|
|
33
|
+
@include onDrag();
|
|
34
|
+
|
|
35
|
+
.widget-row {
|
|
36
|
+
height: 22px;
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: row;
|
|
39
|
+
margin-bottom: 1px;
|
|
40
|
+
.store-name {
|
|
41
|
+
width: 60%;
|
|
42
|
+
color: $colorB;
|
|
43
|
+
font-size: 18px;
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
overflow-x: hidden;
|
|
46
|
+
}
|
|
47
|
+
.stats {
|
|
48
|
+
color: $colorB;
|
|
49
|
+
font-size: 18px;
|
|
50
|
+
white-space: nowrap;
|
|
51
|
+
overflow-x: hidden;
|
|
52
|
+
width: 40%;
|
|
53
|
+
}
|
|
54
|
+
.widget-button {
|
|
55
|
+
margin: 0 1px 0 0;
|
|
56
|
+
padding: 0;
|
|
57
|
+
border: none;
|
|
58
|
+
width: 18px;
|
|
59
|
+
height: 18px;
|
|
60
|
+
background-color: $colorB;
|
|
61
|
+
|
|
62
|
+
&.disabled {
|
|
63
|
+
background-color: gray;
|
|
64
|
+
cursor: default;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&:hover {
|
|
68
|
+
background-color: $colorC;
|
|
69
|
+
transition: background-color 1s;
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.lunatic-suggester-icon {
|
|
74
|
+
svg {
|
|
75
|
+
width: 18px;
|
|
76
|
+
height: 18px;
|
|
77
|
+
fill: $colorA;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.lunatic-suggester-loader-progress {
|
|
83
|
+
height: inherit;
|
|
84
|
+
border: solid 1px $colorB;
|
|
85
|
+
border-radius: 2px;
|
|
86
|
+
width: 70%;
|
|
87
|
+
|
|
88
|
+
&.done {
|
|
89
|
+
&:hover {
|
|
90
|
+
border-color: $colorC;
|
|
91
|
+
transition: border-color 1s;
|
|
92
|
+
.progress {
|
|
93
|
+
background-color: $colorC;
|
|
94
|
+
transition: background-color 1s;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.content {
|
|
102
|
+
padding: 2px 2px;
|
|
103
|
+
height: calc(100%);
|
|
104
|
+
width: 100%;
|
|
105
|
+
.progress {
|
|
106
|
+
background-color: $colorB;
|
|
107
|
+
height: 100%;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.suggester-widget-network {
|
|
114
|
+
position: absolute;
|
|
115
|
+
border: solid $colorB 2px;
|
|
116
|
+
left: 6px;
|
|
117
|
+
background-color: $colorA;
|
|
118
|
+
border-radius: 50%;
|
|
119
|
+
padding: 2px 2px;
|
|
120
|
+
left: -22px;
|
|
121
|
+
top: -22px;
|
|
122
|
+
box-shadow: $colorC 0px 3px 8px;
|
|
123
|
+
|
|
124
|
+
&.online {
|
|
125
|
+
svg {
|
|
126
|
+
fill: forestgreen;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
svg {
|
|
131
|
+
width: 24px;
|
|
132
|
+
height: 24px;
|
|
133
|
+
fill: $colorB;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@include onDrag();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.lunatic-widget-tools {
|
|
140
|
+
position: absolute;
|
|
141
|
+
right: 0;
|
|
142
|
+
top: -18px;
|
|
143
|
+
margin-top: -4px;
|
|
144
|
+
|
|
145
|
+
.lunatic-action-tool {
|
|
146
|
+
display: inline-block;
|
|
147
|
+
height: 18px;
|
|
148
|
+
width: 18px;
|
|
149
|
+
background-color: $colorB;
|
|
150
|
+
border-radius: 50%;
|
|
151
|
+
margin-left: 2px;
|
|
152
|
+
|
|
153
|
+
&:hover {
|
|
154
|
+
box-shadow: $colorC 0px 3px 8px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&.drag {
|
|
158
|
+
background-color: $colorD;
|
|
159
|
+
transition: background-color 0.5s;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.on-drag-icon {
|
|
163
|
+
cursor: grab;
|
|
164
|
+
&.drag {
|
|
165
|
+
cursor: grabbing;
|
|
166
|
+
}
|
|
167
|
+
svg {
|
|
168
|
+
width: 16px;
|
|
169
|
+
height: 16px;
|
|
170
|
+
fill: $colorA;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './table';
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import missingWrapper from '../missing-wrapper';
|
|
4
|
+
import * as lunatic from '../components';
|
|
5
|
+
import Declarations from '../declarations';
|
|
6
|
+
import * as U from '../../utils/lib';
|
|
7
|
+
import * as C from '../../constants';
|
|
8
|
+
import { interpret } from '../../utils/to-expose';
|
|
9
|
+
import './table.scss';
|
|
10
|
+
|
|
11
|
+
const Table = ({
|
|
12
|
+
id: tableId,
|
|
13
|
+
label: tableLabel,
|
|
14
|
+
preferences,
|
|
15
|
+
cells,
|
|
16
|
+
handleChange,
|
|
17
|
+
lines: initLines,
|
|
18
|
+
positioning,
|
|
19
|
+
declarations,
|
|
20
|
+
features,
|
|
21
|
+
bindings,
|
|
22
|
+
addBtnLabel,
|
|
23
|
+
hideBtn,
|
|
24
|
+
management,
|
|
25
|
+
numberAsTextfield,
|
|
26
|
+
logFunction,
|
|
27
|
+
}) => {
|
|
28
|
+
const minLines = initLines
|
|
29
|
+
? Math.max(initLines.min, U.getRosterInitLines(cells))
|
|
30
|
+
: undefined;
|
|
31
|
+
const maxLines = initLines ? initLines.max : undefined;
|
|
32
|
+
const [lines, setLines] = useState(minLines);
|
|
33
|
+
|
|
34
|
+
const width = `${100 / Math.max(...cells.map((line) => line.length))}%`;
|
|
35
|
+
const Button = lunatic.Button;
|
|
36
|
+
return (
|
|
37
|
+
<>
|
|
38
|
+
<Declarations
|
|
39
|
+
id={tableId}
|
|
40
|
+
type={C.BEFORE_QUESTION_TEXT}
|
|
41
|
+
declarations={declarations}
|
|
42
|
+
features={features}
|
|
43
|
+
bindings={bindings}
|
|
44
|
+
/>
|
|
45
|
+
{tableLabel && (
|
|
46
|
+
<label
|
|
47
|
+
htmlFor={`table-one-axis-${tableId}`}
|
|
48
|
+
id={`table-one-axis-label-${tableId}`}
|
|
49
|
+
>
|
|
50
|
+
{interpret(features, logFunction)(bindings)(tableLabel)}
|
|
51
|
+
</label>
|
|
52
|
+
)}
|
|
53
|
+
<Declarations
|
|
54
|
+
id={tableId}
|
|
55
|
+
type={C.AFTER_QUESTION_TEXT}
|
|
56
|
+
declarations={declarations}
|
|
57
|
+
features={features}
|
|
58
|
+
bindings={bindings}
|
|
59
|
+
/>
|
|
60
|
+
<table id={`table-${tableId}`} className="table-lunatic">
|
|
61
|
+
<tbody>
|
|
62
|
+
{(minLines || minLines === 0 ? cells.slice(0, lines + 1) : cells).map(
|
|
63
|
+
(line, i) => (
|
|
64
|
+
<tr key={`table-${tableId}-line${i}`}>
|
|
65
|
+
{line.map((component, j) => {
|
|
66
|
+
const {
|
|
67
|
+
label,
|
|
68
|
+
headerCell,
|
|
69
|
+
colspan,
|
|
70
|
+
rowspan,
|
|
71
|
+
componentType,
|
|
72
|
+
...componentProps
|
|
73
|
+
} = component;
|
|
74
|
+
if (componentType) {
|
|
75
|
+
const Component = lunatic[componentType];
|
|
76
|
+
return (
|
|
77
|
+
<td
|
|
78
|
+
key={`table-${tableId}-line${i}-cell-${j}`}
|
|
79
|
+
style={{ width }}
|
|
80
|
+
>
|
|
81
|
+
<Component
|
|
82
|
+
label={label || ' '}
|
|
83
|
+
handleChange={handleChange}
|
|
84
|
+
preferences={preferences}
|
|
85
|
+
positioning={positioning}
|
|
86
|
+
management={management}
|
|
87
|
+
features={features}
|
|
88
|
+
bindings={bindings}
|
|
89
|
+
{...componentProps}
|
|
90
|
+
zIndex={cells.length - i || 0}
|
|
91
|
+
numberAsTextfield
|
|
92
|
+
logFunction={logFunction}
|
|
93
|
+
shortcut={false}
|
|
94
|
+
/>
|
|
95
|
+
</td>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
const cellOptions = {
|
|
99
|
+
key: `table-${tableId}-line${i}-cell-${j}`,
|
|
100
|
+
style: { width },
|
|
101
|
+
colSpan: colspan || 1,
|
|
102
|
+
rowSpan: rowspan || 1,
|
|
103
|
+
};
|
|
104
|
+
const interpretedLabel = interpret(
|
|
105
|
+
features,
|
|
106
|
+
logFunction
|
|
107
|
+
)(bindings)(label);
|
|
108
|
+
return headerCell ? (
|
|
109
|
+
<th {...cellOptions}>{interpretedLabel}</th>
|
|
110
|
+
) : (
|
|
111
|
+
<td {...cellOptions}>{interpretedLabel}</td>
|
|
112
|
+
);
|
|
113
|
+
})}
|
|
114
|
+
</tr>
|
|
115
|
+
)
|
|
116
|
+
)}
|
|
117
|
+
</tbody>
|
|
118
|
+
</table>
|
|
119
|
+
{Number.isInteger(minLines) && lines < maxLines && !hideBtn && (
|
|
120
|
+
<Button
|
|
121
|
+
label="addLine"
|
|
122
|
+
value={addBtnLabel}
|
|
123
|
+
onClick={() => setLines(lines + 1)}
|
|
124
|
+
id={tableId}
|
|
125
|
+
logFunction={logFunction}
|
|
126
|
+
/>
|
|
127
|
+
)}
|
|
128
|
+
<Declarations
|
|
129
|
+
id={tableId}
|
|
130
|
+
type={C.DETACHABLE}
|
|
131
|
+
declarations={declarations}
|
|
132
|
+
features={features}
|
|
133
|
+
bindings={bindings}
|
|
134
|
+
/>
|
|
135
|
+
</>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
Table.defaultProps = {
|
|
140
|
+
label: '',
|
|
141
|
+
preferences: ['COLLECTED'],
|
|
142
|
+
cells: [],
|
|
143
|
+
lines: {},
|
|
144
|
+
positioning: 'DEFAULT',
|
|
145
|
+
declarations: [],
|
|
146
|
+
features: [],
|
|
147
|
+
bindings: {},
|
|
148
|
+
addBtnLabel: 'Add a line',
|
|
149
|
+
management: false,
|
|
150
|
+
hideBtn: false,
|
|
151
|
+
style: {},
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
Table.propTypes = {
|
|
155
|
+
id: PropTypes.string.isRequired,
|
|
156
|
+
label: PropTypes.string,
|
|
157
|
+
preferences: PropTypes.arrayOf(U.valueTypePropTypes),
|
|
158
|
+
cells: PropTypes.array,
|
|
159
|
+
handleChange: PropTypes.func.isRequired,
|
|
160
|
+
lines: U.linesPropTypes,
|
|
161
|
+
positioning: PropTypes.oneOf(['DEFAULT', 'HORIZONTAL', 'VERTICAL']),
|
|
162
|
+
declarations: U.declarationsPropTypes,
|
|
163
|
+
features: PropTypes.arrayOf(PropTypes.string),
|
|
164
|
+
bindings: PropTypes.object,
|
|
165
|
+
addBtnLabel: PropTypes.string,
|
|
166
|
+
hideBtn: PropTypes.bool,
|
|
167
|
+
management: PropTypes.bool,
|
|
168
|
+
style: PropTypes.object,
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export default React.memo(missingWrapper(Table), U.areEqual);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.table-lunatic {
|
|
2
|
+
table-layout: fixed;
|
|
3
|
+
border-collapse: collapse;
|
|
4
|
+
margin-top: 0.3em;
|
|
5
|
+
margin-bottom: 0.3em;
|
|
6
|
+
& td,
|
|
7
|
+
th {
|
|
8
|
+
border: 0.15em solid var(--color-primary-dark);
|
|
9
|
+
padding: 0.2em;
|
|
10
|
+
}
|
|
11
|
+
& td {
|
|
12
|
+
.field,
|
|
13
|
+
.field-with-tooltip {
|
|
14
|
+
display: flex;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
align-items: center;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.table-lunatic .tooltip-lunatic img {
|
|
22
|
+
height: 20px;
|
|
23
|
+
width: 20px;
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import missingWrapper from '../missing-wrapper';
|
|
3
|
+
import { InputDeclarationsWrapper } from '../declarations/wrappers';
|
|
4
|
+
import { areEqual } from '../../utils/lib';
|
|
5
|
+
import './textarea.scss';
|
|
6
|
+
|
|
7
|
+
const Textarea = (props) => (
|
|
8
|
+
<InputDeclarationsWrapper type={null} roleType="textarea" {...props} />
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
export default React.memo(missingWrapper(Textarea), areEqual);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './component';
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TooltipResponse } from './response';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import ReactTooltip from 'react-tooltip';
|
|
4
|
+
import * as U from '../../utils/lib';
|
|
5
|
+
import * as img from './img';
|
|
6
|
+
import './tooltip.scss';
|
|
7
|
+
|
|
8
|
+
const TooltipResponse = ({ id, response }) => {
|
|
9
|
+
const [tooltipElements, setTooltipElements] = useState(() =>
|
|
10
|
+
U.buildTooltip(response)
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
setTooltipElements(U.buildTooltip(response));
|
|
15
|
+
}, [response]);
|
|
16
|
+
|
|
17
|
+
const { content, imgName } = tooltipElements;
|
|
18
|
+
|
|
19
|
+
if (!content) return null;
|
|
20
|
+
|
|
21
|
+
const text = content
|
|
22
|
+
.map(({ key, value }) => `${key} : ${value}<br />`)
|
|
23
|
+
.join('');
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className="tooltip-lunatic">
|
|
27
|
+
<span
|
|
28
|
+
data-for={`${id}-management-tooltip`}
|
|
29
|
+
data-tip={text}
|
|
30
|
+
data-multiline
|
|
31
|
+
>
|
|
32
|
+
<img id={id} alt="img-tooltip" src={img[imgName].src || img[imgName]} />
|
|
33
|
+
</span>
|
|
34
|
+
<ReactTooltip
|
|
35
|
+
id={`${id}-management-tooltip`}
|
|
36
|
+
className="tooltip-text"
|
|
37
|
+
place="left"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
TooltipResponse.defaultProps = {
|
|
44
|
+
response: {},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
TooltipResponse.propTypes = {
|
|
48
|
+
id: PropTypes.string,
|
|
49
|
+
response: U.responsePropTypes,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default TooltipResponse;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@import 'src/components/index.scss';
|
|
2
|
+
|
|
3
|
+
/* Tooltip container */
|
|
4
|
+
.tooltip-lunatic {
|
|
5
|
+
position: relative;
|
|
6
|
+
display: inline-block;
|
|
7
|
+
align-items: center;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* Tooltip text */
|
|
11
|
+
.tooltip-lunatic .tooltip-text {
|
|
12
|
+
min-width: 10em;
|
|
13
|
+
max-width: 20em;
|
|
14
|
+
background-color: var(--color-primary-dark);
|
|
15
|
+
color: #fff;
|
|
16
|
+
padding: 0.5em;
|
|
17
|
+
border-radius: 6px;
|
|
18
|
+
font-size: 1em;
|
|
19
|
+
&.place-left {
|
|
20
|
+
&::before {
|
|
21
|
+
border-left: 10px solid var(--color-primary-dark);
|
|
22
|
+
}
|
|
23
|
+
&::after {
|
|
24
|
+
content: none;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CHECKBOX_GROUP = 'CheckboxGroup';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Declaration position
|
|
2
|
+
|
|
3
|
+
export const BEFORE_QUESTION_TEXT = 'BEFORE_QUESTION_TEXT';
|
|
4
|
+
export const AFTER_QUESTION_TEXT = 'AFTER_QUESTION_TEXT';
|
|
5
|
+
export const DETACHABLE = 'DETACHABLE';
|
|
6
|
+
|
|
7
|
+
// Declaration types
|
|
8
|
+
|
|
9
|
+
export const INSTRUCTION = 'INSTRUCTION';
|
|
10
|
+
export const COMMENT = 'COMMENT';
|
|
11
|
+
export const HELP = 'HELP';
|
|
12
|
+
export const WARNING = 'WARNING';
|
|
13
|
+
export const MESSAGE_FILTER = 'MESSAGE_FILTER';
|
|
14
|
+
export const STATEMENT = 'STATEMENT';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Event types for paradata
|
|
2
|
+
export const EVENT_FOCUS_IN = 'focus-in';
|
|
3
|
+
export const EVENT_FOCUS_OUT = 'focus-out';
|
|
4
|
+
export const EVENT_SELECTION = 'selection';
|
|
5
|
+
export const EVENT_CLICK = 'click';
|
|
6
|
+
export const EVENT_VALUE_CHANGE = 'value-changed';
|
|
7
|
+
|
|
8
|
+
// Category of object
|
|
9
|
+
export const INPUT_CATEGORY = 'lunatic-input';
|
|
10
|
+
export const BUTTON_CATEGORY = 'lunatic-button';
|
|
11
|
+
export const LINK_CATEGORY = 'lunatic-link';
|
|
12
|
+
export const TOOLTIP_CATEGORY = 'lunatic-tooltip';
|
|
13
|
+
export const CALCULATED_VAR_CATEGORY = 'lunatic-calculated-var';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Breadcrumb component
|
|
2
|
+
|
|
3
|
+
## Props
|
|
4
|
+
|
|
5
|
+
| Props | Type | Default value | Required | Description |
|
|
6
|
+
| :---------: | :----: | :-----------: | :------: | -------------------------- |
|
|
7
|
+
| elements \* | array | [ ] | | Elements of the breadcrumb |
|
|
8
|
+
| style | object | { } | | Style of the breadcrumb |
|
|
9
|
+
|
|
10
|
+
- `elements` props has to be an array composed of ordered strings
|
|
11
|
+
|
|
12
|
+
## Styles
|
|
13
|
+
|
|
14
|
+
**Breadcrumb** component has for class `breadcrumb-lunatic`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { Breadcrumb } from 'components';
|
|
4
|
+
import { withReadme } from 'storybook-readme';
|
|
5
|
+
import readme from './README.md';
|
|
6
|
+
import { titleDecorator } from 'utils/lib';
|
|
7
|
+
|
|
8
|
+
const elements = ['Sequence', 'Sub-sequence', 'Question'];
|
|
9
|
+
|
|
10
|
+
const stories = storiesOf('Breadcrumb', module)
|
|
11
|
+
.addDecorator(withReadme(readme))
|
|
12
|
+
.addDecorator((Component) => {
|
|
13
|
+
const WrappedComponent = titleDecorator(Component);
|
|
14
|
+
return <WrappedComponent title="<Breadcrumb />" />;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
stories.addWithJSX('Default', () => (
|
|
18
|
+
<Breadcrumb id="default" elements={elements} />
|
|
19
|
+
));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Button component
|
|
2
|
+
|
|
3
|
+
## Props
|
|
4
|
+
|
|
5
|
+
| Props | Type | Default value | Required | Description |
|
|
6
|
+
| :------: | :------: | :-----------: | :------: | ----------------------------- |
|
|
7
|
+
| label | string | "button" | | Aria label |
|
|
8
|
+
| value | string | - | ✓ | Label of the button |
|
|
9
|
+
| onClick | function | - | ✓ | Callback |
|
|
10
|
+
| disabled | boolean | false | | Boolean to disable the button |
|
|
11
|
+
|
|
12
|
+
## Styles
|
|
13
|
+
|
|
14
|
+
**Button** component has for class `button-lunatic`.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { withReadme } from 'storybook-readme';
|
|
4
|
+
import { Button } from 'components';
|
|
5
|
+
import readme from './README.md';
|
|
6
|
+
import { titleDecorator } from 'utils/lib';
|
|
7
|
+
import { text, boolean } from '@storybook/addon-knobs/react';
|
|
8
|
+
|
|
9
|
+
const stories = storiesOf('Button', module)
|
|
10
|
+
.addDecorator(withReadme(readme))
|
|
11
|
+
.addDecorator((Component) => {
|
|
12
|
+
const WrappedComponent = titleDecorator(Component);
|
|
13
|
+
return <WrappedComponent title="<Button />" />;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
stories.addWithJSX('Default', () => (
|
|
17
|
+
<Button label="button-default" value="Click me !" onClick={console.log} />
|
|
18
|
+
));
|
|
19
|
+
|
|
20
|
+
stories.addWithJSX('Props', () => (
|
|
21
|
+
<Button
|
|
22
|
+
label="disabled-button"
|
|
23
|
+
value={text('Value', 'Click me !')}
|
|
24
|
+
onClick={console.log}
|
|
25
|
+
disabled={boolean('Disabled', false)}
|
|
26
|
+
/>
|
|
27
|
+
));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# CheckboxBoolean component
|
|
2
|
+
|
|
3
|
+
## Props
|
|
4
|
+
|
|
5
|
+
| Props | Type | Default value | Required | Description |
|
|
6
|
+
| :-------------: | :----: | :-----------: | :------: | --------------------------------------- |
|
|
7
|
+
| id | string | - | ✓ | Id of the checkbox |
|
|
8
|
+
| label | string | "" | | Fieldset label of the checkbox |
|
|
9
|
+
| preferences \* | array | ["COLLECTED"] | | Preferences to manage checkbox response |
|
|
10
|
+
| response \* | object | { } | | Response concerned by the component |
|
|
11
|
+
| handleChange | func | - | ✓ | Handler of the checkbox |
|
|
12
|
+
| disabled | bool | false | | Is the checkbox item disabled |
|
|
13
|
+
| positioning \* | string | "DEFAULT" | | Checkbox item positioning |
|
|
14
|
+
| focused | bool | false | | Is the checkbox item focused |
|
|
15
|
+
| declarations \* | array | [ ] | | Declarations of the checkbox |
|
|
16
|
+
| features | array | [ ] | | Component features for labels |
|
|
17
|
+
| bindings | object | [ ] | | Questionnaire bindings |
|
|
18
|
+
| management | bool | false | | Management mode of the checkbox |
|
|
19
|
+
| style | object | { } | | Style of the checkbox |
|
|
20
|
+
|
|
21
|
+
- `preferences` props has to be an ordered array of `COLLECTED`, `FORCED` or `EDITED`
|
|
22
|
+
- `response` props has to be a shape of `{name: string, values: object}`
|
|
23
|
+
- `declarations` are documented in the `Declarations` component
|
|
24
|
+
|
|
25
|
+
## Styles
|
|
26
|
+
|
|
27
|
+
**CheckboxBoolean** component has for classes `checkbox-lunatic` and `checkbox-boolean-modality`.
|