@inseefr/lunatic 2.4.9 → 2.5.0-beta

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 (101) hide show
  1. package/lib/components/commons/components/orchestrated-component.js +10 -30
  2. package/lib/components/commons/create-row-orchestrator.js +7 -2
  3. package/lib/components/component-set/html/component-set-components.js +16 -25
  4. package/lib/components/component-set/lunatic-component-set.js +23 -37
  5. package/lib/components/index.js +14 -0
  6. package/lib/components/loop/block-for-loop/block-for-loop.js +4 -2
  7. package/lib/components/loop/block-for-loop/row.js +4 -2
  8. package/lib/components/loop/loop.js +6 -3
  9. package/lib/components/loop/roster-for-loop/body.js +4 -2
  10. package/lib/components/loop/roster-for-loop/roster-for-loop.js +2 -0
  11. package/lib/components/loop/roster-for-loop/roster-table.js +4 -2
  12. package/lib/components/loop/roster-for-loop/row.js +3 -1
  13. package/lib/components/question-explication/html/question-explication.js +53 -0
  14. package/lib/components/question-explication/html/question-explication.scss +35 -0
  15. package/lib/components/question-explication/index.js +13 -0
  16. package/lib/components/question-explication/lunatic-question-explication.js +32 -0
  17. package/lib/components/question-explication/question-explication.spec.js +49 -0
  18. package/lib/components/roundabout/lunatic-roundabout.js +2 -4
  19. package/lib/components/subsequence/subsequence.js +0 -2
  20. package/lib/components/subsequence/subsequence.spec.js +2 -2
  21. package/lib/components/summary/html/summary-container.js +14 -0
  22. package/lib/components/summary/html/summary-responses.js +53 -0
  23. package/lib/components/summary/html/summary-title.js +20 -0
  24. package/lib/components/summary/index.js +12 -0
  25. package/lib/components/summary/lunatic-summary.js +99 -0
  26. package/lib/src/components/commons/components/orchestrated-component.d.ts +4 -5
  27. package/lib/src/components/commons/create-row-orchestrator.d.ts +3 -2
  28. package/lib/src/components/component-set/html/component-set-components.d.ts +2 -2
  29. package/lib/src/components/component-set/lunatic-component-set.d.ts +2 -1
  30. package/lib/src/components/index.d.ts +2 -0
  31. package/lib/src/components/loop/block-for-loop/block-for-loop-ochestrator.d.ts +3 -2
  32. package/lib/src/components/loop/block-for-loop/row.d.ts +2 -1
  33. package/lib/src/components/loop/roster-for-loop/body.d.ts +2 -2
  34. package/lib/src/components/loop/roster-for-loop/roster-for-loop-orchestrator.d.ts +3 -2
  35. package/lib/src/components/loop/roster-for-loop/roster-table.d.ts +2 -2
  36. package/lib/src/components/loop/roster-for-loop/row.d.ts +2 -1
  37. package/lib/src/components/question-explication/html/question-explication.d.ts +7 -0
  38. package/lib/src/components/question-explication/index.d.ts +1 -0
  39. package/lib/src/components/question-explication/lunatic-question-explication.d.ts +3 -0
  40. package/lib/src/components/question-explication/question-explication.spec.d.ts +1 -0
  41. package/lib/src/components/subsequence/subsequence.d.ts +2 -2
  42. package/lib/src/components/summary/html/summary-container.d.ts +2 -0
  43. package/lib/src/components/summary/html/summary-responses.d.ts +12 -0
  44. package/lib/src/components/summary/html/summary-title.d.ts +5 -0
  45. package/lib/src/components/summary/index.d.ts +1 -0
  46. package/lib/src/components/summary/lunatic-summary.d.ts +7 -0
  47. package/lib/src/components/type.d.ts +18 -0
  48. package/lib/src/index.d.ts +1 -0
  49. package/lib/src/use-lunatic/actions.d.ts +6 -169
  50. package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +137 -112
  51. package/lib/src/use-lunatic/commons/fill-components/fill-missing-response.d.ts +2 -1
  52. package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +115 -94
  53. package/lib/src/use-lunatic/commons/page-navigation.d.ts +7 -0
  54. package/lib/src/use-lunatic/commons/page-navigation.spec.d.ts +1 -0
  55. package/lib/src/use-lunatic/commons/page.d.ts +11 -0
  56. package/lib/src/use-lunatic/commons/use-components-from-state.d.ts +1 -1
  57. package/lib/src/use-lunatic/reducer/commons/auto-explore-loop.d.ts +5 -0
  58. package/lib/src/use-lunatic/reducer/commons/index.d.ts +0 -1
  59. package/lib/src/use-lunatic/reducer/commons/is-loop-component.d.ts +2 -2
  60. package/lib/src/use-lunatic/reducer/overview/overview-on-init.d.ts +1 -7
  61. package/lib/src/use-lunatic/replace-component-sequence.d.ts +3 -3
  62. package/lib/src/use-lunatic/type-source.d.ts +27 -13
  63. package/lib/src/use-lunatic/type.d.ts +4 -12
  64. package/lib/src/use-lunatic/use-lunatic.d.ts +474 -10
  65. package/lib/src/utils/store-tools/worker-path.d.ts +1 -0
  66. package/lib/stories/component-set/component-set.stories.js +2 -1
  67. package/lib/stories/loop/block-for-loop.stories.js +8 -1
  68. package/lib/stories/loop/roster-for-loop.stories.js +8 -1
  69. package/lib/{use-lunatic/reducer/reduce-roundabout.js → stories/question-explication/question-explication.stories.js} +21 -17
  70. package/lib/stories/question-explication/source.json +17 -0
  71. package/lib/stories/roundabout/roundabout.stories.js +2 -1
  72. package/lib/stories/suggester/source-component-set.json +67 -0
  73. package/lib/stories/suggester/suggester.stories.js +9 -1
  74. package/lib/stories/summary/data.json +32 -0
  75. package/lib/stories/summary/source.json +353 -0
  76. package/lib/stories/summary/summary.stories.js +37 -0
  77. package/lib/stories/utils/orchestrator.js +5 -3
  78. package/lib/use-lunatic/commons/check-pager.js +1 -2
  79. package/lib/use-lunatic/commons/fill-components/fill-missing-response.js +14 -12
  80. package/lib/use-lunatic/commons/page-navigation.js +109 -0
  81. package/lib/use-lunatic/commons/page-navigation.spec.js +129 -0
  82. package/lib/use-lunatic/commons/page.js +44 -0
  83. package/lib/use-lunatic/reducer/commons/auto-explore-loop.js +39 -0
  84. package/lib/use-lunatic/reducer/commons/index.js +0 -8
  85. package/lib/use-lunatic/reducer/reduce-go-next-page.js +25 -159
  86. package/lib/use-lunatic/reducer/reduce-go-previous-page.js +21 -127
  87. package/lib/use-lunatic/reducer/reduce-go-to-page.js +53 -55
  88. package/lib/use-lunatic/reducer/reduce-on-init.js +5 -8
  89. package/lib/use-lunatic/reducer/resolve-component-controls/resolve-roundabout-control.js +1 -1
  90. package/lib/use-lunatic/reducer/resolve-component-controls/resolve-simple-control.js +1 -1
  91. package/lib/use-lunatic/type-source.js +0 -2
  92. package/lib/use-lunatic/use-lunatic.js +17 -3
  93. package/lib/utils/store-tools/auto-load.js +2 -2
  94. package/lib/utils/store-tools/worker-path.js +13 -0
  95. package/lib/utils/suggester-workers/append-to-index/create-append-task.js +2 -2
  96. package/package.json +3 -3
  97. package/lib/components/button/__snapshots__/lunatic-button.spec.jsx.snap +0 -80
  98. package/lib/components/commons/components/combo-box/selection/__snapshots__/selection.spec.jsx.snap +0 -81
  99. package/lib/src/use-lunatic/reducer/commons/is-empty-on-empty-page.d.ts +0 -3
  100. package/lib/src/use-lunatic/reducer/reduce-roundabout.d.ts +0 -2
  101. package/lib/use-lunatic/reducer/commons/is-empty-on-empty-page.js +0 -32
@@ -48,7 +48,7 @@ export type ActionInit = {
48
48
  management: boolean;
49
49
  handleChange: LunaticState['handleChange'];
50
50
  activeControls: boolean;
51
- goToPage: (params: ActionGoToPage['payload']) => ActionGoToPage;
51
+ goToPage: (params: ActionGoToPage['payload']) => void;
52
52
  withOverview: boolean;
53
53
  };
54
54
  };
@@ -85,132 +85,20 @@ export declare const goPreviousPage: () => {
85
85
  readonly type: ActionKind.GO_PREVIOUS_PAGE;
86
86
  readonly payload: {};
87
87
  };
88
- export declare const goNextPage: (payload: {} | {
89
- page: string;
90
- iteration?: number | undefined;
91
- nbIterations?: number | undefined;
92
- subPage?: number | undefined;
93
- roundabout?: {
94
- page: string;
95
- } | undefined;
96
- } | {
97
- response: {
98
- name: string;
99
- };
100
- value: unknown;
101
- args?: {
102
- loop?: boolean | undefined;
103
- length?: number | undefined;
104
- index?: number | undefined;
105
- linksIterations?: number[] | undefined;
106
- symLinks?: {
107
- [variableName: string]: Record<string, string>;
108
- } | undefined;
109
- paginatedLoop?: unknown;
110
- shallowIteration?: unknown;
111
- lengths?: number[] | undefined;
112
- } | undefined;
113
- } | {
114
- data: LunaticData;
115
- source: LunaticSource;
116
- initialPage: string;
117
- features: LunaticState['features'];
118
- preferences: LunaticState['preferences'];
119
- savingType: LunaticState['savingType'];
120
- shortcut: boolean;
121
- management: boolean;
122
- handleChange: LunaticState['handleChange'];
123
- activeControls: boolean;
124
- goToPage: (params: ActionGoToPage['payload']) => ActionGoToPage;
125
- withOverview: boolean;
126
- } | {
127
- status: boolean;
128
- } | {
129
- getSuggesterStatus: (name: string) => {
130
- status: SuggesterStatus;
131
- timestamp: number;
132
- };
133
- } | {
88
+ export declare const goNextPage: (payload: {
134
89
  block?: unknown;
135
90
  }) => ActionGoNextPage & {
136
91
  type: ActionKind.GO_NEXT_PAGE;
137
92
  };
138
- export declare const goToPage: (payload: {} | {
93
+ export declare const goToPage: (payload: {
139
94
  page: string;
140
95
  iteration?: number | undefined;
141
96
  nbIterations?: number | undefined;
142
97
  subPage?: number | undefined;
143
- roundabout?: {
144
- page: string;
145
- } | undefined;
146
- } | {
147
- response: {
148
- name: string;
149
- };
150
- value: unknown;
151
- args?: {
152
- loop?: boolean | undefined;
153
- length?: number | undefined;
154
- index?: number | undefined;
155
- linksIterations?: number[] | undefined;
156
- symLinks?: {
157
- [variableName: string]: Record<string, string>;
158
- } | undefined;
159
- paginatedLoop?: unknown;
160
- shallowIteration?: unknown;
161
- lengths?: number[] | undefined;
162
- } | undefined;
163
- } | {
164
- data: LunaticData;
165
- source: LunaticSource;
166
- initialPage: string;
167
- features: LunaticState['features'];
168
- preferences: LunaticState['preferences'];
169
- savingType: LunaticState['savingType'];
170
- shortcut: boolean;
171
- management: boolean;
172
- handleChange: LunaticState['handleChange'];
173
- activeControls: boolean;
174
- goToPage: (params: ActionGoToPage['payload']) => ActionGoToPage;
175
- withOverview: boolean;
176
- } | {
177
- status: boolean;
178
- } | {
179
- getSuggesterStatus: (name: string) => {
180
- status: SuggesterStatus;
181
- timestamp: number;
182
- };
183
- } | {
184
- block?: unknown;
185
98
  }) => ActionGoToPage & {
186
99
  type: ActionKind.GO_TO_PAGE;
187
100
  };
188
- export declare const onInit: (payload: {} | {
189
- page: string;
190
- iteration?: number | undefined;
191
- nbIterations?: number | undefined;
192
- subPage?: number | undefined;
193
- roundabout?: {
194
- page: string;
195
- } | undefined;
196
- } | {
197
- response: {
198
- name: string;
199
- };
200
- value: unknown;
201
- args?: {
202
- loop?: boolean | undefined;
203
- length?: number | undefined;
204
- index?: number | undefined;
205
- linksIterations?: number[] | undefined;
206
- symLinks?: {
207
- [variableName: string]: Record<string, string>;
208
- } | undefined;
209
- paginatedLoop?: unknown;
210
- shallowIteration?: unknown;
211
- lengths?: number[] | undefined;
212
- } | undefined;
213
- } | {
101
+ export declare const onInit: (payload: {
214
102
  data: LunaticData;
215
103
  source: LunaticSource;
216
104
  initialPage: string;
@@ -221,69 +109,18 @@ export declare const onInit: (payload: {} | {
221
109
  management: boolean;
222
110
  handleChange: LunaticState['handleChange'];
223
111
  activeControls: boolean;
224
- goToPage: (params: ActionGoToPage['payload']) => ActionGoToPage;
112
+ goToPage: (params: ActionGoToPage['payload']) => void;
225
113
  withOverview: boolean;
226
- } | {
227
- status: boolean;
228
- } | {
229
- getSuggesterStatus: (name: string) => {
230
- status: SuggesterStatus;
231
- timestamp: number;
232
- };
233
- } | {
234
- block?: unknown;
235
114
  }) => ActionInit & {
236
115
  type: ActionKind.ON_INIT;
237
116
  };
238
117
  export declare const handleChange: (response: ActionHandleChange['payload']['response'], value: ActionHandleChange['payload']['value'], args: ActionHandleChange['payload']['args']) => Action;
239
118
  export declare const onSetWaiting: (status: boolean) => Action;
240
- export declare const updateState: (payload: {} | {
241
- page: string;
242
- iteration?: number | undefined;
243
- nbIterations?: number | undefined;
244
- subPage?: number | undefined;
245
- roundabout?: {
246
- page: string;
247
- } | undefined;
248
- } | {
249
- response: {
250
- name: string;
251
- };
252
- value: unknown;
253
- args?: {
254
- loop?: boolean | undefined;
255
- length?: number | undefined;
256
- index?: number | undefined;
257
- linksIterations?: number[] | undefined;
258
- symLinks?: {
259
- [variableName: string]: Record<string, string>;
260
- } | undefined;
261
- paginatedLoop?: unknown;
262
- shallowIteration?: unknown;
263
- lengths?: number[] | undefined;
264
- } | undefined;
265
- } | {
266
- data: LunaticData;
267
- source: LunaticSource;
268
- initialPage: string;
269
- features: LunaticState['features'];
270
- preferences: LunaticState['preferences'];
271
- savingType: LunaticState['savingType'];
272
- shortcut: boolean;
273
- management: boolean;
274
- handleChange: LunaticState['handleChange'];
275
- activeControls: boolean;
276
- goToPage: (params: ActionGoToPage['payload']) => ActionGoToPage;
277
- withOverview: boolean;
278
- } | {
279
- status: boolean;
280
- } | {
119
+ export declare const updateState: (payload: {
281
120
  getSuggesterStatus: (name: string) => {
282
121
  status: SuggesterStatus;
283
122
  timestamp: number;
284
123
  };
285
- } | {
286
- block?: unknown;
287
124
  }) => ActionUpdateState & {
288
125
  type: ActionKind.UPDATE_STATE;
289
126
  };