@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
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inseefr/lunatic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-v2",
|
|
4
|
+
"workersVersion": "0.2.4-experimental",
|
|
4
5
|
"description": "Library of questionnaire components",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
@@ -8,6 +9,14 @@
|
|
|
8
9
|
},
|
|
9
10
|
"author": "INSEE (http://www.insee.fr)",
|
|
10
11
|
"contributor": [
|
|
12
|
+
{
|
|
13
|
+
"name": "Laurent Caouissin",
|
|
14
|
+
"email": "laurent.caouissin@agriculture.gouv.fr"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "Renaud Genevois",
|
|
18
|
+
"email": "renaud.genevois@insee.fr"
|
|
19
|
+
},
|
|
11
20
|
{
|
|
12
21
|
"name": "Nicolas Laval",
|
|
13
22
|
"email": "nicolas.laval@insee.fr"
|
|
@@ -24,10 +33,15 @@
|
|
|
24
33
|
"test": "cross-env NODE_PATH=src/ jest",
|
|
25
34
|
"test-watch": "cross-env NODE_PATH=src/ jest --watchAll",
|
|
26
35
|
"test-coverage": "cross-env NODE_PATH=src/ jest --coverage",
|
|
27
|
-
"start-storybook": "cross-env NODE_PATH=src/ start-storybook -p 9999",
|
|
28
|
-
"build-storybook": "cross-env NODE_PATH=src/ build-storybook -o built-storybook/storybook",
|
|
29
36
|
"build": "rollup -c rollup.config.js",
|
|
30
|
-
"prepublish": "npm test && npm run build"
|
|
37
|
+
"prepublish": "npm test && npm run build",
|
|
38
|
+
"analyze": "yarn build && source-map-explorer lib/index.js --html bundle-report/lunatic.html",
|
|
39
|
+
"build-append-worker": "webpack --config ./webpack-append-worker.config.js",
|
|
40
|
+
"build-searching-worker": "webpack --config ./webpack-searching-worker.config.js",
|
|
41
|
+
"build-label-worker": "webpack --config ./webpack-label-worker.config.js",
|
|
42
|
+
"build-workers": "yarn build-append-worker && yarn build-searching-worker && yarn build-label-worker",
|
|
43
|
+
"storybook": "start-storybook -p 9999",
|
|
44
|
+
"build-storybook": "build-storybook"
|
|
31
45
|
},
|
|
32
46
|
"keywords": [
|
|
33
47
|
"react",
|
|
@@ -36,62 +50,94 @@
|
|
|
36
50
|
"library"
|
|
37
51
|
],
|
|
38
52
|
"dependencies": {
|
|
53
|
+
"@inseefr/trevas": "^0.1.10",
|
|
54
|
+
"@inseefr/vtl-2.0-antlr-tools": "^0.1.0",
|
|
55
|
+
"antlr4": "^4.9.3",
|
|
56
|
+
"date-fns": "^2.25.0",
|
|
39
57
|
"lodash.camelcase": "^4.3.0",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
58
|
+
"lodash.debounce": "^4.0.8",
|
|
59
|
+
"lodash.isequal": "^4.5.0",
|
|
60
|
+
"object-hash": "^2.2.0",
|
|
61
|
+
"prop-types": "^15.7.2",
|
|
62
|
+
"react-keyboard-event-handler": "^1.5.4",
|
|
63
|
+
"react-markdown": "^8.0.3",
|
|
64
|
+
"react-tooltip": "^4.2.15",
|
|
65
|
+
"remove-accents": "^0.4.2",
|
|
66
|
+
"sass": "^1.32.2"
|
|
43
67
|
},
|
|
44
68
|
"devDependencies": {
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"babel-
|
|
50
|
-
"babel-
|
|
51
|
-
"babel-
|
|
52
|
-
"babel
|
|
53
|
-
"babel-
|
|
54
|
-
"babel-
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
69
|
+
"@babel/core": "^7.9.0",
|
|
70
|
+
"@babel/plugin-proposal-class-properties": "^7.7.4",
|
|
71
|
+
"@babel/plugin-proposal-private-methods": "^7.18.6",
|
|
72
|
+
"@babel/plugin-proposal-private-property-in-object": "^7.18.6",
|
|
73
|
+
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
|
|
74
|
+
"@babel/plugin-transform-modules-commonjs": "^7.9.0",
|
|
75
|
+
"@babel/plugin-transform-react-jsx": "^7.9.0",
|
|
76
|
+
"@babel/plugin-transform-runtime": "^7.15.0",
|
|
77
|
+
"@babel/preset-env": "^7.9.5",
|
|
78
|
+
"@babel/preset-react": "^7.9.0",
|
|
79
|
+
"@emotion/react": "^11.8.1",
|
|
80
|
+
"@emotion/styled": "^11.8.1",
|
|
81
|
+
"@mui/material": "^5.5.0",
|
|
82
|
+
"@storybook/addon-actions": "^6.5.8",
|
|
83
|
+
"@storybook/addon-essentials": "^6.5.8",
|
|
84
|
+
"@storybook/addon-interactions": "^6.5.8",
|
|
85
|
+
"@storybook/addon-links": "^6.5.8",
|
|
86
|
+
"@storybook/builder-webpack5": "^6.5.8",
|
|
87
|
+
"@storybook/manager-webpack5": "^6.5.8",
|
|
88
|
+
"@storybook/react": "^6.5.8",
|
|
89
|
+
"@storybook/testing-library": "^0.0.11",
|
|
90
|
+
"@testing-library/react-hooks": "^7.0.0",
|
|
91
|
+
"@timdp/rollup-plugin-image": "^1.0.3",
|
|
92
|
+
"babel-eslint": "^10.0.3",
|
|
93
|
+
"babel-loader": "^8.0.6",
|
|
59
94
|
"classnames": "^2.2.5",
|
|
60
|
-
"
|
|
61
|
-
"cross-env": "^
|
|
62
|
-
"css-loader": "^0.
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"eslint": "
|
|
66
|
-
"eslint-config-
|
|
67
|
-
"eslint-
|
|
68
|
-
"eslint-plugin-
|
|
69
|
-
"eslint-plugin-import": "^2.14.0",
|
|
95
|
+
"core-js": "^3.17.3",
|
|
96
|
+
"cross-env": "^7.0.2",
|
|
97
|
+
"css-loader": "^5.0.0",
|
|
98
|
+
"damerau-levenshtein": "^1.0.7",
|
|
99
|
+
"eslint": "7.30.0",
|
|
100
|
+
"eslint-config-prettier": "^7.2.0",
|
|
101
|
+
"eslint-config-react-app": "^6.0.0",
|
|
102
|
+
"eslint-plugin-flowtype": "^5.2.0",
|
|
103
|
+
"eslint-plugin-import": "^2.19.1",
|
|
70
104
|
"eslint-plugin-jsx-a11y": "^6.1.1",
|
|
71
|
-
"eslint-plugin-react": "^7.
|
|
72
|
-
"
|
|
73
|
-
"
|
|
105
|
+
"eslint-plugin-react": "^7.17.0",
|
|
106
|
+
"eslint-plugin-react-hooks": "^4.0.8",
|
|
107
|
+
"identity-obj-proxy": "^3.0.0",
|
|
108
|
+
"jest": "^27.0.6",
|
|
109
|
+
"jest-sonar-reporter": "^2.0.0",
|
|
74
110
|
"jest-transform-stub": "^2.0.0",
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"rollup
|
|
85
|
-
"rollup-plugin-
|
|
86
|
-
"rollup-plugin-
|
|
87
|
-
"rollup-plugin-
|
|
111
|
+
"jsdom": "^16.6.0",
|
|
112
|
+
"jsdom-global": "^3.0.2",
|
|
113
|
+
"postcss": "^8.2.6",
|
|
114
|
+
"postcss-scss": "^3.0.4",
|
|
115
|
+
"prettier": "^2.0.5",
|
|
116
|
+
"react": "^17.0.2",
|
|
117
|
+
"react-dom": "^17.0.2",
|
|
118
|
+
"regenerator-runtime": "^0.13.7",
|
|
119
|
+
"remove-accents": "^0.4.2",
|
|
120
|
+
"rollup": "^2.52.8",
|
|
121
|
+
"rollup-plugin-babel": "^4.3.3",
|
|
122
|
+
"rollup-plugin-babel-minify": "^10.0.0",
|
|
123
|
+
"rollup-plugin-commonjs": "^10.1.0",
|
|
124
|
+
"rollup-plugin-node-resolve": "^5.2.0",
|
|
125
|
+
"rollup-plugin-postcss": "^4.0.0",
|
|
126
|
+
"rollup-plugin-replace": "^2.2.0",
|
|
127
|
+
"rollup-plugin-serve": "^1.0.1",
|
|
128
|
+
"rollup-plugin-terser": "^7.0.1",
|
|
129
|
+
"rollup-plugin-uglify": "^6.0.3",
|
|
130
|
+
"rollup-plugin-url": "^3.0.1",
|
|
88
131
|
"rollup-watch": "^4.3.1",
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
132
|
+
"rxjs-marbles": "^6.0.1",
|
|
133
|
+
"sass-loader": "^10.0.3",
|
|
134
|
+
"snowball": "^0.3.1",
|
|
135
|
+
"source-map-explorer": "^2.4.2",
|
|
136
|
+
"string-tokenizer": "^0.0.8",
|
|
137
|
+
"style-loader": "^2.0.0",
|
|
138
|
+
"url-loader": "^4.1.0",
|
|
139
|
+
"webpack": "^5.53.0",
|
|
140
|
+
"webpack-cli": "^4.8.0"
|
|
95
141
|
},
|
|
96
142
|
"jest": {
|
|
97
143
|
"collectCoverageFrom": [
|
|
@@ -101,13 +147,18 @@
|
|
|
101
147
|
],
|
|
102
148
|
"testURL": "http://localhost",
|
|
103
149
|
"moduleNameMapper": {
|
|
104
|
-
"^.+\\.(css|less|scss)$": "
|
|
150
|
+
"^.+\\.(css|less|scss)$": "identity-obj-proxy"
|
|
105
151
|
},
|
|
106
152
|
"transform": {
|
|
107
153
|
"^.+\\.js$": "babel-jest",
|
|
108
154
|
".+\\.(png|jpg)$": "jest-transform-stub"
|
|
109
155
|
},
|
|
110
|
-
"
|
|
156
|
+
"coverageProvider": "v8",
|
|
157
|
+
"testResultsProcessor": "jest-sonar-reporter",
|
|
158
|
+
"coveragePathIgnorePatterns": [
|
|
159
|
+
"/node_modules/"
|
|
160
|
+
],
|
|
161
|
+
"testEnvironment": "jsdom"
|
|
111
162
|
},
|
|
112
163
|
"publishConfig": {
|
|
113
164
|
"access": "public"
|
|
@@ -118,5 +169,8 @@
|
|
|
118
169
|
"useTabs": true,
|
|
119
170
|
"bracketSpacing": true,
|
|
120
171
|
"trailingComma": "es5"
|
|
172
|
+
},
|
|
173
|
+
"peerDependencies": {
|
|
174
|
+
"react": "^17.0.2"
|
|
121
175
|
}
|
|
122
176
|
}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
@import 'src/components/index.scss';
|
|
2
|
-
|
|
3
1
|
.button-lunatic {
|
|
4
|
-
width:
|
|
2
|
+
min-width: 20%;
|
|
5
3
|
color: white;
|
|
6
|
-
border-color:
|
|
7
|
-
background-color:
|
|
4
|
+
border-color: var(--color-primary-dark);
|
|
5
|
+
background-color: var(--color-primary-dark);
|
|
8
6
|
font-size: 1.5em;
|
|
9
7
|
font-weight: bold;
|
|
10
8
|
padding: 0.4em;
|
|
11
9
|
&:hover,
|
|
12
10
|
&:focus:hover {
|
|
13
|
-
color:
|
|
11
|
+
color: var(--color-primary-dark);
|
|
14
12
|
background-color: white;
|
|
15
|
-
border-color:
|
|
13
|
+
border-color: var(--color-primary-dark);
|
|
16
14
|
}
|
|
17
15
|
&:focus {
|
|
18
16
|
outline: none;
|
|
19
|
-
background-color:
|
|
20
|
-
border-color:
|
|
17
|
+
background-color: var(--color-primary-light);
|
|
18
|
+
border-color: var(--color-primary-light);
|
|
21
19
|
}
|
|
22
20
|
&:disabled {
|
|
23
|
-
background:
|
|
24
|
-
color:
|
|
21
|
+
background: var(--color-disabled);
|
|
22
|
+
color: var(--color-primary-dark);
|
|
25
23
|
}
|
|
26
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './
|
|
1
|
+
export { default } from './lunatic-button';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { isElement } from 'utils/is-element';
|
|
5
|
+
import './button.scss';
|
|
6
|
+
|
|
7
|
+
function Button({ children, onClick, disabled, label, className }) {
|
|
8
|
+
const handleClick = useCallback(
|
|
9
|
+
function (e) {
|
|
10
|
+
e.stopPropagation();
|
|
11
|
+
e.preventDefault();
|
|
12
|
+
onClick(e);
|
|
13
|
+
},
|
|
14
|
+
[onClick]
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
if (isElement(children))
|
|
18
|
+
return (
|
|
19
|
+
<button
|
|
20
|
+
disabled={disabled}
|
|
21
|
+
type="button"
|
|
22
|
+
className={classnames('button-lunatic', className, { disabled })}
|
|
23
|
+
onClick={handleClick}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</button>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<>
|
|
31
|
+
<input
|
|
32
|
+
disabled={disabled}
|
|
33
|
+
type="button"
|
|
34
|
+
className={classnames('button-lunatic', className, { disabled })}
|
|
35
|
+
value={label || children}
|
|
36
|
+
onClick={handleClick}
|
|
37
|
+
/>
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
Button.propTypes = {
|
|
43
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
44
|
+
disabled: PropTypes.bool,
|
|
45
|
+
onClick: PropTypes.func.isRequired,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default Button;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CheckboxOption } from '../commons';
|
|
3
|
+
import { createCustomizableLunaticField } from '../../commons';
|
|
4
|
+
|
|
5
|
+
function CheckboxBoolean({ checked, id, disabled, onClick, labelId }) {
|
|
6
|
+
return (
|
|
7
|
+
<CheckboxOption
|
|
8
|
+
disabled={disabled}
|
|
9
|
+
checked={checked}
|
|
10
|
+
id={id}
|
|
11
|
+
onClick={onClick}
|
|
12
|
+
labelledBy={labelId}
|
|
13
|
+
value={checked}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default createCustomizableLunaticField(CheckboxBoolean);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './lunatic-checkbox-boolean';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import CheckboxBoolean from './checkbox-boolean';
|
|
3
|
+
import { createLunaticComponent } from '../../commons';
|
|
4
|
+
|
|
5
|
+
function LunaticCheckboxBoolean({
|
|
6
|
+
value,
|
|
7
|
+
id,
|
|
8
|
+
options,
|
|
9
|
+
disabled,
|
|
10
|
+
onChange,
|
|
11
|
+
custom,
|
|
12
|
+
}) {
|
|
13
|
+
return (
|
|
14
|
+
<CheckboxBoolean
|
|
15
|
+
id={id}
|
|
16
|
+
options={options}
|
|
17
|
+
checked={value}
|
|
18
|
+
onClick={onChange}
|
|
19
|
+
disabled={disabled}
|
|
20
|
+
custom={custom}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
LunaticCheckboxBoolean.defaultProps = { value: false };
|
|
26
|
+
|
|
27
|
+
export default createLunaticComponent(LunaticCheckboxBoolean, {
|
|
28
|
+
fieldset: true,
|
|
29
|
+
inputId: 'lunatic-checkbox-boolean',
|
|
30
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { CheckboxOption } from '../commons';
|
|
3
|
+
import { Label } from '../../commons';
|
|
4
|
+
import { useOnHandleChange } from '../../commons';
|
|
5
|
+
import { createCustomizableLunaticField } from '../../commons';
|
|
6
|
+
|
|
7
|
+
function onClick() {}
|
|
8
|
+
|
|
9
|
+
function CheckBoxOptionWrapper({
|
|
10
|
+
checkboxId,
|
|
11
|
+
|
|
12
|
+
labelId,
|
|
13
|
+
checked,
|
|
14
|
+
value,
|
|
15
|
+
onKeyDown,
|
|
16
|
+
handleChange,
|
|
17
|
+
response,
|
|
18
|
+
}) {
|
|
19
|
+
const booleanValue = value || false;
|
|
20
|
+
|
|
21
|
+
const onClickOption = useOnHandleChange({
|
|
22
|
+
handleChange,
|
|
23
|
+
response,
|
|
24
|
+
value: booleanValue,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// const onClickOption = useCallback(
|
|
28
|
+
// function (valueOption) {
|
|
29
|
+
// handleChange(response, !valueOption);
|
|
30
|
+
// },
|
|
31
|
+
// [handleChange, response]
|
|
32
|
+
// );
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<CheckboxOption
|
|
36
|
+
id={checkboxId}
|
|
37
|
+
labelledBy={labelId}
|
|
38
|
+
checked={checked}
|
|
39
|
+
onClick={onClickOption}
|
|
40
|
+
value={booleanValue}
|
|
41
|
+
onKeyDown={onKeyDown}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function CheckboxGroupContainer({ children }) {
|
|
47
|
+
return <div className="lunatic-checkbox-group-option">{children}</div>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function CheckboxGroup({ options, value, id, handleChange }) {
|
|
51
|
+
return options.map(function (option, index) {
|
|
52
|
+
const { label, response } = option;
|
|
53
|
+
|
|
54
|
+
if (response && value) {
|
|
55
|
+
const { name } = response;
|
|
56
|
+
|
|
57
|
+
if (name in value) {
|
|
58
|
+
const optionValue = value[name];
|
|
59
|
+
const checkboxId = `lunatic-checkbox-${id}-${name}`;
|
|
60
|
+
const labelId = `lunatic-checkbox-label-${id}-${name}`;
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<CheckboxGroupContainer key={checkboxId}>
|
|
64
|
+
<Label id={labelId} htmlFor={checkboxId}>
|
|
65
|
+
{label}
|
|
66
|
+
</Label>
|
|
67
|
+
<CheckBoxOptionWrapper
|
|
68
|
+
checkboxId={checkboxId}
|
|
69
|
+
labelId={labelId}
|
|
70
|
+
checked={optionValue}
|
|
71
|
+
value={optionValue}
|
|
72
|
+
onKeyDown={onClick}
|
|
73
|
+
response={response}
|
|
74
|
+
handleChange={handleChange}
|
|
75
|
+
/>
|
|
76
|
+
</CheckboxGroupContainer>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export default createCustomizableLunaticField(CheckboxGroup);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { CheckboxChecked, CheckboxUnchecked } from 'components/commons/icons';
|
|
4
|
+
|
|
5
|
+
function CheckboxOption({ disabled, checked, id, value, onClick, labelledBy }) {
|
|
6
|
+
const onClickOption = useCallback(
|
|
7
|
+
function () {
|
|
8
|
+
onClick(value);
|
|
9
|
+
},
|
|
10
|
+
[value, onClick]
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
const handleKeyDown = useCallback(function (e) {
|
|
14
|
+
const { key } = e;
|
|
15
|
+
if (key === 'Space') {
|
|
16
|
+
// TODO
|
|
17
|
+
}
|
|
18
|
+
}, []);
|
|
19
|
+
|
|
20
|
+
const Icon = checked ? CheckboxChecked : CheckboxUnchecked;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div
|
|
24
|
+
className={classnames('checkbox-modality', 'checkbox-modality-block', {
|
|
25
|
+
checked,
|
|
26
|
+
disabled,
|
|
27
|
+
})}
|
|
28
|
+
>
|
|
29
|
+
<span
|
|
30
|
+
id={id}
|
|
31
|
+
role="checkbox"
|
|
32
|
+
className={`lunatic-input-checkbox`}
|
|
33
|
+
aria-checked={checked}
|
|
34
|
+
tabIndex="0"
|
|
35
|
+
onClick={onClickOption}
|
|
36
|
+
onKeyDown={handleKeyDown}
|
|
37
|
+
aria-labelledby={labelledBy}
|
|
38
|
+
>
|
|
39
|
+
<Icon />
|
|
40
|
+
</span>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default CheckboxOption;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './lunatic-checkbox-group';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import CheckboxGroup from './checkbox-group';
|
|
3
|
+
import { createLunaticComponent } from '../../commons';
|
|
4
|
+
|
|
5
|
+
function LunaticCheckboxGroup({
|
|
6
|
+
id,
|
|
7
|
+
value,
|
|
8
|
+
|
|
9
|
+
responses,
|
|
10
|
+
custom,
|
|
11
|
+
handleChange,
|
|
12
|
+
}) {
|
|
13
|
+
return (
|
|
14
|
+
<CheckboxGroup
|
|
15
|
+
id={id}
|
|
16
|
+
options={responses}
|
|
17
|
+
value={value}
|
|
18
|
+
handleChange={handleChange}
|
|
19
|
+
custom={custom}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default createLunaticComponent(LunaticCheckboxGroup, {
|
|
25
|
+
fieldset: true,
|
|
26
|
+
inputId: 'lunatic-checkbox-group',
|
|
27
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './lunatic-checkbox-one';
|
|
@@ -1,39 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
.checkbox-group {
|
|
4
|
-
border: 0.1em solid $main_color;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
@mixin box-margin($margin: false) {
|
|
8
|
-
margin: 0;
|
|
9
|
-
margin-right: 1em;
|
|
10
|
-
margin-left: if($margin, 1em, 0);
|
|
11
|
-
margin-top: 0.5em;
|
|
12
|
-
&:focus {
|
|
13
|
-
outline: none;
|
|
14
|
-
}
|
|
15
|
-
&:checked + label {
|
|
16
|
-
border: 0.1em solid $main_color;
|
|
17
|
-
padding: 0.3em;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.checkbox-lunatic {
|
|
22
|
-
@include box-margin(true);
|
|
23
|
-
&:focus {
|
|
24
|
-
box-shadow: 0 0 0.3em 0.3em $main_color;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.checkbox-lunatic-no-margin {
|
|
29
|
-
@include box-margin(false);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.checkbox-modality {
|
|
33
|
-
margin-top: 1em;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.checkbox-alone {
|
|
37
|
-
margin-left: 0;
|
|
38
|
-
margin-top: 0.5em;
|
|
39
|
-
}
|
|
1
|
+
.lunatic-checkbox-boolean{}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { CheckboxChecked, CheckboxUnchecked } from 'components/commons/icons';
|
|
4
|
+
|
|
5
|
+
function CheckboxOption({
|
|
6
|
+
disabled,
|
|
7
|
+
checked,
|
|
8
|
+
id,
|
|
9
|
+
value = false,
|
|
10
|
+
onClick,
|
|
11
|
+
labelledBy,
|
|
12
|
+
}) {
|
|
13
|
+
const onClickOption = useCallback(
|
|
14
|
+
function () {
|
|
15
|
+
onClick(!value);
|
|
16
|
+
},
|
|
17
|
+
[value, onClick]
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const handleKeyDown = useCallback(
|
|
21
|
+
function (e) {
|
|
22
|
+
const { code } = e;
|
|
23
|
+
if (code === 'Space') {
|
|
24
|
+
onClickOption();
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
[onClickOption]
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const Icon = checked ? CheckboxChecked : CheckboxUnchecked;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
className={classnames('checkbox-modality', 'checkbox-modality-block', {
|
|
35
|
+
checked,
|
|
36
|
+
disabled,
|
|
37
|
+
})}
|
|
38
|
+
>
|
|
39
|
+
<span
|
|
40
|
+
id={id}
|
|
41
|
+
role="checkbox"
|
|
42
|
+
className={`lunatic-input-checkbox`}
|
|
43
|
+
aria-checked={checked}
|
|
44
|
+
tabIndex="0"
|
|
45
|
+
onClick={onClickOption}
|
|
46
|
+
onKeyDown={handleKeyDown}
|
|
47
|
+
aria-labelledby={labelledBy}
|
|
48
|
+
>
|
|
49
|
+
<Icon />
|
|
50
|
+
</span>
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default CheckboxOption;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CheckboxOption } from './checkbox-option';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as CheckboxGroup } from './group';
|
|
2
|
-
export { default as CheckboxBoolean } from './boolean';
|
|
3
|
-
export { default as CheckboxOne } from './one';
|
|
1
|
+
export { default as CheckboxGroup } from './checkbox-group';
|
|
2
|
+
export { default as CheckboxBoolean } from './checkbox-boolean';
|
|
3
|
+
export { default as CheckboxOne } from './checkbox-one';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import camelCase from 'lodash.camelcase';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
obj
|
|
3
|
+
function buildStyleObject(obj) {
|
|
4
|
+
return obj
|
|
5
5
|
? Object.entries(obj).reduce((_, [key, value]) => {
|
|
6
6
|
if (key.startsWith(':')) _[key] = buildStyleObject(value);
|
|
7
7
|
else _[camelCase(key)] = value;
|
|
8
8
|
return _;
|
|
9
9
|
}, {})
|
|
10
10
|
: {};
|
|
11
|
+
}
|
|
12
|
+
export default buildStyleObject;
|