@inseefr/lunatic 0.2.62 → 0.3.0-v2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/lib/index.js +2961 -3143
- package/lib/index.js.map +1 -1
- package/package.json +109 -55
- package/src/components/button/button.scss +9 -11
- package/src/components/button/index.js +1 -1
- package/src/components/button/lunatic-button.js +48 -0
- package/src/components/checkbox/checkbox-boolean/checkbox-boolean.js +18 -0
- package/src/components/checkbox/checkbox-boolean/index.js +1 -0
- package/src/components/checkbox/checkbox-boolean/lunatic-checkbox-boolean.js +30 -0
- package/src/components/checkbox/checkbox-group/checkbox-group.js +84 -0
- package/src/components/checkbox/checkbox-group/checkbox-option.js +45 -0
- package/src/components/checkbox/checkbox-group/index.js +1 -0
- package/src/components/checkbox/checkbox-group/lunatic-checkbox-group.js +27 -0
- package/src/components/checkbox/checkbox-one/index.js +1 -0
- package/src/components/checkbox/checkbox-one/lunatic-checkbox-one.js +7 -0
- package/src/components/checkbox/checkbox.scss +1 -39
- package/src/components/checkbox/commons/checkbox-option.js +55 -0
- package/src/components/checkbox/commons/index.js +1 -0
- package/src/components/checkbox/index.js +3 -3
- package/src/{utils/lib/style.js → components/commons/build-style-object.js} +4 -2
- package/src/components/commons/components/combo-box/combo-box-container.js +31 -0
- package/src/components/commons/components/combo-box/combo-box-content.js +57 -0
- package/src/components/commons/components/combo-box/combo-box.js +189 -0
- package/src/components/commons/components/combo-box/combo-box.scss +218 -0
- package/src/components/commons/components/combo-box/index.js +2 -0
- package/src/components/commons/components/combo-box/panel/index.js +1 -0
- package/src/components/commons/components/combo-box/panel/option-container.js +63 -0
- package/src/components/commons/components/combo-box/panel/panel-container.js +20 -0
- package/src/components/commons/components/combo-box/panel/panel.js +58 -0
- package/src/components/commons/components/combo-box/selection/delete.js +40 -0
- package/src/components/commons/components/combo-box/selection/displayLabelOrInput.js +23 -0
- package/src/components/commons/components/combo-box/selection/index.js +1 -0
- package/src/components/commons/components/combo-box/selection/input.js +55 -0
- package/src/components/commons/components/combo-box/selection/label.js +29 -0
- package/src/components/commons/components/combo-box/selection/selection-container.js +32 -0
- package/src/components/commons/components/combo-box/selection/selection.js +63 -0
- package/src/components/commons/components/combo-box/state-management/actions.js +29 -0
- package/src/components/commons/components/combo-box/state-management/combo-box-context.js +8 -0
- package/src/components/commons/components/combo-box/state-management/index.js +4 -0
- package/src/components/commons/components/combo-box/state-management/initial-state.js +8 -0
- package/src/components/commons/components/combo-box/state-management/reducer/index.js +1 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reduce-on-blur.js +5 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reduce-on-change.js +8 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reduce-on-delete.js +10 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reduce-on-focus.js +5 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reduce-on-init.js +23 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/index.js +1 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/keyboard-key-codes.js +11 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-arrow-down.js +22 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-arrow-up.js +22 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-end.js +13 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-enter.js +6 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-escape.js +5 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-home.js +13 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/on-tab.js +5 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reduce-on-keydown/reduce-on-keydown.js +34 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reduce-on-select.js +8 -0
- package/src/components/commons/components/combo-box/state-management/reducer/reducer.js +32 -0
- package/src/components/commons/components/create-lunatic-component/create-lunatic-component.js +58 -0
- package/src/components/commons/components/create-lunatic-component/index.js +5 -0
- package/src/components/commons/components/default-label-renderer.js +31 -0
- package/src/components/commons/components/default-option-renderer.js +27 -0
- package/src/components/commons/components/dragger/dragger.js +64 -0
- package/src/components/commons/components/dragger/dragger.scss +8 -0
- package/src/components/commons/components/dragger/index.js +1 -0
- package/src/components/commons/components/fab/fab.js +50 -0
- package/src/components/commons/components/fab/fab.scss +32 -0
- package/src/components/commons/components/fab/index.js +1 -0
- package/src/components/commons/components/field-container/field-container.js +28 -0
- package/src/components/commons/components/field-container/field-container.scss +0 -0
- package/src/components/commons/components/field-container/index.js +1 -0
- package/src/components/commons/components/fieldset.js +14 -0
- package/src/components/commons/components/html-table/index.js +6 -0
- package/src/components/commons/components/html-table/table.js +26 -0
- package/src/components/commons/components/html-table/tbody.js +26 -0
- package/src/components/commons/components/html-table/td.js +33 -0
- package/src/components/commons/components/html-table/th.js +33 -0
- package/src/components/commons/components/html-table/thead.js +26 -0
- package/src/components/commons/components/html-table/tr.js +27 -0
- package/src/components/commons/components/is-network/index.js +1 -0
- package/src/components/commons/components/is-network/is-network.js +39 -0
- package/src/components/commons/components/is-network/use-online-status.js +51 -0
- package/src/components/commons/components/label.js +15 -0
- package/src/components/commons/components/lunatic-component.js +54 -0
- package/src/components/commons/components/lunatic-fieldset-component.js +45 -0
- package/src/components/commons/components/md-label/index.js +1 -0
- package/src/components/commons/components/md-label/link.js +54 -0
- package/src/components/commons/components/md-label/md-label.js +21 -0
- package/src/components/commons/components/missing/index.js +1 -0
- package/src/components/commons/components/missing/missing.js +81 -0
- package/src/components/commons/components/missing/missing.scss +30 -0
- package/src/components/commons/components/nothing-to-display.js +7 -0
- package/src/components/commons/components/orchestrated-component.js +49 -0
- package/src/components/{tooltip → commons/components/variable-status}/img/edited.png +0 -0
- package/src/components/{tooltip → commons/components/variable-status}/img/forced.png +0 -0
- package/src/components/{tooltip → commons/components/variable-status}/img/index.js +0 -0
- package/src/components/commons/components/variable-status/index.js +1 -0
- package/src/components/commons/components/variable-status/variable-status.js +54 -0
- package/src/components/commons/components/variable-status/variable-status.scss +39 -0
- package/src/components/commons/create-customizable-field.js +18 -0
- package/src/components/commons/create-row-orchestrator.js +48 -0
- package/src/components/commons/icons/checkbox-checked.icon.js +25 -0
- package/src/components/commons/icons/checkbox-unchecked.icon.js +25 -0
- package/src/components/commons/icons/closed.icon.js +24 -0
- package/src/components/commons/icons/cross.icon.js +24 -0
- package/src/components/commons/icons/index.js +10 -0
- package/src/components/commons/icons/load.icon.js +24 -0
- package/src/components/commons/icons/lunatic-icon.js +9 -0
- package/src/components/commons/icons/lunatic-icon.scss +4 -0
- package/src/components/commons/icons/network.icon.js +24 -0
- package/src/components/commons/icons/on-drag.icon.js +24 -0
- package/src/components/commons/icons/opened.icon.js +24 -0
- package/src/components/commons/icons/radio-checked.icon.js +25 -0
- package/src/components/commons/icons/radio-unchecked.icon.js +25 -0
- package/src/components/commons/index.js +18 -0
- package/src/{utils/lib → components/commons}/prop-types/declarations.js +1 -1
- package/src/{utils/lib → components/commons}/prop-types/index.js +0 -0
- package/src/components/commons/prop-types/lines.js +6 -0
- package/src/{utils/lib → components/commons}/prop-types/options.js +0 -0
- package/src/{utils/lib/prop-types/lines.js → components/commons/prop-types/response.js} +2 -2
- package/src/components/commons/prop-types/value-type.js +10 -0
- package/src/components/commons/safety-label.js +25 -0
- package/src/components/commons/use-document-add-event-listener.js +63 -0
- package/src/components/commons/use-on-handle-change.js +16 -0
- package/src/components/commons/use-options-keydown.js +22 -0
- package/src/components/commons/use-previous.js +11 -0
- package/src/components/components.js +11 -5
- package/src/components/datepicker/datepicker.js +27 -0
- package/src/components/datepicker/datepicker.scss +1 -16
- package/src/components/datepicker/index.js +1 -1
- package/src/components/datepicker/lunatic-datepicker.js +7 -0
- package/src/components/declarations/declaration.js +17 -0
- package/src/components/declarations/declarations-after-text.js +8 -0
- package/src/components/declarations/declarations-before-text.js +8 -0
- package/src/components/declarations/declarations-detachable.js +8 -0
- package/src/components/declarations/declarations.js +39 -0
- package/src/components/declarations/declarations.scss +29 -27
- package/src/components/declarations/index.js +4 -1
- package/src/components/dropdown/dropdown-simple/dropdown-simple.js +33 -0
- package/src/components/dropdown/dropdown-simple/index.js +1 -0
- package/src/components/dropdown/dropdown-simple/simple-label-renderer.js +31 -0
- package/src/components/dropdown/dropdown-simple/simple-option-renderer.js +27 -0
- package/src/components/dropdown/dropdown-writable/dropdown-writable.js +49 -0
- package/src/components/dropdown/dropdown-writable/filter-tools/filter-options.js +20 -0
- package/src/components/dropdown/dropdown-writable/filter-tools/letters-matching.js +16 -0
- package/src/components/dropdown/dropdown-writable/filter-tools/match.js +18 -0
- package/src/components/dropdown/dropdown-writable/filter-tools/prepare-prefix.js +9 -0
- package/src/components/dropdown/dropdown-writable/index.js +1 -0
- package/src/components/dropdown/dropdown-writable/writable-label-renderer.js +31 -0
- package/src/components/dropdown/dropdown-writable/writable-option-renderer.js +84 -0
- package/src/components/dropdown/dropdown.js +46 -0
- package/src/components/dropdown/dropdown.scss +38 -13
- package/src/components/dropdown/index.js +1 -1
- package/src/components/dropdown/lunatic-dropdown.js +55 -0
- package/src/components/filter-description/component.js +14 -0
- package/src/components/{breadcrumb → filter-description}/index.js +0 -0
- package/src/components/index.js +1 -2
- package/src/components/index.scss +113 -49
- package/src/components/input/index.js +1 -2
- package/src/components/input/input.js +40 -110
- package/src/components/input/input.scss +27 -23
- package/src/components/input/lunatic-input.js +13 -0
- package/src/components/input-number/index.js +1 -0
- package/src/components/input-number/input-number.js +40 -0
- package/src/components/input-number/input-number.scss +0 -0
- package/src/components/input-number/lunatic-input-number.js +8 -0
- package/src/components/loop/block-for-loop/block-for-loop-ochestrator.js +6 -0
- package/src/components/loop/block-for-loop/block-for-loop.js +93 -0
- package/src/components/loop/block-for-loop/index.js +1 -0
- package/src/components/loop/block-for-loop/row.js +58 -0
- package/src/components/loop/commons/index.js +2 -0
- package/src/components/loop/commons/row-component.js +52 -0
- package/src/components/loop/index.js +1 -0
- package/src/components/loop/loop.js +81 -0
- package/src/components/loop/roster-for-loop/add-row-button.js +12 -0
- package/src/components/loop/roster-for-loop/body.js +46 -0
- package/src/components/loop/roster-for-loop/header.js +28 -0
- package/src/components/loop/roster-for-loop/index.js +1 -0
- package/src/components/loop/roster-for-loop/roster-for-loop-orchestrator.js +6 -0
- package/src/components/loop/roster-for-loop/roster-for-loop.js +92 -0
- package/src/components/loop/roster-for-loop/roster-table.js +43 -0
- package/src/components/loop/roster-for-loop/roster.scss +42 -0
- package/src/components/loop/roster-for-loop/row.js +67 -0
- package/src/components/modal-controls/close-or-skip.js +25 -0
- package/src/components/modal-controls/index.js +1 -0
- package/src/components/modal-controls/modal-container.js +13 -0
- package/src/components/modal-controls/modal-controls.js +42 -0
- package/src/components/modal-controls/modal-controls.scss +63 -0
- package/src/components/pairwise/block/index.js +1 -0
- package/src/components/pairwise/block/pairwise-block.js +5 -0
- package/src/components/pairwise/index.js +2 -0
- package/src/components/pairwise/links/index.js +1 -0
- package/src/components/pairwise/links/links-orchestrator.js +6 -0
- package/src/components/pairwise/links/pairwise-links.js +58 -0
- package/src/components/pairwise/links/row.js +59 -0
- package/src/components/radio/index.js +1 -1
- package/src/components/radio/lunatic-radio-group.js +23 -0
- package/src/components/radio/radio-group.js +34 -0
- package/src/components/radio/radio-option.js +89 -0
- package/src/components/radio/radio.scss +55 -20
- package/src/components/sequence/index.js +1 -1
- package/src/components/sequence/sequence.js +23 -0
- package/src/components/sequence/sequence.scss +9 -14
- package/src/components/subsequence/index.js +1 -1
- package/src/components/subsequence/subsequence.js +25 -0
- package/src/components/suggester/check-store.js +70 -0
- package/src/components/suggester/default-style.scss +125 -0
- package/src/components/suggester/find-best-label/find-best-label.js +51 -0
- package/src/components/suggester/find-best-label/index.js +1 -0
- package/src/components/suggester/idb-suggester.js +69 -0
- package/src/components/suggester/index.js +1 -0
- package/src/components/suggester/lunatic-suggester.js +73 -0
- package/src/components/suggester/searching/create-searching.js +49 -0
- package/src/components/suggester/searching/index.js +1 -0
- package/src/components/suggester/suggester.js +117 -0
- package/src/components/suggester-loader-widget/index.js +1 -0
- package/src/components/suggester-loader-widget/loader-row.js +101 -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 +123 -0
- package/src/components/suggester-loader-widget/widget.scss +176 -0
- package/src/components/switch/index.js +1 -0
- package/src/components/switch/lunatic-switch.js +36 -0
- package/src/components/switch/switch.js +73 -0
- package/src/components/switch/switch.scss +47 -0
- package/src/components/table/cell.js +83 -0
- package/src/components/table/components/cell.js +83 -0
- package/src/components/table/components/header.js +36 -0
- package/src/components/table/components/row.js +38 -0
- package/src/components/table/components/table.js +21 -0
- package/src/components/table/components/table.scss +26 -0
- package/src/components/table/index.js +1 -1
- package/src/components/table/lunatic-table.js +60 -0
- package/src/components/table/table-orchestrator.js +44 -0
- package/src/components/textarea/index.js +1 -1
- package/src/components/textarea/lunatic-textarea.js +23 -0
- package/src/components/textarea/textarea.js +41 -0
- package/src/components/textarea/textarea.scss +5 -13
- package/src/constants/component-types.js +1 -0
- package/src/{utils/constants.js → constants/declarations.js} +0 -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/i18n/build-dictionary.js +43 -0
- package/src/i18n/dictionary.js +7 -0
- package/src/i18n/index.js +7 -0
- package/src/stories/Introduction.stories.mdx +114 -0
- package/src/stories/custom-mui/checkbox-boolean-mui.js +23 -0
- package/src/stories/custom-mui/checkbox-group-mui.js +63 -0
- package/src/stories/custom-mui/checkbox-one-mui.js +7 -0
- package/src/stories/custom-mui/index.js +15 -0
- package/src/stories/custom-mui/input-mui.js +50 -0
- package/src/stories/custom-mui/input-number-mui.js +36 -0
- package/src/stories/custom-mui/radio-mui.js +39 -0
- package/src/stories/custom-mui/suggester-mui/index.js +1 -0
- package/src/stories/custom-mui/suggester-mui/suggester-mui.js +285 -0
- package/src/stories/custom-mui/switch-mui.js +29 -0
- package/src/stories/custom-mui/table-mui.js +20 -0
- package/src/stories/custom-mui/tbody-mui.js +16 -0
- package/src/stories/custom-mui/td-mui.js +16 -0
- package/src/stories/custom-mui/textarea-mui.js +38 -0
- package/src/stories/custom-mui/th-mui.js +16 -0
- package/src/stories/custom-mui/thead-mui.js +16 -0
- package/src/stories/custom-mui/tr-mui.js +27 -0
- package/src/stories/input/data.json +5 -0
- package/src/stories/input/input.stories.js +12 -82
- package/src/stories/input/source.json +28 -0
- package/src/stories/pairwise/block/block.json +3 -0
- package/src/stories/pairwise/block/pairwise-block.stories.js +17 -0
- package/src/stories/pairwise/links/data.json +12 -0
- package/src/stories/pairwise/links/links.json +164 -0
- package/src/stories/pairwise/links/pairwise-links.stories.js +18 -0
- package/src/stories/questionnaires/logement/data.json +2691 -0
- package/src/stories/questionnaires/logement/logement.stories.js +45 -0
- package/src/stories/questionnaires/logement/source-sequence.json +29291 -0
- package/src/stories/questionnaires/logement/source.json +33450 -0
- package/src/stories/questionnaires/simpsons/simpsons.stories.js +34 -0
- package/src/stories/questionnaires/simpsons/source.json +6290 -0
- package/src/stories/suggester/source.json +234 -0
- package/src/stories/suggester/suggester.stories.js +40 -0
- package/src/stories/switch/README.md +31 -0
- package/src/stories/switch/SwitchMaterialUI.js +35 -0
- package/src/stories/switch/data-forced.json +48 -0
- package/src/stories/switch/data.json +80 -0
- package/src/stories/switch/switch.js +72 -0
- package/src/stories/utils/custom-lunatic.scss +28 -0
- package/src/stories/utils/default-arg-types.js +29 -0
- package/src/stories/utils/options.js +25 -0
- package/src/stories/utils/orchestrator.js +130 -0
- package/src/stories/utils/waiting/index.js +1 -0
- package/src/stories/utils/waiting/preloader.svg +1 -0
- package/src/stories/utils/waiting/waiting.js +21 -0
- package/src/stories/utils/waiting/waiting.scss +21 -0
- package/src/tests/sample.spec.js +5 -0
- package/src/use-lunatic/actions.js +44 -0
- package/src/use-lunatic/commons/check-loops.js +61 -0
- package/src/use-lunatic/commons/create-map-pages.js +69 -0
- package/src/use-lunatic/commons/execute-condition-filter.js +16 -0
- package/src/use-lunatic/commons/execute-expression/create-execute-expression.js +187 -0
- package/src/use-lunatic/commons/execute-expression/create-memoizer.js +42 -0
- package/src/use-lunatic/commons/execute-expression/create-refresh-calculated.js +98 -0
- package/src/use-lunatic/commons/execute-expression/execute-expression.js +69 -0
- package/src/use-lunatic/commons/execute-expression/get-expressions-variables.js +22 -0
- package/src/use-lunatic/commons/execute-expression/get-safety-expression.js +19 -0
- package/src/use-lunatic/commons/execute-expression/index.js +1 -0
- package/src/use-lunatic/commons/fill-components/fill-component-expressions.js +129 -0
- package/src/use-lunatic/commons/fill-components/fill-component-value.js +8 -0
- package/src/use-lunatic/commons/fill-components/fill-components.js +32 -0
- package/src/use-lunatic/commons/fill-components/fill-errors.js +13 -0
- package/src/use-lunatic/commons/fill-components/fill-from-state.js +6 -0
- package/src/use-lunatic/commons/fill-components/fill-missing-response.js +22 -0
- package/src/use-lunatic/commons/fill-components/fill-pagination.js +8 -0
- package/src/use-lunatic/commons/fill-components/index.js +1 -0
- package/src/use-lunatic/commons/get-compatible-vtl-expression.js +16 -0
- package/src/use-lunatic/commons/get-component-value/get-component-value.js +118 -0
- package/src/use-lunatic/commons/get-component-value/index.js +1 -0
- package/src/use-lunatic/commons/get-components-from-state.js +24 -0
- package/src/use-lunatic/commons/get-page-tag.js +10 -0
- package/src/use-lunatic/commons/index.js +12 -0
- package/src/use-lunatic/commons/is-First-last-page.js +8 -0
- package/src/use-lunatic/commons/is-paginated-loop.js +6 -0
- package/src/use-lunatic/commons/load-suggesters.js +59 -0
- package/src/use-lunatic/commons/use-components-from-state.js +20 -0
- package/src/use-lunatic/index.js +1 -0
- package/src/use-lunatic/initial-state.js +31 -0
- package/src/use-lunatic/reducer/commons/Insee.code-workspace +47 -0
- package/src/use-lunatic/reducer/commons/index.js +3 -0
- package/src/use-lunatic/reducer/commons/is-empty-on-empty-page.js +29 -0
- package/src/use-lunatic/reducer/commons/resize-array-variable.js +28 -0
- package/src/use-lunatic/reducer/commons/validate-condition-filter.js +20 -0
- package/src/use-lunatic/reducer/index.js +1 -0
- package/src/use-lunatic/reducer/reduce-go-next-page.js +135 -0
- package/src/use-lunatic/reducer/reduce-go-previous-page.js +133 -0
- package/src/use-lunatic/reducer/reduce-handle-change/index.js +1 -0
- package/src/use-lunatic/reducer/reduce-handle-change/reduce-cleaning.js +44 -0
- package/src/use-lunatic/reducer/reduce-handle-change/reduce-handle-change.js +89 -0
- package/src/use-lunatic/reducer/reduce-handle-change/reduce-links-variable.js +18 -0
- package/src/use-lunatic/reducer/reduce-handle-change/reduce-missing.js +47 -0
- package/src/use-lunatic/reducer/reduce-handle-change/reduce-resizing.js +91 -0
- package/src/use-lunatic/reducer/reduce-handle-change/reduce-variables-array.js +22 -0
- package/src/use-lunatic/reducer/reduce-handle-change/reduce-variables-simple.js +13 -0
- package/src/use-lunatic/reducer/reduce-on-init.js +183 -0
- package/src/use-lunatic/reducer/reduce-on-set-waiting.js +7 -0
- package/src/use-lunatic/reducer/reducer.js +26 -0
- package/src/use-lunatic/reducer/validate-controls/create-validate-reducer.js +86 -0
- package/src/use-lunatic/reducer/validate-controls/index.js +1 -0
- package/src/use-lunatic/use-lunatic.js +155 -0
- package/src/utils/constants/features.js +3 -0
- package/src/utils/constants/index.js +5 -0
- package/src/utils/constants/links.js +2 -0
- package/src/utils/constants/missing.js +2 -0
- package/src/utils/constants/variable-status.js +5 -0
- package/src/utils/constants/variable-types.js +1 -0
- package/src/utils/idb-tools/clear-store.js +16 -0
- package/src/utils/idb-tools/create-db-opener.js +43 -0
- package/src/utils/idb-tools/create-open-db.js +25 -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/idb-bulk-insert.js +96 -0
- package/src/utils/idb-tools/index.js +10 -0
- package/src/utils/idb-tools/insert-entity.js +15 -0
- package/src/utils/idb-tools/open-db.js +13 -0
- package/src/utils/idb-tools/open-or-create-db.js +34 -0
- package/src/utils/is-element.js +7 -0
- package/src/utils/store-tools/auto-load.js +74 -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 +2 -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 +7 -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/suggester-workers/append-to-index/append.js +25 -0
- package/src/utils/suggester-workers/append-to-index/append.worker.js +16 -0
- package/src/utils/suggester-workers/append-to-index/create-append-task.js +45 -0
- package/src/utils/suggester-workers/append-to-index/index.js +2 -0
- package/src/utils/suggester-workers/append-to-index/prepare-entities.js +61 -0
- package/src/utils/suggester-workers/append-to-index/store-messages.js +21 -0
- 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 +17 -0
- 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/filters/filter-double.js +12 -0
- package/src/utils/suggester-workers/commons-tokenizer/filters/filter-double.spec.js +20 -0
- package/src/utils/suggester-workers/commons-tokenizer/filters/filter-length.js +7 -0
- package/src/utils/suggester-workers/commons-tokenizer/filters/filter-length.spec.js +18 -0
- package/src/utils/suggester-workers/commons-tokenizer/filters/filter-stemmer.js +13 -0
- 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/filters/stop-words.js +118 -0
- package/src/utils/suggester-workers/commons-tokenizer/get-regexp-from-pattern.js +8 -0
- package/src/utils/suggester-workers/commons-tokenizer/get-stemmer.js +18 -0
- package/src/utils/suggester-workers/commons-tokenizer/index.js +9 -0
- package/src/utils/suggester-workers/commons-tokenizer/prepare-string-indexation.js +13 -0
- package/src/utils/suggester-workers/commons-tokenizer/soft-tokenizer.js +7 -0
- package/src/utils/suggester-workers/create-worker.js +55 -0
- package/src/utils/suggester-workers/find-best-label/find-best-label.js +39 -0
- package/src/utils/suggester-workers/find-best-label/find-best-label.worker.js +40 -0
- package/src/utils/suggester-workers/find-best-label/index.js +0 -0
- package/src/utils/suggester-workers/find-best-label/tokenize.js +30 -0
- package/src/utils/suggester-workers/find-best-label/tokenize.spec.js +19 -0
- package/src/utils/suggester-workers/searching/compute-score.js +33 -0
- package/src/utils/suggester-workers/searching/get-db.js +18 -0
- package/src/utils/suggester-workers/searching/index.js +1 -0
- package/src/utils/suggester-workers/searching/order/create-alphanumeric-orderer.js +20 -0
- package/src/utils/suggester-workers/searching/order/index.js +19 -0
- package/src/utils/suggester-workers/searching/query-parser/index.js +2 -0
- package/src/utils/suggester-workers/searching/query-parser/query-parser-soft.js +7 -0
- package/src/utils/suggester-workers/searching/query-parser/query-parser-soft.spec.js +24 -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 +27 -0
- package/src/utils/suggester-workers/searching/search-in-index.js +17 -0
- package/src/utils/suggester-workers/searching/searching.js +70 -0
- package/src/utils/suggester-workers/searching/searching.worker.js +11 -0
- package/src/utils/vtl/dataset-builder.js +17 -0
- package/src/utils/vtl/index.js +1 -0
- package/src/components/breadcrumb/breadcrumb.scss +0 -22
- package/src/components/breadcrumb/component.js +0 -29
- package/src/components/button/component.js +0 -25
- package/src/components/checkbox/boolean.js +0 -100
- package/src/components/checkbox/group.js +0 -128
- package/src/components/checkbox/one.js +0 -132
- package/src/components/datepicker/component.js +0 -113
- package/src/components/declarations/component.js +0 -33
- package/src/components/dropdown/component.js +0 -100
- package/src/components/dropdown/shared/option.component.js +0 -77
- package/src/components/dropdown/shared/select-base.component.js +0 -148
- package/src/components/dropdown/shared/select-container.component.js +0 -59
- package/src/components/dropdown/shared/select-panel.component.js +0 -202
- package/src/components/dropdown/simple/index.js +0 -10
- package/src/components/dropdown/simple/prop-types.js +0 -14
- package/src/components/dropdown/simple/simple-select-list.component.js +0 -31
- package/src/components/dropdown/simple/simple-select-nested.component.js +0 -70
- package/src/components/dropdown/simple/simple-select.scss +0 -84
- package/src/components/dropdown/writable/index.js +0 -1
- package/src/components/dropdown/writable/writable-select.component.js +0 -98
- package/src/components/dropdown/writable/writable-select.scss +0 -113
- package/src/components/input/input-number.js +0 -171
- package/src/components/progress-bar/component.js +0 -28
- package/src/components/progress-bar/index.js +0 -1
- package/src/components/progress-bar/progress-bar.scss +0 -54
- package/src/components/radio/component.js +0 -136
- package/src/components/sequence/component.js +0 -43
- package/src/components/subsequence/component.js +0 -43
- package/src/components/subsequence/subsequence.scss +0 -15
- package/src/components/table/table.js +0 -133
- package/src/components/table/table.scss +0 -23
- package/src/components/textarea/component.js +0 -117
- package/src/components/tooltip/index.js +0 -1
- package/src/components/tooltip/response.js +0 -42
- package/src/components/tooltip/tooltip.scss +0 -35
- package/src/stories/breadcrumb/README.md +0 -14
- package/src/stories/breadcrumb/breadcrumb.stories.js +0 -35
- package/src/stories/button/README.md +0 -14
- package/src/stories/button/button.stories.js +0 -63
- package/src/stories/checkbox-boolean/README.md +0 -25
- package/src/stories/checkbox-boolean/checkbox-boolean.stories.js +0 -49
- package/src/stories/checkbox-group/README.md +0 -28
- package/src/stories/checkbox-group/checkbox-group.stories.js +0 -122
- package/src/stories/checkbox-one/README.md +0 -30
- package/src/stories/checkbox-one/checkbox-one.stories.js +0 -112
- package/src/stories/datepicker/README.md +0 -27
- package/src/stories/datepicker/datepicker.stories.js +0 -82
- package/src/stories/declarations/README.md +0 -17
- package/src/stories/declarations/declarations.stories.js +0 -61
- package/src/stories/dropdown/README.md +0 -29
- package/src/stories/dropdown/dropdown.stories.js +0 -70
- package/src/stories/input/README.md +0 -28
- package/src/stories/input-number/README.md +0 -31
- package/src/stories/input-number/input-number.stories.js +0 -95
- package/src/stories/progress-bar/README.md +0 -13
- package/src/stories/progress-bar/progress-bar.stories.js +0 -24
- package/src/stories/radio/README.md +0 -30
- package/src/stories/radio/radio.stories.js +0 -110
- package/src/stories/sequence/README.md +0 -16
- package/src/stories/sequence/sequence.stories.js +0 -46
- package/src/stories/subsequence/README.md +0 -16
- package/src/stories/subsequence/subsequence.stories.js +0 -46
- package/src/stories/table/README.md +0 -23
- package/src/stories/table/table.stories.js +0 -1021
- package/src/stories/textarea/README.md +0 -29
- package/src/stories/textarea/textarea.stories.js +0 -85
- package/src/stories/tooltip-response/README.md +0 -14
- package/src/stories/tooltip-response/tooltip.stories.js +0 -43
- package/src/tests/components/breadcrumb.spec.js +0 -13
- package/src/tests/components/button.spec.js +0 -11
- package/src/tests/components/checkbox-boolean.spec.js +0 -22
- package/src/tests/components/checkbox-group.spec.js +0 -17
- package/src/tests/components/checkbox-one.spec.js +0 -17
- package/src/tests/components/datepicker.spec.js +0 -42
- package/src/tests/components/declarations.spec.js +0 -46
- package/src/tests/components/dropdown.spec.js +0 -20
- package/src/tests/components/input-number.spec.js +0 -85
- package/src/tests/components/input.spec.js +0 -38
- package/src/tests/components/progress-bar.spec.js +0 -15
- package/src/tests/components/radio.spec.js +0 -21
- package/src/tests/components/sequence.spec.js +0 -9
- package/src/tests/components/subsequence.spec.js +0 -9
- package/src/tests/components/table.spec.js +0 -11
- package/src/tests/components/textarea.spec.js +0 -38
- package/src/tests/setup/setupTests.js +0 -4
- package/src/tests/utils/lib/decorator/title-decorator.spec.js +0 -12
- package/src/tests/utils/lib/items-positioning.spec.js +0 -17
- package/src/tests/utils/lib/label-position.spec.js +0 -19
- package/src/tests/utils/lib/responses.spec.js +0 -68
- package/src/tests/utils/lib/style.spec.js +0 -26
- package/src/tests/utils/lib/table/roster.spec.js +0 -25
- package/src/tests/utils/lib/tooltip/build-response.spec.js +0 -50
- package/src/tests/utils/to-expose/handler.spec.js +0 -184
- package/src/tests/utils/to-expose/init-questionnaire.spec.js +0 -10
- package/src/tests/utils/to-expose/state.spec.js +0 -251
- package/src/utils/lib/alphabet.js +0 -1
- package/src/utils/lib/decorator/index.js +0 -1
- package/src/utils/lib/decorator/title-decorator.js +0 -18
- package/src/utils/lib/index.js +0 -9
- package/src/utils/lib/label-position.js +0 -12
- package/src/utils/lib/options-positioning.js +0 -9
- package/src/utils/lib/prop-types/response.js +0 -15
- package/src/utils/lib/prop-types/value-type.js +0 -9
- package/src/utils/lib/responses.js +0 -9
- package/src/utils/lib/table/index.js +0 -1
- package/src/utils/lib/table/roster.js +0 -21
- package/src/utils/lib/tooltip/build-response.js +0 -11
- package/src/utils/lib/tooltip/content.js +0 -46
- package/src/utils/lib/tooltip/index.js +0 -2
- package/src/utils/to-expose/handler.js +0 -104
- package/src/utils/to-expose/index.js +0 -3
- package/src/utils/to-expose/init-questionnaire.js +0 -47
- package/src/utils/to-expose/state.js +0 -75
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
|
-
import { withReadme } from 'storybook-readme';
|
|
4
|
-
import { CheckboxOne } from 'components';
|
|
5
|
-
import readme from './README.md';
|
|
6
|
-
import { titleDecorator } from 'utils/lib';
|
|
7
|
-
import {
|
|
8
|
-
text,
|
|
9
|
-
boolean,
|
|
10
|
-
number,
|
|
11
|
-
color,
|
|
12
|
-
object,
|
|
13
|
-
select,
|
|
14
|
-
} from '@storybook/addon-knobs/react';
|
|
15
|
-
|
|
16
|
-
const stories = storiesOf('CheckboxOne', module)
|
|
17
|
-
.addDecorator(withReadme(readme))
|
|
18
|
-
.addDecorator(Component => {
|
|
19
|
-
const WrappedComponent = titleDecorator(Component);
|
|
20
|
-
return <WrappedComponent title="<CheckboxOne />" />;
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const options = [
|
|
24
|
-
{ value: 'france', label: 'France' },
|
|
25
|
-
{ value: 'italy', label: 'Italy' },
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
const positioningOptions = {
|
|
29
|
-
DEFAULT: 'Default',
|
|
30
|
-
HORIZONTAL: 'Horizontal',
|
|
31
|
-
VERTICAL: 'Vertical',
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const defaultProps = {
|
|
35
|
-
handleChange: console.log,
|
|
36
|
-
response: {
|
|
37
|
-
name: 'CHECKBOX_ONE',
|
|
38
|
-
valueState: [
|
|
39
|
-
{ valueType: 'COLLECTED', value: 'france' },
|
|
40
|
-
{ valueType: 'FORCED', value: 'italy' },
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
stories.addWithJSX('Default', () => (
|
|
46
|
-
<CheckboxOne id="default" options={options} {...defaultProps} />
|
|
47
|
-
));
|
|
48
|
-
|
|
49
|
-
stories.addWithJSX('Props', () => (
|
|
50
|
-
<CheckboxOne
|
|
51
|
-
id="props"
|
|
52
|
-
label={text(
|
|
53
|
-
'Label',
|
|
54
|
-
"I'm the label of the checkbox with a single response"
|
|
55
|
-
)}
|
|
56
|
-
positioning={select('Items positioning', positioningOptions)}
|
|
57
|
-
disabled={boolean('Disabled', false)}
|
|
58
|
-
focused={boolean('Focused', false)}
|
|
59
|
-
keyboardSelection={boolean('Keyboard selection', false)}
|
|
60
|
-
options={options}
|
|
61
|
-
preferences={['COLLECTED', 'FORCED']}
|
|
62
|
-
tooltip={boolean('Tooltip', false)}
|
|
63
|
-
{...defaultProps}
|
|
64
|
-
/>
|
|
65
|
-
));
|
|
66
|
-
|
|
67
|
-
stories.addWithJSX('Styled', () => (
|
|
68
|
-
<CheckboxOne
|
|
69
|
-
id="styled"
|
|
70
|
-
label={text(
|
|
71
|
-
'Label',
|
|
72
|
-
"I'm the label of the checkbox with a single response"
|
|
73
|
-
)}
|
|
74
|
-
positioning={select('Items positioning', positioningOptions)}
|
|
75
|
-
disabled={boolean('Disabled', false)}
|
|
76
|
-
focused={boolean('Focused', false)}
|
|
77
|
-
options={options}
|
|
78
|
-
style={object('Generated style', {
|
|
79
|
-
fieldsetStyle: {
|
|
80
|
-
'border-color': color('Fieldset color', '#e80a4d'),
|
|
81
|
-
'border-width': number('Border-width', 3, {
|
|
82
|
-
range: true,
|
|
83
|
-
min: 0,
|
|
84
|
-
max: 20,
|
|
85
|
-
step: 1,
|
|
86
|
-
}),
|
|
87
|
-
'border-radius': number('Border-radius', 5, {
|
|
88
|
-
range: true,
|
|
89
|
-
min: 0,
|
|
90
|
-
max: 20,
|
|
91
|
-
step: 1,
|
|
92
|
-
}),
|
|
93
|
-
},
|
|
94
|
-
checkboxStyle: {
|
|
95
|
-
'border-color': color('Checked label border color', '#e80a4d'),
|
|
96
|
-
'border-width': number('Checked label border width', 3, {
|
|
97
|
-
range: true,
|
|
98
|
-
min: 0,
|
|
99
|
-
max: 20,
|
|
100
|
-
step: 1,
|
|
101
|
-
}),
|
|
102
|
-
'border-radius': number('Checked label border radius', 5, {
|
|
103
|
-
range: true,
|
|
104
|
-
min: 0,
|
|
105
|
-
max: 20,
|
|
106
|
-
step: 1,
|
|
107
|
-
}),
|
|
108
|
-
},
|
|
109
|
-
})}
|
|
110
|
-
{...defaultProps}
|
|
111
|
-
/>
|
|
112
|
-
));
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# Datepicker component
|
|
2
|
-
|
|
3
|
-
## Props
|
|
4
|
-
|
|
5
|
-
| Props | Type | Default value | Required | Description |
|
|
6
|
-
| :-------------: | :----: | :-----------: | :------: | ----------------------------------------- |
|
|
7
|
-
| id | string | - | ✓ | Id of the datepicker |
|
|
8
|
-
| label | string | - | ✓ | Label of the datepicker |
|
|
9
|
-
| preferences \* | array | ["COLLECTED"] | | Preferences to manage datepicker response |
|
|
10
|
-
| response \* | object | {} | | Response concerned by the component |
|
|
11
|
-
| placeholder | string | "" | | Placeholder of the datepicker |
|
|
12
|
-
| handleChange | func | - | ✓ | Handler of the datepicker |
|
|
13
|
-
| readOnly | bool | false | | Is the datepicker read only |
|
|
14
|
-
| labelPosition | string | "DEFAULT" | | Position of the datepicker label |
|
|
15
|
-
| required | bool | false | | Is the datepicker required |
|
|
16
|
-
| focused | bool | false | | Is the datepicker focused |
|
|
17
|
-
| declarations \* | array | [] | | Declarations of the datepicker |
|
|
18
|
-
| tooltip | bool | false | | Tooltip of the datepicker |
|
|
19
|
-
| style | object | {} | | Style of the datepicker |
|
|
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, valueState: object}`
|
|
23
|
-
- `declarations` are documented in the `Declarations` component
|
|
24
|
-
|
|
25
|
-
## Styles
|
|
26
|
-
|
|
27
|
-
**Datepicker** component has for classes `datepicker-lunatic`.
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
|
-
import { withReadme } from 'storybook-readme';
|
|
4
|
-
import { Datepicker } from 'components';
|
|
5
|
-
import readme from './README.md';
|
|
6
|
-
import { titleDecorator } from 'utils/lib';
|
|
7
|
-
import {
|
|
8
|
-
text,
|
|
9
|
-
boolean,
|
|
10
|
-
number,
|
|
11
|
-
color,
|
|
12
|
-
object,
|
|
13
|
-
select,
|
|
14
|
-
} from '@storybook/addon-knobs/react';
|
|
15
|
-
|
|
16
|
-
const labelPositionOptions = {
|
|
17
|
-
DEFAULT: 'Default',
|
|
18
|
-
TOP: 'Top',
|
|
19
|
-
RIGHT: 'Right',
|
|
20
|
-
BOTTOM: 'Bottom',
|
|
21
|
-
LEFT: 'Left',
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const defaultProps = {
|
|
25
|
-
handleChange: console.log,
|
|
26
|
-
response: {
|
|
27
|
-
name: 'DATEPICKER',
|
|
28
|
-
valueState: [
|
|
29
|
-
{ valueType: 'COLLECTED', value: '1998-07-12' },
|
|
30
|
-
{ valueType: 'FORCED', value: '2018-07-15' },
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const stories = storiesOf('Datepicker', module)
|
|
36
|
-
.addDecorator(withReadme(readme))
|
|
37
|
-
.addDecorator(Component => {
|
|
38
|
-
const WrappedComponent = titleDecorator(Component);
|
|
39
|
-
return <WrappedComponent title="<Datepicker />" />;
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
stories.addWithJSX('Default', () => (
|
|
43
|
-
<Datepicker id="default" label="Label" {...defaultProps} />
|
|
44
|
-
));
|
|
45
|
-
|
|
46
|
-
stories.addWithJSX('Props', () => (
|
|
47
|
-
<Datepicker
|
|
48
|
-
id="props"
|
|
49
|
-
label={text('Label', "I'm the label of the datepicker")}
|
|
50
|
-
placeholder={text('Placeholder', 'Placeholder')}
|
|
51
|
-
readOnly={boolean('Read only', false)}
|
|
52
|
-
required={boolean('Required', false)}
|
|
53
|
-
focused={boolean('Focused', false)}
|
|
54
|
-
preferences={['COLLECTED', 'FORCED']}
|
|
55
|
-
tooltip={boolean('Tooltip', false)}
|
|
56
|
-
labelPosition={select('Label position', labelPositionOptions)}
|
|
57
|
-
{...defaultProps}
|
|
58
|
-
/>
|
|
59
|
-
));
|
|
60
|
-
|
|
61
|
-
stories.addWithJSX('Styled', () => (
|
|
62
|
-
<Datepicker
|
|
63
|
-
id="styled"
|
|
64
|
-
label={text('Label', "I'm the label of the datepicker")}
|
|
65
|
-
{...defaultProps}
|
|
66
|
-
style={object('Generated style', {
|
|
67
|
-
'border-color': color('Border color', '#e80a4d'),
|
|
68
|
-
'border-width': number('Border-width', 2, {
|
|
69
|
-
range: true,
|
|
70
|
-
min: 2,
|
|
71
|
-
max: 20,
|
|
72
|
-
step: 1,
|
|
73
|
-
}),
|
|
74
|
-
'border-radius': number('Border-radius', 10, {
|
|
75
|
-
range: true,
|
|
76
|
-
min: 0,
|
|
77
|
-
max: 20,
|
|
78
|
-
step: 1,
|
|
79
|
-
}),
|
|
80
|
-
})}
|
|
81
|
-
/>
|
|
82
|
-
));
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Declarations component
|
|
2
|
-
|
|
3
|
-
## Props
|
|
4
|
-
|
|
5
|
-
| Props | Type | Default value | Required | Description |
|
|
6
|
-
| :-------------: | :----: | :-------------------: | :------: | ---------------------------------------------- |
|
|
7
|
-
| id | string | - | ✓ | Id of the declarations |
|
|
8
|
-
| type | string | 'AFTER_QUESTION_TEXT' | | Type of the selected position for declarations |
|
|
9
|
-
| declarations \* | number | [ ] | | Array of declaration |
|
|
10
|
-
|
|
11
|
-
- `declarations` props has to be an array made by objects with a shape of `{id : string, label: string, position: position *, declarationType: declarationType *}`
|
|
12
|
-
- `position` props has to be `BEFORE_QUESTION_TEXT`, `AFTER_QUESTION_TEXT` or `DETACHABLE`
|
|
13
|
-
- `declarationType` props has to be `INSTRUCTION`, `COMMENT`, `HELP`, `WARNING`, `MESSAGE_FILTER` or `STATEMENT`
|
|
14
|
-
|
|
15
|
-
## Styles
|
|
16
|
-
|
|
17
|
-
**Declarations** component has for classes `.declarations-lunatic`, `.declaration-lunatic`, `.declaration-instruction`, `.declaration-comment`, `.declaration-help`, `.declaration-warning` and `.declaration-message-filter`.
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
|
-
import { withReadme } from 'storybook-readme';
|
|
4
|
-
import { Declarations } from 'components';
|
|
5
|
-
import readme from './README.md';
|
|
6
|
-
import { titleDecorator } from 'utils/lib';
|
|
7
|
-
import * as C from 'utils/constants';
|
|
8
|
-
|
|
9
|
-
const declarations = [
|
|
10
|
-
{
|
|
11
|
-
id: '1',
|
|
12
|
-
label: "I'm the label of the instruction declaration",
|
|
13
|
-
position: C.BEFORE_QUESTION_TEXT,
|
|
14
|
-
declarationType: C.INSTRUCTION,
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
id: '2',
|
|
18
|
-
label: "I'm the label of the comment declaration",
|
|
19
|
-
position: C.BEFORE_QUESTION_TEXT,
|
|
20
|
-
declarationType: C.COMMENT,
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: '3',
|
|
24
|
-
label: "I'm the label of the help declaration",
|
|
25
|
-
position: C.BEFORE_QUESTION_TEXT,
|
|
26
|
-
declarationType: C.HELP,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: '4',
|
|
30
|
-
label: "I'm the label of the warning declaration",
|
|
31
|
-
position: C.BEFORE_QUESTION_TEXT,
|
|
32
|
-
declarationType: C.WARNING,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: '5',
|
|
36
|
-
label: "I'm the label of the message filter declaration",
|
|
37
|
-
position: C.BEFORE_QUESTION_TEXT,
|
|
38
|
-
declarationType: C.MESSAGE_FILTER,
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: '6',
|
|
42
|
-
label: "I'm the label of the statement declaration",
|
|
43
|
-
position: C.BEFORE_QUESTION_TEXT,
|
|
44
|
-
declarationType: C.STATEMENT,
|
|
45
|
-
},
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
const stories = storiesOf('Declarations', module)
|
|
49
|
-
.addDecorator(withReadme(readme))
|
|
50
|
-
.addDecorator(Component => {
|
|
51
|
-
const WrappedComponent = titleDecorator(Component);
|
|
52
|
-
return <WrappedComponent title="<Declarations />" />;
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
stories.addWithJSX('Default', () => (
|
|
56
|
-
<Declarations
|
|
57
|
-
id="default"
|
|
58
|
-
type={C.BEFORE_QUESTION_TEXT}
|
|
59
|
-
declarations={declarations}
|
|
60
|
-
/>
|
|
61
|
-
));
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# Dropdown component
|
|
2
|
-
|
|
3
|
-
## Props
|
|
4
|
-
|
|
5
|
-
| Props | Type | Default value | Required | Description |
|
|
6
|
-
| :-------------: | :----: | :-----------: | :------: | --------------------------------------- |
|
|
7
|
-
| id | string | - | ✓ | Id of the dropdown |
|
|
8
|
-
| label | string | "" | | Fieldset label of the dropdown |
|
|
9
|
-
| preferences \* | array | ["COLLECTED"] | | Preferences to manage dropdown response |
|
|
10
|
-
| response \* | object | {} | | Response concerned by the component |
|
|
11
|
-
| options \* | array | - | ✓ | Options of the dropdown |
|
|
12
|
-
| handleChange | func | - | ✓ | Handler of the dropdown |
|
|
13
|
-
| placeholder | string | "" | | Placeholder of the dropdown |
|
|
14
|
-
| readOnly | bool | false | | Is the dropdown read only |
|
|
15
|
-
| writable | bool | false | | Is the dropdown writable |
|
|
16
|
-
| required | bool | false | | Is the dropdown required |
|
|
17
|
-
| labelPosition | string | "DEFAULT" | | Position of the dropdown label |
|
|
18
|
-
| declarations \* | array | [] | | Declarations of the dropdown |
|
|
19
|
-
| tooltip | bool | false | | Tooltip of the dropdown |
|
|
20
|
-
| style | object | {} | | Style of the dropdown |
|
|
21
|
-
|
|
22
|
-
- `preferences` props has to be an ordered array of `COLLECTED`, `FORCED` or `EDITED`
|
|
23
|
-
- `response` props has to be a shape of `{name: string, valueState: object}`
|
|
24
|
-
- `options` props has to be an array made by objects with a shape of `{label: string, value: string}`
|
|
25
|
-
- `declarations` are documented in the `Declarations` component
|
|
26
|
-
|
|
27
|
-
## Styles
|
|
28
|
-
|
|
29
|
-
**Dropdown** component has for classes XXX
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
|
-
import { withReadme } from 'storybook-readme';
|
|
4
|
-
import { Dropdown } from 'components';
|
|
5
|
-
import readme from './README.md';
|
|
6
|
-
import { titleDecorator } from 'utils/lib';
|
|
7
|
-
import {
|
|
8
|
-
text,
|
|
9
|
-
boolean,
|
|
10
|
-
number,
|
|
11
|
-
color,
|
|
12
|
-
object,
|
|
13
|
-
select,
|
|
14
|
-
} from '@storybook/addon-knobs/react';
|
|
15
|
-
|
|
16
|
-
const stories = storiesOf('Dropdown', module)
|
|
17
|
-
.addDecorator(withReadme(readme))
|
|
18
|
-
.addDecorator(Component => {
|
|
19
|
-
const WrappedComponent = titleDecorator(Component);
|
|
20
|
-
return <WrappedComponent title="<Dropdown />" />;
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const options = [
|
|
24
|
-
{ value: 'belgium', label: 'Belgium' },
|
|
25
|
-
{ value: 'france', label: 'France' },
|
|
26
|
-
{ value: 'italy', label: 'Italy' },
|
|
27
|
-
{ value: 'netherland', label: 'Netherland' },
|
|
28
|
-
{ value: 'spain', label: 'Spain' },
|
|
29
|
-
{ value: 'sweden', label: 'Sweden' },
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
const labelPositionOptions = {
|
|
33
|
-
DEFAULT: 'Default',
|
|
34
|
-
TOP: 'Top',
|
|
35
|
-
RIGHT: 'Right',
|
|
36
|
-
BOTTOM: 'Bottom',
|
|
37
|
-
LEFT: 'Left',
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const defaultProps = {
|
|
41
|
-
handleChange: console.log,
|
|
42
|
-
response: {
|
|
43
|
-
name: 'DROPDOWN',
|
|
44
|
-
valueState: [
|
|
45
|
-
{ valueType: 'COLLECTED', value: 'belgium' },
|
|
46
|
-
{ valueType: 'FORCED', value: 'italy' },
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
options,
|
|
50
|
-
labelPositionOptions,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
stories.addWithJSX('Default', () => (
|
|
54
|
-
<Dropdown id="default" label="Default dropdown" {...defaultProps} />
|
|
55
|
-
));
|
|
56
|
-
|
|
57
|
-
stories.addWithJSX('Props', () => (
|
|
58
|
-
<Dropdown
|
|
59
|
-
{...defaultProps}
|
|
60
|
-
id="props"
|
|
61
|
-
label={text('Label', "I'm the label of the dropdown")}
|
|
62
|
-
options={options}
|
|
63
|
-
placeholder={text('Placeholder', 'Placeholder')}
|
|
64
|
-
readOnly={boolean('Read only', false)}
|
|
65
|
-
writable={boolean('Writable', false)}
|
|
66
|
-
labelPosition={select('Label position', labelPositionOptions)}
|
|
67
|
-
preferences={['COLLECTED', 'FORCED']}
|
|
68
|
-
tooltip={boolean('Tooltip', false)}
|
|
69
|
-
/>
|
|
70
|
-
));
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# Input component
|
|
2
|
-
|
|
3
|
-
## Props
|
|
4
|
-
|
|
5
|
-
| Props | Type | Default value | Required | Description |
|
|
6
|
-
| :-------------: | :----: | :-----------: | :------: | ------------------------------------ |
|
|
7
|
-
| id | string | - | ✓ | Id of the input |
|
|
8
|
-
| label | string | "" | | Label of the input |
|
|
9
|
-
| preferences \* | array | ["COLLECTED"] | | Preferences to manage input response |
|
|
10
|
-
| response \* | object | {} | | Response concerned by the component |
|
|
11
|
-
| placeholder | string | " " | | Placeholder of the input |
|
|
12
|
-
| handleChange | func | - | ✓ | Handler of the input |
|
|
13
|
-
| readOnly | bool | false | | Is the input read only |
|
|
14
|
-
| autoComplete | bool | false | | Is the input autocompletable |
|
|
15
|
-
| labelPosition | string | "DEFAULT" | | Position of the input label |
|
|
16
|
-
| required | bool | false | | Is the input required |
|
|
17
|
-
| focused | bool | false | | Is the input focused |
|
|
18
|
-
| declarations \* | array | [] | | Declarations of the input |
|
|
19
|
-
| tooltip | bool | false | | Tooltip of the input |
|
|
20
|
-
| style | object | {} | | Style of the input |
|
|
21
|
-
|
|
22
|
-
- `preferences` props has to be an ordered array of `COLLECTED`, `FORCED` or `EDITED`
|
|
23
|
-
- `response` props has to be a shape of `{name: string, valueState: object}`
|
|
24
|
-
- `declarations` are documented in the `Declarations` component
|
|
25
|
-
|
|
26
|
-
## Styles
|
|
27
|
-
|
|
28
|
-
**Input** component has for class `.input-lunatic`.
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# InputNumber component
|
|
2
|
-
|
|
3
|
-
## Props
|
|
4
|
-
|
|
5
|
-
| Props | Type | Default value | Required | Description |
|
|
6
|
-
| :-------------: | :----: | :---------------------: | :------: | ------------------------------------ |
|
|
7
|
-
| id | string | - | ✓ | Id of the input |
|
|
8
|
-
| label | string | " " | | Label of the input |
|
|
9
|
-
| preferences \* | array | ["COLLECTED"] | | Preferences to manage input response |
|
|
10
|
-
| response \* | object | {} | | Response concerned by the component |
|
|
11
|
-
| min | number | Number.MIN_SAFE_INTEGER | | Minimum of the input |
|
|
12
|
-
| max | number | Number.MAX_SAFE_INTEGER | | Maximum of the input |
|
|
13
|
-
| decimals | number | 0 | | Number of decimals of the input |
|
|
14
|
-
| placeholder | string | "" | | Placeholder of the input |
|
|
15
|
-
| handleChange | func | - | ✓ | Handler of the input |
|
|
16
|
-
| readOnly | bool | false | | Is the input read only |
|
|
17
|
-
| autoComplete | bool | false | | Is the input autocompletable |
|
|
18
|
-
| focused | bool | false | | Is the input focused |
|
|
19
|
-
| declarations \* | array | [ ] | | Declarations of the input |
|
|
20
|
-
| labelPosition | string | "DEFAULT" | | Position of the input label |
|
|
21
|
-
| required | bool | false | | Is the input required |
|
|
22
|
-
| tooltip | bool | false | | Tooltip of the input |
|
|
23
|
-
| style | object | {} | | Style of the input |
|
|
24
|
-
|
|
25
|
-
- `preferences` props has to be an ordered array of `COLLECTED`, `FORCED` or `EDITED`
|
|
26
|
-
- `response` props has to be a shape of `{name: string, valueState: object}`
|
|
27
|
-
- `declarations` are documented in the `Declarations` component
|
|
28
|
-
|
|
29
|
-
## Styles
|
|
30
|
-
|
|
31
|
-
**InputNumber** component has for classes `.input-lunatic`, `.warning` and `.lunatic-input-number-errors > error`.
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
|
-
import { withReadme } from 'storybook-readme';
|
|
4
|
-
import { InputNumber } from 'components';
|
|
5
|
-
import readme from './README.md';
|
|
6
|
-
import { titleDecorator } from 'utils/lib';
|
|
7
|
-
import {
|
|
8
|
-
text,
|
|
9
|
-
boolean,
|
|
10
|
-
number,
|
|
11
|
-
color,
|
|
12
|
-
object,
|
|
13
|
-
select,
|
|
14
|
-
} from '@storybook/addon-knobs/react';
|
|
15
|
-
|
|
16
|
-
const labelPositionOptions = {
|
|
17
|
-
DEFAULT: 'Default',
|
|
18
|
-
TOP: 'Top',
|
|
19
|
-
RIGHT: 'Right',
|
|
20
|
-
BOTTOM: 'Bottom',
|
|
21
|
-
LEFT: 'Left',
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const defaultProps = {
|
|
25
|
-
handleChange: console.log,
|
|
26
|
-
response: {
|
|
27
|
-
name: 'INPUT_NUMBER',
|
|
28
|
-
valueState: [
|
|
29
|
-
{ valueType: 'COLLECTED', value: '1' },
|
|
30
|
-
{ valueType: 'FORCED', value: '2' },
|
|
31
|
-
{ valueType: 'EDITED', value: '3' },
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const stories = storiesOf('InputNumber', module)
|
|
37
|
-
.addDecorator(withReadme(readme))
|
|
38
|
-
.addDecorator(Component => {
|
|
39
|
-
const WrappedComponent = titleDecorator(Component);
|
|
40
|
-
return <WrappedComponent title="<InputNumber />" />;
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
stories.addWithJSX('Default', () => (
|
|
44
|
-
<InputNumber id="default" label="Label" {...defaultProps} />
|
|
45
|
-
));
|
|
46
|
-
|
|
47
|
-
stories.addWithJSX('Props', () => (
|
|
48
|
-
<InputNumber
|
|
49
|
-
id="props"
|
|
50
|
-
label={text('Label', "I'm the label of the number input")}
|
|
51
|
-
unit={text('Unit', 'euros')}
|
|
52
|
-
min={number('Min', 0)}
|
|
53
|
-
max={number('Max', 10)}
|
|
54
|
-
decimals={number('Decimals', 1)}
|
|
55
|
-
placeholder={text('Placeholder', 'Placeholder')}
|
|
56
|
-
readOnly={boolean('Read only', false)}
|
|
57
|
-
autoComplete={boolean('Autocomplete', false)}
|
|
58
|
-
required={boolean('Required', false)}
|
|
59
|
-
focused={boolean('Focused', false)}
|
|
60
|
-
tooltip={boolean('Tooltip', false)}
|
|
61
|
-
labelPosition={select('Label position', labelPositionOptions)}
|
|
62
|
-
preferences={['COLLECTED', 'FORCED', 'EDITED']}
|
|
63
|
-
{...defaultProps}
|
|
64
|
-
/>
|
|
65
|
-
));
|
|
66
|
-
|
|
67
|
-
stories.addWithJSX('Styled', () => (
|
|
68
|
-
<InputNumber
|
|
69
|
-
id="styled"
|
|
70
|
-
label={text('Label', "I'm the label of the number input")}
|
|
71
|
-
min={number('Min', 0)}
|
|
72
|
-
max={number('Max', 0)}
|
|
73
|
-
decimals={number('Decimals', 0)}
|
|
74
|
-
placeholder={text('Placeholder', 'Placeholder')}
|
|
75
|
-
readOnly={boolean('Read only', false)}
|
|
76
|
-
autoComplete={boolean('Autocomplete', false)}
|
|
77
|
-
focused={boolean('Focused', false)}
|
|
78
|
-
style={object('Generated style', {
|
|
79
|
-
'border-color': color('Border color', '#e80a4d'),
|
|
80
|
-
'border-width': number('Border-width', 2, {
|
|
81
|
-
range: true,
|
|
82
|
-
min: 2,
|
|
83
|
-
max: 20,
|
|
84
|
-
step: 1,
|
|
85
|
-
}),
|
|
86
|
-
'border-radius': number('Border-radius', 10, {
|
|
87
|
-
range: true,
|
|
88
|
-
min: 0,
|
|
89
|
-
max: 20,
|
|
90
|
-
step: 1,
|
|
91
|
-
}),
|
|
92
|
-
})}
|
|
93
|
-
{...defaultProps}
|
|
94
|
-
/>
|
|
95
|
-
));
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# ProgressBar component
|
|
2
|
-
|
|
3
|
-
## Props
|
|
4
|
-
|
|
5
|
-
| Props | Type | Default value | Required | Description |
|
|
6
|
-
| :---: | :----: | :-----------: | :------: | -------------------------- |
|
|
7
|
-
| id | string | - | ✓ | Id of the the progress bar |
|
|
8
|
-
| value | number | | ✓ | Value of the progress bar |
|
|
9
|
-
| style | object | { } | | Style of the progress bar |
|
|
10
|
-
|
|
11
|
-
## Styles
|
|
12
|
-
|
|
13
|
-
**ProgressBar** component has for classes `progress-lunatic`
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
|
-
import { withReadme } from 'storybook-readme';
|
|
4
|
-
import { ProgressBar } from 'components';
|
|
5
|
-
import readme from './README.md';
|
|
6
|
-
import { titleDecorator } from 'utils/lib';
|
|
7
|
-
|
|
8
|
-
const stories = storiesOf('ProgressBar', module)
|
|
9
|
-
.addDecorator(withReadme(readme))
|
|
10
|
-
.addDecorator(Component => {
|
|
11
|
-
const WrappedComponent = titleDecorator(Component);
|
|
12
|
-
return <WrappedComponent title="<ProgressBar />" />;
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
stories.addWithJSX('Default', () => (
|
|
16
|
-
<React.Fragment>
|
|
17
|
-
{Array.from(new Array(11), (a, i) => (
|
|
18
|
-
<React.Fragment key={i}>
|
|
19
|
-
<ProgressBar id={`default-${i * 10}`} value={i * 10} />
|
|
20
|
-
<br />
|
|
21
|
-
</React.Fragment>
|
|
22
|
-
))}
|
|
23
|
-
</React.Fragment>
|
|
24
|
-
));
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# Radio component
|
|
2
|
-
|
|
3
|
-
## Props
|
|
4
|
-
|
|
5
|
-
| Props | Type | Default value | Required | Description |
|
|
6
|
-
| :---------------: | :----: | :-----------------------------------: | :------: | -------------------------------------- |
|
|
7
|
-
| id | string | - | ✓ | Id of the radio |
|
|
8
|
-
| label | string | "" | | Fieldset label of the radio |
|
|
9
|
-
| preferences \* | array | ["COLLECTED"] | | Preferences to manage radio response |
|
|
10
|
-
| response \* | object | {} | | Response concerned by the component |
|
|
11
|
-
| options \* | array | [] | | Options of the radio |
|
|
12
|
-
| handleChange | func | - | ✓ | Handler of the radio |
|
|
13
|
-
| disabled | bool | false | | Is the radio options disabled |
|
|
14
|
-
| focused | bool | false | | Is the radio options focused |
|
|
15
|
-
| keyboardSelection | bool | false | | Enable keyboard selection of the radio |
|
|
16
|
-
| positioning \* | string | "DEFAULT" | | Checkbox options positioning |
|
|
17
|
-
| declarations \* | array | [] | | Declarations of the radio |
|
|
18
|
-
| tooltip | bool | false | | Tooltip of the radio |
|
|
19
|
-
| style \* | object | { fieldsetStyle: {}, radioStyle: {} } | | Style of the radio |
|
|
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, valueState: object}`
|
|
23
|
-
- `options` props has to be an array made by objects with a shape of `{label: string, value: string}`
|
|
24
|
-
- `positioning` props has to be one of `DEFAULT`, `HORIZONTAL` or `VERTICAL`
|
|
25
|
-
- `declarations` are documented in the `Declarations` component
|
|
26
|
-
- `style` props has to be composed of `fieldsetStyle` and `radioStyle`
|
|
27
|
-
|
|
28
|
-
## Styles
|
|
29
|
-
|
|
30
|
-
**CheckboxOne** component has for classes `radio-group`, `radio-modality` and `radio-lunatic`.
|