@inseefr/lunatic 3.0.0-rc.1 → 3.0.0-rc.10
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.
- package/lib/components/CheckboxBoolean/CheckboxBoolean.js +39 -19
- package/lib/components/CheckboxGroup/CheckboxGroup.js +3 -2
- package/lib/components/CheckboxGroup/CustomCheckboxGroup.js +4 -5
- package/lib/components/CheckboxGroup/CustomCheckboxGroup.spec.js +3 -0
- package/lib/components/CheckboxOne/CheckboxOne.js +6 -7
- package/lib/components/Datepicker/Datepicker.js +43 -29
- package/lib/components/Dropdown/Dropdown.js +37 -37
- package/lib/components/Duration/Duration.js +41 -17
- package/lib/components/FilterDescription/FilterDescription.js +2 -3
- package/lib/components/Input/Input.js +39 -22
- package/lib/components/InputNumber/InputNumber.js +45 -35
- package/lib/components/InputNumber/__snapshots__/InputNumber.spec.tsx.snap +0 -2
- package/lib/components/Loop/Loop.js +52 -29
- package/lib/components/LunaticComponents.js +60 -51
- package/lib/components/Question/Question.js +23 -14
- package/lib/components/Radio/Radio.js +2 -2
- package/lib/components/RosterForLoop/RosterForLoop.js +13 -36
- package/lib/components/Roundabout/CustomRoundabout.js +2 -2
- package/lib/components/Roundabout/Roundabout.js +0 -1
- package/lib/components/Roundabout/RoundaboutItButton.js +2 -2
- package/lib/components/Roundabout/extra.js +6 -6
- package/lib/components/Sequence/Sequence.js +2 -3
- package/lib/components/Subsequence/Subsequence.js +2 -2
- package/lib/components/Subsequence/Subsequence.spec.js +1 -1
- package/lib/components/Suggester/CustomSuggester.js +9 -6
- package/lib/components/Suggester/Suggester.js +67 -4
- package/lib/components/Suggester/SuggesterNotification.js +2 -2
- package/lib/components/Summary/Summary.js +3 -3
- package/lib/components/Switch/Switch.js +42 -22
- package/lib/components/Textarea/Textarea.js +43 -24
- package/lib/components/library.js +0 -2
- package/lib/components/shared/Button/Button.js +2 -3
- package/lib/components/shared/Button/IconButton.js +0 -1
- package/lib/components/shared/Checkbox/CheckboxOption.js +2 -3
- package/lib/components/shared/Combobox/Combobox.js +5 -4
- package/lib/components/shared/Combobox/ComboboxContainer.js +2 -2
- package/lib/components/shared/Combobox/ComboboxContentBox.js +2 -2
- package/lib/components/shared/Combobox/Panel/ComboboxOption.js +2 -2
- package/lib/components/shared/Combobox/Panel/ComboboxPanelContainer.js +2 -2
- package/lib/components/shared/Combobox/Selection/ComboboxClearButton.js +2 -2
- package/lib/components/shared/Combobox/Selection/ComboboxInput.js +2 -2
- package/lib/components/shared/Combobox/Selection/ComboboxLabelSelection.js +2 -2
- package/lib/components/shared/ComponentErrors/ComponentErrors.js +0 -1
- package/lib/components/shared/Declarations/Declarations.js +6 -7
- package/lib/components/shared/Declarations/Declarations.spec.js +5 -5
- package/lib/components/shared/Fieldset/Fieldset.js +2 -3
- package/lib/components/shared/HOC/{customizedComponent.js → slottableComponent.js} +35 -13
- package/lib/components/shared/Icons/lunatic-icon.js +0 -1
- package/lib/components/shared/Label/Label.js +2 -3
- package/lib/components/shared/MDLabel/RouterLink.js +2 -2
- package/lib/components/shared/Missing/Missing.js +0 -1
- package/lib/components/shared/ModalControls/ModalControls.js +0 -1
- package/lib/components/shared/Notification.js +2 -2
- package/lib/components/shared/Radio/RadioGroup.js +4 -4
- package/lib/components/shared/Radio/RadioOption.js +2 -2
- package/lib/components/shared/Table/Table.js +2 -3
- package/lib/components/shared/Table/Tbody.js +2 -2
- package/lib/components/shared/Table/Td.js +2 -2
- package/lib/components/shared/Table/Th.js +2 -2
- package/lib/components/shared/Table/Thead.js +2 -2
- package/lib/components/shared/Table/Tr.js +2 -2
- package/lib/components/shared/VariableStatus/VariableStatus.js +0 -1
- package/lib/components/shared/suggester-loader-widget/dragger/dragger.js +0 -1
- package/lib/components/shared/suggester-loader-widget/widget.js +0 -1
- package/lib/css/components/Button.scss +24 -0
- package/lib/css/components/CheckboxGroup.scss +13 -0
- package/lib/css/components/CheckboxOne.scss +19 -0
- package/lib/css/components/CheckboxOption.scss +19 -0
- package/lib/css/components/Combobox.scss +206 -0
- package/lib/css/components/ComponentErrors.scss +5 -0
- package/lib/css/components/Datepicker.scss +19 -0
- package/lib/css/components/Declarations.scss +42 -0
- package/lib/css/components/Dragger.scss +8 -0
- package/lib/css/components/Dropdown.scss +38 -0
- package/lib/css/components/Duration.scss +9 -0
- package/lib/css/components/Fieldset.scss +5 -0
- package/lib/css/components/IconButton.scss +38 -0
- package/lib/css/components/Input.scss +42 -0
- package/lib/css/components/InputNumber.scss +11 -0
- package/lib/css/components/Label.scss +6 -0
- package/lib/css/components/Missing.scss +27 -0
- package/lib/css/components/ModalControls.scss +48 -0
- package/lib/css/components/RadioGroup.scss +21 -0
- package/lib/css/components/RosterForLoop.scss +39 -0
- package/lib/css/components/Roundabout.scss +13 -0
- package/lib/css/components/Sequence.scss +10 -0
- package/lib/css/components/Suggester.scss +170 -0
- package/lib/css/components/SuggesterWidget.scss +176 -0
- package/lib/css/components/Table.scss +27 -0
- package/lib/css/components/Textarea.scss +8 -0
- package/lib/css/components/VariableStatus.scss +36 -0
- package/lib/css/main.scss +181 -0
- package/lib/hooks/useSuggesterInfo.js +14 -12
- package/lib/main.css +1063 -0
- package/lib/main.css.map +1 -0
- package/lib/src/components/CheckboxBoolean/CheckboxBoolean.d.ts +10 -5
- package/lib/src/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/lib/src/components/CheckboxOne/CheckboxOne.d.ts +5 -12
- package/lib/src/components/Datepicker/Datepicker.d.ts +8 -10
- package/lib/src/components/Dropdown/Dropdown.d.ts +9 -12
- package/lib/src/components/Duration/Duration.d.ts +9 -7
- package/lib/src/components/FilterDescription/FilterDescription.d.ts +1 -1
- package/lib/src/components/Input/Input.d.ts +9 -8
- package/lib/src/components/InputNumber/InputNumber.d.ts +9 -10
- package/lib/src/components/Loop/Loop.d.ts +11 -18
- package/lib/src/components/LunaticComponents.d.ts +4 -2
- package/lib/src/components/Question/Question.d.ts +6 -4
- package/lib/src/components/RosterForLoop/RosterForLoop.d.ts +2 -22
- package/lib/src/components/Roundabout/Roundabout.d.ts +0 -1
- package/lib/src/components/Sequence/Sequence.d.ts +1 -2
- package/lib/src/components/Subsequence/Subsequence.d.ts +1 -1
- package/lib/src/components/Suggester/CustomSuggester.d.ts +7 -3
- package/lib/src/components/Suggester/Suggester.d.ts +1 -2
- package/lib/src/components/Suggester/SuggesterType.d.ts +6 -0
- package/lib/src/components/Suggester/helpers.d.ts +2 -2
- package/lib/src/components/Switch/Switch.d.ts +9 -0
- package/lib/src/components/Textarea/Textarea.d.ts +9 -10
- package/lib/src/components/library.d.ts +26 -93
- package/lib/src/components/shared/Button/Button.d.ts +0 -1
- package/lib/src/components/shared/Button/IconButton.d.ts +0 -1
- package/lib/src/components/shared/Checkbox/CheckboxOption.d.ts +0 -1
- package/lib/src/components/shared/Combobox/Combobox.d.ts +1 -1
- package/lib/src/components/shared/ComponentErrors/ComponentErrors.d.ts +0 -1
- package/lib/src/components/shared/Declarations/Declarations.d.ts +2 -3
- package/lib/src/components/shared/Fieldset/Fieldset.d.ts +0 -1
- package/lib/src/components/shared/HOC/slottableComponent.d.ts +105 -0
- package/lib/src/components/shared/Icons/lunatic-icon.d.ts +0 -1
- package/lib/src/components/shared/Label/Label.d.ts +0 -1
- package/lib/src/components/shared/Missing/Missing.d.ts +0 -1
- package/lib/src/components/shared/ModalControls/ModalControls.d.ts +0 -1
- package/lib/src/components/shared/Radio/RadioGroup.d.ts +1 -1
- package/lib/src/components/shared/Table/Table.d.ts +0 -1
- package/lib/src/components/shared/VariableStatus/VariableStatus.d.ts +0 -1
- package/lib/src/components/shared/suggester-loader-widget/dragger/dragger.d.ts +0 -1
- package/lib/src/components/shared/suggester-loader-widget/widget.d.ts +0 -1
- package/lib/src/components/type.d.ts +7 -7
- package/lib/src/hooks/use-track-changes.d.ts +9 -1
- package/lib/src/hooks/useSuggesterInfo.d.ts +1 -1
- package/lib/src/index.d.ts +1 -1
- package/lib/src/use-lunatic/commons/fill-components/fill-component-required.d.ts +106 -59
- package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +87 -58
- package/lib/src/use-lunatic/commons/fill-components/fill-iterations.d.ts +47 -38
- package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +159 -87
- package/lib/src/use-lunatic/commons/use-components-from-state.d.ts +1 -1
- package/lib/src/use-lunatic/lunatic-context.d.ts +1 -4
- package/lib/src/use-lunatic/replace-component-sequence.d.ts +23 -5
- package/lib/src/use-lunatic/type-source.d.ts +55 -46
- package/lib/src/use-lunatic/type.d.ts +4 -4
- package/lib/src/use-lunatic/use-lunatic.d.ts +63 -32
- package/lib/src/utils/variables.d.ts +10 -2
- package/lib/stories/{component-set/component-set.stories.js → behaviour/slots.stories.js} +36 -25
- package/lib/stories/checkbox-group/checkbox-group.stories.js +1 -6
- package/lib/stories/disabled/source.json +1 -1
- package/lib/stories/loop/source-roster.json +2 -2
- package/lib/stories/pairwise/pairwise-links.stories.js +1 -9
- package/lib/stories/suggester/fakeReferentiel.json +12 -0
- package/lib/stories/suggester/source-option-responses.json +145 -0
- package/lib/stories/suggester/suggester.stories.js +45 -7
- package/lib/stories/utils/orchestrator.js +4 -4
- package/lib/use-lunatic/commons/fill-components/fill-specific-expression.js +0 -1
- package/lib/use-lunatic/lunatic-context.js +2 -10
- package/lib/use-lunatic/replace-component-sequence.js +2 -3
- package/lib/use-lunatic/use-lunatic.js +1 -4
- package/lib/use-lunatic/use-lunatic.test.js +12 -37
- package/package.json +2 -2
- package/lib/components/ComponentSet/ComponentSet.js +0 -68
- package/lib/components/Dropdown/DropdownWritable.js +0 -58
- package/lib/components/Dropdown/renderer/WritableLabelRenderer.js +0 -38
- package/lib/components/Dropdown/renderer/WritableOptionRenderer.js +0 -140
- package/lib/src/components/ComponentSet/ComponentSet.d.ts +0 -7
- package/lib/src/components/Dropdown/DropdownWritable.d.ts +0 -17
- package/lib/src/components/Dropdown/renderer/WritableLabelRenderer.d.ts +0 -8
- package/lib/src/components/Dropdown/renderer/WritableOptionRenderer.d.ts +0 -8
- package/lib/src/components/shared/HOC/customizedComponent.d.ts +0 -5
- package/lib/src/components/type-custom.d.ts +0 -101
- package/lib/stories/checkbox-group/sourceComponentset.json +0 -424
- package/lib/stories/component-set/data-loop.json +0 -18
- package/lib/stories/component-set/data-roundabout.json +0 -25
- package/lib/stories/component-set/data.json +0 -25
- package/lib/stories/component-set/source-loop.json +0 -308
- package/lib/stories/component-set/source-roundabout.json +0 -434
- package/lib/stories/component-set/source.json +0 -113
- package/lib/stories/pairwise/source-componentset.json +0 -292
- package/lib/stories/suggester/source-component-set.json +0 -113
- /package/lib/components/{type-custom.js → Suggester/SuggesterType.js} +0 -0
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.DropdownWritable = DropdownWritable;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _WritableOptionRenderer = require("./renderer/WritableOptionRenderer");
|
|
9
|
-
var _WritableLabelRenderer = require("./renderer/WritableLabelRenderer");
|
|
10
|
-
var _Combobox = require("../shared/Combobox/Combobox");
|
|
11
|
-
var _helpers = require("./helpers");
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
18
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
-
function DropdownWritable(_ref) {
|
|
20
|
-
var id = _ref.id,
|
|
21
|
-
disabled = _ref.disabled,
|
|
22
|
-
options = _ref.options,
|
|
23
|
-
onSelect = _ref.onSelect,
|
|
24
|
-
className = _ref.className,
|
|
25
|
-
value = _ref.value,
|
|
26
|
-
label = _ref.label,
|
|
27
|
-
errors = _ref.errors,
|
|
28
|
-
description = _ref.description,
|
|
29
|
-
readOnly = _ref.readOnly;
|
|
30
|
-
var _useState = (0, _react.useState)(options),
|
|
31
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
-
filtered = _useState2[0],
|
|
33
|
-
setFiltered = _useState2[1];
|
|
34
|
-
var onChange = (0, _react.useCallback)(function (search) {
|
|
35
|
-
if (search) {
|
|
36
|
-
setFiltered((0, _helpers.filterOptions)(options, search));
|
|
37
|
-
} else {
|
|
38
|
-
setFiltered(options);
|
|
39
|
-
}
|
|
40
|
-
onSelect(null);
|
|
41
|
-
}, [options, onSelect]);
|
|
42
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Combobox.Combobox, {
|
|
43
|
-
id: id,
|
|
44
|
-
className: className,
|
|
45
|
-
disabled: disabled,
|
|
46
|
-
readOnly: readOnly,
|
|
47
|
-
options: filtered,
|
|
48
|
-
onSelect: onSelect,
|
|
49
|
-
onChange: onChange,
|
|
50
|
-
optionRenderer: _WritableOptionRenderer.WritableOptionRenderer,
|
|
51
|
-
labelRenderer: _WritableLabelRenderer.WritableLabelRenderer,
|
|
52
|
-
editable: true,
|
|
53
|
-
value: value,
|
|
54
|
-
label: label,
|
|
55
|
-
errors: errors,
|
|
56
|
-
description: description
|
|
57
|
-
});
|
|
58
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.WritableLabelRenderer = WritableLabelRenderer;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
-
function getContent(option, search) {
|
|
10
|
-
if (option) {
|
|
11
|
-
var value = option.value,
|
|
12
|
-
label = option.label;
|
|
13
|
-
if ( /*#__PURE__*/(0, _react.isValidElement)(label)) {
|
|
14
|
-
return label;
|
|
15
|
-
}
|
|
16
|
-
return label ? "".concat(value, " - ").concat(label) : value;
|
|
17
|
-
}
|
|
18
|
-
if (search !== null && search !== void 0 && search.trim().length) {
|
|
19
|
-
return search;
|
|
20
|
-
}
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
function WritableLabelRenderer(_ref) {
|
|
24
|
-
var option = _ref.option,
|
|
25
|
-
placeholder = _ref.placeholder,
|
|
26
|
-
search = _ref.search;
|
|
27
|
-
var content = getContent(option, search);
|
|
28
|
-
if (content) {
|
|
29
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
30
|
-
className: "selection",
|
|
31
|
-
children: content
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
35
|
-
className: "placeholder",
|
|
36
|
-
children: placeholder
|
|
37
|
-
});
|
|
38
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.WritableOptionRenderer = WritableOptionRenderer;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var _helpers = require("../helpers");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
-
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; }
|
|
18
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
21
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
23
|
-
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
|
24
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
26
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
27
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
28
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
|
-
function hightlightSearch(label, prefix) {
|
|
30
|
-
var labelText = (0, _helpers.labelToString)(label);
|
|
31
|
-
var initLetters = (0, _helpers.lettersMatching)(labelText, prefix);
|
|
32
|
-
return labelText.split('').reduce(function (_ref, c) {
|
|
33
|
-
var letters = _ref.letters,
|
|
34
|
-
stack = _ref.stack;
|
|
35
|
-
var m = (0, _helpers.preparePrefix)(c);
|
|
36
|
-
var _letters = _toArray(letters),
|
|
37
|
-
first = _letters[0],
|
|
38
|
-
rest = _letters.slice(1);
|
|
39
|
-
if (m === first) {
|
|
40
|
-
return {
|
|
41
|
-
letters: rest,
|
|
42
|
-
stack: [].concat(_toConsumableArray(stack), [{
|
|
43
|
-
"char": c,
|
|
44
|
-
className: 'prefix'
|
|
45
|
-
}])
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
letters: letters,
|
|
50
|
-
stack: [].concat(_toConsumableArray(stack), [{
|
|
51
|
-
"char": c,
|
|
52
|
-
className: 'normal'
|
|
53
|
-
}])
|
|
54
|
-
};
|
|
55
|
-
}, {
|
|
56
|
-
letters: initLetters,
|
|
57
|
-
stack: []
|
|
58
|
-
}).stack.reduce(function (_ref2, _ref3) {
|
|
59
|
-
var last = _ref2.last,
|
|
60
|
-
stack = _ref2.stack;
|
|
61
|
-
var _char = _ref3["char"],
|
|
62
|
-
className = _ref3.className;
|
|
63
|
-
if (!last) {
|
|
64
|
-
return {
|
|
65
|
-
last: className,
|
|
66
|
-
stack: [{
|
|
67
|
-
part: _char,
|
|
68
|
-
className: className
|
|
69
|
-
}]
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
if (last !== className) {
|
|
73
|
-
return {
|
|
74
|
-
last: className,
|
|
75
|
-
stack: [{
|
|
76
|
-
part: _char,
|
|
77
|
-
className: className
|
|
78
|
-
}].concat(_toConsumableArray(stack))
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
var _stack = _toArray(stack),
|
|
82
|
-
first = _stack[0],
|
|
83
|
-
rest = _stack.slice(1);
|
|
84
|
-
return {
|
|
85
|
-
last: className,
|
|
86
|
-
stack: [_objectSpread(_objectSpread({}, first), {}, {
|
|
87
|
-
part: "".concat(first.part).concat(_char)
|
|
88
|
-
})].concat(_toConsumableArray(rest))
|
|
89
|
-
};
|
|
90
|
-
}, {
|
|
91
|
-
last: undefined,
|
|
92
|
-
stack: []
|
|
93
|
-
}).stack.reverse();
|
|
94
|
-
}
|
|
95
|
-
function WritableOptionRenderer(_ref4) {
|
|
96
|
-
var option = _ref4.option,
|
|
97
|
-
selected = _ref4.selected,
|
|
98
|
-
search = _ref4.search;
|
|
99
|
-
var _useState = (0, _react.useState)([]),
|
|
100
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
101
|
-
parts = _useState2[0],
|
|
102
|
-
setParts = _useState2[1];
|
|
103
|
-
var value = option.value,
|
|
104
|
-
label = option.label;
|
|
105
|
-
(0, _react.useEffect)(function () {
|
|
106
|
-
setParts(hightlightSearch(label, search));
|
|
107
|
-
}, [search, label]);
|
|
108
|
-
if (parts !== null && parts !== void 0 && parts.length) {
|
|
109
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
110
|
-
className: (0, _classnames["default"])('lunatic-dropdown-option', {
|
|
111
|
-
selected: selected
|
|
112
|
-
}),
|
|
113
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
114
|
-
className: "id",
|
|
115
|
-
children: value
|
|
116
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
117
|
-
children: "\xA0\u2014\xA0"
|
|
118
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
119
|
-
className: "label",
|
|
120
|
-
children: parts.map(function (_ref5, i) {
|
|
121
|
-
var part = _ref5.part,
|
|
122
|
-
className = _ref5.className;
|
|
123
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
124
|
-
className: className,
|
|
125
|
-
children: part
|
|
126
|
-
}, i);
|
|
127
|
-
})
|
|
128
|
-
})]
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
132
|
-
className: (0, _classnames["default"])('lunatic-dropdown-option', {
|
|
133
|
-
selected: selected
|
|
134
|
-
}),
|
|
135
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
136
|
-
className: "id",
|
|
137
|
-
children: value
|
|
138
|
-
})
|
|
139
|
-
});
|
|
140
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { LunaticComponentProps } from '../type';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
export declare function ComponentSet({ id, label, description, response, // Do not propagate the response (it's undefined)
|
|
4
|
-
components, ...props }: LunaticComponentProps<'ComponentSet'>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
export declare const ComponentSetItem: import("react").ComponentType<{
|
|
6
|
-
children?: ReactNode;
|
|
7
|
-
}>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
import type { ComboboxOptionType } from '../shared/Combobox/ComboboxType';
|
|
3
|
-
import type { LunaticError } from '../../use-lunatic/type';
|
|
4
|
-
type Props = {
|
|
5
|
-
id?: string;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
options: ComboboxOptionType[];
|
|
8
|
-
onSelect: (v: string | null) => void;
|
|
9
|
-
className?: string;
|
|
10
|
-
value: string | null;
|
|
11
|
-
label?: ReactNode;
|
|
12
|
-
errors?: LunaticError[];
|
|
13
|
-
description?: ReactNode;
|
|
14
|
-
readOnly?: boolean;
|
|
15
|
-
};
|
|
16
|
-
export declare function DropdownWritable({ id, disabled, options, onSelect, className, value, label, errors, description, readOnly, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ComboboxOptionType } from '../../shared/Combobox/ComboboxType';
|
|
2
|
-
type Props = {
|
|
3
|
-
option?: ComboboxOptionType;
|
|
4
|
-
placeholder?: string;
|
|
5
|
-
search?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function WritableLabelRenderer({ option, placeholder, search }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ComboboxOptionType } from '../../shared/Combobox/ComboboxType';
|
|
2
|
-
type Props = {
|
|
3
|
-
option: ComboboxOptionType;
|
|
4
|
-
selected?: boolean;
|
|
5
|
-
search?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function WritableOptionRenderer({ option, selected, search }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type ComponentType, type FunctionComponent } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Create a replaceable version of a component
|
|
4
|
-
*/
|
|
5
|
-
export declare function customizedComponent<T extends Record<string, unknown>>(name: string, LunaticField: FunctionComponent<T>): ComponentType<T>;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import type { Subsequence } from './Subsequence/Subsequence';
|
|
2
|
-
import type { Input } from './Input/Input';
|
|
3
|
-
import type { Declaration, Declarations } from './shared/Declarations/Declarations';
|
|
4
|
-
import type { Label } from './shared/Label/Label';
|
|
5
|
-
import { Tr, Td, Th, Tbody, Thead, Table } from './shared/Table';
|
|
6
|
-
import type { Textarea } from './Textarea/Textarea';
|
|
7
|
-
import type { RadioGroup } from './shared/Radio/RadioGroup';
|
|
8
|
-
import type { CustomRoundabout } from './Roundabout/CustomRoundabout';
|
|
9
|
-
import { RoundaboutContainer, RoundaboutItContainer, RoundaboutItTitle, RoundaboutLabel, RoundaboutPending } from './Roundabout/extra';
|
|
10
|
-
import type { RoundaboutItButton } from './Roundabout/RoundaboutItButton';
|
|
11
|
-
import type { Button } from './shared/Button/Button';
|
|
12
|
-
import type { CheckboxBoolean } from './CheckboxBoolean/CheckboxBoolean';
|
|
13
|
-
import { CheckboxOne } from './CheckboxOne/CheckboxOne';
|
|
14
|
-
import type { CheckboxOption } from './shared/Checkbox/CheckboxOption';
|
|
15
|
-
import type { Datepicker } from './Datepicker/Datepicker';
|
|
16
|
-
import type { Duration } from './Duration/Duration';
|
|
17
|
-
import { Fieldset } from './shared/Fieldset/Fieldset';
|
|
18
|
-
import type { InputNumber } from './InputNumber/InputNumber';
|
|
19
|
-
import type { Question } from './Question/Question';
|
|
20
|
-
import type { RadioOption } from './shared/Radio/RadioOption';
|
|
21
|
-
import type { Sequence } from './Sequence/Sequence';
|
|
22
|
-
import type { Switch } from './Switch/Switch';
|
|
23
|
-
import type { Loop } from './Loop/Loop';
|
|
24
|
-
import type { RosterForLoop } from './RosterForLoop/RosterForLoop';
|
|
25
|
-
import type { Dropdown } from './Dropdown/Dropdown';
|
|
26
|
-
import type { Combobox } from './shared/Combobox/Combobox';
|
|
27
|
-
import { ComboboxContainer } from './shared/Combobox/ComboboxContainer';
|
|
28
|
-
import { ComboboxContentBox } from './shared/Combobox/ComboboxContentBox';
|
|
29
|
-
import { ComboboxOption } from './shared/Combobox/Panel/ComboboxOption';
|
|
30
|
-
import type { ComboboxPanelContainer } from './shared/Combobox/Panel/ComboboxPanelContainer';
|
|
31
|
-
import type { ComboboxClearButton } from './shared/Combobox/Selection/ComboboxClearButton';
|
|
32
|
-
import type { ComboboxLabelSelection } from './shared/Combobox/Selection/ComboboxLabelSelection';
|
|
33
|
-
import { SuggesterNotification } from './Suggester/SuggesterNotification';
|
|
34
|
-
import type { Radio } from './Radio/Radio';
|
|
35
|
-
import type { ComboboxInput } from './shared/Combobox/Selection/ComboboxInput';
|
|
36
|
-
import type { FilterDescription } from './FilterDescription/FilterDescription';
|
|
37
|
-
import type { CustomSuggester } from './Suggester/CustomSuggester';
|
|
38
|
-
import type { CustomCheckboxGroup } from './CheckboxGroup/CustomCheckboxGroup';
|
|
39
|
-
import { ComponentSet, ComponentSetItem } from './ComponentSet/ComponentSet';
|
|
40
|
-
import type { RouterLink } from './shared/MDLabel/RouterLink';
|
|
41
|
-
import { SummaryResponses, type SummaryTitle } from './Summary/Summary';
|
|
42
|
-
/**
|
|
43
|
-
* Contains the type of every customizable component
|
|
44
|
-
*/
|
|
45
|
-
export type LunaticCustomizedComponent = {
|
|
46
|
-
Input: typeof Input;
|
|
47
|
-
InputNumber: typeof InputNumber;
|
|
48
|
-
Sequence: typeof Sequence;
|
|
49
|
-
Switch: typeof Switch;
|
|
50
|
-
Subsequence: typeof Subsequence;
|
|
51
|
-
Textarea: typeof Textarea;
|
|
52
|
-
Datepicker: typeof Datepicker;
|
|
53
|
-
Duration: typeof Duration;
|
|
54
|
-
Question: typeof Question;
|
|
55
|
-
BlockForLoop: typeof Loop;
|
|
56
|
-
RosterForLoop: typeof RosterForLoop;
|
|
57
|
-
Dropdown: typeof Dropdown;
|
|
58
|
-
LunaticRadio: typeof Radio;
|
|
59
|
-
FilterDescription: typeof FilterDescription;
|
|
60
|
-
Suggester: typeof CustomSuggester;
|
|
61
|
-
ComponentSet: typeof ComponentSet;
|
|
62
|
-
ComponentSetItem: typeof ComponentSetItem;
|
|
63
|
-
CheckboxBoolean: typeof CheckboxBoolean;
|
|
64
|
-
CheckboxGroup: typeof CustomCheckboxGroup;
|
|
65
|
-
CheckboxOne: typeof CheckboxOne;
|
|
66
|
-
CheckboxOption: typeof CheckboxOption;
|
|
67
|
-
Radio: typeof RadioGroup;
|
|
68
|
-
RadioGroup: typeof RadioGroup;
|
|
69
|
-
RadioOption: typeof RadioOption;
|
|
70
|
-
Combobox: typeof Combobox;
|
|
71
|
-
ComboboxContainer: typeof ComboboxContainer;
|
|
72
|
-
ComboboxContentBox: typeof ComboboxContentBox;
|
|
73
|
-
ComboboxPanelContainer: typeof ComboboxPanelContainer;
|
|
74
|
-
ComboboxOption: typeof ComboboxOption;
|
|
75
|
-
ComboboxInput: typeof ComboboxInput;
|
|
76
|
-
ComboboxClearButton: typeof ComboboxClearButton;
|
|
77
|
-
ComboboxLabelSelection: typeof ComboboxLabelSelection;
|
|
78
|
-
Roundabout: typeof CustomRoundabout;
|
|
79
|
-
RoundaboutContainer: typeof RoundaboutContainer;
|
|
80
|
-
RoundaboutLabel: typeof RoundaboutLabel;
|
|
81
|
-
RoundaboutItTitle: typeof RoundaboutItTitle;
|
|
82
|
-
RoundaboutItContainer: typeof RoundaboutItContainer;
|
|
83
|
-
RoundaboutItButton: typeof RoundaboutItButton;
|
|
84
|
-
RoundaboutPending: typeof RoundaboutPending;
|
|
85
|
-
SuggesterNotification: typeof SuggesterNotification;
|
|
86
|
-
SummaryTitle: typeof SummaryTitle;
|
|
87
|
-
SummaryResponses: typeof SummaryResponses;
|
|
88
|
-
Button: typeof Button;
|
|
89
|
-
Label: typeof Label;
|
|
90
|
-
Declarations: typeof Declarations;
|
|
91
|
-
Declaration: typeof Declaration;
|
|
92
|
-
Tr: typeof Tr;
|
|
93
|
-
Td: typeof Td;
|
|
94
|
-
Th: typeof Th;
|
|
95
|
-
Tbody: typeof Tbody;
|
|
96
|
-
Table: typeof Table;
|
|
97
|
-
Thead: typeof Thead;
|
|
98
|
-
Fieldset: typeof Fieldset;
|
|
99
|
-
Notification: typeof Notification;
|
|
100
|
-
RouterLink: typeof RouterLink;
|
|
101
|
-
};
|