@inseefr/lunatic 2.5.0-fix-last-reached-page → 2.5.1-suggesterCustomisationStyle
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/commons/components/combo-box/combo-box-container.js +15 -7
- package/lib/components/commons/components/combo-box/combo-box-container.spec.js +5 -5
- package/lib/components/commons/components/combo-box/combo-box-content-box.js +30 -0
- package/lib/components/commons/components/combo-box/combo-box-content.js +8 -9
- package/lib/components/commons/components/combo-box/combo-box.js +8 -9
- package/lib/components/commons/components/{default-option-renderer.js → combo-box/panel/combo-box-option.js} +3 -2
- package/lib/components/commons/components/{default-option-renderer.spec.js → combo-box/panel/combo-box-option.spec.js} +5 -5
- package/lib/components/commons/components/combo-box/panel/panel.js +4 -4
- package/lib/components/commons/components/combo-box/selection/LabelOrInput.js +51 -0
- package/lib/components/commons/components/combo-box/selection/LabelOrInput.spec.js +23 -0
- package/lib/components/commons/components/combo-box/selection/__snapshots__/selection.spec.tsx.snap +14 -12
- package/lib/components/commons/components/combo-box/selection/{delete.js → clear-button.js} +6 -3
- package/lib/components/commons/components/combo-box/selection/{delete.spec.js → clear-button.spec.js} +9 -9
- package/lib/components/commons/components/combo-box/selection/combo-box-label-selection.js +47 -0
- package/lib/components/commons/components/{default-label-renderer.spec.js → combo-box/selection/combo-box-label-selection.spec.js} +4 -4
- package/lib/components/commons/components/combo-box/selection/input.js +2 -2
- package/lib/components/commons/components/combo-box/selection/label-selection.js +8 -12
- package/lib/components/commons/components/combo-box/selection/label-selection.spec.js +3 -11
- package/lib/components/commons/components/combo-box/selection/selection-container.js +3 -2
- package/lib/components/commons/components/combo-box/selection/selection.js +8 -12
- package/lib/components/commons/components/combo-box/selection/selection.spec.js +5 -30
- package/lib/components/commons/index.js +1 -12
- package/lib/components/suggester/html/suggester.js +3 -5
- package/lib/components/suggester/lunatic-suggester.js +3 -1
- package/lib/src/components/commons/components/combo-box/combo-box-container.d.ts +4 -2
- package/lib/src/components/commons/components/combo-box/combo-box-content-box.d.ts +11 -0
- package/lib/src/components/commons/components/combo-box/combo-box-content.d.ts +2 -1
- package/lib/src/components/commons/components/combo-box/combo-box.d.ts +3 -3
- package/lib/src/components/commons/components/combo-box/combo-box.stories.d.ts +4 -3
- package/lib/src/components/commons/components/combo-box/combo-box.type.d.ts +1 -1
- package/lib/src/components/commons/components/combo-box/panel/combo-box-option.d.ts +8 -0
- package/lib/src/components/commons/components/combo-box/panel/panel.d.ts +7 -4
- package/lib/src/components/commons/components/combo-box/selection/LabelOrInput.d.ts +16 -0
- package/lib/src/components/commons/components/combo-box/selection/clear-button.d.ts +9 -0
- package/lib/src/components/commons/components/combo-box/selection/combo-box-label-selection.d.ts +10 -0
- package/lib/src/components/commons/components/combo-box/selection/input.d.ts +9 -4
- package/lib/src/components/commons/components/combo-box/selection/label-selection.d.ts +9 -9
- package/lib/src/components/commons/components/combo-box/selection/selection-container.d.ts +2 -1
- package/lib/src/components/commons/components/combo-box/selection/selection.d.ts +2 -1
- package/lib/src/components/commons/components/combo-box/state-management/actions.d.ts +5 -5
- package/lib/src/components/commons/index.d.ts +0 -3
- package/lib/src/components/dropdown/html/dropdown-simple/simple-label-renderer.d.ts +2 -2
- package/lib/src/components/dropdown/html/dropdown-simple/simple-option-renderer.d.ts +2 -2
- package/lib/src/components/dropdown/html/dropdown-writable/dropdown-writable.d.ts +2 -2
- package/lib/src/components/dropdown/html/dropdown-writable/writable-label-renderer.d.ts +2 -2
- package/lib/src/components/dropdown/html/dropdown-writable/writable-option-renderer.d.ts +2 -2
- package/lib/src/components/loop/block-for-loop/block-for-loop-ochestrator.d.ts +1 -1
- package/lib/src/components/loop/roster-for-loop/roster-for-loop-orchestrator.d.ts +1 -1
- package/lib/src/components/suggester/html/suggester.d.ts +2 -2
- package/lib/src/components/suggester/lunatic-suggester.d.ts +1 -1
- package/lib/src/components/suggester/searching/create-searching.d.ts +2 -2
- package/lib/src/i18n/index.d.ts +2 -2
- package/lib/src/i18n/inputNumberProps.d.ts +1 -1
- package/lib/stories/suggester/simple.json +15 -0
- package/package.json +1 -1
- package/lib/components/commons/components/combo-box/selection/displayLabelOrInput.js +0 -26
- package/lib/components/commons/components/combo-box/selection/displayLabelOrInput.spec.js +0 -56
- package/lib/components/commons/components/default-label-renderer.js +0 -37
- package/lib/src/components/commons/components/combo-box/selection/delete.d.ts +0 -8
- package/lib/src/components/commons/components/combo-box/selection/displayLabelOrInput.d.ts +0 -5
- package/lib/src/components/commons/components/default-label-renderer.d.ts +0 -8
- package/lib/src/components/commons/components/default-option-renderer.d.ts +0 -7
- /package/lib/src/components/commons/components/combo-box/{selection/delete.spec.d.ts → panel/combo-box-option.spec.d.ts} +0 -0
- /package/lib/src/components/commons/components/combo-box/selection/{displayLabelOrInput.spec.d.ts → LabelOrInput.spec.d.ts} +0 -0
- /package/lib/src/components/commons/components/{default-label-renderer.spec.d.ts → combo-box/selection/clear-button.spec.d.ts} +0 -0
- /package/lib/src/components/commons/components/{default-option-renderer.spec.d.ts → combo-box/selection/combo-box-label-selection.spec.d.ts} +0 -0
|
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.LabelSelection = LabelSelection;
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
10
|
-
var _displayLabelOrInput = require("./displayLabelOrInput");
|
|
9
|
+
var _comboBoxLabelSelection = _interopRequireDefault(require("./combo-box-label-selection"));
|
|
11
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
12
|
function LabelSelection(_ref) {
|
|
@@ -18,16 +17,13 @@ function LabelSelection(_ref) {
|
|
|
18
17
|
search = _ref.search,
|
|
19
18
|
disabled = _ref.disabled;
|
|
20
19
|
var option = selectedIndex !== undefined ? options[selectedIndex] : undefined;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
placeholder: placeholder,
|
|
28
|
-
search: search
|
|
29
|
-
})
|
|
20
|
+
var LabelSelectionComponent = Renderer !== null && Renderer !== void 0 ? Renderer : _comboBoxLabelSelection["default"];
|
|
21
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(LabelSelectionComponent, {
|
|
22
|
+
option: option,
|
|
23
|
+
placeholder: placeholder,
|
|
24
|
+
search: search,
|
|
25
|
+
disabled: disabled
|
|
30
26
|
});
|
|
31
27
|
}
|
|
32
|
-
var _default =
|
|
28
|
+
var _default = LabelSelection;
|
|
33
29
|
exports["default"] = _default;
|
|
@@ -16,15 +16,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
16
16
|
label: 'Option 3',
|
|
17
17
|
value: 'banana'
|
|
18
18
|
}];
|
|
19
|
-
var LabelRenderer = function LabelRenderer(props) {
|
|
20
|
-
var _props$option$label, _props$option;
|
|
21
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
22
|
-
children: (_props$option$label = (_props$option = props.option) === null || _props$option === void 0 ? void 0 : _props$option.label) !== null && _props$option$label !== void 0 ? _props$option$label : 'Unknown'
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
19
|
(0, _vitest.it)('should render the labelRenderer when expanded is true and editable is false', function () {
|
|
26
20
|
var _render = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_labelSelection["default"], {
|
|
27
|
-
labelRenderer: LabelRenderer,
|
|
28
21
|
selectedIndex: 0,
|
|
29
22
|
options: options,
|
|
30
23
|
placeholder: "Select an option...",
|
|
@@ -32,18 +25,17 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
32
25
|
disabled: false
|
|
33
26
|
})),
|
|
34
27
|
getByText = _render.getByText;
|
|
35
|
-
(0, _vitest.expect)(getByText('Option 1')).toBeInTheDocument();
|
|
28
|
+
(0, _vitest.expect)(getByText('apple - Option 1')).toBeInTheDocument();
|
|
36
29
|
});
|
|
37
30
|
(0, _vitest.it)('should add the disabled class when disabled is true', function () {
|
|
38
31
|
var _render2 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_labelSelection["default"], {
|
|
39
|
-
labelRenderer: LabelRenderer,
|
|
40
32
|
selectedIndex: 0,
|
|
41
33
|
options: options,
|
|
42
34
|
placeholder: "Select an option...",
|
|
43
35
|
search: "search term",
|
|
44
36
|
disabled: true
|
|
45
37
|
})),
|
|
46
|
-
|
|
47
|
-
(0, _vitest.expect)(
|
|
38
|
+
getByText = _render2.getByText;
|
|
39
|
+
(0, _vitest.expect)(getByText('apple - Option 1').parentElement).toHaveClass('disabled');
|
|
48
40
|
});
|
|
49
41
|
});
|
|
@@ -14,11 +14,12 @@ function SelectionContainer(_ref) {
|
|
|
14
14
|
expanded = _ref.expanded,
|
|
15
15
|
focused = _ref.focused,
|
|
16
16
|
disabled = _ref.disabled,
|
|
17
|
-
labelId = _ref.labelId
|
|
17
|
+
labelId = _ref.labelId,
|
|
18
|
+
className = _ref.className;
|
|
18
19
|
var comboBoxId = "".concat(id);
|
|
19
20
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
20
21
|
id: comboBoxId,
|
|
21
|
-
className: (0, _classnames["default"])('lunatic-combo-box-selection
|
|
22
|
+
className: (0, _classnames["default"])("".concat(className !== null && className !== void 0 ? className : 'lunatic', "-combo-box-selection"), {
|
|
22
23
|
focused: focused,
|
|
23
24
|
disabled: disabled
|
|
24
25
|
}),
|
|
@@ -5,9 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Selection = Selection;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var _labelSelection = require("./label-selection");
|
|
9
|
-
var _input = _interopRequireDefault(require("./input"));
|
|
10
8
|
var _selectionContainer = _interopRequireDefault(require("./selection-container"));
|
|
9
|
+
var _LabelOrInput = require("./LabelOrInput");
|
|
11
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
12
|
function Selection(_ref) {
|
|
@@ -22,32 +21,29 @@ function Selection(_ref) {
|
|
|
22
21
|
options = _ref.options,
|
|
23
22
|
editable = _ref.editable,
|
|
24
23
|
labelId = _ref.labelId,
|
|
25
|
-
id = _ref.id
|
|
24
|
+
id = _ref.id,
|
|
25
|
+
className = _ref.className;
|
|
26
26
|
var onChangeEx = (0, _react.useCallback)(function (e) {
|
|
27
27
|
onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value);
|
|
28
28
|
}, [onChange]);
|
|
29
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
29
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_selectionContainer["default"], {
|
|
30
30
|
id: id,
|
|
31
31
|
labelId: labelId,
|
|
32
32
|
expanded: expanded,
|
|
33
33
|
"aria-owns": "".concat(id, "-list"),
|
|
34
|
-
|
|
34
|
+
className: className,
|
|
35
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_LabelOrInput.LabelOrInput, {
|
|
35
36
|
labelRenderer: labelRenderer,
|
|
36
37
|
placeholder: placeholder,
|
|
37
38
|
selectedIndex: selectedIndex,
|
|
38
39
|
options: options,
|
|
39
40
|
search: search,
|
|
40
|
-
disabled: disabled
|
|
41
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_input["default"], {
|
|
42
|
-
id: "combobox-input-".concat(id),
|
|
43
|
-
className: "lunatic-combo-box-input",
|
|
41
|
+
disabled: disabled,
|
|
44
42
|
onChange: onChangeEx,
|
|
45
43
|
value: search,
|
|
46
|
-
placeholder: placeholder,
|
|
47
|
-
disabled: disabled,
|
|
48
44
|
focused: focused,
|
|
49
45
|
editable: editable,
|
|
50
46
|
expanded: expanded
|
|
51
|
-
})
|
|
47
|
+
})
|
|
52
48
|
});
|
|
53
49
|
}
|
|
@@ -15,15 +15,8 @@ var options = [{
|
|
|
15
15
|
value: 'banana'
|
|
16
16
|
}];
|
|
17
17
|
(0, _vitest.describe)('Selection component', function () {
|
|
18
|
-
var LabelRenderer = function LabelRenderer(_ref) {
|
|
19
|
-
var option = _ref.option;
|
|
20
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
21
|
-
children: option ? option.label : 'No selection'
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
18
|
(0, _vitest.it)('should render correctly with default props', function () {
|
|
25
19
|
var _render = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_selection.Selection, {
|
|
26
|
-
labelRenderer: LabelRenderer,
|
|
27
20
|
options: options
|
|
28
21
|
})),
|
|
29
22
|
container = _render.container;
|
|
@@ -31,7 +24,6 @@ var options = [{
|
|
|
31
24
|
});
|
|
32
25
|
(0, _vitest.it)('should render correctly when it is editable', function () {
|
|
33
26
|
var _render2 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_selection.Selection, {
|
|
34
|
-
labelRenderer: LabelRenderer,
|
|
35
27
|
options: options,
|
|
36
28
|
editable: true
|
|
37
29
|
})),
|
|
@@ -40,7 +32,6 @@ var options = [{
|
|
|
40
32
|
});
|
|
41
33
|
(0, _vitest.it)('should render correctly when it is expanded', function () {
|
|
42
34
|
var _render3 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_selection.Selection, {
|
|
43
|
-
labelRenderer: LabelRenderer,
|
|
44
35
|
options: options,
|
|
45
36
|
expanded: true
|
|
46
37
|
})),
|
|
@@ -49,40 +40,24 @@ var options = [{
|
|
|
49
40
|
});
|
|
50
41
|
(0, _vitest.it)('should render correctly when it is disabled', function () {
|
|
51
42
|
var _render4 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_selection.Selection, {
|
|
52
|
-
labelRenderer: function labelRenderer(_ref2) {
|
|
53
|
-
var option = _ref2.option;
|
|
54
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
55
|
-
children: option ? option.label : 'No selection'
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
43
|
options: options,
|
|
59
|
-
disabled: true
|
|
44
|
+
disabled: true,
|
|
45
|
+
placeholder: "hello!"
|
|
60
46
|
})),
|
|
61
47
|
container = _render4.container;
|
|
62
48
|
(0, _vitest.expect)(container.firstChild).toMatchSnapshot();
|
|
63
49
|
});
|
|
64
50
|
(0, _vitest.it)('should render the selected option when there is a selection', function () {
|
|
65
51
|
var _render5 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_selection.Selection, {
|
|
66
|
-
labelRenderer: function labelRenderer(_ref3) {
|
|
67
|
-
var option = _ref3.option;
|
|
68
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
69
|
-
children: option ? option.label : 'No selection'
|
|
70
|
-
});
|
|
71
|
-
},
|
|
72
52
|
options: options,
|
|
73
|
-
selectedIndex: 0
|
|
53
|
+
selectedIndex: 0,
|
|
54
|
+
expanded: false
|
|
74
55
|
})),
|
|
75
56
|
getByText = _render5.getByText;
|
|
76
|
-
(0, _vitest.expect)(getByText('Apple')).toBeInTheDocument();
|
|
57
|
+
(0, _vitest.expect)(getByText('apple - Apple')).toBeInTheDocument();
|
|
77
58
|
});
|
|
78
59
|
(0, _vitest.it)('should not render the input when it is not editable', function () {
|
|
79
60
|
var _render6 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_selection.Selection, {
|
|
80
|
-
labelRenderer: function labelRenderer(_ref4) {
|
|
81
|
-
var option = _ref4.option;
|
|
82
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
83
|
-
children: option ? option.label : 'No selection'
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
61
|
options: options,
|
|
87
62
|
placeholder: "Search fruits",
|
|
88
63
|
editable: false
|
|
@@ -10,13 +10,6 @@ Object.defineProperty(exports, "ComboBox", {
|
|
|
10
10
|
return _comboBox["default"];
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
Object.defineProperty(exports, "DefaultLabelRenderer", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _defaultLabelRenderer["default"];
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
exports.DefaultOptionRenderer = void 0;
|
|
20
13
|
Object.defineProperty(exports, "Errors", {
|
|
21
14
|
enumerable: true,
|
|
22
15
|
get: function get() {
|
|
@@ -90,8 +83,6 @@ Object.defineProperty(exports, "useOptionsKeydown", {
|
|
|
90
83
|
return _useOptionsKeydown["default"];
|
|
91
84
|
}
|
|
92
85
|
});
|
|
93
|
-
var _defaultOptionRenderer = _interopRequireDefault(require("./components/default-option-renderer"));
|
|
94
|
-
var _defaultLabelRenderer = _interopRequireDefault(require("./components/default-label-renderer"));
|
|
95
86
|
var _fieldContainer = _interopRequireDefault(require("./components/field-container"));
|
|
96
87
|
var _label = _interopRequireDefault(require("./components/label"));
|
|
97
88
|
var _fieldset = _interopRequireDefault(require("./components/fieldset"));
|
|
@@ -109,6 +100,4 @@ var _safetyLabel = _interopRequireDefault(require("./safety-label"));
|
|
|
109
100
|
var _errors = _interopRequireDefault(require("./components/errors"));
|
|
110
101
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
111
102
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
112
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
113
|
-
var DefaultOptionRenderer = _defaultOptionRenderer["default"]; // We need to export this way to avoid crash on storybook TODO : investigate
|
|
114
|
-
exports.DefaultOptionRenderer = DefaultOptionRenderer;
|
|
103
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -25,15 +25,13 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
25
25
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
26
|
function Suggester(_ref) {
|
|
27
27
|
var _ref$className = _ref.className,
|
|
28
|
-
className = _ref$className === void 0 ? 'lunatic
|
|
28
|
+
className = _ref$className === void 0 ? 'lunatic' : _ref$className,
|
|
29
29
|
_ref$placeholder = _ref.placeholder,
|
|
30
30
|
placeholder = _ref$placeholder === void 0 ? _i18n["default"].PLACEHOLDER : _ref$placeholder,
|
|
31
31
|
_ref$onSelect = _ref.onSelect,
|
|
32
32
|
onSelect = _ref$onSelect === void 0 ? _function.voidFunction : _ref$onSelect,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
_ref$optionRenderer = _ref.optionRenderer,
|
|
36
|
-
optionRenderer = _ref$optionRenderer === void 0 ? _commons.DefaultOptionRenderer : _ref$optionRenderer,
|
|
33
|
+
labelRenderer = _ref.labelRenderer,
|
|
34
|
+
optionRenderer = _ref.optionRenderer,
|
|
37
35
|
value = _ref.value,
|
|
38
36
|
disabled = _ref.disabled,
|
|
39
37
|
id = _ref.id,
|
|
@@ -28,6 +28,7 @@ function LunaticSuggester(_ref) {
|
|
|
28
28
|
missingResponse = _ref.missingResponse,
|
|
29
29
|
management = _ref.management,
|
|
30
30
|
response = _ref.response,
|
|
31
|
+
className = _ref.className,
|
|
31
32
|
getSuggesterStatus = _ref.getSuggesterStatus;
|
|
32
33
|
var onChange = (0, _useOnHandleChange["default"])({
|
|
33
34
|
handleChange: handleChange,
|
|
@@ -55,7 +56,8 @@ function LunaticSuggester(_ref) {
|
|
|
55
56
|
value: value,
|
|
56
57
|
errors: errors,
|
|
57
58
|
label: label,
|
|
58
|
-
getSuggesterStatus: getSuggesterStatus
|
|
59
|
+
getSuggesterStatus: getSuggesterStatus,
|
|
60
|
+
className: className
|
|
59
61
|
})
|
|
60
62
|
});
|
|
61
63
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import { LunaticBaseProps } from '../../../type';
|
|
2
3
|
type Props = PropsWithChildren<{
|
|
3
4
|
className?: string;
|
|
4
5
|
id?: string;
|
|
5
6
|
classStyle?: string;
|
|
7
|
+
errors?: LunaticBaseProps['errors'];
|
|
6
8
|
}>;
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
+
declare const _default: import("react").ComponentType<Props>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { KeyboardEvent } from 'react';
|
|
2
|
+
import React, { PropsWithChildren } from 'react';
|
|
3
|
+
type Props = PropsWithChildren<{
|
|
4
|
+
focused?: boolean;
|
|
5
|
+
onFocus: () => void;
|
|
6
|
+
onKeyDown: (e: KeyboardEvent<Element>) => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function ComboBoxContentBox({ children, className, onFocus, onKeyDown, focused, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare const _default: React.ComponentType<Props>;
|
|
11
|
+
export default _default;
|
|
@@ -4,6 +4,7 @@ type Props = PropsWithChildren<{
|
|
|
4
4
|
onBlur: () => void;
|
|
5
5
|
onFocus: () => void;
|
|
6
6
|
onKeyDown: (key: string) => void;
|
|
7
|
+
className?: string;
|
|
7
8
|
}>;
|
|
8
|
-
export declare function ComboBoxContent({ children, focused, onFocus, onBlur, onKeyDown, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function ComboBoxContent({ children, focused, onFocus, onBlur, onKeyDown, className, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export default ComboBoxContent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import './combo-box.scss';
|
|
3
|
-
import {
|
|
3
|
+
import { ComboBoxOptionType } from './combo-box.type';
|
|
4
4
|
import { SelectionProps } from './selection/selection';
|
|
5
5
|
import { PanelProps } from './panel/panel';
|
|
6
6
|
import { LunaticBaseProps } from '../../../type';
|
|
@@ -9,13 +9,13 @@ type Props = SelectionProps & PanelProps & {
|
|
|
9
9
|
classStyle?: string;
|
|
10
10
|
value: string | null;
|
|
11
11
|
messageError?: string;
|
|
12
|
-
getOptionValue?: (o:
|
|
12
|
+
getOptionValue?: (o: ComboBoxOptionType) => string;
|
|
13
13
|
label?: ReactNode;
|
|
14
14
|
description?: ReactNode;
|
|
15
15
|
errors?: LunaticBaseProps['errors'];
|
|
16
16
|
onChange?: (s: string | null) => void;
|
|
17
17
|
onSelect: (s: string | null) => void;
|
|
18
|
-
options:
|
|
18
|
+
options: ComboBoxOptionType[];
|
|
19
19
|
};
|
|
20
20
|
declare const _default: import("react").ComponentType<Props>;
|
|
21
21
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Meta, Story } from '@storybook/react';
|
|
3
|
-
import {
|
|
3
|
+
import { ComboBoxOptionType } from './combo-box.type';
|
|
4
4
|
declare const stories: Meta;
|
|
5
5
|
export default stories;
|
|
6
6
|
export declare const Default: Story<{
|
|
@@ -10,12 +10,13 @@ export declare const Default: Story<{
|
|
|
10
10
|
editable?: boolean | undefined;
|
|
11
11
|
labelId?: string | undefined;
|
|
12
12
|
id?: string | undefined;
|
|
13
|
+
className?: string | undefined;
|
|
13
14
|
} & import("./selection/label-selection").LabelSelectionProps & import("./panel/panel").PanelProps & {
|
|
14
15
|
className?: string | undefined;
|
|
15
16
|
classStyle?: string | undefined;
|
|
16
17
|
value: string | null;
|
|
17
18
|
messageError?: string | undefined;
|
|
18
|
-
getOptionValue?: ((o:
|
|
19
|
+
getOptionValue?: ((o: ComboBoxOptionType) => string) | undefined;
|
|
19
20
|
label?: import("react").ReactNode;
|
|
20
21
|
description?: import("react").ReactNode;
|
|
21
22
|
errors?: {
|
|
@@ -23,5 +24,5 @@ export declare const Default: Story<{
|
|
|
23
24
|
} | undefined;
|
|
24
25
|
onChange?: ((s: string | null) => void) | undefined;
|
|
25
26
|
onSelect: (s: string | null) => void;
|
|
26
|
-
options:
|
|
27
|
+
options: ComboBoxOptionType[];
|
|
27
28
|
}>;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ComboBoxOptionType } from '../combo-box.type';
|
|
3
3
|
export type PanelProps = {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated use createCustomizableField with ComboboxOptionRenderer as name.
|
|
6
|
+
*/
|
|
7
|
+
optionRenderer?: FunctionComponent<{
|
|
8
|
+
option: ComboBoxOptionType;
|
|
6
9
|
selected?: boolean;
|
|
7
10
|
search?: string;
|
|
8
11
|
}>;
|
|
9
|
-
options: Array<
|
|
12
|
+
options: Array<ComboBoxOptionType>;
|
|
10
13
|
focused?: boolean;
|
|
11
14
|
selectedIndex?: number | string | null;
|
|
12
15
|
expanded?: boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LabelSelectionProps } from './label-selection';
|
|
2
|
+
import { InputProps } from './input';
|
|
3
|
+
type LabelOrInputTypeProps = LabelSelectionProps & InputProps & {
|
|
4
|
+
editable?: boolean;
|
|
5
|
+
expanded?: boolean;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Display the input or the label of the selection based on the state of the Suggester.
|
|
9
|
+
*
|
|
10
|
+
* When the component is not focused, a representation of what is being searched
|
|
11
|
+
* is presented instead of the Input. This is related to what the user searched
|
|
12
|
+
* (i.e. the letters entered), not directly to the option chosen among the suggestions.
|
|
13
|
+
* Using the input directly to represent the selection causes a conflict with that which the user enters in order to search.
|
|
14
|
+
*/
|
|
15
|
+
export declare function LabelOrInput(props: LabelOrInputTypeProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
package/lib/src/components/commons/components/combo-box/selection/combo-box-label-selection.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ComboBoxOptionType } from '../combo-box.type';
|
|
3
|
+
type Props = {
|
|
4
|
+
option?: ComboBoxOptionType | null;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
search?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: import("react").ComponentType<Props>;
|
|
10
|
+
export default _default;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
|
+
export type InputProps = {
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
value?: string;
|
|
6
|
+
labelledBy?: string;
|
|
7
|
+
focused?: boolean;
|
|
8
|
+
} & HTMLAttributes<HTMLInputElement>;
|
|
9
|
+
declare const _default: React.ComponentType<Record<string, unknown>>;
|
|
5
10
|
export default _default;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ComboBoxOptionType } from '../combo-box.type';
|
|
3
3
|
export type LabelSelectionProps = {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated use createCustomizableField with ComboboxLabelRenderer as name.
|
|
6
|
+
*/
|
|
7
|
+
labelRenderer?: FunctionComponent<{
|
|
8
|
+
option?: ComboBoxOptionType;
|
|
6
9
|
placeholder?: string;
|
|
7
10
|
search?: string;
|
|
11
|
+
disabled?: boolean;
|
|
8
12
|
}>;
|
|
9
13
|
placeholder?: string;
|
|
10
14
|
selectedIndex?: number;
|
|
11
|
-
options: Array<
|
|
15
|
+
options: Array<ComboBoxOptionType>;
|
|
12
16
|
search?: string;
|
|
13
17
|
disabled?: boolean;
|
|
14
18
|
};
|
|
15
19
|
export declare function LabelSelection({ labelRenderer: Renderer, placeholder, selectedIndex, options, search, disabled, }: LabelSelectionProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
|
|
17
|
-
editable?: boolean | undefined;
|
|
18
|
-
expanded?: boolean | undefined;
|
|
19
|
-
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
20
|
-
export default _default;
|
|
20
|
+
export default LabelSelection;
|
|
@@ -5,6 +5,7 @@ type Props = PropsWithChildren<{
|
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
labelId?: string;
|
|
7
7
|
id?: string;
|
|
8
|
+
className?: string;
|
|
8
9
|
}>;
|
|
9
|
-
declare function SelectionContainer({ children, id, expanded, focused, disabled, labelId, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function SelectionContainer({ children, id, expanded, focused, disabled, labelId, className, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export default SelectionContainer;
|
|
@@ -6,5 +6,6 @@ export type SelectionProps = {
|
|
|
6
6
|
editable?: boolean;
|
|
7
7
|
labelId?: string;
|
|
8
8
|
id?: string;
|
|
9
|
+
className?: string;
|
|
9
10
|
} & LabelSelectionProps;
|
|
10
|
-
export declare function Selection({ labelRenderer, placeholder, search, expanded, disabled, focused, onChange, selectedIndex, options, editable, labelId, id, }: SelectionProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function Selection({ labelRenderer, placeholder, search, expanded, disabled, focused, onChange, selectedIndex, options, editable, labelId, id, className, }: SelectionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComboBoxOptionType } from '../combo-box.type';
|
|
2
2
|
export declare enum ComboActionKind {
|
|
3
3
|
ON_CHANGE = "combo-box/on-change",
|
|
4
4
|
ON_SELECT = "combo-box/on-select",
|
|
@@ -39,9 +39,9 @@ export declare const onBlur: () => {
|
|
|
39
39
|
export declare const onInit: ({ ...payload }: ComboAction<ComboActionKind.ON_INIT>['payload']) => {
|
|
40
40
|
readonly type: ComboActionKind.ON_INIT;
|
|
41
41
|
readonly payload: {
|
|
42
|
-
readonly options:
|
|
42
|
+
readonly options: ComboBoxOptionType[];
|
|
43
43
|
readonly value: string | null;
|
|
44
|
-
readonly getOptionValue: (o:
|
|
44
|
+
readonly getOptionValue: (o: ComboBoxOptionType) => string;
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
export type ComboAction<T extends ComboActionKind = ComboActionKind> = ({
|
|
@@ -69,9 +69,9 @@ export type ComboAction<T extends ComboActionKind = ComboActionKind> = ({
|
|
|
69
69
|
} | {
|
|
70
70
|
type: ComboActionKind.ON_INIT;
|
|
71
71
|
payload: {
|
|
72
|
-
options:
|
|
72
|
+
options: ComboBoxOptionType[];
|
|
73
73
|
value: string | null;
|
|
74
|
-
getOptionValue: (o:
|
|
74
|
+
getOptionValue: (o: ComboBoxOptionType) => string;
|
|
75
75
|
};
|
|
76
76
|
}) & {
|
|
77
77
|
type: T;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { default as DefaultOptionRendererFn } from './components/default-option-renderer';
|
|
2
|
-
export { default as DefaultLabelRenderer } from './components/default-label-renderer';
|
|
3
1
|
export { default as FieldContainer } from './components/field-container';
|
|
4
2
|
export { default as Label } from './components/label';
|
|
5
3
|
export { default as Fieldset } from './components/fieldset';
|
|
@@ -12,6 +10,5 @@ export { default as createRowOrchestrator } from './create-row-orchestrator';
|
|
|
12
10
|
export { default as OrchestratedComponent } from './components/orchestrated-component';
|
|
13
11
|
export { default as ComboBox } from './components/combo-box';
|
|
14
12
|
export * as HtmlTable from './components/html-table';
|
|
15
|
-
export declare const DefaultOptionRenderer: typeof DefaultOptionRendererFn;
|
|
16
13
|
export { default as safetyLabel } from './safety-label';
|
|
17
14
|
export { default as Errors } from './components/errors';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComboBoxOptionType } from '../../../commons/components/combo-box/combo-box.type';
|
|
2
2
|
type Props = {
|
|
3
|
-
option?:
|
|
3
|
+
option?: ComboBoxOptionType;
|
|
4
4
|
placeholder?: string;
|
|
5
5
|
search?: string;
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComboBoxOptionType } from '../../../commons/components/combo-box/combo-box.type';
|
|
2
2
|
type Props = {
|
|
3
|
-
option:
|
|
3
|
+
option: ComboBoxOptionType;
|
|
4
4
|
selected?: boolean;
|
|
5
5
|
};
|
|
6
6
|
declare function SimpleOptionRenderer({ option, selected }: Props): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ComboBoxOptionType } from '../../../commons/components/combo-box/combo-box.type';
|
|
3
3
|
import { LunaticError } from '../../../../use-lunatic/type';
|
|
4
4
|
type Props = {
|
|
5
5
|
id?: string;
|
|
6
6
|
disabled?: boolean;
|
|
7
|
-
options:
|
|
7
|
+
options: ComboBoxOptionType[];
|
|
8
8
|
onSelect: (v: string | null) => void;
|
|
9
9
|
className?: string;
|
|
10
10
|
value: string | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComboBoxOptionType } from '../../../commons/components/combo-box/combo-box.type';
|
|
2
2
|
type Props = {
|
|
3
|
-
option?:
|
|
3
|
+
option?: ComboBoxOptionType;
|
|
4
4
|
placeholder?: string;
|
|
5
5
|
search?: string;
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComboBoxOptionType } from '../../../commons/components/combo-box/combo-box.type';
|
|
2
2
|
type Props = {
|
|
3
|
-
option:
|
|
3
|
+
option: ComboBoxOptionType;
|
|
4
4
|
selected?: boolean;
|
|
5
5
|
search?: string;
|
|
6
6
|
};
|
|
@@ -47,5 +47,5 @@ declare const BlockForLoopOrchestrator: ({ id, components, nbRows, valueMap, han
|
|
|
47
47
|
label: import("react").ReactNode;
|
|
48
48
|
}[] | undefined;
|
|
49
49
|
paginatedLoop?: boolean | undefined;
|
|
50
|
-
}, "
|
|
50
|
+
}, "missing" | "shortcut" | "id" | "preferences" | "errors" | "disabled">, "missing" | "shortcut" | "id" | "components" | "iteration" | "executeExpression" | "features" | "preferences" | "errors" | "valueMap">) => import("react/jsx-runtime").JSX.Element | null;
|
|
51
51
|
export default BlockForLoopOrchestrator;
|