@inseefr/lunatic 2.7.1 → 2.7.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 (177) hide show
  1. package/README.md +45 -11
  2. package/lib/components/checkbox/checkbox-boolean/html/checkbox-boolean.js +3 -3
  3. package/lib/components/checkbox/checkbox-boolean/lunatic-checkbox-boolean.js +2 -1
  4. package/lib/components/checkbox/checkbox-group/checkbox-group-content.js +0 -2
  5. package/lib/components/checkbox/checkbox-group/html/checkbox-group-content.js +4 -2
  6. package/lib/components/checkbox/checkbox-group/html/checkbox-group.js +3 -3
  7. package/lib/components/checkbox/checkbox-group/lunatic-checkbox-group.js +2 -2
  8. package/lib/components/checkbox/checkbox-one/lunatic-checkbox-one.js +2 -1
  9. package/lib/components/checkbox/commons/checkbox-option.js +3 -1
  10. package/lib/components/commons/components/combo-box/combo-box-container.js +1 -2
  11. package/lib/components/commons/components/combo-box/combo-box.js +2 -2
  12. package/lib/components/commons/components/combo-box/selection/LabelOrInput.js +3 -1
  13. package/lib/components/commons/components/combo-box/selection/input.js +3 -1
  14. package/lib/components/commons/components/combo-box/selection/selection.js +3 -1
  15. package/lib/components/commons/components/errors/errors.js +12 -10
  16. package/lib/components/commons/components/errors/errors.spec.js +6 -6
  17. package/lib/components/component-set/html/__snapshots__/component-set.spec.tsx.snap +2 -0
  18. package/lib/components/component-set/html/component-set.js +2 -2
  19. package/lib/components/datepicker/html/DatepickerField.js +47 -0
  20. package/lib/components/datepicker/html/__snapshots__/datepicker.spec.tsx.snap +209 -17
  21. package/lib/components/datepicker/html/datepicker.js +104 -21
  22. package/lib/components/datepicker/html/datepicker.scss +19 -1
  23. package/lib/components/datepicker/html/datepicker.spec.js +71 -23
  24. package/lib/components/datepicker/lunatic-datepicker.js +5 -2
  25. package/lib/components/dropdown/lunatic-dropdown.js +2 -1
  26. package/lib/components/duration/duration.js +6 -7
  27. package/lib/components/duration/duration.scss +6 -14
  28. package/lib/components/duration/durationInput.js +14 -8
  29. package/lib/components/duration/durationUtils.js +38 -8
  30. package/lib/components/input/html/__snapshots__/input.spec.tsx.snap +2 -0
  31. package/lib/components/input/html/input.js +3 -3
  32. package/lib/components/input/lunatic-input.js +2 -1
  33. package/lib/components/input-number/html/__snapshots__/input-number.spec.tsx.snap +2 -2
  34. package/lib/components/input-number/html/input-number-thousand.js +4 -17
  35. package/lib/components/input-number/html/input-number.js +3 -5
  36. package/lib/components/input-number/lunatic-input-number.js +2 -3
  37. package/lib/components/loop/block-for-loop.js +3 -3
  38. package/lib/components/loop/roster-for-loop/__snapshots__/roster-for-loop.spec.tsx.snap +88 -0
  39. package/lib/components/loop/roster-for-loop/roster-for-loop.js +7 -3
  40. package/lib/components/loop/roster-for-loop/roster-for-loop.spec.js +46 -0
  41. package/lib/components/lunatic-components.js +2 -11
  42. package/lib/components/radio/html/radio-group-content.js +4 -2
  43. package/lib/components/radio/html/radio-group.js +3 -3
  44. package/lib/components/radio/html/radio-option.js +3 -1
  45. package/lib/components/radio/lunatic-radio-group.js +2 -1
  46. package/lib/components/suggester/find-best-label/find-best-label.js +5 -5
  47. package/lib/components/suggester/idb-suggester/check-store.js +6 -3
  48. package/lib/components/suggester/idb-suggester/idb-suggester.js +8 -7
  49. package/lib/components/suggester/idb-suggester/suggester-status.js +1 -4
  50. package/lib/components/suggester/lunatic-suggester.js +7 -4
  51. package/lib/components/suggester/searching/create-searching.js +19 -42
  52. package/lib/components/suggester-loader-widget/loader-row.js +4 -2
  53. package/lib/components/suggester-loader-widget/loader.js +5 -4
  54. package/lib/components/suggester-loader-widget/widget.js +8 -8
  55. package/lib/components/switch/html/switch.js +2 -2
  56. package/lib/components/switch/lunatic-switch.js +2 -1
  57. package/lib/components/table/lunatic-table.js +2 -2
  58. package/lib/components/textarea/html/__snapshots__/textarea.spec.tsx.snap +2 -0
  59. package/lib/components/textarea/html/textarea.js +6 -4
  60. package/lib/components/textarea/lunatic-textarea.js +6 -3
  61. package/lib/hooks/use-auto-focus.js +26 -0
  62. package/lib/src/components/checkbox/checkbox-boolean/html/checkbox-boolean.d.ts +1 -1
  63. package/lib/src/components/checkbox/checkbox-group/html/checkbox-group-content.d.ts +2 -1
  64. package/lib/src/components/checkbox/checkbox-group/html/checkbox-group.d.ts +1 -1
  65. package/lib/src/components/checkbox/commons/checkbox-option.d.ts +1 -0
  66. package/lib/src/components/commons/components/combo-box/combo-box-container.d.ts +2 -2
  67. package/lib/src/components/commons/components/combo-box/combo-box.d.ts +2 -2
  68. package/lib/src/components/commons/components/combo-box/selection/LabelOrInput.d.ts +1 -0
  69. package/lib/src/components/commons/components/combo-box/selection/input.d.ts +1 -0
  70. package/lib/src/components/commons/components/combo-box/selection/selection.d.ts +2 -1
  71. package/lib/src/components/commons/components/errors/errors.d.ts +6 -3
  72. package/lib/src/components/datepicker/html/DatepickerField.d.ts +12 -0
  73. package/lib/src/components/datepicker/html/datepicker.d.ts +4 -3
  74. package/lib/src/components/datepicker/lunatic-datepicker.d.ts +1 -0
  75. package/lib/src/components/dropdown/html/dropdown-writable/dropdown-writable.d.ts +1 -1
  76. package/lib/src/components/dropdown/html/dropdown.d.ts +3 -1
  77. package/lib/src/components/duration/durationInput.d.ts +6 -2
  78. package/lib/src/components/duration/durationUtils.d.ts +24 -7
  79. package/lib/src/components/input/html/input.d.ts +2 -2
  80. package/lib/src/components/input-number/html/input-number-thousand.d.ts +2 -2
  81. package/lib/src/components/input-number/html/input-number.d.ts +2 -3
  82. package/lib/src/components/radio/html/radio-group-content.d.ts +2 -1
  83. package/lib/src/components/radio/html/radio-group.d.ts +1 -1
  84. package/lib/src/components/radio/html/radio-option.d.ts +1 -0
  85. package/lib/src/components/suggester/find-best-label/find-best-label.d.ts +1 -1
  86. package/lib/src/components/suggester/html/suggester.d.ts +1 -1
  87. package/lib/src/components/suggester/idb-suggester/check-store.d.ts +5 -2
  88. package/lib/src/components/suggester/idb-suggester/idb-suggester.d.ts +5 -2
  89. package/lib/src/components/suggester/idb-suggester/suggester-status.d.ts +1 -4
  90. package/lib/src/components/suggester/lunatic-suggester.d.ts +1 -1
  91. package/lib/src/components/suggester/searching/create-searching.d.ts +1 -1
  92. package/lib/src/components/suggester-loader-widget/loader-row.d.ts +2 -1
  93. package/lib/src/components/suggester-loader-widget/loader.d.ts +2 -1
  94. package/lib/src/components/suggester-loader-widget/widget.d.ts +3 -2
  95. package/lib/src/components/switch/html/switch.d.ts +1 -1
  96. package/lib/src/components/textarea/html/textarea.d.ts +3 -2
  97. package/lib/src/components/type.d.ts +5 -3
  98. package/lib/src/hooks/use-auto-focus.d.ts +6 -0
  99. package/lib/src/use-lunatic/actions.d.ts +2 -0
  100. package/lib/src/use-lunatic/commons/fill-components/fill-component-required.d.ts +383 -0
  101. package/lib/src/use-lunatic/commons/fill-components/fill-component-value.d.ts +1 -1
  102. package/lib/src/use-lunatic/commons/fill-components/fill-component-value.spec.d.ts +1 -0
  103. package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +20 -0
  104. package/lib/src/use-lunatic/commons/variables/lunatic-variables-store.d.ts +4 -0
  105. package/lib/src/use-lunatic/reducer/overview/overview-on-init.d.ts +1 -0
  106. package/lib/src/use-lunatic/type.d.ts +1 -0
  107. package/lib/src/use-lunatic/use-lunatic.d.ts +8 -3
  108. package/lib/src/use-lunatic/use-suggesters.d.ts +2 -1
  109. package/lib/src/utils/suggester-workers/append-to-index/create-append-task.d.ts +2 -2
  110. package/lib/src/utils/suggester-workers/worker-path.d.ts +6 -0
  111. package/lib/stories/behaviour/cleaning/source.json +151 -0
  112. package/lib/stories/behaviour/cleaning/test.stories.js +83 -0
  113. package/lib/stories/{questionnaires-test → behaviour}/controls/controls.stories.js +5 -5
  114. package/lib/stories/{questionnaires-test → behaviour/others}/test.stories.js +7 -7
  115. package/lib/stories/{paste-questionnaire → behaviour/paste}/test.stories.js +5 -4
  116. package/lib/stories/{resizing-questionnaire → behaviour/resizing}/test.stories.js +5 -4
  117. package/lib/stories/date-picker/datepicker.stories.js +32 -29
  118. package/lib/stories/duration/duration.stories.js +4 -4
  119. package/lib/stories/duration/{source.json → mois.json} +1 -1
  120. package/lib/stories/duration/{source1.json → time.json} +1 -1
  121. package/lib/stories/loop/not-paginated-loop.stories.js +35 -0
  122. package/lib/stories/loop/source-bloc.json +2 -2
  123. package/lib/stories/loop/source-not-paginated.json +138 -0
  124. package/lib/stories/loop/source-paginated.json +2 -2
  125. package/lib/stories/suggester/suggester.stories.js +6 -37
  126. package/lib/stories/utils/referentiel.js +38 -0
  127. package/lib/use-lunatic/commons/fill-components/fill-component-required.js +23 -0
  128. package/lib/use-lunatic/commons/fill-components/fill-component-value.js +1 -1
  129. package/lib/use-lunatic/commons/fill-components/fill-component-value.spec.js +67 -0
  130. package/lib/use-lunatic/commons/fill-components/fill-components.js +2 -1
  131. package/lib/use-lunatic/commons/fill-components/fill-from-state.js +2 -0
  132. package/lib/use-lunatic/commons/variables/lunatic-variables-store.js +15 -0
  133. package/lib/use-lunatic/commons/variables/lunatic-variables-store.spec.js +9 -1
  134. package/lib/use-lunatic/initial-state.js +2 -1
  135. package/lib/use-lunatic/reducer/reduce-on-init.js +4 -2
  136. package/lib/use-lunatic/use-lunatic.js +7 -3
  137. package/lib/use-lunatic/use-suggesters.js +55 -38
  138. package/lib/utils/env.js +9 -1
  139. package/lib/utils/suggester-workers/append-to-index/create-append-task.js +5 -4
  140. package/lib/utils/suggester-workers/create-worker.js +7 -1
  141. package/lib/utils/suggester-workers/worker-path.js +29 -0
  142. package/package.json +24 -11
  143. package/scripts/build/add-workers-to-public.js +44 -0
  144. package/scripts/build/workers-paths.js +45 -0
  145. package/workers-release/lunatic-append-worker-0.3.0.js +2 -0
  146. package/workers-release/lunatic-append-worker-0.3.0.js.LICENSE.txt +34 -0
  147. package/workers-release/lunatic-label-worker-0.3.0.js +2 -0
  148. package/workers-release/lunatic-label-worker-0.3.0.js.LICENSE.txt +13 -0
  149. package/workers-release/lunatic-search-worker-0.3.0.js +2 -0
  150. package/workers-release/lunatic-search-worker-0.3.0.js.LICENSE.txt +34 -0
  151. package/lib/components/datepicker/html/datepicker-container.js +0 -17
  152. package/lib/components/datepicker/html/datepicker-input.js +0 -35
  153. package/lib/env.d.js +0 -1
  154. package/lib/src/components/datepicker/html/datepicker-container.d.ts +0 -3
  155. package/lib/src/components/datepicker/html/datepicker-input.d.ts +0 -13
  156. package/lib/src/utils/get-component-value.d.ts +0 -5
  157. package/lib/src/utils/store-tools/worker-path.d.ts +0 -1
  158. package/lib/utils/get-component-value.js +0 -34
  159. package/lib/utils/get-component-value.test.js +0 -57
  160. package/lib/utils/store-tools/worker-path.js +0 -13
  161. package/lib/utils/suggester-workers/create-worker-ts.js +0 -54
  162. /package/lib/src/{utils/get-component-value.test.d.ts → components/loop/roster-for-loop/roster-for-loop.spec.d.ts} +0 -0
  163. /package/lib/src/utils/suggester-workers/{create-worker-ts.d.ts → create-worker.d.ts} +0 -0
  164. /package/lib/stories/{questionnaires-test → behaviour}/controls/V2_ControlesNonNum_horsBoucle_PasPageFin.json +0 -0
  165. /package/lib/stories/{questionnaires-test → behaviour}/controls/V2_ControlesNum_horsBoucle_PasPageFin.json +0 -0
  166. /package/lib/stories/{questionnaires-test → behaviour}/controls/V2_Controles_BouclesLiees2_PasPageFin.json +0 -0
  167. /package/lib/stories/{questionnaires-test → behaviour}/controls/V2_Controles_BouclesLiees_PasPageFin.json +0 -0
  168. /package/lib/stories/{questionnaires-test → behaviour}/controls/boucles-n.json +0 -0
  169. /package/lib/stories/{questionnaires-test → behaviour}/controls/controls-externes.json +0 -0
  170. /package/lib/stories/{questionnaires-test → behaviour}/controls/controls-externes.stories.js +0 -0
  171. /package/lib/stories/{questionnaires-test → behaviour/others}/V2_DeclarationsSimples.json +0 -0
  172. /package/lib/stories/{questionnaires-test → behaviour/others}/V2_MinMaxSum_Boucles.json +0 -0
  173. /package/lib/stories/{questionnaires-test → behaviour/others}/V2_QuestSimple_Boucles.json +0 -0
  174. /package/lib/stories/{questionnaires-test → behaviour/others}/V2_TCMRallyeGames.json +0 -0
  175. /package/lib/stories/{questionnaires-test → behaviour/others}/test-dylan.json +0 -0
  176. /package/lib/stories/{paste-questionnaire → behaviour/paste}/source.json +0 -0
  177. /package/lib/stories/{resizing-questionnaire → behaviour/resizing}/source.json +0 -0
@@ -1,8 +1,11 @@
1
1
  import './errors.scss';
2
2
  import type { LunaticError } from '../../../../use-lunatic/type';
3
3
  type Props = {
4
- errors?: Record<string, LunaticError[]>;
5
- activeId?: string;
4
+ errors?: LunaticError[];
6
5
  };
7
- declare function Errors({ errors, activeId }: Props): import("react/jsx-runtime").JSX.Element | null;
6
+ /**
7
+ * Display a list of error as simple red text
8
+ */
9
+ declare function Errors({ errors }: Props): import("react/jsx-runtime").JSX.Element | null;
10
+ export declare function getComponentErrors(errors?: Record<string, LunaticError[]>, componentId?: string): LunaticError[] | undefined;
8
11
  export default Errors;
@@ -0,0 +1,12 @@
1
+ type Props = {
2
+ id: string;
3
+ label: string;
4
+ description: string;
5
+ max?: number;
6
+ onChange: (value: number) => void;
7
+ value?: number;
8
+ readOnly?: boolean;
9
+ disabled?: boolean;
10
+ };
11
+ export declare function DatepickerField({ label, id, description, onChange, value, max, readOnly, disabled, }: Props): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -1,17 +1,18 @@
1
1
  import { type ReactNode } from 'react';
2
- import './datepicker.scss';
3
2
  import type { LunaticError } from '../../../use-lunatic/type';
3
+ import './datepicker.scss';
4
4
  type Props = {
5
5
  label?: ReactNode;
6
6
  description?: ReactNode;
7
- errors?: Record<string, LunaticError[]>;
7
+ errors?: LunaticError[];
8
8
  disabled?: boolean;
9
9
  readOnly?: boolean;
10
10
  min?: string;
11
11
  max?: string;
12
12
  id?: string;
13
13
  value?: string;
14
- onChange: (s: string) => void;
14
+ onChange: (s: string | null) => void;
15
+ format?: string;
15
16
  };
16
17
  declare const _default: import("react").ComponentType<Props>;
17
18
  export default _default;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  declare const _default: import("react").ComponentType<import("../type").LunaticBaseProps<string | null> & {
3
+ format: "YYYY-MM-DD" | "YYYY-MM" | "YYYY";
3
4
  min?: string | undefined;
4
5
  max?: string | undefined;
5
6
  response: {
@@ -9,7 +9,7 @@ type Props = {
9
9
  className?: string;
10
10
  value: string | null;
11
11
  label?: ReactNode;
12
- errors?: Record<string, LunaticError[]>;
12
+ errors?: LunaticError[];
13
13
  description?: ReactNode;
14
14
  readOnly?: boolean;
15
15
  };
@@ -1,10 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import './dropdown.scss';
3
3
  import type { LunaticComponentProps } from '../../type';
4
+ import type { LunaticError } from '../../../use-lunatic/type';
4
5
  export type DropdownProps = {
5
6
  onSelect: (v: string | null) => void;
6
7
  className?: string;
7
8
  readOnly?: boolean;
8
- } & Pick<LunaticComponentProps<'Dropdown'>, 'id' | 'disabled' | 'options' | 'writable' | 'value' | 'description' | 'label' | 'errors'>;
9
+ errors?: LunaticError[];
10
+ } & Pick<LunaticComponentProps<'Dropdown'>, 'id' | 'disabled' | 'options' | 'writable' | 'value' | 'description' | 'label'>;
9
11
  declare const _default: import("react").ComponentType<DropdownProps>;
10
12
  export default _default;
@@ -1,7 +1,11 @@
1
+ import { type ReactNode } from 'react';
1
2
  import { type Formats } from './durationUtils';
2
- declare const DurationInput: ({ value, format, onChange, }: {
3
+ type Props = {
4
+ label?: ReactNode;
5
+ id?: string;
3
6
  value: string | null;
4
7
  format: Formats;
5
8
  onChange: (s: string | null) => void;
6
- }) => import("react/jsx-runtime").JSX.Element;
9
+ };
10
+ declare const DurationInput: ({ value, format, onChange, label }: Props) => import("react/jsx-runtime").JSX.Element;
7
11
  export default DurationInput;
@@ -7,19 +7,35 @@ export type DurationValue = {
7
7
  export type Formats = 'PTnHnM' | 'PnYnM';
8
8
  export declare const propsByUnit: {
9
9
  hours: {
10
- min: string;
11
- max: string;
10
+ min: number;
11
+ max: number;
12
+ size: number;
13
+ style: {
14
+ width: string;
15
+ };
12
16
  };
13
17
  minutes: {
14
- min: string;
15
- max: string;
18
+ min: number;
19
+ max: number;
20
+ size: number;
21
+ style: {
22
+ width: string;
23
+ };
16
24
  };
17
25
  months: {
18
- min: string;
19
- max: string;
26
+ min: number;
27
+ max: number;
28
+ size: number;
29
+ style: {
30
+ width: string;
31
+ };
20
32
  };
21
33
  years: {
22
- min: string;
34
+ min: number;
35
+ size: number;
36
+ style: {
37
+ width: string;
38
+ };
23
39
  };
24
40
  };
25
41
  export declare const labelByUnit: {
@@ -28,3 +44,4 @@ export declare const labelByUnit: {
28
44
  months: string;
29
45
  years: string;
30
46
  };
47
+ export declare function clampDuration(value: number | null, unit: keyof typeof propsByUnit): number | null;
@@ -1,11 +1,11 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import './input.scss';
3
- import type { LunaticBaseProps } from '../../type';
3
+ import type { LunaticError } from '../../../use-lunatic/type';
4
4
  type Props = {
5
5
  label?: ReactNode;
6
6
  onChange: (v: string) => void;
7
7
  description?: string;
8
- errors: LunaticBaseProps['errors'];
8
+ errors?: LunaticError[];
9
9
  value?: string | null;
10
10
  disabled?: boolean;
11
11
  readOnly?: boolean;
@@ -6,9 +6,9 @@ type Props = {
6
6
  readOnly?: boolean;
7
7
  required?: boolean;
8
8
  labelId?: string;
9
- min?: number;
10
9
  max?: number;
11
10
  decimals?: number;
11
+ invalid?: boolean;
12
12
  };
13
- declare const InputNumberThousand: ({ id, onChange, value, disabled, readOnly, required, labelId, min, max, decimals, }: Props) => import("react/jsx-runtime").JSX.Element;
13
+ declare const InputNumberThousand: ({ id, onChange, value, disabled, readOnly, required, labelId, max, decimals, invalid, }: Props) => import("react/jsx-runtime").JSX.Element;
14
14
  export default InputNumberThousand;
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
- import { type LunaticBaseProps } from '../../type';
3
2
  import './input-number.scss';
3
+ import type { LunaticError } from '../../../use-lunatic/type';
4
4
  type Props = {
5
5
  id?: string;
6
6
  onChange?: (n: number | null) => void;
@@ -9,13 +9,12 @@ type Props = {
9
9
  readOnly?: boolean;
10
10
  required?: boolean;
11
11
  labelId?: string;
12
- min?: number;
13
12
  max?: number;
14
13
  decimals?: number;
15
14
  label?: ReactNode;
16
15
  description?: string;
17
16
  unit?: string;
18
- errors?: LunaticBaseProps['errors'];
17
+ errors?: LunaticError[];
19
18
  };
20
19
  declare const _default: import("react").ComponentType<Props>;
21
20
  export default _default;
@@ -13,6 +13,7 @@ export type Props = {
13
13
  shortcut?: boolean;
14
14
  disabled?: boolean;
15
15
  readOnly?: boolean;
16
+ invalid?: boolean;
16
17
  };
17
- declare function RadioGroupContent({ options, value, id, onClick, checkboxStyle, shortcut, disabled, readOnly, }: Props): import("react/jsx-runtime").JSX.Element;
18
+ declare function RadioGroupContent({ options, value, id, onClick, checkboxStyle, shortcut, disabled, readOnly, invalid, }: Props): import("react/jsx-runtime").JSX.Element;
18
19
  export default RadioGroupContent;
@@ -13,7 +13,7 @@ export type RadioGroupProps = {
13
13
  label?: ReactNode;
14
14
  onSelect: (v: string | null) => void;
15
15
  checkboxStyle?: boolean;
16
- errors?: Record<string, LunaticError[]>;
16
+ errors?: LunaticError[];
17
17
  className?: string;
18
18
  shortcut?: boolean;
19
19
  disabled?: boolean;
@@ -17,6 +17,7 @@ export type Props = {
17
17
  labelledBy?: string;
18
18
  label?: ReactNode;
19
19
  codeModality?: string;
20
+ invalid?: boolean;
20
21
  };
21
22
  declare const _default: import("react").ComponentType<Props>;
22
23
  export default _default;
@@ -1,2 +1,2 @@
1
- declare function findBestLabel(option: unknown, search: unknown): Promise<unknown>;
1
+ declare function findBestLabel(option: unknown, search: unknown, workersBasePath?: string): Promise<unknown>;
2
2
  export default findBestLabel;
@@ -19,7 +19,7 @@ type Props = {
19
19
  }>;
20
20
  label?: ReactNode;
21
21
  description?: ReactNode;
22
- errors?: Record<string, LunaticError[]>;
22
+ errors?: LunaticError[];
23
23
  };
24
24
  declare const _default: import("react").ComponentType<Props>;
25
25
  export default _default;
@@ -2,7 +2,10 @@ import { type PropsWithChildren } from 'react';
2
2
  type Props = PropsWithChildren<{
3
3
  storeName: string;
4
4
  version: number;
5
- setStore: (v: any) => void;
5
+ onInfo: (v: any) => void;
6
6
  }>;
7
- declare function CheckStore({ storeName, version, setStore, children }: Props): import("react/jsx-runtime").JSX.Element;
7
+ /**
8
+ * Check the store info displaying a message while it is fetching
9
+ */
10
+ declare function CheckStore({ storeName, version, onInfo, children }: Props): import("react/jsx-runtime").JSX.Element;
8
11
  export default CheckStore;
@@ -1,6 +1,9 @@
1
+ import type { LunaticError } from '../../../use-lunatic/type';
1
2
  import type { LunaticComponentProps } from '../../type';
2
- type Props = Pick<LunaticComponentProps<'Suggester'>, 'storeName' | 'idbVersion' | 'id' | 'className' | 'optionRenderer' | 'labelRenderer' | 'disabled' | 'readOnly' | 'value' | 'label' | 'description' | 'getSuggesterStatus' | 'errors'> & {
3
+ type Props = Pick<LunaticComponentProps<'Suggester'>, 'storeName' | 'idbVersion' | 'id' | 'className' | 'optionRenderer' | 'labelRenderer' | 'disabled' | 'readOnly' | 'value' | 'label' | 'description' | 'getSuggesterStatus'> & {
4
+ errors?: LunaticError[];
3
5
  onSelect: (v: string | null) => void;
6
+ workersBasePath?: string;
4
7
  };
5
- export declare function IDBSuggester({ storeName, idbVersion, id, className, optionRenderer, labelRenderer, onSelect, disabled, value, label, description, getSuggesterStatus, errors, readOnly, }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export declare function IDBSuggester({ storeName, idbVersion, id, className, optionRenderer, labelRenderer, onSelect, disabled, value, label, description, getSuggesterStatus, errors, readOnly, workersBasePath, }: Props): import("react/jsx-runtime").JSX.Element;
6
9
  export {};
@@ -17,10 +17,7 @@ type Props = PropsWithChildren<{
17
17
  description?: ReactNode;
18
18
  }>;
19
19
  /**
20
- * Component witch check status of loading process.
21
- * it notifies users through SuggesterNotification, a customizable component.
22
- * @param {} param0
23
- * @returns
20
+ * Check the status of suggester status and shows a warning / error
24
21
  */
25
22
  export declare function SuggesterStatus({ children, storeName, getSuggesterStatus, label, description, }: Props): import("react/jsx-runtime").JSX.Element;
26
23
  export {};
@@ -1,3 +1,3 @@
1
1
  import type { LunaticComponentProps } from '../type';
2
- declare function LunaticSuggester({ id, storeName, optionRenderer, labelRenderer, idbVersion, focused, value, handleChange, disabled, readOnly, errors, label, description, preferences, declarations, missing, missingResponse, management, response, className, getSuggesterStatus, }: LunaticComponentProps<'Suggester'>): import("react/jsx-runtime").JSX.Element;
2
+ declare function LunaticSuggester({ id, storeName, optionRenderer, labelRenderer, idbVersion, focused, value, handleChange, disabled, readOnly, errors, label, description, preferences, declarations, missing, missingResponse, management, response, className, getSuggesterStatus, workersBasePath, }: LunaticComponentProps<'Suggester'>): import("react/jsx-runtime").JSX.Element;
3
3
  export default LunaticSuggester;
@@ -1,6 +1,6 @@
1
1
  import type { ComboBoxOptionType } from '../../commons/components/combo-box/combo-box.type';
2
2
  export declare function isWorkerCompatible(): boolean;
3
- declare function createSearching(name: string, version: string): (search: string | null) => Promise<{
3
+ declare function createSearching(name: string, version: string, workersBasePath?: string): (search: string | null) => Promise<{
4
4
  results: ComboBoxOptionType[];
5
5
  }>;
6
6
  export default createSearching;
@@ -1,10 +1,11 @@
1
1
  import type { SuggesterType } from '../../use-lunatic/type-source';
2
2
  type Props = {
3
3
  storeInfo: SuggesterType;
4
+ workersBasePath?: string;
4
5
  idbVersion: number;
5
6
  fetchStore: () => Promise<unknown[]>;
6
7
  disabled?: boolean;
7
8
  onRefresh: (s: string) => void;
8
9
  };
9
- declare function LoaderRow({ storeInfo, idbVersion, fetchStore, onRefresh, disabled, }: Props): import("react/jsx-runtime").JSX.Element;
10
+ declare function LoaderRow({ storeInfo, workersBasePath, idbVersion, fetchStore, onRefresh, disabled, }: Props): import("react/jsx-runtime").JSX.Element;
10
11
  export default LoaderRow;
@@ -7,6 +7,7 @@ type Props = {
7
7
  handleClick: (n: number) => void;
8
8
  start?: boolean;
9
9
  store: SuggesterType;
10
+ workersBasePath?: string;
10
11
  };
11
- declare function Loader({ start, db, store, idbVersion, fetch, post, handleClick, }: Props): import("react/jsx-runtime").JSX.Element;
12
+ declare function Loader({ start, db, store, workersBasePath, idbVersion, fetch, post, handleClick, }: Props): import("react/jsx-runtime").JSX.Element;
12
13
  export default Loader;
@@ -1,15 +1,16 @@
1
- import './widget.scss';
2
1
  import type { SuggesterType } from '../../use-lunatic/type-source';
2
+ import './widget.scss';
3
3
  type Props = {
4
4
  absolute?: boolean;
5
5
  source: {
6
6
  suggesters: Array<SuggesterType>;
7
7
  };
8
+ workersBasePath?: string;
8
9
  onRefresh: () => void;
9
10
  getStoreInfo: (s: string) => {
10
11
  idbVersion: number;
11
12
  fetch: () => Promise<unknown[]>;
12
13
  };
13
14
  };
14
- declare function SuggesterLoaderWidget({ source, getStoreInfo, onRefresh, absolute, }: Props): import("react/jsx-runtime").JSX.Element;
15
+ declare function SuggesterLoaderWidget({ source, workersBasePath, getStoreInfo, onRefresh, absolute, }: Props): import("react/jsx-runtime").JSX.Element;
15
16
  export default SuggesterLoaderWidget;
@@ -11,7 +11,7 @@ type Props = {
11
11
  onClick: (v: boolean) => void;
12
12
  id: string;
13
13
  label: ReactNode;
14
- errors?: Record<string, LunaticError[]>;
14
+ errors?: LunaticError[];
15
15
  };
16
16
  declare const _default: import("react").ComponentType<Props>;
17
17
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import './textarea.scss';
3
- import type { LunaticBaseProps } from '../../type';
3
+ import { type LunaticError } from '../../../use-lunatic/type';
4
4
  type Props = {
5
5
  id?: string;
6
6
  rows?: number;
@@ -11,8 +11,9 @@ type Props = {
11
11
  label?: ReactNode;
12
12
  value?: string | number | null;
13
13
  description?: string;
14
- errors?: LunaticBaseProps['errors'];
14
+ errors?: LunaticError[];
15
15
  readOnly?: boolean;
16
+ required?: boolean;
16
17
  };
17
18
  declare const _default: import("react").ComponentType<Props>;
18
19
  export default _default;
@@ -1,8 +1,8 @@
1
- import type { LunaticComponentDefinition, LunaticError, LunaticState } from '../use-lunatic/type';
2
1
  import type { CSSProperties, FunctionComponent, ReactNode } from 'react';
3
- import { SuggesterStatus } from '../use-lunatic/use-suggesters';
4
2
  import useLunatic from '../use-lunatic';
5
3
  import type { FilledLunaticComponentProps } from '../use-lunatic/commons/fill-components/fill-components';
4
+ import type { LunaticComponentDefinition, LunaticError, LunaticState } from '../use-lunatic/type';
5
+ import { SuggesterStatus } from '../use-lunatic/use-suggesters';
6
6
  type Formats = 'PTnHnM' | 'PnYnM';
7
7
  export type VtlExpression = {
8
8
  value: string;
@@ -60,7 +60,7 @@ export type SuggesterOption = {
60
60
  };
61
61
  type ComponentPropsByType = {
62
62
  InputNumber: LunaticBaseProps<number | null> & {
63
- min: number;
63
+ min?: number;
64
64
  max: number;
65
65
  decimals: number;
66
66
  unit?: string;
@@ -129,6 +129,7 @@ type ComponentPropsByType = {
129
129
  iteration: LunaticState['pager']['iteration'];
130
130
  };
131
131
  Datepicker: LunaticBaseProps<string | null> & {
132
+ format: 'YYYY-MM-DD' | 'YYYY-MM' | 'YYYY';
132
133
  min?: string;
133
134
  max?: string;
134
135
  response: {
@@ -236,6 +237,7 @@ type ComponentPropsByType = {
236
237
  };
237
238
  Suggester: LunaticBaseProps<string | null> & {
238
239
  storeName: string;
240
+ workersBasePath?: string;
239
241
  getSuggesterStatus: (name: string) => {
240
242
  status: SuggesterStatus;
241
243
  timestamp: number;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Focus the first focusable element in the wrapper when the "key" changes and is defined
3
+ */
4
+ export declare function useAutoFocus(wrapperRef: {
5
+ current: HTMLDivElement | null;
6
+ }, key?: string): void;
@@ -40,6 +40,7 @@ export type ActionInit = {
40
40
  goNextPage: () => void;
41
41
  goPreviousPage: () => void;
42
42
  withOverview: boolean;
43
+ workersBasePath?: string;
43
44
  };
44
45
  };
45
46
  export type ActionOnSetWaiting = {
@@ -100,6 +101,7 @@ export declare const onInit: (payload: {
100
101
  goNextPage: () => void;
101
102
  goPreviousPage: () => void;
102
103
  withOverview: boolean;
104
+ workersBasePath?: string | undefined;
103
105
  }) => ActionInit & {
104
106
  type: ActionKind.ON_INIT;
105
107
  };