@inseefr/lunatic 0.3.18-v2 → 0.4.3-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.
Files changed (112) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +25 -25
  3. package/lib/components/button/button.scss +24 -24
  4. package/lib/components/commons/components/combo-box/combo-box.scss +218 -218
  5. package/lib/components/commons/components/create-lunatic-component/create-lunatic-component.js +10 -10
  6. package/lib/components/commons/components/dragger/dragger.scss +7 -7
  7. package/lib/components/commons/components/fab/fab.scss +32 -32
  8. package/lib/components/commons/components/lunatic-component.js +3 -0
  9. package/lib/components/commons/components/lunatic-fieldset-component.js +3 -0
  10. package/lib/components/commons/components/missing/missing.scss +30 -30
  11. package/lib/components/commons/components/orchestrated-component.js +3 -2
  12. package/lib/components/commons/components/variable-status/variable-status.scss +39 -39
  13. package/lib/components/commons/icons/lunatic-icon.scss +4 -4
  14. package/lib/components/commons/use-on-handle-change.js +1 -2
  15. package/lib/components/datepicker/datepicker.scss +1 -1
  16. package/lib/components/declarations/declarations.js +1 -1
  17. package/lib/components/declarations/declarations.scss +36 -36
  18. package/lib/components/dropdown/dropdown-simple/simple-label-renderer.js +1 -1
  19. package/lib/components/dropdown/dropdown-simple/simple-option-renderer.js +1 -1
  20. package/lib/components/dropdown/dropdown.scss +41 -41
  21. package/lib/components/filter-description/component.js +3 -4
  22. package/lib/components/index.scss +139 -139
  23. package/lib/components/input/input.scss +31 -31
  24. package/lib/components/loop/block-for-loop/block-for-loop.js +15 -3
  25. package/lib/components/loop/loop.js +4 -2
  26. package/lib/components/loop/roster-for-loop/roster-for-loop.js +4 -12
  27. package/lib/components/loop/roster-for-loop/roster.scss +42 -42
  28. package/lib/components/modal-controls/modal-controls.scss +63 -63
  29. package/lib/components/pairwise/links/pairwise-links.js +3 -0
  30. package/lib/components/radio/radio-option.js +3 -2
  31. package/lib/components/radio/radio.scss +59 -59
  32. package/lib/components/sequence/sequence.js +8 -7
  33. package/lib/components/sequence/sequence.scss +10 -10
  34. package/lib/components/subsequence/subsequence.js +9 -6
  35. package/lib/components/suggester/default-style.scss +125 -125
  36. package/lib/components/suggester/find-best-label/find-best-label.js +5 -5
  37. package/lib/components/suggester-loader-widget/widget.scss +176 -176
  38. package/lib/components/switch/switch.scss +47 -47
  39. package/lib/components/table/components/table.scss +26 -26
  40. package/lib/components/textarea/textarea.scss +8 -8
  41. package/lib/i18n/build-dictionary.js +16 -16
  42. package/lib/stories/Introduction.stories.mdx +114 -114
  43. package/lib/stories/checkboxOne/checkboxOne.stories.js +35 -0
  44. package/lib/stories/checkboxOne/source.json +36 -0
  45. package/lib/stories/custom-mui/textarea-mui.js +0 -5
  46. package/lib/stories/dropdown/data.json +16 -16
  47. package/lib/stories/dropdown/source.json +122 -98
  48. package/lib/stories/filter-description/filter-description.stories.js +58 -0
  49. package/lib/stories/filter-description/source-options.json +81 -0
  50. package/lib/stories/filter-description/source.json +11 -0
  51. package/lib/stories/input/data.json +5 -5
  52. package/lib/stories/input/source.json +28 -28
  53. package/lib/stories/input-number/input-number.stories.js +35 -0
  54. package/lib/stories/input-number/source.json +37 -0
  55. package/lib/stories/pairwise/block/block.json +3 -3
  56. package/lib/stories/pairwise/links/data.json +12 -12
  57. package/lib/stories/pairwise/links/links.json +141 -141
  58. package/lib/stories/paste-questionnaire/source.json +6290 -0
  59. package/lib/stories/paste-questionnaire/test.stories.js +91 -0
  60. package/lib/stories/questionnaires/logement/data.json +2691 -2691
  61. package/lib/stories/questionnaires/logement/source-sequence.json +34181 -33114
  62. package/lib/stories/questionnaires/logement/source.json +34191 -33124
  63. package/lib/stories/questionnaires/simpsons/source.json +6290 -6290
  64. package/lib/stories/questionnaires-test/V2_DeclarationsSimples.json +848 -0
  65. package/lib/stories/questionnaires-test/V2_MinMaxSum_Boucles.json +509 -0
  66. package/lib/stories/questionnaires-test/V2_QuestSimple_Boucles.json +4091 -0
  67. package/lib/stories/questionnaires-test/V2_TCMRallyeGames.json +2892 -0
  68. package/lib/stories/questionnaires-test/controls/V2_ControlesNonNum_horsBoucle_PasPageFin.json +452 -0
  69. package/lib/stories/questionnaires-test/controls/V2_ControlesNum_horsBoucle_PasPageFin.json +1689 -0
  70. package/lib/stories/questionnaires-test/controls/V2_Controles_BouclesLiees2_PasPageFin.json +709 -0
  71. package/lib/stories/questionnaires-test/controls/V2_Controles_BouclesLiees_PasPageFin.json +368 -0
  72. package/lib/stories/questionnaires-test/controls/controls.stories.js +98 -0
  73. package/lib/stories/questionnaires-test/test-dylan.json +430 -0
  74. package/lib/stories/questionnaires-test/test.stories.js +100 -0
  75. package/lib/stories/radio/radio.stories.js +35 -0
  76. package/lib/stories/radio/source.json +36 -0
  77. package/lib/stories/roster-for-loop/source.json +114 -114
  78. package/lib/stories/suggester/source.json +234 -234
  79. package/lib/stories/switch/README.md +31 -31
  80. package/lib/stories/switch/data-forced.json +48 -48
  81. package/lib/stories/switch/data.json +80 -80
  82. package/lib/stories/table/data-roster.json +1 -1
  83. package/lib/stories/table/data.json +1 -1
  84. package/lib/stories/table/source-roster.json +504 -504
  85. package/lib/stories/table/source.json +19 -19
  86. package/lib/stories/utils/custom-lunatic.scss +28 -28
  87. package/lib/stories/utils/orchestrator.js +24 -8
  88. package/lib/stories/utils/waiting/waiting.scss +21 -21
  89. package/lib/use-lunatic/actions.js +30 -16
  90. package/lib/use-lunatic/commons/calculated-variables.js +124 -0
  91. package/lib/use-lunatic/commons/create-map-pages.js +10 -10
  92. package/lib/use-lunatic/commons/execute-expression/create-execute-expression.js +16 -16
  93. package/lib/use-lunatic/commons/execute-expression/create-refresh-calculated.js +11 -0
  94. package/lib/use-lunatic/commons/execute-expression/execute-expression.js +1 -0
  95. package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +21 -21
  96. package/lib/use-lunatic/commons/get-components-from-state.js +9 -2
  97. package/lib/use-lunatic/commons/get-data.js +90 -0
  98. package/lib/use-lunatic/reducer/commons/resize-array-variable.js +7 -7
  99. package/lib/use-lunatic/reducer/reduce-go-next-page.js +20 -11
  100. package/lib/use-lunatic/reducer/reduce-go-to-page.js +51 -0
  101. package/lib/use-lunatic/reducer/reduce-handle-change/reduce-cleaning.js +2 -1
  102. package/lib/use-lunatic/reducer/reduce-handle-change/reduce-handle-change.js +18 -17
  103. package/lib/use-lunatic/reducer/reduce-on-init.js +8 -7
  104. package/lib/use-lunatic/reducer/reducer.js +8 -3
  105. package/lib/use-lunatic/use-lunatic.js +18 -14
  106. package/lib/utils/store-tools/auto-load.js +2 -2
  107. package/lib/utils/suggester-workers/append-to-index/create-append-task.js +2 -2
  108. package/lib/utils/suggester-workers/commons-tokenizer/create-entity-tokenizer.js +1 -3
  109. package/lib/utils/suggester-workers/commons-tokenizer/create-fields-tokenizer.js +3 -1
  110. package/lib/utils/suggester-workers/commons-tokenizer/filters/compose-filters.js +1 -1
  111. package/package.json +159 -159
  112. package/lib/use-lunatic/reducer/commons/Insee.code-workspace +0 -47
@@ -1,32 +1,32 @@
1
- .lunatic-fab {
2
- width: 32px;
3
- height: 32px;
4
- border-radius: 50%;
5
- margin: 0;
6
- padding: 0;
7
- outline: inherit;
8
- border: none;
9
- background-color: royalblue;
10
- box-shadow: 0px 3px 5px -1px rgb(0 0 0 / 20%),
11
- 0px 6px 10px 0px rgb(0 0 0 / 14%), 0px 1px 18px 0px rgb(0 0 0 / 12%);
12
-
13
- &:hover {
14
- cursor: pointer;
15
- background-color: navy;
16
- transition: background-color 1s;
17
- }
18
-
19
- &.mini {
20
- width: 18px;
21
- height: 18px;
22
- }
23
-
24
- &:focus {
25
- border: solid 1px black;
26
- }
27
-
28
- &:disabled {
29
- cursor: default;
30
- background-color: darkgray;
31
- }
32
- }
1
+ .lunatic-fab {
2
+ width: 32px;
3
+ height: 32px;
4
+ border-radius: 50%;
5
+ margin: 0;
6
+ padding: 0;
7
+ outline: inherit;
8
+ border: none;
9
+ background-color: royalblue;
10
+ box-shadow: 0px 3px 5px -1px rgb(0 0 0 / 20%),
11
+ 0px 6px 10px 0px rgb(0 0 0 / 14%), 0px 1px 18px 0px rgb(0 0 0 / 12%);
12
+
13
+ &:hover {
14
+ cursor: pointer;
15
+ background-color: navy;
16
+ transition: background-color 1s;
17
+ }
18
+
19
+ &.mini {
20
+ width: 18px;
21
+ height: 18px;
22
+ }
23
+
24
+ &:focus {
25
+ border: solid 1px black;
26
+ }
27
+
28
+ &:disabled {
29
+ cursor: default;
30
+ background-color: darkgray;
31
+ }
32
+ }
@@ -38,6 +38,7 @@ function LunaticComponent(props) {
38
38
 
39
39
  var content = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsBeforeText, {
40
40
  declarations: declarations,
41
+ id: id,
41
42
  custom: custom
42
43
  }), /*#__PURE__*/_react["default"].createElement(_label["default"], {
43
44
  id: labelId,
@@ -46,6 +47,7 @@ function LunaticComponent(props) {
46
47
  custom: custom
47
48
  }, (0, _safetyLabel["default"])(label, id)), /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsAfterText, {
48
49
  declarations: declarations,
50
+ id: id,
49
51
  custom: custom
50
52
  }), /*#__PURE__*/_react["default"].createElement(_fieldContainer["default"], {
51
53
  value: value,
@@ -54,6 +56,7 @@ function LunaticComponent(props) {
54
56
  preferences: preferences
55
57
  }, children), /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsDetachable, {
56
58
  declarations: declarations,
59
+ id: id,
57
60
  custom: custom
58
61
  }), missing && missingResponse && /*#__PURE__*/_react["default"].createElement(_missing["default"], props));
59
62
 
@@ -33,6 +33,7 @@ function LunaticFieldsetComponent(props) {
33
33
 
34
34
  var content = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsBeforeText, {
35
35
  declarations: declarations,
36
+ id: id,
36
37
  custom: custom
37
38
  }), /*#__PURE__*/_react["default"].createElement(_fieldContainer["default"], {
38
39
  value: value,
@@ -44,9 +45,11 @@ function LunaticFieldsetComponent(props) {
44
45
  custom: custom
45
46
  }, /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsAfterText, {
46
47
  declarations: declarations,
48
+ id: id,
47
49
  custom: custom
48
50
  }), children)), /*#__PURE__*/_react["default"].createElement(_declarations.DeclarationsDetachable, {
49
51
  declarations: declarations,
52
+ id: id,
50
53
  custom: custom
51
54
  }), missing && missingResponse && /*#__PURE__*/_react["default"].createElement(_missing["default"], props));
52
55
 
@@ -1,30 +1,30 @@
1
- .lunatic-component {
2
- .missing-buttons {
3
- margin-top: 1em;
4
- .button-lunatic {
5
- width: 4em;
6
- font-size: 1em;
7
- font-weight: normal;
8
- }
9
- .missing-button {
10
- .button-lunatic {
11
- background-color: var(--color-very-very-light);
12
- color: var(--color-primary-dark);
13
- &:hover {
14
- background-color: white;
15
- color: var(--color-primary-main);
16
- }
17
- }
18
- }
19
- .missing-button-active {
20
- .button-lunatic {
21
- background-color: var(--color-primary-dark);
22
- color: var(--color-very-very-light);
23
- &:hover {
24
- background-color: var(--color-primary-main);
25
- color: white;
26
- }
27
- }
28
- }
29
- }
30
- }
1
+ .lunatic-component {
2
+ .missing-buttons {
3
+ margin-top: 1em;
4
+ .button-lunatic {
5
+ width: 4em;
6
+ font-size: 1em;
7
+ font-weight: normal;
8
+ }
9
+ .missing-button {
10
+ .button-lunatic {
11
+ background-color: var(--color-very-very-light);
12
+ color: var(--color-primary-dark);
13
+ &:hover {
14
+ background-color: white;
15
+ color: var(--color-primary-main);
16
+ }
17
+ }
18
+ }
19
+ .missing-button-active {
20
+ .button-lunatic {
21
+ background-color: var(--color-primary-dark);
22
+ color: var(--color-very-very-light);
23
+ &:hover {
24
+ background-color: var(--color-primary-main);
25
+ color: white;
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
@@ -44,9 +44,10 @@ function OrchestratedComponent(_ref) {
44
44
  }
45
45
  });
46
46
  var Component = lunatic[componentType];
47
- var isFiltered = componentFilled === null || componentFilled === void 0 ? void 0 : componentFilled.conditionFilter;
47
+ var conditionFilter = componentFilled.conditionFilter;
48
+ var hasToBeDisplay = conditionFilter !== undefined ? conditionFilter : true;
48
49
 
49
- if (componentType in lunatic && isFiltered) {
50
+ if (componentType in lunatic && hasToBeDisplay) {
50
51
  return /*#__PURE__*/_react["default"].createElement(Component, _extends({}, componentFilled, {
51
52
  id: id,
52
53
  handleChange: handleChange,
@@ -1,39 +1,39 @@
1
- // Import index once for bundle
2
- @import '../../../index.scss';
3
-
4
- .lunatic-component-container-test {
5
- display: flex;
6
-
7
- .lunatic-component-body {
8
- width: 80%;
9
- }
10
-
11
- /* Tooltip container */
12
- .tooltip-lunatic {
13
- margin: auto;
14
- width: 20%;
15
- position: relative;
16
- display: block;
17
- margin-left: auto;
18
- margin-right: auto;
19
- }
20
-
21
- /* Tooltip text */
22
- .tooltip-lunatic .tooltip-text {
23
- min-width: 10em;
24
- max-width: 20em;
25
- background-color: var(--color-primary-dark);
26
- color: #fff;
27
- padding: 0.5em;
28
- border-radius: 6px;
29
- font-size: 1em;
30
- &.place-left {
31
- &::before {
32
- border-left: 10px solid var(--color-primary-dark);
33
- }
34
- &::after {
35
- content: none;
36
- }
37
- }
38
- }
39
- }
1
+ // Import index once for bundle
2
+ @import '../../../index.scss';
3
+
4
+ .lunatic-component-container-test {
5
+ display: flex;
6
+
7
+ .lunatic-component-body {
8
+ width: 80%;
9
+ }
10
+
11
+ /* Tooltip container */
12
+ .tooltip-lunatic {
13
+ margin: auto;
14
+ width: 20%;
15
+ position: relative;
16
+ display: block;
17
+ margin-left: auto;
18
+ margin-right: auto;
19
+ }
20
+
21
+ /* Tooltip text */
22
+ .tooltip-lunatic .tooltip-text {
23
+ min-width: 10em;
24
+ max-width: 20em;
25
+ background-color: var(--color-primary-dark);
26
+ color: #fff;
27
+ padding: 0.5em;
28
+ border-radius: 6px;
29
+ font-size: 1em;
30
+ &.place-left {
31
+ &::before {
32
+ border-left: 10px solid var(--color-primary-dark);
33
+ }
34
+ &::after {
35
+ content: none;
36
+ }
37
+ }
38
+ }
39
+ }
@@ -1,4 +1,4 @@
1
- .lunatic-icon {
2
- display: flex;
3
- justify-content: center;
4
- }
1
+ .lunatic-icon {
2
+ display: flex;
3
+ justify-content: center;
4
+ }
@@ -11,12 +11,11 @@ function useOnHandleChange(_ref) {
11
11
  var handleChange = _ref.handleChange,
12
12
  response = _ref.response,
13
13
  value = _ref.value;
14
- var onHandlechange = (0, _react.useCallback)(function (valueOption) {
14
+ return (0, _react.useCallback)(function (valueOption) {
15
15
  if (value !== valueOption) {
16
16
  handleChange(response, valueOption);
17
17
  }
18
18
  }, [handleChange, response, value]);
19
- return onHandlechange;
20
19
  }
21
20
 
22
21
  var _default = useOnHandleChange;
@@ -1 +1 @@
1
- // see input.scss
1
+ // see input.scss
@@ -33,7 +33,7 @@ function Declarations(_ref) {
33
33
  if (filtered.length === 0) return null;
34
34
  return /*#__PURE__*/_react["default"].createElement("div", {
35
35
  id: "declarations-".concat(id, "-").concat(type),
36
- className: "lunatic-declarations"
36
+ className: "declarations-lunatic"
37
37
  }, filtered.map(function (_ref3) {
38
38
  var idD = _ref3.id,
39
39
  label = _ref3.label,
@@ -1,36 +1,36 @@
1
- .lunatic-component {
2
- .lunatic-declarations {
3
- margin-bottom: 0.4rem;
4
- }
5
-
6
- .declaration-instruction {
7
- font-style: italic;
8
- font-size: 80%;
9
- }
10
-
11
- .declaration-statement {
12
- font-style: italic;
13
- font-size: 80%;
14
- color: blue;
15
- }
16
-
17
- .declaration-help {
18
- font-style: italic;
19
- font-size: 80%;
20
- color: green;
21
- }
22
-
23
- .declaration-codecard {
24
- font-style: bold;
25
- font-size: 80%;
26
- color: purple;
27
- }
28
-
29
- .declaration-message_filter {
30
- font-size: 100%;
31
- color: rgb(73, 66, 66);
32
- &:before {
33
- content: '→ ';
34
- }
35
- }
36
- }
1
+ .lunatic-component {
2
+ .lunatic-declarations {
3
+ margin-bottom: 0.4rem;
4
+ }
5
+
6
+ .declaration-instruction {
7
+ font-style: italic;
8
+ font-size: 80%;
9
+ }
10
+
11
+ .declaration-statement {
12
+ font-style: italic;
13
+ font-size: 80%;
14
+ color: blue;
15
+ }
16
+
17
+ .declaration-help {
18
+ font-style: italic;
19
+ font-size: 80%;
20
+ color: green;
21
+ }
22
+
23
+ .declaration-codecard {
24
+ font-style: bold;
25
+ font-size: 80%;
26
+ color: purple;
27
+ }
28
+
29
+ .declaration-message_filter {
30
+ font-size: 100%;
31
+ color: rgb(73, 66, 66);
32
+ &:before {
33
+ content: '→ ';
34
+ }
35
+ }
36
+ }
@@ -15,7 +15,7 @@ function getContent(option, search) {
15
15
  if (option) {
16
16
  var value = option.value,
17
17
  label = option.label;
18
- return label ? "".concat(value, " - ").concat(label) : value;
18
+ return label || value;
19
19
  }
20
20
 
21
21
  if (search && search.trim().length) {
@@ -35,7 +35,7 @@ function SimpleOptionRenderer(_ref) {
35
35
  })
36
36
  }, /*#__PURE__*/_react["default"].createElement("span", {
37
37
  className: "id"
38
- }, value));
38
+ }, label));
39
39
  }
40
40
 
41
41
  var _default = SimpleOptionRenderer;
@@ -1,41 +1,41 @@
1
- @mixin defaultFont {
2
- font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
3
- }
4
-
5
- @mixin disableSelect {
6
- -moz-user-select: none; /* Firefox */
7
- -ms-user-select: none; /* Internet Explorer */
8
- -khtml-user-select: none; /* KHTML browsers (e.g. Konqueror) */
9
- -webkit-user-select: none; /* Chrome, Safari, and Opera */
10
- -webkit-touch-callout: none; /* Disable Android and iOS callouts*/
11
- }
12
-
13
- .lunatic-component {
14
- .lunatic-dropdown {
15
- .lunatic-dropdown-option {
16
- text-overflow: ellipsis;
17
- white-space: nowrap;
18
- overflow: hidden;
19
- margin-bottom: 0.1em;
20
- line-height: 2rem;
21
- display: block;
22
-
23
- &.selected {
24
- color: var(--color-primary-dark);
25
- background-color: goldenrod;
26
- }
27
-
28
- &:hover {
29
- background-color: var(--color-primary-main);
30
- color: white;
31
- }
32
-
33
- .prefix {
34
- color: red;
35
- }
36
-
37
- .normal {
38
- }
39
- }
40
- }
41
- }
1
+ @mixin defaultFont {
2
+ font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
3
+ }
4
+
5
+ @mixin disableSelect {
6
+ -moz-user-select: none; /* Firefox */
7
+ -ms-user-select: none; /* Internet Explorer */
8
+ -khtml-user-select: none; /* KHTML browsers (e.g. Konqueror) */
9
+ -webkit-user-select: none; /* Chrome, Safari, and Opera */
10
+ -webkit-touch-callout: none; /* Disable Android and iOS callouts*/
11
+ }
12
+
13
+ .lunatic-component {
14
+ .lunatic-dropdown {
15
+ .lunatic-dropdown-option {
16
+ text-overflow: ellipsis;
17
+ white-space: nowrap;
18
+ overflow: hidden;
19
+ margin-bottom: 0.1em;
20
+ line-height: 2rem;
21
+ display: block;
22
+
23
+ &.selected {
24
+ color: var(--color-primary-dark);
25
+ background-color: goldenrod;
26
+ }
27
+
28
+ &:hover {
29
+ background-color: var(--color-primary-main);
30
+ color: white;
31
+ }
32
+
33
+ .prefix {
34
+ color: red;
35
+ }
36
+
37
+ .normal {
38
+ }
39
+ }
40
+ }
41
+ }
@@ -11,13 +11,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
11
11
 
12
12
  var FilterDescription = function FilterDescription(_ref) {
13
13
  var id = _ref.id,
14
- label = _ref.label,
15
- filterDescription = _ref.filterDescription;
16
- return filterDescription ? /*#__PURE__*/_react["default"].createElement("div", {
14
+ label = _ref.label;
15
+ return /*#__PURE__*/_react["default"].createElement("div", {
17
16
  id: "filter-description-".concat(id),
18
17
  "aria-label": "filter-description",
19
18
  className: "filter-description-lunatic"
20
- }, label) : null;
19
+ }, label);
21
20
  };
22
21
 
23
22
  var _default = FilterDescription;