@inseefr/lunatic 3.0.0-rc.1 → 3.0.0-rc.6

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 (104) hide show
  1. package/lib/components/CheckboxBoolean/CheckboxBoolean.js +39 -19
  2. package/lib/components/CheckboxGroup/CustomCheckboxGroup.js +2 -2
  3. package/lib/components/CheckboxOne/CheckboxOne.js +6 -6
  4. package/lib/components/Datepicker/Datepicker.js +43 -28
  5. package/lib/components/Dropdown/Dropdown.js +40 -23
  6. package/lib/components/Duration/Duration.js +41 -16
  7. package/lib/components/FilterDescription/FilterDescription.js +2 -3
  8. package/lib/components/Input/Input.js +39 -21
  9. package/lib/components/InputNumber/InputNumber.js +45 -34
  10. package/lib/components/InputNumber/__snapshots__/InputNumber.spec.tsx.snap +0 -2
  11. package/lib/components/Loop/Loop.js +52 -29
  12. package/lib/components/LunaticComponents.js +42 -37
  13. package/lib/components/Question/Question.js +23 -14
  14. package/lib/components/Radio/Radio.js +2 -2
  15. package/lib/components/RosterForLoop/RosterForLoop.js +13 -35
  16. package/lib/components/Roundabout/CustomRoundabout.js +2 -2
  17. package/lib/components/Roundabout/RoundaboutItButton.js +2 -2
  18. package/lib/components/Roundabout/extra.js +6 -6
  19. package/lib/components/Sequence/Sequence.js +2 -2
  20. package/lib/components/Subsequence/Subsequence.js +2 -2
  21. package/lib/components/Suggester/CustomSuggester.js +2 -2
  22. package/lib/components/Suggester/SuggesterNotification.js +2 -2
  23. package/lib/components/Summary/Summary.js +3 -3
  24. package/lib/components/Switch/Switch.js +42 -22
  25. package/lib/components/Textarea/Textarea.js +43 -23
  26. package/lib/components/library.js +0 -2
  27. package/lib/components/shared/Button/Button.js +2 -2
  28. package/lib/components/shared/Checkbox/CheckboxOption.js +2 -2
  29. package/lib/components/shared/Combobox/Combobox.js +2 -2
  30. package/lib/components/shared/Combobox/ComboboxContainer.js +2 -2
  31. package/lib/components/shared/Combobox/ComboboxContentBox.js +2 -2
  32. package/lib/components/shared/Combobox/Panel/ComboboxOption.js +2 -2
  33. package/lib/components/shared/Combobox/Panel/ComboboxPanelContainer.js +2 -2
  34. package/lib/components/shared/Combobox/Selection/ComboboxClearButton.js +2 -2
  35. package/lib/components/shared/Combobox/Selection/ComboboxInput.js +2 -2
  36. package/lib/components/shared/Combobox/Selection/ComboboxLabelSelection.js +2 -2
  37. package/lib/components/shared/Declarations/Declarations.js +3 -3
  38. package/lib/components/shared/Fieldset/Fieldset.js +2 -2
  39. package/lib/components/shared/HOC/{customizedComponent.js → slottableComponent.js} +35 -13
  40. package/lib/components/shared/Label/Label.js +2 -2
  41. package/lib/components/shared/MDLabel/RouterLink.js +2 -2
  42. package/lib/components/shared/Notification.js +2 -2
  43. package/lib/components/shared/Radio/RadioGroup.js +4 -3
  44. package/lib/components/shared/Radio/RadioOption.js +2 -2
  45. package/lib/components/shared/Table/Table.js +2 -2
  46. package/lib/components/shared/Table/Tbody.js +2 -2
  47. package/lib/components/shared/Table/Td.js +2 -2
  48. package/lib/components/shared/Table/Th.js +2 -2
  49. package/lib/components/shared/Table/Thead.js +2 -2
  50. package/lib/components/shared/Table/Tr.js +2 -2
  51. package/lib/src/components/CheckboxBoolean/CheckboxBoolean.d.ts +10 -5
  52. package/lib/src/components/CheckboxOne/CheckboxOne.d.ts +5 -11
  53. package/lib/src/components/Datepicker/Datepicker.d.ts +8 -9
  54. package/lib/src/components/Dropdown/Dropdown.d.ts +9 -11
  55. package/lib/src/components/Duration/Duration.d.ts +9 -6
  56. package/lib/src/components/FilterDescription/FilterDescription.d.ts +1 -1
  57. package/lib/src/components/Input/Input.d.ts +9 -7
  58. package/lib/src/components/InputNumber/InputNumber.d.ts +9 -9
  59. package/lib/src/components/Loop/Loop.d.ts +11 -18
  60. package/lib/src/components/LunaticComponents.d.ts +4 -2
  61. package/lib/src/components/Question/Question.d.ts +6 -4
  62. package/lib/src/components/RosterForLoop/RosterForLoop.d.ts +2 -21
  63. package/lib/src/components/Switch/Switch.d.ts +9 -0
  64. package/lib/src/components/Textarea/Textarea.d.ts +9 -9
  65. package/lib/src/components/library.d.ts +24 -91
  66. package/lib/src/components/shared/HOC/slottableComponent.d.ts +101 -0
  67. package/lib/src/components/shared/Radio/RadioGroup.d.ts +1 -0
  68. package/lib/src/components/type.d.ts +0 -5
  69. package/lib/src/index.d.ts +1 -1
  70. package/lib/src/use-lunatic/commons/fill-components/fill-component-required.d.ts +18 -33
  71. package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +0 -37
  72. package/lib/src/use-lunatic/commons/fill-components/fill-iterations.d.ts +16 -18
  73. package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +4 -52
  74. package/lib/src/use-lunatic/commons/use-components-from-state.d.ts +1 -1
  75. package/lib/src/use-lunatic/lunatic-context.d.ts +1 -4
  76. package/lib/src/use-lunatic/replace-component-sequence.d.ts +3 -3
  77. package/lib/src/use-lunatic/type-source.d.ts +1 -5
  78. package/lib/src/use-lunatic/use-lunatic.d.ts +8 -19
  79. package/lib/stories/{component-set/component-set.stories.js → behaviour/slots.stories.js} +36 -25
  80. package/lib/stories/checkbox-group/checkbox-group.stories.js +1 -6
  81. package/lib/stories/disabled/source.json +1 -1
  82. package/lib/stories/pairwise/pairwise-links.stories.js +1 -9
  83. package/lib/stories/suggester/suggester.stories.js +1 -8
  84. package/lib/stories/utils/orchestrator.js +4 -4
  85. package/lib/use-lunatic/commons/fill-components/fill-specific-expression.js +0 -1
  86. package/lib/use-lunatic/lunatic-context.js +2 -10
  87. package/lib/use-lunatic/replace-component-sequence.js +2 -3
  88. package/lib/use-lunatic/use-lunatic.js +1 -4
  89. package/lib/use-lunatic/use-lunatic.test.js +4 -30
  90. package/package.json +1 -1
  91. package/lib/components/ComponentSet/ComponentSet.js +0 -68
  92. package/lib/components/type-custom.js +0 -5
  93. package/lib/src/components/ComponentSet/ComponentSet.d.ts +0 -7
  94. package/lib/src/components/shared/HOC/customizedComponent.d.ts +0 -5
  95. package/lib/src/components/type-custom.d.ts +0 -101
  96. package/lib/stories/checkbox-group/sourceComponentset.json +0 -424
  97. package/lib/stories/component-set/data-loop.json +0 -18
  98. package/lib/stories/component-set/data-roundabout.json +0 -25
  99. package/lib/stories/component-set/data.json +0 -25
  100. package/lib/stories/component-set/source-loop.json +0 -308
  101. package/lib/stories/component-set/source-roundabout.json +0 -434
  102. package/lib/stories/component-set/source.json +0 -113
  103. package/lib/stories/pairwise/source-componentset.json +0 -292
  104. package/lib/stories/suggester/source-component-set.json +0 -113
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Notification = void 0;
7
7
  var _classnames = _interopRequireDefault(require("classnames"));
8
- var _customizedComponent = require("./HOC/customizedComponent");
8
+ var _slottableComponent = require("./HOC/slottableComponent");
9
9
  var _jsxRuntime = require("react/jsx-runtime");
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
11
  function LunaticNotification(_ref) {
@@ -26,4 +26,4 @@ function LunaticNotification(_ref) {
26
26
  })
27
27
  });
28
28
  }
29
- var Notification = exports.Notification = (0, _customizedComponent.customizedComponent)('Notification', LunaticNotification);
29
+ var Notification = exports.Notification = (0, _slottableComponent.slottableComponent)('Notification', LunaticNotification);
@@ -7,7 +7,7 @@ exports.RadioGroup = void 0;
7
7
  require("./RadioGroup.scss");
8
8
  var _Fieldset = require("../Fieldset/Fieldset");
9
9
  var _ComponentErrors = require("../ComponentErrors/ComponentErrors");
10
- var _customizedComponent = require("../HOC/customizedComponent");
10
+ var _slottableComponent = require("../HOC/slottableComponent");
11
11
  var _getShortcutKey = require("../Checkbox/getShortcutKey");
12
12
  var _RadioOption = require("./RadioOption");
13
13
  var _useListKeyboardHandler = require("../../../hooks/useListKeyboardHandler");
@@ -35,7 +35,8 @@ function LunaticRadioGroup(_ref) {
35
35
  className = _ref.className,
36
36
  shortcut = _ref.shortcut,
37
37
  disabled = _ref.disabled,
38
- readOnly = _ref.readOnly;
38
+ readOnly = _ref.readOnly,
39
+ clearable = _ref.clearable;
39
40
  var onKeyDown = (0, _useListKeyboardHandler.useListKeyboardHandler)(options, onSelect);
40
41
  var maxIndex = options.length;
41
42
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Fieldset.Fieldset, {
@@ -64,4 +65,4 @@ function LunaticRadioGroup(_ref) {
64
65
  })]
65
66
  });
66
67
  }
67
- var RadioGroup = exports.RadioGroup = (0, _customizedComponent.customizedComponent)('Radio', LunaticRadioGroup);
68
+ var RadioGroup = exports.RadioGroup = (0, _slottableComponent.slottableComponent)('RadioGroup', LunaticRadioGroup);
@@ -9,7 +9,7 @@ var _react = require("react");
9
9
  var _reactKeyboardEventHandler = _interopRequireDefault(require("react-keyboard-event-handler"));
10
10
  var _function = require("../../../utils/function");
11
11
  var _Label = require("../Label/Label");
12
- var _customizedComponent = require("../HOC/customizedComponent");
12
+ var _slottableComponent = require("../HOC/slottableComponent");
13
13
  var _Icons = require("../Icons");
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -113,4 +113,4 @@ function getIcon(checked, checkboxStyle) {
113
113
  }
114
114
  return _Icons.RadioUncheckedIcon;
115
115
  }
116
- var RadioOption = exports.RadioOption = (0, _customizedComponent.customizedComponent)('RadioOption', LunaticRadioOption);
116
+ var RadioOption = exports.RadioOption = (0, _slottableComponent.slottableComponent)('RadioOption', LunaticRadioOption);
@@ -7,7 +7,7 @@ exports.Table = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _classnames = _interopRequireDefault(require("classnames"));
9
9
  require("./Table.scss");
10
- var _customizedComponent = require("../HOC/customizedComponent");
10
+ var _slottableComponent = require("../HOC/slottableComponent");
11
11
  var _jsxRuntime = require("react/jsx-runtime");
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
13
  function LunaticTable(_ref) {
@@ -20,4 +20,4 @@ function LunaticTable(_ref) {
20
20
  children: children
21
21
  });
22
22
  }
23
- var Table = exports.Table = (0, _customizedComponent.customizedComponent)('Table', LunaticTable);
23
+ var Table = exports.Table = (0, _slottableComponent.slottableComponent)('Table', LunaticTable);
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Tbody = void 0;
7
7
  var _classnames = _interopRequireDefault(require("classnames"));
8
- var _customizedComponent = require("../HOC/customizedComponent");
8
+ var _slottableComponent = require("../HOC/slottableComponent");
9
9
  var _jsxRuntime = require("react/jsx-runtime");
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
11
  function LunaticTbody(_ref) {
@@ -18,4 +18,4 @@ function LunaticTbody(_ref) {
18
18
  children: children
19
19
  });
20
20
  }
21
- var Tbody = exports.Tbody = (0, _customizedComponent.customizedComponent)('Tbody', LunaticTbody);
21
+ var Tbody = exports.Tbody = (0, _slottableComponent.slottableComponent)('Tbody', LunaticTbody);
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Td = void 0;
7
7
  var _classnames = _interopRequireDefault(require("classnames"));
8
- var _customizedComponent = require("../HOC/customizedComponent");
8
+ var _slottableComponent = require("../HOC/slottableComponent");
9
9
  var _jsxRuntime = require("react/jsx-runtime");
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
11
  function LunaticTd(_ref) {
@@ -24,4 +24,4 @@ function LunaticTd(_ref) {
24
24
  children: children
25
25
  });
26
26
  }
27
- var Td = exports.Td = (0, _customizedComponent.customizedComponent)('Td', LunaticTd);
27
+ var Td = exports.Td = (0, _slottableComponent.slottableComponent)('Td', LunaticTd);
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Th = void 0;
7
7
  var _classnames = _interopRequireDefault(require("classnames"));
8
- var _customizedComponent = require("../HOC/customizedComponent");
8
+ var _slottableComponent = require("../HOC/slottableComponent");
9
9
  var _jsxRuntime = require("react/jsx-runtime");
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
11
  function LunaticTh(_ref) {
@@ -23,4 +23,4 @@ function LunaticTh(_ref) {
23
23
  children: children
24
24
  });
25
25
  }
26
- var Th = exports.Th = (0, _customizedComponent.customizedComponent)('Th', LunaticTh);
26
+ var Th = exports.Th = (0, _slottableComponent.slottableComponent)('Th', LunaticTh);
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Thead = void 0;
7
7
  var _classnames = _interopRequireDefault(require("classnames"));
8
- var _customizedComponent = require("../HOC/customizedComponent");
8
+ var _slottableComponent = require("../HOC/slottableComponent");
9
9
  var _jsxRuntime = require("react/jsx-runtime");
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
11
  function LunaticThead(_ref) {
@@ -18,4 +18,4 @@ function LunaticThead(_ref) {
18
18
  children: children
19
19
  });
20
20
  }
21
- var Thead = exports.Thead = (0, _customizedComponent.customizedComponent)('Thead', LunaticThead);
21
+ var Thead = exports.Thead = (0, _slottableComponent.slottableComponent)('Thead', LunaticThead);
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Tr = void 0;
7
7
  var _classnames = _interopRequireDefault(require("classnames"));
8
- var _customizedComponent = require("../HOC/customizedComponent");
8
+ var _slottableComponent = require("../HOC/slottableComponent");
9
9
  var _jsxRuntime = require("react/jsx-runtime");
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
11
  function LunaticTr(_ref) {
@@ -19,4 +19,4 @@ function LunaticTr(_ref) {
19
19
  children: children
20
20
  });
21
21
  }
22
- var Tr = exports.Tr = (0, _customizedComponent.customizedComponent)('Tr', LunaticTr);
22
+ var Tr = exports.Tr = (0, _slottableComponent.slottableComponent)('Tr', LunaticTr);
@@ -1,6 +1,11 @@
1
1
  /// <reference types="react" />
2
- export declare const CheckboxBoolean: import("react").ComponentType<import("../type").LunaticBaseProps<boolean> & {
3
- response: {
4
- name: string;
5
- };
6
- }>;
2
+ import type { LunaticComponentProps } from '../type';
3
+ import type { LunaticError } from '../../use-lunatic/type';
4
+ export declare function CheckboxBoolean({ handleChange, response, errors, value, ...props }: LunaticComponentProps<'CheckboxBoolean'>): import("react/jsx-runtime").JSX.Element;
5
+ type CustomProps = Omit<LunaticComponentProps<'CheckboxBoolean'>, 'response' | 'handleChange' | 'errors' | 'value'> & {
6
+ onChange: () => void;
7
+ errors?: LunaticError[];
8
+ checked?: boolean;
9
+ };
10
+ export declare const CustomCheckboxBoolean: import("react").ComponentType<CustomProps>;
11
+ export {};
@@ -1,12 +1,6 @@
1
- /// <reference types="react" />
2
1
  import './CheckboxOne.scss';
3
- export declare const CheckboxOne: import("react").ComponentType<import("../type").LunaticBaseProps<string | null> & {
4
- options: {
5
- description?: import("react").ReactNode;
6
- label: import("react").ReactNode;
7
- value: string;
8
- }[];
9
- response: {
10
- name: string;
11
- };
12
- }>;
2
+ import type { LunaticComponentProps } from '../type';
3
+ /**
4
+ * Checkbox acting as a radio (only one option can be checked at a time)
5
+ */
6
+ export declare function CheckboxOne({ options, value, id, label, description, handleChange, errors, shortcut, response, }: LunaticComponentProps<'CheckboxOne'>): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import './Datepicker.scss';
3
3
  import type { LunaticComponentProps } from '../type';
4
- export declare function LunaticDatepicker({ disabled, readOnly, value, dateFormat, response, id, handleChange, label, errors, description, declarations, }: LunaticComponentProps<'Datepicker'>): import("react/jsx-runtime").JSX.Element;
5
- export declare const Datepicker: import("react").ComponentType<import("../type").LunaticBaseProps<string | null> & {
6
- dateFormat: "YYYY-MM-DD" | "YYYY" | "YYYY-MM";
7
- min?: string | undefined;
8
- max?: string | undefined;
9
- response: {
10
- name: string;
11
- };
12
- }>;
4
+ import type { LunaticError } from '../../use-lunatic/type';
5
+ export declare function Datepicker({ dateFormat, response, handleChange, errors, ...props }: LunaticComponentProps<'Datepicker'>): import("react/jsx-runtime").JSX.Element;
6
+ type CustomProps = Omit<LunaticComponentProps<'Datepicker'>, 'response' | 'handleChange' | 'errors'> & {
7
+ onChange: (s: string | null) => void;
8
+ errors?: LunaticError[];
9
+ };
10
+ export declare const CustomDatepicker: import("react").ComponentType<CustomProps>;
11
+ export {};
@@ -1,13 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import './Dropdown.scss';
3
- export declare const Dropdown: import("react").ComponentType<import("../type").LunaticBaseProps<string | null> & {
4
- options: {
5
- description: import("react").ReactNode;
6
- label: import("react").ReactNode;
7
- value: string;
8
- }[];
9
- response: {
10
- name: string;
11
- };
12
- writable?: boolean | undefined;
13
- }>;
3
+ import type { LunaticComponentProps } from '../type';
4
+ import type { LunaticError } from '../../use-lunatic/type';
5
+ export declare function Dropdown({ handleChange, response, errors, ...props }: LunaticComponentProps<'Dropdown'>): import("react/jsx-runtime").JSX.Element;
6
+ type CustomProps = Omit<LunaticComponentProps<'Dropdown'>, 'response' | 'handleChange' | 'errors'> & {
7
+ onChange: (v: string | null) => void;
8
+ errors?: LunaticError[];
9
+ };
10
+ export declare const CustomDropdown: import("react").ComponentType<CustomProps>;
11
+ export {};
@@ -1,8 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import './Duration.scss';
3
- export declare const Duration: import("react").ComponentType<import("../type").LunaticBaseProps<string | null> & {
4
- format: "PTnHnM" | "PnYnM";
5
- response: {
6
- name: string;
7
- };
8
- }>;
3
+ import type { LunaticComponentProps } from '../type';
4
+ import type { LunaticError } from '../../use-lunatic/type';
5
+ export declare function Duration({ handleChange, response, errors, ...props }: LunaticComponentProps<'Duration'>): import("react/jsx-runtime").JSX.Element;
6
+ type CustomProps = Omit<LunaticComponentProps<'Duration'>, 'response' | 'handleChange' | 'errors'> & {
7
+ onChange: (v: string | null) => void;
8
+ errors?: LunaticError[];
9
+ };
10
+ export declare const CustomDuration: import("react").ComponentType<CustomProps>;
11
+ export {};
@@ -3,5 +3,5 @@ type Props = {
3
3
  id: string;
4
4
  label?: ReactNode;
5
5
  };
6
- export declare const FilterDescription: import("react").ComponentType<Props>;
6
+ export declare const FilterDescription: ({ id, label }: Props) => import("react/jsx-runtime").JSX.Element;
7
7
  export {};
@@ -1,9 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import './Input.scss';
3
- export declare const Input: import("react").ComponentType<import("../type").LunaticBaseProps<string> & {
4
- maxLength?: number | undefined;
5
- value: string | null;
6
- response: {
7
- name: string;
8
- };
9
- }>;
3
+ import type { LunaticComponentProps } from '../type';
4
+ import type { LunaticError } from '../../use-lunatic/type';
5
+ export declare function Input({ handleChange, response, errors, ...props }: LunaticComponentProps<'Input'>): import("react/jsx-runtime").JSX.Element;
6
+ type CustomProps = Omit<LunaticComponentProps<'Input'>, 'response' | 'handleChange' | 'errors'> & {
7
+ onChange: (v: string) => void;
8
+ errors?: LunaticError[];
9
+ };
10
+ export declare const CustomInput: import("react").ComponentType<CustomProps>;
11
+ export {};
@@ -1,11 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import './InputNumber.scss';
3
- export declare const InputNumber: import("react").ComponentType<import("../type").LunaticBaseProps<number | null> & {
4
- min?: number | undefined;
5
- max?: number | undefined;
6
- decimals?: number | undefined;
7
- unit?: string | undefined;
8
- response: {
9
- name: string;
10
- };
11
- }>;
3
+ import type { LunaticComponentProps } from '../type';
4
+ import type { LunaticError } from '../../use-lunatic/type';
5
+ export declare function InputNumber({ handleChange, response, errors, decimals, ...props }: LunaticComponentProps<'InputNumber'>): import("react/jsx-runtime").JSX.Element;
6
+ type CustomProps = Omit<LunaticComponentProps<'InputNumber'>, 'response' | 'handleChange' | 'errors'> & {
7
+ onChange: (v: number | null) => void;
8
+ errors?: LunaticError[];
9
+ };
10
+ export declare const CustomInputNumber: import("react").ComponentType<CustomProps>;
11
+ export {};
@@ -1,22 +1,15 @@
1
- /// <reference types="react" />
1
+ import { type PropsWithChildren } from 'react';
2
+ import type { LunaticComponentProps } from '../type';
3
+ import type { LunaticError } from '../../use-lunatic/type';
2
4
  /**
3
5
  * Loop without specific markup (stack of subcomponents)
4
6
  */
5
- export declare const Loop: import("react").ComponentType<import("../type").LunaticBaseProps<unknown> & {
6
- lines: {
7
- min: number;
8
- max: number;
9
- };
10
- iterations: number;
11
- getComponents: (n: number) => import("../../use-lunatic/commons/fill-components/fill-components").FilledLunaticComponentProps[];
12
- executeExpression: <T extends unknown = unknown>(expression: unknown, args?: {
13
- iteration?: number | number[] | undefined;
14
- bindingDependencies?: string[] | undefined;
15
- deps?: string[] | undefined;
16
- } | undefined) => T;
17
- value: Record<string, unknown[]>;
18
- header?: {
19
- label: import("react").ReactNode;
20
- }[] | undefined;
21
- paginatedLoop?: boolean | undefined;
7
+ export declare function Loop({ lines, iterations, value, handleChange, getComponents, errors, ...props }: LunaticComponentProps<'Loop'>): import("react/jsx-runtime").JSX.Element | null;
8
+ type CustomProps = Omit<LunaticComponentProps<'Loop'>, 'response' | 'handleChange' | 'errors' | 'lines' | 'iterations' | 'value' | 'getComponents'> & PropsWithChildren<{
9
+ errors?: LunaticError[];
10
+ addRow?: () => void;
11
+ removeRow?: () => void;
12
+ canControlRows?: boolean;
22
13
  }>;
14
+ export declare const CustomLoop: import("react").ComponentType<CustomProps>;
15
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { type PropsWithChildren, type ReactElement, type ReactNode } from 'react';
2
2
  import type { FilledLunaticComponentProps } from '../use-lunatic/commons/fill-components/fill-components';
3
- type Props<T extends FilledLunaticComponentProps, V = undefined> = {
3
+ import { type LunaticSlotComponents } from './shared/HOC/slottableComponent';
4
+ type Props<T extends FilledLunaticComponentProps, V = unknown> = {
4
5
  components: (FilledLunaticComponentProps | ReactElement | {
5
6
  label: string;
6
7
  [key: string]: unknown;
@@ -12,11 +13,12 @@ type Props<T extends FilledLunaticComponentProps, V = undefined> = {
12
13
  wrapper?: (props: PropsWithChildren<FilledLunaticComponentProps & T & V & {
13
14
  index: number;
14
15
  }>) => ReactNode;
16
+ slots?: Partial<LunaticSlotComponents>;
15
17
  };
16
18
  /**
17
19
  * Entry point for orchestrators, this component display the list of fields
18
20
  */
19
- export declare function LunaticComponents<T extends FilledLunaticComponentProps, V = undefined>({ components, autoFocusKey, componentProps, blocklist, memo, wrapper, }: Props<T, V>): import("react/jsx-runtime").JSX.Element;
21
+ export declare function LunaticComponents<T extends FilledLunaticComponentProps, V = undefined>({ components, autoFocusKey, componentProps, blocklist, memo, slots, wrapper, }: Props<T, V>): import("react/jsx-runtime").JSX.Element;
20
22
  export declare function hasLabel(component: unknown): component is {
21
23
  label: ReactNode;
22
24
  } & FilledLunaticComponentProps;
@@ -1,7 +1,9 @@
1
- /// <reference types="react" />
1
+ import type { LunaticComponentProps } from '../type';
2
+ import type { PropsWithChildren } from 'react';
2
3
  /**
3
4
  * Surround a question giving additional context with label / description / declarations
4
5
  */
5
- export declare const Question: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<unknown>, "id" | "label" | "description" | "declarations"> & {
6
- components: import("../../use-lunatic/commons/fill-components/fill-components").FilledLunaticComponentProps[];
7
- }>;
6
+ export declare const Question: ({ components, ...props }: LunaticComponentProps<'Question'>) => import("react/jsx-runtime").JSX.Element;
7
+ type CustomProps = PropsWithChildren<Omit<LunaticComponentProps<'Question'>, 'components'>>;
8
+ export declare const CustomQuestion: import("react").ComponentType<CustomProps>;
9
+ export {};
@@ -1,25 +1,6 @@
1
- /// <reference types="react" />
2
1
  import './RosterForLoop.scss';
2
+ import type { LunaticComponentProps } from '../type';
3
3
  /**
4
4
  * Loop displayed as a table
5
5
  */
6
- export declare const RosterForLoop: import("react").ComponentType<import("../type").LunaticBaseProps<unknown> & {
7
- lines: {
8
- min: number;
9
- max: number;
10
- };
11
- iterations: number;
12
- getComponents: (n: number) => import("../../use-lunatic/commons/fill-components/fill-components").FilledLunaticComponentProps[];
13
- executeExpression: <T extends unknown = unknown>(expression: unknown, args?: {
14
- iteration?: number | number[] | undefined;
15
- bindingDependencies?: string[] | undefined;
16
- deps?: string[] | undefined;
17
- } | undefined) => T;
18
- value: Record<string, unknown[]>;
19
- header?: {
20
- label: import("react").ReactNode;
21
- rowspan?: number | undefined;
22
- colspan?: number | undefined;
23
- }[] | undefined;
24
- paginatedLoop?: boolean | undefined;
25
- }>;
6
+ export declare const RosterForLoop: (props: LunaticComponentProps<'RosterForLoop'>) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,4 +1,12 @@
1
+ import type { LunaticComponentProps } from '../type';
1
2
  import React from 'react';
3
+ import type { LunaticError } from '../../use-lunatic/type';
4
+ type CustomProps = Omit<LunaticComponentProps<'Switch'>, 'response' | 'handleChange' | 'errors' | 'value'> & {
5
+ onChange: () => void;
6
+ errors?: LunaticError[];
7
+ checked: boolean;
8
+ };
9
+ export declare const CustomSwitch: React.ComponentType<CustomProps>;
2
10
  export declare const Switch: React.ComponentType<import("../type").LunaticBaseProps<boolean> & {
3
11
  response: {
4
12
  name: string;
@@ -8,3 +16,4 @@ export declare const Switch: React.ComponentType<import("../type").LunaticBasePr
8
16
  false: string;
9
17
  } | undefined;
10
18
  }>;
19
+ export {};
@@ -1,11 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import './Textarea.scss';
3
- export declare const Textarea: import("react").ComponentType<import("../type").LunaticBaseProps<string> & {
4
- cols?: number | undefined;
5
- placeHolder?: string | undefined;
6
- maxLength?: number | undefined;
7
- rows?: number | undefined;
8
- response: {
9
- name: string;
10
- };
11
- }>;
3
+ import type { LunaticComponentProps } from '../type';
4
+ import type { LunaticError } from '../../use-lunatic/type';
5
+ export declare function Textarea({ handleChange, response, errors, ...props }: LunaticComponentProps<'Textarea'>): import("react/jsx-runtime").JSX.Element;
6
+ type CustomProps = Omit<LunaticComponentProps<'Textarea'>, 'response' | 'handleChange' | 'errors'> & {
7
+ onChange: (v: string) => void;
8
+ errors?: LunaticError[];
9
+ };
10
+ export declare const CustomTextarea: import("react").ComponentType<CustomProps>;
11
+ export {};
@@ -1,14 +1,22 @@
1
1
  import { Table } from './Table/Table';
2
+ import { Datepicker } from './Datepicker/Datepicker';
2
3
  import { CheckboxGroup } from './CheckboxGroup/CheckboxGroup';
4
+ import { CheckboxBoolean } from './CheckboxBoolean/CheckboxBoolean';
5
+ import { Input } from './Input/Input';
6
+ import { Textarea } from './Textarea/Textarea';
3
7
  import type { ComponentType } from 'react';
4
- import { ComponentSet } from './ComponentSet/ComponentSet';
8
+ import { InputNumber } from './InputNumber/InputNumber';
9
+ import { Duration } from './Duration/Duration';
10
+ import { Loop } from './Loop/Loop';
11
+ import { Dropdown } from './Dropdown/Dropdown';
5
12
  import { Roundabout } from './Roundabout/Roundabout';
13
+ import { CheckboxOne } from './CheckboxOne/CheckboxOne';
6
14
  import { Suggester } from './Suggester/Suggester';
7
15
  import { Summary } from './Summary/Summary';
8
16
  export declare const library: {
9
17
  Sequence: ComponentType<Pick<import("./type").LunaticBaseProps<string>, "id" | "label" | "style" | "description" | "declarations">>;
10
18
  Subsequence: ComponentType<Pick<import("./type").LunaticBaseProps<string>, "id" | "label" | "declarations">>;
11
- RosterForLoop: ComponentType<import("./type").LunaticBaseProps<unknown> & {
19
+ RosterForLoop: (props: import("./type").LunaticBaseProps<unknown> & {
12
20
  lines: {
13
21
  min: number;
14
22
  max: number;
@@ -27,59 +35,14 @@ export declare const library: {
27
35
  colspan?: number | undefined;
28
36
  }[] | undefined;
29
37
  paginatedLoop?: boolean | undefined;
30
- }>;
31
- Loop: ComponentType<import("./type").LunaticBaseProps<unknown> & {
32
- lines: {
33
- min: number;
34
- max: number;
35
- };
36
- iterations: number;
37
- getComponents: (n: number) => import("../use-lunatic/commons/fill-components/fill-components").FilledLunaticComponentProps[];
38
- executeExpression: <T extends unknown = unknown>(expression: unknown, args?: {
39
- iteration?: number | number[] | undefined;
40
- bindingDependencies?: string[] | undefined;
41
- deps?: string[] | undefined;
42
- } | undefined) => T;
43
- value: Record<string, unknown[]>;
44
- header?: {
45
- label: import("react").ReactNode;
46
- }[] | undefined;
47
- paginatedLoop?: boolean | undefined;
48
- }>;
38
+ }) => import("react/jsx-runtime").JSX.Element | null;
39
+ Loop: typeof Loop;
49
40
  Table: typeof Table;
50
- InputNumber: ComponentType<import("./type").LunaticBaseProps<number | null> & {
51
- min?: number | undefined;
52
- max?: number | undefined;
53
- decimals?: number | undefined;
54
- unit?: string | undefined;
55
- response: {
56
- name: string;
57
- };
58
- }>;
59
- Datepicker: ComponentType<import("./type").LunaticBaseProps<string | null> & {
60
- dateFormat: "YYYY-MM-DD" | "YYYY" | "YYYY-MM";
61
- min?: string | undefined;
62
- max?: string | undefined;
63
- response: {
64
- name: string;
65
- };
66
- }>;
41
+ InputNumber: typeof InputNumber;
42
+ Datepicker: typeof Datepicker;
67
43
  CheckboxGroup: typeof CheckboxGroup;
68
- CheckboxOne: ComponentType<import("./type").LunaticBaseProps<string | null> & {
69
- options: {
70
- description?: import("react").ReactNode;
71
- label: import("react").ReactNode;
72
- value: string;
73
- }[];
74
- response: {
75
- name: string;
76
- };
77
- }>;
78
- CheckboxBoolean: ComponentType<import("./type").LunaticBaseProps<boolean> & {
79
- response: {
80
- name: string;
81
- };
82
- }>;
44
+ CheckboxOne: typeof CheckboxOne;
45
+ CheckboxBoolean: typeof CheckboxBoolean;
83
46
  Radio: ComponentType<import("./type").LunaticBaseProps<string | null> & {
84
47
  options: {
85
48
  description: import("react").ReactNode;
@@ -91,28 +54,9 @@ export declare const library: {
91
54
  name: string;
92
55
  };
93
56
  }>;
94
- Input: ComponentType<import("./type").LunaticBaseProps<string> & {
95
- maxLength?: number | undefined;
96
- value: string | null;
97
- response: {
98
- name: string;
99
- };
100
- }>;
101
- Duration: ComponentType<import("./type").LunaticBaseProps<string | null> & {
102
- format: "PTnHnM" | "PnYnM";
103
- response: {
104
- name: string;
105
- };
106
- }>;
107
- Textarea: ComponentType<import("./type").LunaticBaseProps<string> & {
108
- cols?: number | undefined;
109
- placeHolder?: string | undefined;
110
- maxLength?: number | undefined;
111
- rows?: number | undefined;
112
- response: {
113
- name: string;
114
- };
115
- }>;
57
+ Input: typeof Input;
58
+ Duration: typeof Duration;
59
+ Textarea: typeof Textarea;
116
60
  Switch: ComponentType<import("./type").LunaticBaseProps<boolean> & {
117
61
  response: {
118
62
  name: string;
@@ -122,25 +66,14 @@ export declare const library: {
122
66
  false: string;
123
67
  } | undefined;
124
68
  }>;
125
- Question: ComponentType<Pick<import("./type").LunaticBaseProps<unknown>, "id" | "label" | "description" | "declarations"> & {
69
+ Question: ({ components, ...props }: Pick<import("./type").LunaticBaseProps<unknown>, "id" | "label" | "description" | "declarations"> & {
126
70
  components: import("../use-lunatic/commons/fill-components/fill-components").FilledLunaticComponentProps[];
127
- }>;
128
- ComponentSet: typeof ComponentSet;
129
- FilterDescription: ComponentType<{
71
+ }) => import("react/jsx-runtime").JSX.Element;
72
+ FilterDescription: ({ id, label }: {
130
73
  id: string;
131
74
  label?: import("react").ReactNode;
132
- }>;
133
- Dropdown: ComponentType<import("./type").LunaticBaseProps<string | null> & {
134
- options: {
135
- description: import("react").ReactNode;
136
- label: import("react").ReactNode;
137
- value: string;
138
- }[];
139
- response: {
140
- name: string;
141
- };
142
- writable?: boolean | undefined;
143
- }>;
75
+ }) => import("react/jsx-runtime").JSX.Element;
76
+ Dropdown: typeof Dropdown;
144
77
  PairwiseLinks: ({ declarations, xAxisIterations, yAxisIterations, id, getComponents, }: Omit<import("./type").LunaticBaseProps<unknown>, "value"> & {
145
78
  components: import("..").LunaticComponentDefinition[];
146
79
  features?: ["VTL"] | ["VTL", "MD"] | undefined;