@inseefr/lunatic 2.4.10 → 2.5.0-fast-forward

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 (103) hide show
  1. package/lib/components/commons/components/orchestrated-component.js +10 -30
  2. package/lib/components/commons/create-row-orchestrator.js +7 -2
  3. package/lib/components/component-set/html/component-set-components.js +16 -25
  4. package/lib/components/component-set/lunatic-component-set.js +23 -37
  5. package/lib/components/index.js +14 -0
  6. package/lib/components/loop/block-for-loop/block-for-loop.js +4 -2
  7. package/lib/components/loop/block-for-loop/row.js +4 -2
  8. package/lib/components/loop/loop.js +6 -3
  9. package/lib/components/loop/roster-for-loop/body.js +4 -2
  10. package/lib/components/loop/roster-for-loop/roster-for-loop.js +2 -0
  11. package/lib/components/loop/roster-for-loop/roster-table.js +4 -2
  12. package/lib/components/loop/roster-for-loop/row.js +3 -1
  13. package/lib/components/question-explication/html/question-explication.js +53 -0
  14. package/lib/components/question-explication/html/question-explication.scss +35 -0
  15. package/lib/components/question-explication/index.js +13 -0
  16. package/lib/components/question-explication/lunatic-question-explication.js +32 -0
  17. package/lib/components/question-explication/question-explication.spec.js +49 -0
  18. package/lib/components/roundabout/lunatic-roundabout.js +2 -4
  19. package/lib/components/subsequence/subsequence.js +0 -2
  20. package/lib/components/subsequence/subsequence.spec.js +2 -2
  21. package/lib/components/summary/html/summary-container.js +14 -0
  22. package/lib/components/summary/html/summary-responses.js +53 -0
  23. package/lib/components/summary/html/summary-title.js +20 -0
  24. package/lib/components/summary/index.js +12 -0
  25. package/lib/components/summary/lunatic-summary.js +99 -0
  26. package/lib/src/components/commons/components/orchestrated-component.d.ts +4 -5
  27. package/lib/src/components/commons/create-row-orchestrator.d.ts +3 -2
  28. package/lib/src/components/component-set/html/component-set-components.d.ts +2 -2
  29. package/lib/src/components/component-set/lunatic-component-set.d.ts +2 -1
  30. package/lib/src/components/index.d.ts +2 -0
  31. package/lib/src/components/loop/block-for-loop/block-for-loop-ochestrator.d.ts +3 -2
  32. package/lib/src/components/loop/block-for-loop/row.d.ts +2 -1
  33. package/lib/src/components/loop/roster-for-loop/body.d.ts +2 -2
  34. package/lib/src/components/loop/roster-for-loop/roster-for-loop-orchestrator.d.ts +3 -2
  35. package/lib/src/components/loop/roster-for-loop/roster-table.d.ts +2 -2
  36. package/lib/src/components/loop/roster-for-loop/row.d.ts +2 -1
  37. package/lib/src/components/question-explication/html/question-explication.d.ts +7 -0
  38. package/lib/src/components/question-explication/index.d.ts +1 -0
  39. package/lib/src/components/question-explication/lunatic-question-explication.d.ts +3 -0
  40. package/lib/src/components/question-explication/question-explication.spec.d.ts +1 -0
  41. package/lib/src/components/subsequence/subsequence.d.ts +2 -2
  42. package/lib/src/components/summary/html/summary-container.d.ts +2 -0
  43. package/lib/src/components/summary/html/summary-responses.d.ts +12 -0
  44. package/lib/src/components/summary/html/summary-title.d.ts +5 -0
  45. package/lib/src/components/summary/index.d.ts +1 -0
  46. package/lib/src/components/summary/lunatic-summary.d.ts +7 -0
  47. package/lib/src/components/type.d.ts +18 -0
  48. package/lib/src/index.d.ts +1 -0
  49. package/lib/src/use-lunatic/actions.d.ts +8 -169
  50. package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +137 -112
  51. package/lib/src/use-lunatic/commons/fill-components/fill-missing-response.d.ts +2 -1
  52. package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +115 -94
  53. package/lib/src/use-lunatic/commons/page-navigation.d.ts +7 -0
  54. package/lib/src/use-lunatic/commons/page-navigation.spec.d.ts +1 -0
  55. package/lib/src/use-lunatic/commons/page.d.ts +11 -0
  56. package/lib/src/use-lunatic/commons/use-components-from-state.d.ts +1 -1
  57. package/lib/src/use-lunatic/reducer/commons/auto-explore-loop.d.ts +5 -0
  58. package/lib/src/use-lunatic/reducer/commons/index.d.ts +0 -1
  59. package/lib/src/use-lunatic/reducer/commons/is-loop-component.d.ts +2 -2
  60. package/lib/src/use-lunatic/reducer/overview/overview-on-init.d.ts +1 -7
  61. package/lib/src/use-lunatic/reducer/reduce-on-init.d.ts +1 -1
  62. package/lib/src/use-lunatic/replace-component-sequence.d.ts +3 -3
  63. package/lib/src/use-lunatic/type-source.d.ts +27 -13
  64. package/lib/src/use-lunatic/type.d.ts +4 -12
  65. package/lib/src/use-lunatic/use-lunatic.d.ts +475 -10
  66. package/lib/src/utils/store-tools/worker-path.d.ts +1 -0
  67. package/lib/stories/component-set/component-set.stories.js +2 -1
  68. package/lib/stories/loop/block-for-loop.stories.js +8 -1
  69. package/lib/stories/loop/roster-for-loop.stories.js +92 -2
  70. package/lib/{use-lunatic/reducer/reduce-roundabout.js → stories/question-explication/question-explication.stories.js} +21 -17
  71. package/lib/stories/question-explication/source.json +17 -0
  72. package/lib/stories/roundabout/roundabout.stories.js +2 -1
  73. package/lib/stories/suggester/source-component-set.json +67 -0
  74. package/lib/stories/suggester/suggester.stories.js +9 -1
  75. package/lib/stories/summary/data.json +32 -0
  76. package/lib/stories/summary/source.json +353 -0
  77. package/lib/stories/summary/summary.stories.js +37 -0
  78. package/lib/stories/utils/orchestrator.js +21 -6
  79. package/lib/use-lunatic/commons/check-pager.js +1 -2
  80. package/lib/use-lunatic/commons/fill-components/fill-missing-response.js +14 -12
  81. package/lib/use-lunatic/commons/page-navigation.js +109 -0
  82. package/lib/use-lunatic/commons/page-navigation.spec.js +129 -0
  83. package/lib/use-lunatic/commons/page.js +44 -0
  84. package/lib/use-lunatic/reducer/commons/auto-explore-loop.js +37 -0
  85. package/lib/use-lunatic/reducer/commons/index.js +0 -8
  86. package/lib/use-lunatic/reducer/reduce-go-next-page.js +25 -159
  87. package/lib/use-lunatic/reducer/reduce-go-previous-page.js +21 -127
  88. package/lib/use-lunatic/reducer/reduce-go-to-page.js +51 -55
  89. package/lib/use-lunatic/reducer/reduce-on-init.js +8 -10
  90. package/lib/use-lunatic/reducer/resolve-component-controls/resolve-roundabout-control.js +1 -1
  91. package/lib/use-lunatic/reducer/resolve-component-controls/resolve-simple-control.js +1 -1
  92. package/lib/use-lunatic/type-source.js +0 -2
  93. package/lib/use-lunatic/use-lunatic.js +22 -4
  94. package/lib/use-lunatic/use-lunatic.test.js +9 -7
  95. package/lib/utils/store-tools/auto-load.js +2 -2
  96. package/lib/utils/store-tools/worker-path.js +13 -0
  97. package/lib/utils/suggester-workers/append-to-index/create-append-task.js +2 -2
  98. package/package.json +3 -4
  99. package/lib/components/button/__snapshots__/lunatic-button.spec.jsx.snap +0 -80
  100. package/lib/components/commons/components/combo-box/selection/__snapshots__/selection.spec.jsx.snap +0 -81
  101. package/lib/src/use-lunatic/reducer/commons/is-empty-on-empty-page.d.ts +0 -3
  102. package/lib/src/use-lunatic/reducer/reduce-roundabout.d.ts +0 -2
  103. package/lib/use-lunatic/reducer/commons/is-empty-on-empty-page.js +0 -32
@@ -5,8 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _actions = require("../actions");
8
- var _commons = require("./commons");
8
+ var _pageTag = require("../commons/page-tag");
9
9
  var _reduceGoNextPage = _interopRequireDefault(require("./reduce-go-next-page"));
10
+ var _page = require("../commons/page");
10
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
12
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
12
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -14,66 +15,61 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
14
15
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
16
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
16
17
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
17
- function validateChange(state) {
18
- var updatedState = _objectSpread({}, state);
19
- if ((0, _commons.isOnEmptyPage)(updatedState)) {
20
- return (0, _reduceGoNextPage["default"])(updatedState, {
18
+ function reduceGoToPage(state, action) {
19
+ // The page contains non digit, extract information from it
20
+ if (action.payload.page.match(/\D/)) {
21
+ var pager = (0, _pageTag.getPagerFromPageTag)(action.payload.page);
22
+ if (pager) {
23
+ action.payload.iteration = pager.iteration;
24
+ action.payload.subPage = pager.subPage;
25
+ action.payload.page = pager.page;
26
+ }
27
+ }
28
+
29
+ // The page is still not a number, cancel the action
30
+ if (action.payload.page.match(/\D/)) {
31
+ console.error("Cannot reach page \"".concat(action.payload.page, "\", not a number"));
32
+ return state;
33
+ }
34
+ var newPager = _objectSpread(_objectSpread({}, state.pager), {}, {
35
+ page: action.payload.page,
36
+ subPage: action.payload.subPage,
37
+ iteration: action.payload.iteration,
38
+ nbIterations: undefined,
39
+ nbSubPages: undefined
40
+ });
41
+
42
+ // The page is not reachable
43
+ var pageId = (0, _page.getPageId)(newPager);
44
+ if (!(pageId in state.pages)) {
45
+ console.error("Page \"".concat(pageId, "\" does not exists in this questionnaire"));
46
+ return state;
47
+ }
48
+
49
+ // Find the number of subPages and iteration
50
+ var parentPage = state.pages[action.payload.page];
51
+ if (action.payload.subPage !== undefined) {
52
+ var _parentPage$subPages;
53
+ newPager.nbSubPages = (_parentPage$subPages = parentPage.subPages) === null || _parentPage$subPages === void 0 ? void 0 : _parentPage$subPages.length;
54
+ newPager.nbIterations = state.executeExpression(parentPage.iterations);
55
+ }
56
+
57
+ // Prevent an out of bound iteration
58
+ if (newPager.iteration !== undefined && newPager.nbIterations !== undefined && newPager.iteration >= newPager.nbIterations) {
59
+ newPager.iteration = newPager.nbIterations - 1;
60
+ }
61
+
62
+ // Move forward if the page is empty
63
+ if ((0, _page.isPageEmpty)(state)) {
64
+ return (0, _reduceGoNextPage["default"])(state, {
21
65
  type: _actions.ActionKind.GO_NEXT_PAGE,
22
66
  payload: {}
23
67
  });
24
68
  }
25
- return updatedState;
26
- }
27
- function resolveSubPage(state, action) {
28
- var pager = state.pager,
29
- pages = state.pages;
30
- var _action$payload = action.payload,
31
- page = _action$payload.page,
32
- iteration = _action$payload.iteration,
33
- nbIterations = _action$payload.nbIterations,
34
- _action$payload$subPa = _action$payload.subPage,
35
- subPage = _action$payload$subPa === void 0 ? 0 : _action$payload$subPa,
36
- roundabout = _action$payload.roundabout;
37
- var _ref = pages[page] || {
38
- subPages: []
39
- },
40
- subPages = _ref.subPages;
41
- var nbSubPages = subPages === null || subPages === void 0 ? void 0 : subPages.length;
42
69
  return _objectSpread(_objectSpread({}, state), {}, {
43
- isInLoop: true,
44
- pager: _objectSpread(_objectSpread({}, pager), {}, {
45
- page: page,
46
- iteration: iteration,
47
- nbIterations: nbIterations,
48
- nbSubPages: nbSubPages,
49
- subPage: subPage,
50
- roundabout: roundabout
51
- })
52
- });
53
- }
54
- function reduceGoToPage(state, action) {
55
- var isInLoop = state.isInLoop,
56
- pager = state.pager;
57
- var _action$payload2 = action.payload,
58
- newPage = _action$payload2.page,
59
- iteration = _action$payload2.iteration;
60
- if (iteration !== undefined) {
61
- return resolveSubPage(state, action);
62
- }
63
- if (!isInLoop) return _objectSpread(_objectSpread({}, state), {}, {
64
- pager: _objectSpread(_objectSpread({}, pager), {}, {
65
- subPage: undefined,
66
- nbSubPages: undefined,
67
- iteration: undefined,
68
- nbIterations: undefined,
69
- page: newPage
70
- })
70
+ isInLoop: newPager.nbIterations !== undefined,
71
+ pager: newPager
71
72
  });
72
- // TODO: fix when redirect to loop component
73
- // How to calculate nbSubPages & nbIterations?
74
- // How to calculate lazy variables we need?
75
- // Handle setLoopBindings with the good iteration
76
- return validateChange(state);
77
73
  }
78
74
  var _default = reduceGoToPage;
79
75
  exports["default"] = _default;
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _commons = require("../commons");
8
- var _pageTag = require("../commons/page-tag");
9
8
  var _compose = _interopRequireDefault(require("../commons/compose"));
9
+ var _pageTag = require("../commons/page-tag");
10
10
  var _overviewOnInit = require("./overview/overview-on-init");
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
12
12
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
@@ -28,21 +28,21 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
28
28
  /**
29
29
  * Extract value from colllected data
30
30
  */
31
- function getInitalValueFromCollected(variable) {
32
- var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
31
+ function getInitalValueFromCollected(variable, data) {
33
32
  var name = variable.name;
34
33
  var fromData;
35
- if (name in data) {
34
+ if (data && name in data) {
36
35
  var _data$name = data[name],
37
36
  COLLECTED = _data$name.COLLECTED,
38
37
  FORCED = _data$name.FORCED;
39
38
  fromData = COLLECTED || FORCED;
40
39
  }
41
40
  if ('values' in variable && variable.values) {
41
+ var _fromData;
42
42
  var _variable$values = variable.values,
43
43
  _COLLECTED = _variable$values.COLLECTED,
44
44
  _FORCED = _variable$values.FORCED;
45
- return fromData || _FORCED || _COLLECTED;
45
+ return (_fromData = fromData) !== null && _fromData !== void 0 ? _fromData : _FORCED || _COLLECTED;
46
46
  }
47
47
  return undefined;
48
48
  }
@@ -53,10 +53,7 @@ function getInitalValueFromCollected(variable) {
53
53
  function getInitialValueFromExternal(variable) {
54
54
  var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
55
55
  var name = variable.name;
56
- if (name in data) {
57
- return data[name];
58
- }
59
- return undefined;
56
+ return data === null || data === void 0 ? void 0 : data[name];
60
57
  }
61
58
 
62
59
  /**
@@ -174,6 +171,7 @@ function reduceOnInit(state, action) {
174
171
  var source = payload.source,
175
172
  data = payload.data,
176
173
  initialPage = payload.initialPage,
174
+ lastReachedPage = payload.lastReachedPage,
177
175
  features = payload.features,
178
176
  handleChange = payload.handleChange,
179
177
  preferences = payload.preferences,
@@ -205,7 +203,7 @@ function reduceOnInit(state, action) {
205
203
  nbSubPages: undefined,
206
204
  iteration: undefined,
207
205
  nbIterations: undefined,
208
- lastReachedPage: initialPage
206
+ lastReachedPage: lastReachedPage
209
207
  };
210
208
  var _isFirstLastPage = (0, _commons.isFirstLastPage)(pager),
211
209
  isFirstPage = _isFirstLastPage.isFirstPage,
@@ -19,7 +19,7 @@ function resolveRoundaboutControl(state, control) {
19
19
  id = control.id,
20
20
  typeOfControl = control.typeOfControl,
21
21
  iterations = control.iterations;
22
- var value = (_control$control$valu = control === null || control === void 0 ? void 0 : (_control$control = control.control) === null || _control$control === void 0 ? void 0 : _control$control.value) !== null && _control$control$valu !== void 0 ? _control$control$valu : 'true';
22
+ var value = (_control$control$valu = control === null || control === void 0 || (_control$control = control.control) === null || _control$control === void 0 ? void 0 : _control$control.value) !== null && _control$control$valu !== void 0 ? _control$control$valu : 'true';
23
23
  if (!iterations || iterations <= 0) {
24
24
  return undefined;
25
25
  }
@@ -14,7 +14,7 @@ function resolveSimpleControl(state, control) {
14
14
  errorMessage = control.errorMessage,
15
15
  id = control.id,
16
16
  typeOfControl = control.typeOfControl;
17
- var value = (_control$control$valu = control === null || control === void 0 ? void 0 : (_control$control = control.control) === null || _control$control === void 0 ? void 0 : _control$control.value) !== null && _control$control$valu !== void 0 ? _control$control$valu : 'true';
17
+ var value = (_control$control$valu = control === null || control === void 0 || (_control$control = control.control) === null || _control$control === void 0 ? void 0 : _control$control.value) !== null && _control$control$valu !== void 0 ? _control$control$valu : 'true';
18
18
  var result = executeExpression(value, {
19
19
  iteration: iteration,
20
20
  linksIterations: linksIterations
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.TypeOfControl = exports.Criticality = exports.ControlTypeEnum = void 0;
7
7
  /**
8
8
  * Types used for source data (lunatic models and data.json)
9
- *
10
- * These types should not be used outside of use-lunatic
11
9
  */
12
10
  var Criticality = /*#__PURE__*/function (Criticality) {
13
11
  Criticality["INFO"] = "INFO";
@@ -56,6 +56,8 @@ function useLunatic(source) {
56
56
  shortcut = _ref$shortcut === void 0 ? false : _ref$shortcut,
57
57
  _ref$initialPage = _ref.initialPage,
58
58
  initialPage = _ref$initialPage === void 0 ? '1' : _ref$initialPage,
59
+ _ref$lastReachedPage = _ref.lastReachedPage,
60
+ lastReachedPage = _ref$lastReachedPage === void 0 ? '1' : _ref$lastReachedPage,
59
61
  _ref$autoSuggesterLoa = _ref.autoSuggesterLoading,
60
62
  autoSuggesterLoading = _ref$autoSuggesterLoa === void 0 ? false : _ref$autoSuggesterLoa,
61
63
  _ref$activeControls = _ref.activeControls,
@@ -121,12 +123,26 @@ function useLunatic(source) {
121
123
  var payload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
122
124
  dispatch(actions.goNextPage(payload));
123
125
  }, [dispatch]);
124
- var goToPage = (0, _react.useCallback)(function () {
125
- var payload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
126
+ var goToPage = (0, _react.useCallback)(function (payload) {
126
127
  dispatch(actions.goToPage(payload));
127
128
  }, [dispatch]);
128
129
  var getComponents = (0, _react.useCallback)(function () {
129
- // validate variables ?
130
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
131
+ only = _ref2.only,
132
+ except = _ref2.except;
133
+ if (only && except) {
134
+ throw new Error('"only" and "except" cannot be used together in getComponents()');
135
+ }
136
+ if (only) {
137
+ return components.filter(function (c) {
138
+ return only.includes(c.componentType);
139
+ });
140
+ }
141
+ if (except) {
142
+ return components.filter(function (c) {
143
+ return !except.includes(c.componentType);
144
+ });
145
+ }
130
146
  return components;
131
147
  }, [components]);
132
148
  var handleChange = (0, _react.useCallback)(function (response, value, args) {
@@ -147,11 +163,13 @@ function useLunatic(source) {
147
163
  var _isFirstLastPage = (0, _commons.isFirstLastPage)(pager),
148
164
  isFirstPage = _isFirstLastPage.isFirstPage,
149
165
  isLastPage = _isFirstLastPage.isLastPage;
166
+ console.log('State overview', state.overview);
150
167
  (0, _react.useEffect)(function () {
151
168
  dispatch(actions.onInit({
152
169
  source: source,
153
170
  data: data,
154
171
  initialPage: initialPage,
172
+ lastReachedPage: lastReachedPage,
155
173
  features: features,
156
174
  preferences: preferences,
157
175
  savingType: savingType,
@@ -162,7 +180,7 @@ function useLunatic(source) {
162
180
  goToPage: goToPage,
163
181
  withOverview: withOverview
164
182
  }));
165
- }, [source, data, initialPage, features, preferences, savingType, management, shortcut, handleChange, activeControls, withOverview, goToPage]);
183
+ }, [source, data, initialPage, features, preferences, savingType, management, shortcut, handleChange, activeControls, withOverview, goToPage, lastReachedPage]);
166
184
  (0, _react.useEffect)(function () {
167
185
  dispatch(actions.updateState({
168
186
  getSuggesterStatus: getSuggesterStatus
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
 
3
- var _vitest = require("vitest");
4
3
  var _reactHooks = require("@testing-library/react-hooks");
4
+ var _vitest = require("vitest");
5
5
  var _useLunatic = _interopRequireDefault(require("./use-lunatic"));
6
- var _source = _interopRequireDefault(require("../stories/questionnaires/simpsons/source.json"));
6
+ var _source = _interopRequireDefault(require("../stories/overview/source.json"));
7
7
  var _source2 = _interopRequireDefault(require("../stories/questionnaires/logement/source.json"));
8
- var _source3 = _interopRequireDefault(require("../stories/overview/source.json"));
8
+ var _source3 = _interopRequireDefault(require("../stories/questionnaires/simpsons/source.json"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
10
10
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
11
11
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -29,7 +29,7 @@ var dataFromObject = function dataFromObject(o) {
29
29
  };
30
30
  };
31
31
  (0, _vitest.describe)('use-lunatic()', function () {
32
- var defaultParams = [_source["default"], dataFromObject({}), {}];
32
+ var defaultParams = [_source3["default"], dataFromObject({}), {}];
33
33
  (0, _vitest.it)('should initialize correcly', function () {
34
34
  var _renderHook = (0, _reactHooks.renderHook)(function () {
35
35
  return _useLunatic["default"].apply(void 0, defaultParams);
@@ -53,7 +53,7 @@ var dataFromObject = function dataFromObject(o) {
53
53
  (0, _vitest.expect)(result.current.pager.lastReachedPage).toBe('2');
54
54
  });
55
55
  (0, _vitest.it)('should jump to a specific page', function () {
56
- var params = [_source["default"], dataFromObject({
56
+ var params = [_source3["default"], dataFromObject({
57
57
  COMMENT: 'Hello world',
58
58
  READY: true,
59
59
  NAME_CHAR: ['a', 'b']
@@ -142,7 +142,7 @@ var dataFromObject = function dataFromObject(o) {
142
142
  });
143
143
  (0, _vitest.it)('should be empty when no hierarchy', function () {
144
144
  var _renderHook8 = (0, _reactHooks.renderHook)(function () {
145
- return (0, _useLunatic["default"])(_source3["default"], undefined, lunaticConfiguration);
145
+ return (0, _useLunatic["default"])(_source["default"], undefined, lunaticConfiguration);
146
146
  }),
147
147
  result = _renderHook8.result;
148
148
  (0, _vitest.expect)(result.current.overview).toHaveLength(0);
@@ -152,7 +152,9 @@ var dataFromObject = function dataFromObject(o) {
152
152
  var _renderHook9 = (0, _reactHooks.renderHook)(function () {
153
153
  return (0, _useLunatic["default"])(_source2["default"], advancedQestionnaireData, _objectSpread(_objectSpread({}, lunaticConfiguration), {}, {
154
154
  // hack on initialPage : useLunatic SHOULD find lastReachedPage from COLLECTED data
155
- initialPage: '16'
155
+ initialPage: '1',
156
+ // use lastReachedPage saved by orchestrator
157
+ lastReachedPage: '16'
156
158
  }));
157
159
  }),
158
160
  result = _renderHook9.result;
@@ -10,6 +10,7 @@ var _updateStoreInfo = _interopRequireDefault(require("./create/update-store-inf
10
10
  var _clearStoreData = _interopRequireDefault(require("./clear-store-data"));
11
11
  var _clearStoreInfo = _interopRequireDefault(require("./clear-store-info"));
12
12
  var _createWorker = require("../suggester-workers/create-worker");
13
+ var _workerPath = require("./worker-path");
13
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
14
15
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
15
16
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -20,7 +21,6 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
20
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
22
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
22
23
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } // @ts-ignore
23
- var workerPath = process.env.LUNATIC_LOADER_WORKER_PATH || process.env.REACT_APP_LUNATIC_LOADER_WORKER_PATH || 'workers/lunatic-loader-worker-0.1.0.js';
24
24
  var loadSuggesters = function loadSuggesters(suggesterFetcher) {
25
25
  return /*#__PURE__*/function () {
26
26
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(suggesters) {
@@ -123,7 +123,7 @@ function task(_ref8, version) {
123
123
  var log = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
124
124
  return null;
125
125
  };
126
- var worker = (0, _createWorker.createWorker)(workerPath);
126
+ var worker = (0, _createWorker.createWorker)((0, _workerPath.getWorkerPath)());
127
127
  var start = false;
128
128
  var stop = false;
129
129
  function launch(entities) {
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getWorkerPath = getWorkerPath;
7
+ function getWorkerPath() {
8
+ var _ref, _process$env$LUNATIC_;
9
+ if ('LUNATIC_WORKER_PATH' in window) {
10
+ return window.LUNATIC_WORKER_PATH;
11
+ }
12
+ return (_ref = (_process$env$LUNATIC_ = process.env.LUNATIC_LOADER_WORKER_PATH) !== null && _process$env$LUNATIC_ !== void 0 ? _process$env$LUNATIC_ : process.env.REACT_APP_LUNATIC_LOADER_WORKER_PATH) !== null && _ref !== void 0 ? _ref : 'workers/lunatic-loader-worker-0.1.0.js';
13
+ }
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createAppendTask = createAppendTask;
7
7
  var _createWorkerTs = require("../create-worker-ts");
8
+ var _workerPath = require("../../store-tools/worker-path");
8
9
  var _logger = require("../../logger");
9
- var workerPath = process.env.LUNATIC_LOADER_WORKER_PATH || process.env.REACT_APP_LUNATIC_LOADER_WORKER_PATH || 'workers/lunatic-loader-worker-0.1.0.js';
10
10
  function consoleLogging() {
11
11
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12
12
  args[_key] = arguments[_key];
@@ -25,7 +25,7 @@ function createAppendTask(info, version) {
25
25
  fields = info.fields,
26
26
  stopWords = info.stopWords,
27
27
  meloto = info.meloto;
28
- var worker = (0, _createWorkerTs.createWorker)(workerPath);
28
+ var worker = (0, _createWorkerTs.createWorker)((0, _workerPath.getWorkerPath)());
29
29
  var start = false;
30
30
  var stop = false;
31
31
  function launch(entities) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inseefr/lunatic",
3
- "version": "2.4.10",
3
+ "version": "2.5.0-fast-forward",
4
4
  "workersVersion": "0.2.5-experimental",
5
5
  "description": "Library of questionnaire components",
6
6
  "repository": {
@@ -24,7 +24,6 @@
24
24
  ],
25
25
  "license": "MIT",
26
26
  "main": "lib/index.js",
27
- "types": "lib/src/index.d.ts",
28
27
  "files": [
29
28
  "lib"
30
29
  ],
@@ -53,7 +52,7 @@
53
52
  "library"
54
53
  ],
55
54
  "dependencies": {
56
- "@inseefr/trevas": "^0.1.17",
55
+ "@inseefr/trevas": "^0.1.19",
57
56
  "@inseefr/vtl-2.0-antlr-tools": "^0.1.0-bundle",
58
57
  "antlr4": "4.11.0",
59
58
  "classnames": "^2.3.1",
@@ -146,7 +145,7 @@
146
145
  "sass-loader": "^13.2.0",
147
146
  "source-map-explorer": "^2.4.2",
148
147
  "ts-loader": "^9.4.2",
149
- "typescript": "^5.0.4",
148
+ "typescript": "^5.1.6",
150
149
  "vite": "^4.0.0",
151
150
  "vitest": "^0.27.2",
152
151
  "wait-on": "^7.0.1",
@@ -1,80 +0,0 @@
1
- // Vitest Snapshot v1
2
-
3
- exports[`Button > renders without crashing 1`] = `
4
- {
5
- "asFragment": [Function],
6
- "baseElement": <body>
7
- <div>
8
- <button
9
- class="button-lunatic"
10
- type="button"
11
- >
12
- <span>
13
- Click me!
14
- </span>
15
- </button>
16
- </div>
17
- </body>,
18
- "container": <div>
19
- <button
20
- class="button-lunatic"
21
- type="button"
22
- >
23
- <span>
24
- Click me!
25
- </span>
26
- </button>
27
- </div>,
28
- "debug": [Function],
29
- "findAllByAltText": [Function],
30
- "findAllByDisplayValue": [Function],
31
- "findAllByLabelText": [Function],
32
- "findAllByPlaceholderText": [Function],
33
- "findAllByRole": [Function],
34
- "findAllByTestId": [Function],
35
- "findAllByText": [Function],
36
- "findAllByTitle": [Function],
37
- "findByAltText": [Function],
38
- "findByDisplayValue": [Function],
39
- "findByLabelText": [Function],
40
- "findByPlaceholderText": [Function],
41
- "findByRole": [Function],
42
- "findByTestId": [Function],
43
- "findByText": [Function],
44
- "findByTitle": [Function],
45
- "getAllByAltText": [Function],
46
- "getAllByDisplayValue": [Function],
47
- "getAllByLabelText": [Function],
48
- "getAllByPlaceholderText": [Function],
49
- "getAllByRole": [Function],
50
- "getAllByTestId": [Function],
51
- "getAllByText": [Function],
52
- "getAllByTitle": [Function],
53
- "getByAltText": [Function],
54
- "getByDisplayValue": [Function],
55
- "getByLabelText": [Function],
56
- "getByPlaceholderText": [Function],
57
- "getByRole": [Function],
58
- "getByTestId": [Function],
59
- "getByText": [Function],
60
- "getByTitle": [Function],
61
- "queryAllByAltText": [Function],
62
- "queryAllByDisplayValue": [Function],
63
- "queryAllByLabelText": [Function],
64
- "queryAllByPlaceholderText": [Function],
65
- "queryAllByRole": [Function],
66
- "queryAllByTestId": [Function],
67
- "queryAllByText": [Function],
68
- "queryAllByTitle": [Function],
69
- "queryByAltText": [Function],
70
- "queryByDisplayValue": [Function],
71
- "queryByLabelText": [Function],
72
- "queryByPlaceholderText": [Function],
73
- "queryByRole": [Function],
74
- "queryByTestId": [Function],
75
- "queryByText": [Function],
76
- "queryByTitle": [Function],
77
- "rerender": [Function],
78
- "unmount": [Function],
79
- }
80
- `;
@@ -1,81 +0,0 @@
1
- // Vitest Snapshot v1
2
-
3
- exports[`Selection component > should render correctly when it is disabled 1`] = `
4
- <div
5
- aria-autocomplete="list"
6
- aria-controls="todo"
7
- aria-haspopup="listbox"
8
- aria-owns="idUndefined"
9
- class="lunatic-combo-box-selection"
10
- id="idUndefined"
11
- role="combobox"
12
- >
13
- <div
14
- class="lunatic-combo-box-selected disabled"
15
- >
16
- <div>
17
- No selection
18
- </div>
19
- </div>
20
- </div>
21
- `;
22
-
23
- exports[`Selection component > should render correctly when it is editable 1`] = `
24
- <div
25
- aria-autocomplete="list"
26
- aria-controls="todo"
27
- aria-haspopup="listbox"
28
- aria-owns="idUndefined"
29
- class="lunatic-combo-box-selection"
30
- id="idUndefined"
31
- role="combobox"
32
- >
33
- <div
34
- class="lunatic-combo-box-selected"
35
- >
36
- <div>
37
- No selection
38
- </div>
39
- </div>
40
- </div>
41
- `;
42
-
43
- exports[`Selection component > should render correctly when it is expanded 1`] = `
44
- <div
45
- aria-autocomplete="list"
46
- aria-controls="todo"
47
- aria-haspopup="listbox"
48
- aria-owns="idUndefined"
49
- class="lunatic-combo-box-selection"
50
- id="idUndefined"
51
- role="combobox"
52
- >
53
- <div
54
- class="lunatic-combo-box-selected"
55
- >
56
- <div>
57
- No selection
58
- </div>
59
- </div>
60
- </div>
61
- `;
62
-
63
- exports[`Selection component > should render correctly with default props 1`] = `
64
- <div
65
- aria-autocomplete="list"
66
- aria-controls="todo"
67
- aria-haspopup="listbox"
68
- aria-owns="idUndefined"
69
- class="lunatic-combo-box-selection"
70
- id="idUndefined"
71
- role="combobox"
72
- >
73
- <div
74
- class="lunatic-combo-box-selected"
75
- >
76
- <div>
77
- No selection
78
- </div>
79
- </div>
80
- </div>
81
- `;
@@ -1,3 +0,0 @@
1
- import { LunaticState } from '../../type';
2
- declare function isOnEmptyPage(state: LunaticState): boolean;
3
- export default isOnEmptyPage;
@@ -1,2 +0,0 @@
1
- import type { LunaticState } from '../type';
2
- export declare function reduceToRoundabout(state: LunaticState): LunaticState;