@inseefr/lunatic 3.6.1 → 3.6.3

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 (63) hide show
  1. package/components/PairwiseLinks/PairwiseLinks.js +2 -0
  2. package/components/PairwiseLinks/PairwiseLinks.js.map +1 -1
  3. package/components/shared/Checkbox/CheckboxOption.d.ts +1 -0
  4. package/components/shared/Checkbox/CheckboxOption.js +2 -2
  5. package/components/shared/Checkbox/CheckboxOption.js.map +1 -1
  6. package/components/shared/Radio/RadioOption.js +2 -2
  7. package/components/shared/Radio/RadioOption.js.map +1 -1
  8. package/components/type.d.ts +4 -1
  9. package/esm/components/PairwiseLinks/PairwiseLinks.js +2 -0
  10. package/esm/components/PairwiseLinks/PairwiseLinks.js.map +1 -1
  11. package/esm/components/shared/Checkbox/CheckboxOption.d.ts +1 -0
  12. package/esm/components/shared/Checkbox/CheckboxOption.js +2 -2
  13. package/esm/components/shared/Checkbox/CheckboxOption.js.map +1 -1
  14. package/esm/components/shared/Radio/RadioOption.js +2 -2
  15. package/esm/components/shared/Radio/RadioOption.js.map +1 -1
  16. package/esm/components/type.d.ts +4 -1
  17. package/esm/type.source.d.ts +3 -0
  18. package/esm/use-lunatic/commons/variables/behaviours/cleaning-behaviour.d.ts +7 -2
  19. package/esm/use-lunatic/commons/variables/behaviours/cleaning-behaviour.js +106 -33
  20. package/esm/use-lunatic/commons/variables/behaviours/cleaning-behaviour.js.map +1 -1
  21. package/esm/use-lunatic/commons/variables/get-questionnaire-data.js +2 -1
  22. package/esm/use-lunatic/commons/variables/get-questionnaire-data.js.map +1 -1
  23. package/esm/use-lunatic/commons/variables/lunatic-variables-store.js +8 -1
  24. package/esm/use-lunatic/commons/variables/lunatic-variables-store.js.map +1 -1
  25. package/esm/use-lunatic/commons/variables/lunatic-variables-store.spec.js +76 -2
  26. package/esm/use-lunatic/commons/variables/lunatic-variables-store.spec.js.map +1 -1
  27. package/esm/use-lunatic/props/getComponentTypeProps.d.ts +4 -1
  28. package/esm/use-lunatic/props/propOptions.d.ts +6 -2
  29. package/esm/use-lunatic/props/propOptions.js +9 -7
  30. package/esm/use-lunatic/props/propOptions.js.map +1 -1
  31. package/esm/use-lunatic/props/propOptions.spec.js +68 -0
  32. package/esm/use-lunatic/props/propOptions.spec.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/components/PairwiseLinks/PairwiseLinks.tsx +1 -0
  35. package/src/components/shared/Checkbox/CheckboxOption.tsx +3 -0
  36. package/src/components/shared/Radio/RadioOption.tsx +2 -0
  37. package/src/components/type.ts +4 -1
  38. package/src/stories/pairwise/source.json +4 -1
  39. package/src/stories/questionnaires/simpsons/source.json +6 -0
  40. package/src/type.source.ts +3 -0
  41. package/src/use-lunatic/commons/variables/behaviours/cleaning-behaviour.ts +120 -30
  42. package/src/use-lunatic/commons/variables/get-questionnaire-data.ts +4 -1
  43. package/src/use-lunatic/commons/variables/lunatic-variables-store.spec.ts +87 -2
  44. package/src/use-lunatic/commons/variables/lunatic-variables-store.ts +9 -1
  45. package/src/use-lunatic/props/propOptions.spec.ts +88 -0
  46. package/src/use-lunatic/props/propOptions.ts +10 -5
  47. package/tsconfig.build.tsbuildinfo +1 -1
  48. package/type.source.d.ts +3 -0
  49. package/use-lunatic/commons/variables/behaviours/cleaning-behaviour.d.ts +7 -2
  50. package/use-lunatic/commons/variables/behaviours/cleaning-behaviour.js +105 -32
  51. package/use-lunatic/commons/variables/behaviours/cleaning-behaviour.js.map +1 -1
  52. package/use-lunatic/commons/variables/get-questionnaire-data.js +2 -1
  53. package/use-lunatic/commons/variables/get-questionnaire-data.js.map +1 -1
  54. package/use-lunatic/commons/variables/lunatic-variables-store.js +8 -1
  55. package/use-lunatic/commons/variables/lunatic-variables-store.js.map +1 -1
  56. package/use-lunatic/commons/variables/lunatic-variables-store.spec.js +76 -2
  57. package/use-lunatic/commons/variables/lunatic-variables-store.spec.js.map +1 -1
  58. package/use-lunatic/props/getComponentTypeProps.d.ts +4 -1
  59. package/use-lunatic/props/propOptions.d.ts +6 -2
  60. package/use-lunatic/props/propOptions.js +6 -4
  61. package/use-lunatic/props/propOptions.js.map +1 -1
  62. package/use-lunatic/props/propOptions.spec.js +68 -0
  63. package/use-lunatic/props/propOptions.spec.js.map +1 -1
@@ -18,13 +18,15 @@ export type InterpretedOption = {
18
18
  description?: ReactNode;
19
19
  detailLabel?: ReactNode;
20
20
  detailValue?: string | null;
21
+ detailMaxLength?: number;
22
+ shouldBeFiltered?: boolean;
21
23
  onDetailChange?: (value: string) => void;
22
24
  onCheck?: () => void;
23
25
  onUncheck?: () => void;
24
26
  };
25
27
 
26
28
  /**
27
- * Compute options for checkboxes / radios
29
+ * Compute options for checkboxes / radios / dropdown
28
30
  */
29
31
  export function getOptionsProp(
30
32
  definition: DeepTranslateExpression<LunaticComponentDefinition>,
@@ -61,6 +63,7 @@ export function getOptionsProp(
61
63
  detailValue: response.detail?.response
62
64
  ? variables.get(response.detail.response.name, iteration)
63
65
  : undefined,
66
+ detailMaxLength: response.detail?.maxLength,
64
67
  onCheck: (checked: boolean) => {
65
68
  handleChanges([{ name: response.response.name, value: checked }]);
66
69
  },
@@ -108,6 +111,12 @@ export function getOptionsProp(
108
111
  value: option.value,
109
112
  checked: value === option.value,
110
113
  detailLabel: 'detail' in option ? option.detail?.label : undefined,
114
+ detailValue:
115
+ 'detail' in option && option.detail
116
+ ? variables.get(option.detail.response.name, iteration)
117
+ : null,
118
+ detailMaxLength:
119
+ 'detail' in option ? option.detail?.maxLength : undefined,
111
120
  onCheck: () => {
112
121
  handleChanges([
113
122
  { name: definition.response.name, value: option.value },
@@ -117,10 +126,6 @@ export function getOptionsProp(
117
126
  onUncheck: () => {
118
127
  handleChanges([{ name: definition.response.name, value: null }]);
119
128
  },
120
- detailValue:
121
- 'detail' in option && option.detail
122
- ? variables.get(option.detail.response.name, iteration)
123
- : null,
124
129
  onDetailChange:
125
130
  'detail' in option && option.detail
126
131
  ? (value: string) => {