@inseefr/lunatic 3.5.6 → 3.5.8

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 (245) hide show
  1. package/components/CheckboxOne/CheckboxOne.spec.js +3 -2
  2. package/components/CheckboxOne/CheckboxOne.spec.js.map +1 -1
  3. package/components/shared/Combobox/Combobox.stories.d.ts +3 -2
  4. package/components/shared/Combobox/Combobox.stories.js +26 -21
  5. package/components/shared/Combobox/Combobox.stories.js.map +1 -1
  6. package/components/type.d.ts +3 -0
  7. package/esm/components/CheckboxOne/CheckboxOne.spec.js +3 -2
  8. package/esm/components/CheckboxOne/CheckboxOne.spec.js.map +1 -1
  9. package/esm/components/shared/Combobox/Combobox.stories.d.ts +3 -2
  10. package/esm/components/shared/Combobox/Combobox.stories.js +28 -24
  11. package/esm/components/shared/Combobox/Combobox.stories.js.map +1 -1
  12. package/esm/components/type.d.ts +3 -0
  13. package/esm/hooks/useLocalStorage.d.ts +1 -0
  14. package/esm/hooks/useLocalStorage.js +31 -0
  15. package/esm/hooks/useLocalStorage.js.map +1 -0
  16. package/esm/type.source.d.ts +6 -0
  17. package/esm/use-lunatic/commons/compile-controls.js +22 -14
  18. package/esm/use-lunatic/commons/compile-controls.js.map +1 -1
  19. package/esm/use-lunatic/commons/fill-components/fill-component-expressions.js +4 -1
  20. package/esm/use-lunatic/commons/fill-components/fill-component-expressions.js.map +1 -1
  21. package/esm/use-lunatic/hooks/use-page-has-response.js +1 -1
  22. package/esm/use-lunatic/hooks/use-page-has-response.js.map +1 -1
  23. package/esm/use-lunatic/hooks/useOverview.spec.js +2 -2
  24. package/esm/use-lunatic/hooks/useOverview.spec.js.map +1 -1
  25. package/esm/use-lunatic/props/getComponentTypeProps.d.ts +3 -0
  26. package/esm/utils/number.d.ts +4 -0
  27. package/esm/utils/number.js +12 -0
  28. package/esm/utils/number.js.map +1 -1
  29. package/esm/utils/object.d.ts +10 -0
  30. package/esm/utils/object.js +26 -0
  31. package/esm/utils/object.js.map +1 -1
  32. package/hooks/useLocalStorage.d.ts +1 -0
  33. package/hooks/useLocalStorage.js +34 -0
  34. package/hooks/useLocalStorage.js.map +1 -0
  35. package/package.json +76 -137
  36. package/src/components/CheckboxOne/CheckboxOne.spec.tsx +3 -0
  37. package/src/components/shared/Combobox/Combobox.stories.tsx +48 -49
  38. package/src/components/type.ts +1 -0
  39. package/src/hooks/useLocalStorage.ts +37 -0
  40. package/src/json.d.ts +16 -0
  41. package/src/stories/accordion/accordion.stories.tsx +21 -0
  42. package/src/stories/behaviour/cleaning/cleaning.stories.tsx +40 -0
  43. package/src/stories/behaviour/controls/controls.stories.tsx +51 -0
  44. package/src/stories/behaviour/disabled/disabled.stories.tsx +29 -0
  45. package/src/stories/behaviour/filter/filter.stories.tsx +34 -0
  46. package/src/stories/behaviour/missing/missing.stories.tsx +31 -0
  47. package/src/stories/behaviour/overview/overview.stories.tsx +61 -0
  48. package/src/stories/{overview/sourceWithHierarchy.json → behaviour/overview/source.json} +1 -1
  49. package/src/stories/{overview → behaviour/overview}/sourceLoop.json +1 -1
  50. package/src/stories/behaviour/performance/performance.stories.tsx +29 -0
  51. package/src/stories/behaviour/resizing/resizing.stories.tsx +34 -0
  52. package/src/stories/behaviour/slots.stories.tsx +34 -0
  53. package/src/stories/checkbox/checkbox.stories.tsx +75 -0
  54. package/src/stories/{checkbox-group/sourceLoop.json → checkbox/sourceGroupLoop.json} +1 -1
  55. package/src/stories/datepicker/datepicker.stories.tsx +21 -0
  56. package/src/stories/declaration/declaration.stories.tsx +27 -0
  57. package/src/stories/dropdown/dropdown.stories.tsx +27 -0
  58. package/src/stories/duration/duration.stories.tsx +27 -0
  59. package/src/stories/filter-description/filter-description.stories.tsx +28 -0
  60. package/src/stories/input/input.stories.tsx +21 -0
  61. package/src/stories/input-number/input-number.stories.tsx +35 -0
  62. package/src/stories/loop/loop.stories.tsx +35 -0
  63. package/src/stories/loop/roster-for-loop.stories.tsx +59 -0
  64. package/src/stories/pairwise/pairwise.stories.tsx +30 -0
  65. package/src/stories/paste.stories.tsx +85 -0
  66. package/src/stories/question/question.stories.tsx +21 -0
  67. package/src/stories/questionnaires/logement/logement.stories.tsx +26 -0
  68. package/src/stories/questionnaires/recensement/recensement.stories.tsx +28 -0
  69. package/src/stories/questionnaires/rp/rp.stories.tsx +21 -0
  70. package/src/stories/questionnaires/simpsons/simpsons.stories.tsx +31 -0
  71. package/src/stories/radio/radio.stories.tsx +53 -0
  72. package/src/stories/roundabout/roundabout.stories.tsx +37 -0
  73. package/src/stories/roundabout/source.json +1 -0
  74. package/src/stories/sequence/sequence.stories.tsx +28 -0
  75. package/src/stories/suggester/source-option-responses.json +1 -1
  76. package/src/stories/suggester/suggester.stories.tsx +68 -0
  77. package/src/stories/summary/source.json +22 -1
  78. package/src/stories/summary/summary.stories.tsx +31 -0
  79. package/src/stories/table/table.stories.tsx +35 -0
  80. package/src/stories/text/text.stories.tsx +38 -0
  81. package/src/stories/textarea/textarea.stories.tsx +21 -0
  82. package/src/stories/utils/Orchestrator.tsx +310 -0
  83. package/src/stories/utils/OrchestratorData.tsx +176 -0
  84. package/src/stories/utils/OrchestratorOverview.tsx +70 -0
  85. package/src/stories/utils/OrchestratorSidebar.tsx +119 -0
  86. package/src/stories/utils/SchemaValidator.tsx +29 -0
  87. package/src/stories/utils/referentiel.ts +9 -0
  88. package/src/type.source.ts +6 -0
  89. package/src/use-lunatic/commons/compile-controls.ts +36 -18
  90. package/src/use-lunatic/commons/fill-components/fill-component-expressions.ts +4 -1
  91. package/src/use-lunatic/hooks/use-page-has-response.ts +1 -1
  92. package/src/use-lunatic/hooks/useOverview.spec.ts +3 -2
  93. package/src/use-lunatic/use-lunatic.test.ts +53 -40
  94. package/src/utils/number.ts +13 -0
  95. package/src/utils/object.ts +40 -0
  96. package/tsconfig.build.tsbuildinfo +1 -1
  97. package/type.source.d.ts +6 -0
  98. package/use-lunatic/commons/compile-controls.js +21 -13
  99. package/use-lunatic/commons/compile-controls.js.map +1 -1
  100. package/use-lunatic/commons/fill-components/fill-component-expressions.js +5 -2
  101. package/use-lunatic/commons/fill-components/fill-component-expressions.js.map +1 -1
  102. package/use-lunatic/hooks/use-page-has-response.js +2 -2
  103. package/use-lunatic/hooks/use-page-has-response.js.map +1 -1
  104. package/use-lunatic/hooks/useOverview.spec.js +8 -8
  105. package/use-lunatic/hooks/useOverview.spec.js.map +1 -1
  106. package/use-lunatic/props/getComponentTypeProps.d.ts +3 -0
  107. package/utils/number.d.ts +4 -0
  108. package/utils/number.js +13 -0
  109. package/utils/number.js.map +1 -1
  110. package/utils/object.d.ts +10 -0
  111. package/utils/object.js +30 -0
  112. package/utils/object.js.map +1 -1
  113. package/esm/stories/overview/sourceWithHierarchy.json +0 -5151
  114. package/esm/tests/utils/lunatic.d.ts +0 -15
  115. package/esm/tests/utils/lunatic.js +0 -27
  116. package/esm/tests/utils/lunatic.js.map +0 -1
  117. package/esm/use-lunatic/replace-component-sequence.d.ts +0 -36
  118. package/esm/use-lunatic/replace-component-sequence.js +0 -19
  119. package/esm/use-lunatic/replace-component-sequence.js.map +0 -1
  120. package/esm/use-lunatic/test.utils.d.ts +0 -2
  121. package/esm/use-lunatic/test.utils.js +0 -13
  122. package/esm/use-lunatic/test.utils.js.map +0 -1
  123. package/esm/utils/is-object.d.ts +0 -4
  124. package/esm/utils/is-object.js +0 -7
  125. package/esm/utils/is-object.js.map +0 -1
  126. package/esm/utils/to-number.d.ts +0 -4
  127. package/esm/utils/to-number.js +0 -13
  128. package/esm/utils/to-number.js.map +0 -1
  129. package/src/stories/accordion/accordion.stories.jsx +0 -17
  130. package/src/stories/behaviour/cleaning/cleaning.stories.jsx +0 -69
  131. package/src/stories/behaviour/controls/controls.stories.jsx +0 -81
  132. package/src/stories/behaviour/filter/dataLoop.json +0 -14
  133. package/src/stories/behaviour/filter/filter.stories.jsx +0 -36
  134. package/src/stories/behaviour/missing/missing.stories.jsx +0 -69
  135. package/src/stories/behaviour/others/V2_DeclarationsSimples.json +0 -908
  136. package/src/stories/behaviour/others/V2_MinMaxSum_Boucles.json +0 -489
  137. package/src/stories/behaviour/others/V2_QuestSimple_Boucles.json +0 -3919
  138. package/src/stories/behaviour/others/V2_TCMRallyeGames.json +0 -2760
  139. package/src/stories/behaviour/others/test-dylan.json +0 -538
  140. package/src/stories/behaviour/others/test.stories.jsx +0 -78
  141. package/src/stories/behaviour/paste/source.json +0 -32
  142. package/src/stories/behaviour/paste/test.stories.jsx +0 -62
  143. package/src/stories/behaviour/performance/performance.stories.jsx +0 -26
  144. package/src/stories/behaviour/resizing/resizing.stories.jsx +0 -60
  145. package/src/stories/behaviour/slots.stories.jsx +0 -32
  146. package/src/stories/checkbox-boolean/checkboxBoolean.stories.jsx +0 -17
  147. package/src/stories/checkbox-group/checkbox-group.stories.jsx +0 -77
  148. package/src/stories/checkbox-one/checkboxOne.stories.jsx +0 -53
  149. package/src/stories/date-picker/data.json +0 -3
  150. package/src/stories/date-picker/datepicker.stories.jsx +0 -26
  151. package/src/stories/declaration/data.json +0 -1
  152. package/src/stories/declaration/input.stories.jsx +0 -18
  153. package/src/stories/disabled/data.json +0 -16
  154. package/src/stories/disabled/disabled.stories.jsx +0 -18
  155. package/src/stories/dropdown/data.json +0 -8
  156. package/src/stories/dropdown/dropdown.stories.jsx +0 -25
  157. package/src/stories/duration/duration.stories.jsx +0 -25
  158. package/src/stories/filter-description/filter-description.stories.jsx +0 -37
  159. package/src/stories/input/data.json +0 -1
  160. package/src/stories/input/input.stories.jsx +0 -18
  161. package/src/stories/input-number/input-number.stories.jsx +0 -23
  162. package/src/stories/loop/loop.stories.jsx +0 -29
  163. package/src/stories/loop/roster-for-loop.stories.jsx +0 -46
  164. package/src/stories/markdown/markdown.stories.jsx +0 -20
  165. package/src/stories/overview/data.json +0 -1
  166. package/src/stories/overview/dataLoop.json +0 -93
  167. package/src/stories/overview/overview.stories.jsx +0 -44
  168. package/src/stories/overview/source.json +0 -25
  169. package/src/stories/pairwise/data.json +0 -12
  170. package/src/stories/pairwise/pairwise-links.stories.jsx +0 -48
  171. package/src/stories/question/question.stories.jsx +0 -16
  172. package/src/stories/questionnaires/logement/logement.stories.jsx +0 -59
  173. package/src/stories/questionnaires/recensement/data.json +0 -12
  174. package/src/stories/questionnaires/recensement/recensement.stories.jsx +0 -35
  175. package/src/stories/questionnaires/rp/data.json +0 -5
  176. package/src/stories/questionnaires/rp/rp.stories.jsx +0 -23
  177. package/src/stories/questionnaires/simpsons/simpsons.stories.jsx +0 -246
  178. package/src/stories/radio/radio.stories.jsx +0 -78
  179. package/src/stories/roundabout/data1.json +0 -13
  180. package/src/stories/roundabout/data2.json +0 -16
  181. package/src/stories/roundabout/roundabout.stories.jsx +0 -32
  182. package/src/stories/sequence/sequence.stories.jsx +0 -29
  183. package/src/stories/suggester/suggester.stories.jsx +0 -71
  184. package/src/stories/summary/data.json +0 -16
  185. package/src/stories/summary/summary.stories.jsx +0 -23
  186. package/src/stories/switch/README.md +0 -29
  187. package/src/stories/switch/data-forced.json +0 -40
  188. package/src/stories/switch/source.json +0 -64
  189. package/src/stories/switch/switch.stories.jsx +0 -17
  190. package/src/stories/table/data.json +0 -1
  191. package/src/stories/table/table.stories.jsx +0 -30
  192. package/src/stories/text/data-roster.json +0 -5
  193. package/src/stories/text/text.stories.jsx +0 -20
  194. package/src/stories/textarea/data.json +0 -1
  195. package/src/stories/textarea/textarea.stories.jsx +0 -18
  196. package/src/stories/utils/SchemaValidator.jsx +0 -40
  197. package/src/stories/utils/default-arg-types.js +0 -39
  198. package/src/stories/utils/default-args.js +0 -3
  199. package/src/stories/utils/options.js +0 -19
  200. package/src/stories/utils/orchestrator.jsx +0 -267
  201. package/src/stories/utils/orchestrator.scss +0 -66
  202. package/src/stories/utils/overview.jsx +0 -39
  203. package/src/stories/utils/overview.scss +0 -37
  204. package/src/stories/utils/referentiel.js +0 -7
  205. package/src/tests/utils/e2e.js +0 -91
  206. package/src/tests/utils/lunatic.ts +0 -33
  207. package/src/use-lunatic/replace-component-sequence.ts +0 -25
  208. package/src/use-lunatic/test.utils.ts +0 -17
  209. package/src/utils/is-object.ts +0 -6
  210. package/src/utils/to-number.ts +0 -12
  211. package/stories/overview/sourceWithHierarchy.json +0 -5151
  212. package/tests/utils/lunatic.d.ts +0 -15
  213. package/tests/utils/lunatic.js +0 -31
  214. package/tests/utils/lunatic.js.map +0 -1
  215. package/use-lunatic/replace-component-sequence.d.ts +0 -36
  216. package/use-lunatic/replace-component-sequence.js +0 -22
  217. package/use-lunatic/replace-component-sequence.js.map +0 -1
  218. package/use-lunatic/test.utils.d.ts +0 -2
  219. package/use-lunatic/test.utils.js +0 -17
  220. package/use-lunatic/test.utils.js.map +0 -1
  221. package/utils/is-object.d.ts +0 -4
  222. package/utils/is-object.js +0 -10
  223. package/utils/is-object.js.map +0 -1
  224. package/utils/to-number.d.ts +0 -4
  225. package/utils/to-number.js +0 -16
  226. package/utils/to-number.js.map +0 -1
  227. /package/src/stories/behaviour/cleaning/{loop.json → source-loop-scopes.json} +0 -0
  228. /package/src/stories/behaviour/controls/{boucles-n.json → source-boucles-n.json} +0 -0
  229. /package/src/stories/behaviour/controls/{loop.json → source-loop.json} +0 -0
  230. /package/src/stories/behaviour/controls/{roundabout.json → source-roundabout.json} +0 -0
  231. /package/src/stories/behaviour/controls/{simple-numeric.json → source-simple-numeric.json} +0 -0
  232. /package/src/stories/behaviour/controls/{simple.json → source-simple.json} +0 -0
  233. /package/src/stories/{disabled → behaviour/disabled}/source.json +0 -0
  234. /package/src/stories/{checkbox-boolean → checkbox}/source.json +0 -0
  235. /package/src/stories/{checkbox-group/source.json → checkbox/sourceGroup.json} +0 -0
  236. /package/src/stories/{checkbox-group/sourceCondition.json → checkbox/sourceGroupCondition.json} +0 -0
  237. /package/src/stories/{checkbox-group/sourceDetail.json → checkbox/sourceGroupDetail.json} +0 -0
  238. /package/src/stories/{checkbox-one/source.json → checkbox/sourceOne.json} +0 -0
  239. /package/src/stories/{checkbox-one/sourceDetail.json → checkbox/sourceOneDetail.json} +0 -0
  240. /package/src/stories/{date-picker → datepicker}/source.json +0 -0
  241. /package/src/stories/{markdown/source.json → declaration/sourceMarkdown.json} +0 -0
  242. /package/src/stories/duration/{mois.json → sourceMonths.json} +0 -0
  243. /package/src/stories/duration/{time.json → sourceTime.json} +0 -0
  244. /package/src/stories/filter-description/{source-options.json → sourceOptions.json} +0 -0
  245. /package/src/stories/table/{table-dynamique.json → source-dynamic.json} +0 -0
@@ -0,0 +1,37 @@
1
+ import { useCallback, useMemo, useState } from 'react';
2
+
3
+ export function useLocalStorage<T>(
4
+ key: string
5
+ ): [T | null, (value: string) => void, string] {
6
+ const [storedValue, setStoredValue] = useState<T | null>(() => {
7
+ try {
8
+ const item = window.localStorage.getItem(key);
9
+ return item ? JSON.parse(item) : null;
10
+ } catch (error) {
11
+ console.error(`Error reading localStorage key "${key}":`, error);
12
+ return null;
13
+ }
14
+ });
15
+
16
+ const setValue = useCallback(
17
+ (value: string) => {
18
+ try {
19
+ const parsedValue = JSON.parse(value);
20
+ setStoredValue(parsedValue);
21
+ window.localStorage.setItem(key, value);
22
+ } catch (error) {
23
+ console.error(`Error setting localStorage key "${key}":`, error);
24
+ }
25
+ },
26
+ [key]
27
+ );
28
+
29
+ const stringValue = useMemo(() => {
30
+ if (!storedValue) {
31
+ return '';
32
+ }
33
+ return JSON.stringify(storedValue, null, 2);
34
+ }, [storedValue]);
35
+
36
+ return [storedValue, setValue, stringValue];
37
+ }
package/src/json.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ declare module './data*.json' {
2
+ import type { LunaticData } from './use-lunatic/type';
3
+ const value: LunaticData;
4
+ export default value;
5
+ }
6
+
7
+ declare module '*-schema.json' {
8
+ const value: any;
9
+ export default value;
10
+ }
11
+
12
+ declare module '*.json' {
13
+ import type { LunaticSource } from './type.source';
14
+ const value: LunaticSource;
15
+ export default value;
16
+ }
@@ -0,0 +1,21 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../utils/Orchestrator';
6
+ import source from './source.json';
7
+
8
+ import { Meta } from '@storybook/react';
9
+
10
+ const meta: Meta<typeof Orchestrator> = {
11
+ title: 'Components/Accordion',
12
+ ...OrchestratorMeta,
13
+ };
14
+
15
+ export default meta;
16
+
17
+ export const Default: OrchestratorStory = {
18
+ args: {
19
+ source,
20
+ },
21
+ };
@@ -0,0 +1,40 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../../utils/Orchestrator';
6
+ import source from './source.json';
7
+ import sourceLoop from './source-loop.json';
8
+ import sourceLoopScopes from './source-loop-scopes.json';
9
+
10
+ import { Meta } from '@storybook/react';
11
+
12
+ import { dataFromObject } from '../../../utils/object';
13
+
14
+ const meta: Meta<typeof Orchestrator> = {
15
+ title: 'Behaviour/Cleaning',
16
+ ...OrchestratorMeta,
17
+ };
18
+
19
+ export default meta;
20
+
21
+ export const Default: OrchestratorStory = {
22
+ args: {
23
+ source,
24
+ },
25
+ };
26
+
27
+ export const Loop: OrchestratorStory = {
28
+ args: {
29
+ source: sourceLoop,
30
+ },
31
+ };
32
+
33
+ export const LoopWithMixedScopes: OrchestratorStory = {
34
+ args: {
35
+ source: sourceLoopScopes,
36
+ data: dataFromObject({
37
+ PRENOM: ['Laurent', 'Alain', 'toto'],
38
+ }),
39
+ },
40
+ };
@@ -0,0 +1,51 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../../utils/Orchestrator';
6
+ import simple from './source-simple.json';
7
+ import simpleNum from './source-simple-numeric.json';
8
+ import sourceLoop from './source-loop.json';
9
+ import sourceRoundabout from './source-roundabout.json';
10
+ import boucleNTabDynamique from './source-boucles-n.json';
11
+
12
+ import { Meta } from '@storybook/react';
13
+
14
+ const meta: Meta<typeof Orchestrator> = {
15
+ title: 'Behaviour/Controls',
16
+ ...OrchestratorMeta,
17
+ };
18
+
19
+ export default meta;
20
+
21
+ export const BoucleN: OrchestratorStory = {
22
+ args: {
23
+ source: boucleNTabDynamique,
24
+ },
25
+ };
26
+
27
+ export const Simple: OrchestratorStory = {
28
+ args: {
29
+ source: simple,
30
+ },
31
+ };
32
+
33
+ export const SimpleNum: OrchestratorStory = {
34
+ args: {
35
+ source: simpleNum,
36
+ },
37
+ };
38
+
39
+ export const LinkedLoop: OrchestratorStory = {};
40
+
41
+ export const Loop: OrchestratorStory = {
42
+ args: {
43
+ source: sourceLoop,
44
+ },
45
+ };
46
+
47
+ export const Roundabout: OrchestratorStory = {
48
+ args: {
49
+ source: sourceRoundabout,
50
+ },
51
+ };
@@ -0,0 +1,29 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../../utils/Orchestrator';
6
+ import source from './source.json';
7
+
8
+ import { Meta } from '@storybook/react';
9
+
10
+ import { dataFromObject } from '../../../utils/object';
11
+
12
+ const meta: Meta<typeof Orchestrator> = {
13
+ title: 'Behaviour/Disabled',
14
+ ...OrchestratorMeta,
15
+ };
16
+
17
+ export default meta;
18
+
19
+ export const Default: OrchestratorStory = {
20
+ args: {
21
+ source,
22
+ data: dataFromObject({
23
+ NOM: 'Renaud',
24
+ DISABLED_NOM: true,
25
+ SEXE: '2',
26
+ DISABLED_SEXE: true,
27
+ }),
28
+ },
29
+ };
@@ -0,0 +1,34 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../../utils/Orchestrator';
6
+ import source from './source.json';
7
+ import sourceLoop from './sourceLoop.json';
8
+
9
+ import { Meta } from '@storybook/react';
10
+
11
+ import { dataFromObject } from '../../../utils/object';
12
+
13
+ const meta: Meta<typeof Orchestrator> = {
14
+ title: 'Behaviour/Filter',
15
+ ...OrchestratorMeta,
16
+ };
17
+
18
+ export default meta;
19
+
20
+ export const Default: OrchestratorStory = {
21
+ args: {
22
+ source,
23
+ },
24
+ };
25
+
26
+ export const WithLoop: OrchestratorStory = {
27
+ args: {
28
+ source: sourceLoop,
29
+ data: dataFromObject({
30
+ NBHAB: 2,
31
+ NAME: ['Jean', 'Paul'],
32
+ }),
33
+ },
34
+ };
@@ -0,0 +1,31 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../../utils/Orchestrator';
6
+ import source from './source.json';
7
+
8
+ import { Meta } from '@storybook/react';
9
+
10
+ const meta: Meta<typeof Orchestrator> = {
11
+ title: 'Behaviour/Missing',
12
+ ...OrchestratorMeta,
13
+ };
14
+
15
+ export default meta;
16
+
17
+ export const Default: OrchestratorStory = {
18
+ args: {
19
+ source,
20
+ initialPage: '2',
21
+ missing: true,
22
+ shortcut: true,
23
+ },
24
+ };
25
+
26
+ export const ReadOnly: OrchestratorStory = {
27
+ args: {
28
+ ...Default.args,
29
+ readOnly: true,
30
+ },
31
+ };
@@ -0,0 +1,61 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../../utils/Orchestrator';
6
+ import source from './source.json';
7
+ import sourceLoop from './sourceLoop.json';
8
+
9
+ import { Meta } from '@storybook/react';
10
+
11
+ import { dataFromObject } from '../../../utils/object';
12
+
13
+ const meta: Meta<typeof Orchestrator> = {
14
+ title: 'Behaviour/Overview',
15
+ ...OrchestratorMeta,
16
+ args: {
17
+ ...OrchestratorMeta.args,
18
+ showOverview: true,
19
+ },
20
+ };
21
+
22
+ export default meta;
23
+
24
+ export const Default: OrchestratorStory = {
25
+ args: {
26
+ source,
27
+ },
28
+ };
29
+
30
+ export const WithLoop: OrchestratorStory = {
31
+ args: {
32
+ source: sourceLoop,
33
+ data: dataFromObject({
34
+ ETAT: '1',
35
+ SATISFAIT: '1',
36
+ T_NHAB: 3,
37
+ T_PRENOM: ['Quentin', 'Luna', 'Paul'],
38
+ COMMCOMPO: 'super',
39
+ T_SEXE: ['1', '2', '1'],
40
+ T_DATENAIS: [null, null, null],
41
+ REMARQUES: [null, 'a', 'b'],
42
+ SUPERQUEST: ['ok', 'ok', null],
43
+ AUTRESUPERQUEST: ['a', 'c', 'ras'],
44
+ ENCOREUNEQ: ['wow', 'b', null],
45
+ COMMENT_QE: null,
46
+ ETAT_MISSING: null,
47
+ SATISFAIT_MISSING: null,
48
+ T_NHAB_MISSING: null,
49
+ T_PRENOM_MISSING: null,
50
+ COMMCOMPO_MISSING: null,
51
+ T_SEXE_MISSING: null,
52
+ T_DATENAIS_MISSING: [null, 'DK', 'RF'],
53
+ REMARQUES_MISSING: [null, null, null],
54
+ SUPERQUEST_MISSING: [null, null, 'DK'],
55
+ ENCOREUNEQ_MISSING: [null, null, 'RF'],
56
+ AUTRESUPERQUEST_MISSING: null,
57
+ COMMENT_QE_MISSING: null,
58
+ }),
59
+ lastReachedPage: '11.2#2',
60
+ },
61
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "../../../lunatic-schema.json",
2
+ "$schema": "../../../../lunatic-schema.json",
3
3
  "id": "i6vwi2506qf2mms",
4
4
  "modele": "SIMPSONS",
5
5
  "enoCoreVersion": "2.3.7",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "../../../lunatic-schema.json",
2
+ "$schema": "../../../../lunatic-schema.json",
3
3
  "cleaning": {
4
4
  "T_PRENOM": {
5
5
  "REMARQUES": "(PRENOM <> PRENOMREF)",
@@ -0,0 +1,29 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../../utils/Orchestrator';
6
+ import source from './source.json';
7
+
8
+ import { Meta } from '@storybook/react';
9
+ import { times } from '../../../utils/array';
10
+ import { dataFromObject } from '../../../utils/object';
11
+
12
+ const meta: Meta<typeof Orchestrator> = {
13
+ title: 'Behaviour/Performance',
14
+ ...OrchestratorMeta,
15
+ };
16
+
17
+ export default meta;
18
+
19
+ export const Default: OrchestratorStory = {
20
+ args: {
21
+ source,
22
+ data: dataFromObject({
23
+ PRENOM: times(200, (k) => `John${k}`),
24
+ NOM: times(200, (k) => `Doe${k}`),
25
+ AGE: times(200, (k) => k + 1),
26
+ BIRTHDAY: times(200, (k) => `2${k.toString().padStart(3, '0')}-01-01`),
27
+ }),
28
+ },
29
+ };
@@ -0,0 +1,34 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../../utils/Orchestrator';
6
+ import source from './source.json';
7
+ import sourceResizingCleaning from './source-resizing-cleaning.json';
8
+
9
+ import { Meta } from '@storybook/react';
10
+
11
+ import { dataFromObject } from '../../../utils/object';
12
+
13
+ const meta: Meta<typeof Orchestrator> = {
14
+ title: 'Behaviour/Resizing',
15
+ ...OrchestratorMeta,
16
+ };
17
+
18
+ export default meta;
19
+
20
+ export const Default: OrchestratorStory = {
21
+ args: {
22
+ source,
23
+ },
24
+ };
25
+
26
+ export const ResizingWithCleaning: OrchestratorStory = {
27
+ args: {
28
+ source: sourceResizingCleaning,
29
+ data: dataFromObject({
30
+ NBHAB: 2,
31
+ NAME: ['Jean', 'Paul'],
32
+ }),
33
+ },
34
+ };
@@ -0,0 +1,34 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../utils/Orchestrator';
6
+ import source from '../input/source.json';
7
+
8
+ import { Meta } from '@storybook/react';
9
+
10
+ const meta: Meta<typeof Orchestrator> = {
11
+ title: 'Behaviour/Slots',
12
+ ...OrchestratorMeta,
13
+ };
14
+
15
+ export default meta;
16
+
17
+ export const Default: OrchestratorStory = {
18
+ args: {
19
+ source,
20
+ slots: {
21
+ Input: ({ onChange, value, label }) => (
22
+ <label className="floating-label">
23
+ <input
24
+ placeholder="Nom de l'occupant"
25
+ className="input"
26
+ value={value ?? ''}
27
+ onChange={(e) => onChange(e.currentTarget.value)}
28
+ />
29
+ <span>{label}</span>
30
+ </label>
31
+ ),
32
+ },
33
+ },
34
+ };
@@ -0,0 +1,75 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../utils/Orchestrator';
6
+ import source from './source.json';
7
+ import sourceGroup from './sourceGroup.json';
8
+ import sourceGroupCondition from './sourceGroupCondition.json';
9
+ import sourceGroupDetail from './sourceGroupDetail.json';
10
+ import sourceGroupLoop from './sourceGroupLoop.json';
11
+ import sourceOne from './sourceOne.json';
12
+ import sourceOneDetail from './sourceOneDetail.json';
13
+
14
+ import { Meta } from '@storybook/react';
15
+
16
+ const meta: Meta<typeof Orchestrator> = {
17
+ title: 'Components/Checkbox',
18
+ ...OrchestratorMeta,
19
+ };
20
+
21
+ export default meta;
22
+
23
+ export const CheckboxBoolean: OrchestratorStory = {
24
+ args: {
25
+ source,
26
+ },
27
+ };
28
+
29
+ export const CheckboxGroup: OrchestratorStory = {
30
+ args: {
31
+ source: sourceGroup,
32
+ shortcut: true,
33
+ },
34
+ };
35
+
36
+ export const GroupWithCondition: OrchestratorStory = {
37
+ args: {
38
+ source: sourceGroupCondition,
39
+ shortcut: true,
40
+ },
41
+ };
42
+
43
+ export const CheckboxGroupReadOnly: OrchestratorStory = {
44
+ args: {
45
+ readOnly: true,
46
+ source: sourceGroup,
47
+ shortcut: true,
48
+ },
49
+ };
50
+
51
+ export const CheckboxGroupWithDetail: OrchestratorStory = {
52
+ args: {
53
+ source: sourceGroupDetail,
54
+ shortcut: true,
55
+ },
56
+ };
57
+
58
+ export const CheckboxGroupInLoop: OrchestratorStory = {
59
+ args: {
60
+ source: sourceGroupLoop,
61
+ shortcut: true,
62
+ },
63
+ };
64
+
65
+ export const CheckboxOne: OrchestratorStory = {
66
+ args: {
67
+ source: sourceOne,
68
+ },
69
+ };
70
+
71
+ export const CheckboxOneWithDetail: OrchestratorStory = {
72
+ args: {
73
+ source: sourceOneDetail,
74
+ },
75
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
- "maxPage": "5",
2
+ "maxPage": "1",
3
3
  "components": [
4
4
  {
5
5
  "id": "loop",
@@ -0,0 +1,21 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../utils/Orchestrator';
6
+
7
+ import source from './source.json';
8
+ import { Meta } from '@storybook/react';
9
+
10
+ const meta: Meta<typeof Orchestrator> = {
11
+ title: 'Components/Datepicker',
12
+ ...OrchestratorMeta,
13
+ };
14
+
15
+ export default meta;
16
+
17
+ export const Default: OrchestratorStory = {
18
+ args: {
19
+ source,
20
+ },
21
+ };
@@ -0,0 +1,27 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../utils/Orchestrator';
6
+ import source from './source.json';
7
+ import sourceMarkdown from './sourceMarkdown.json';
8
+ import { Meta } from '@storybook/react';
9
+
10
+ const meta: Meta<typeof Orchestrator> = {
11
+ title: 'Components/Declaration',
12
+ ...OrchestratorMeta,
13
+ };
14
+
15
+ export default meta;
16
+
17
+ export const Default: OrchestratorStory = {
18
+ args: {
19
+ source,
20
+ },
21
+ };
22
+
23
+ export const Markdown: OrchestratorStory = {
24
+ args: {
25
+ source: sourceMarkdown,
26
+ },
27
+ };
@@ -0,0 +1,27 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../utils/Orchestrator';
6
+ import source from './source.json';
7
+
8
+ import { Meta } from '@storybook/react';
9
+
10
+ import { dataFromObject } from '../../utils/object';
11
+
12
+ const meta: Meta<typeof Orchestrator> = {
13
+ title: 'Components/Dropdown',
14
+ ...OrchestratorMeta,
15
+ };
16
+
17
+ export default meta;
18
+
19
+ export const Default: OrchestratorStory = {
20
+ args: {
21
+ source,
22
+ data: dataFromObject({
23
+ STATE: '2',
24
+ STATE2: '3',
25
+ }),
26
+ },
27
+ };
@@ -0,0 +1,27 @@
1
+ import { Meta } from '@storybook/react';
2
+ import {
3
+ type Orchestrator,
4
+ OrchestratorMeta,
5
+ type OrchestratorStory,
6
+ } from '../utils/Orchestrator';
7
+ import sourceMonths from './sourceMonths.json';
8
+ import sourceTime from './sourceTime.json';
9
+
10
+ const meta: Meta<typeof Orchestrator> = {
11
+ title: 'Components/Duration',
12
+ ...OrchestratorMeta,
13
+ };
14
+
15
+ export default meta;
16
+
17
+ export const DateDuration: OrchestratorStory = {
18
+ args: {
19
+ source: sourceMonths,
20
+ },
21
+ };
22
+
23
+ export const TimeDuration: OrchestratorStory = {
24
+ args: {
25
+ source: sourceTime,
26
+ },
27
+ };
@@ -0,0 +1,28 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../utils/Orchestrator';
6
+ import source from './source.json';
7
+ import sourceOptions from './sourceOptions.json';
8
+
9
+ import { Meta } from '@storybook/react';
10
+
11
+ const meta: Meta<typeof Orchestrator> = {
12
+ title: 'Components/FilterDescription',
13
+ ...OrchestratorMeta,
14
+ };
15
+
16
+ export default meta;
17
+
18
+ export const Default: OrchestratorStory = {
19
+ args: {
20
+ source,
21
+ },
22
+ };
23
+
24
+ export const Options: OrchestratorStory = {
25
+ args: {
26
+ source: sourceOptions,
27
+ },
28
+ };
@@ -0,0 +1,21 @@
1
+ import {
2
+ type Orchestrator,
3
+ OrchestratorMeta,
4
+ type OrchestratorStory,
5
+ } from '../utils/Orchestrator';
6
+ import source from './source.json';
7
+
8
+ import { Meta } from '@storybook/react';
9
+
10
+ const meta: Meta<typeof Orchestrator> = {
11
+ title: 'Components/Input',
12
+ ...OrchestratorMeta,
13
+ };
14
+
15
+ export default meta;
16
+
17
+ export const Default: OrchestratorStory = {
18
+ args: {
19
+ source,
20
+ },
21
+ };