@inseefr/lunatic 3.6.13 → 3.6.14
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/components/shared/Combobox/ComboboxContent.js +0 -3
- package/components/shared/Combobox/ComboboxContent.js.map +1 -1
- package/esm/components/shared/Combobox/ComboboxContent.js +1 -4
- package/esm/components/shared/Combobox/ComboboxContent.js.map +1 -1
- package/package.json +2 -1
- package/src/components/shared/Combobox/ComboboxContent.tsx +6 -5
- package/src/stories/utils/Orchestrator.tsx +7 -0
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -20,15 +20,12 @@ function ComboboxContent({ children, focused, onFocus, onBlur, onKeyDown, classN
|
|
|
20
20
|
(0, useDocumentEvent_1.default)('mousedown', onClick);
|
|
21
21
|
const handleKeyDown = (0, react_1.useCallback)(function (e) {
|
|
22
22
|
const { key } = e;
|
|
23
|
-
e.stopPropagation();
|
|
24
23
|
switch (key) {
|
|
25
24
|
case constants_1.KEYBOARD_KEY_CODES.Escape:
|
|
26
25
|
case constants_1.KEYBOARD_KEY_CODES.Enter:
|
|
27
26
|
case constants_1.KEYBOARD_KEY_CODES.Tab:
|
|
28
27
|
ref.current?.focus();
|
|
29
28
|
break;
|
|
30
|
-
default:
|
|
31
|
-
// e.preventDefault();
|
|
32
29
|
}
|
|
33
30
|
onKeyDown(key);
|
|
34
31
|
}, [onKeyDown]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxContent.js","sourceRoot":"","sources":["../../../src/components/shared/Combobox/ComboboxContent.tsx"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"ComboboxContent.js","sourceRoot":"","sources":["../../../src/components/shared/Combobox/ComboboxContent.tsx"],"names":[],"mappings":";;;;;AAmBA,0CAuDC;;AA1ED,iCAKe;AACf,4DAAoC;AACpC,2CAAiD;AACjD,6DAA0D;AAC1D,uFAA+D;AAU/D,SAAgB,eAAe,CAAC,EAC/B,QAA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|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useRef } from 'react';
|
|
2
|
+
import { useCallback, useRef, } from 'react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { KEYBOARD_KEY_CODES } from './constants';
|
|
5
5
|
import { ComboboxContentBox } from './ComboboxContentBox';
|
|
@@ -16,15 +16,12 @@ export function ComboboxContent({ children, focused, onFocus, onBlur, onKeyDown,
|
|
|
16
16
|
const handleKeyDown = useCallback(function (e) {
|
|
17
17
|
var _a;
|
|
18
18
|
const { key } = e;
|
|
19
|
-
e.stopPropagation();
|
|
20
19
|
switch (key) {
|
|
21
20
|
case KEYBOARD_KEY_CODES.Escape:
|
|
22
21
|
case KEYBOARD_KEY_CODES.Enter:
|
|
23
22
|
case KEYBOARD_KEY_CODES.Tab:
|
|
24
23
|
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
25
24
|
break;
|
|
26
|
-
default:
|
|
27
|
-
// e.preventDefault();
|
|
28
25
|
}
|
|
29
26
|
onKeyDown(key);
|
|
30
27
|
}, [onKeyDown]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxContent.js","sourceRoot":"","sources":["../../../../src/components/shared/Combobox/ComboboxContent.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ComboboxContent.js","sourceRoot":"","sources":["../../../../src/components/shared/Combobox/ComboboxContent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGN,WAAW,EACX,MAAM,GACN,MAAM,OAAO,CAAC;AACf,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAU/D,MAAM,UAAU,eAAe,CAAC,EAC/B,QAAQ,EACR,OAAO,EACP,OAAO,EACP,MAAM,EACN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
{
|
|
2
2
|
"name": "@inseefr/lunatic",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.14",
|
|
4
4
|
"description": "Library of questionnaire components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -2017,6 +2017,7 @@
|
|
|
2017
2017
|
"prettier": "^3.3.3",
|
|
2018
2018
|
"react": "^18.3.1",
|
|
2019
2019
|
"react-dom": "^18.3.1",
|
|
2020
|
+
"react-hot-keys": "^2.7.3",
|
|
2020
2021
|
"storybook": "^8.2.9",
|
|
2021
2022
|
"tailwindcss": "^4.1.4",
|
|
2022
2023
|
"tsx": "^4.19.1",
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
type KeyboardEvent,
|
|
3
|
+
type PropsWithChildren,
|
|
4
|
+
useCallback,
|
|
5
|
+
useRef,
|
|
6
|
+
} from 'react';
|
|
3
7
|
import classnames from 'classnames';
|
|
4
8
|
import { KEYBOARD_KEY_CODES } from './constants';
|
|
5
9
|
import { ComboboxContentBox } from './ComboboxContentBox';
|
|
@@ -37,15 +41,12 @@ export function ComboboxContent({
|
|
|
37
41
|
const handleKeyDown = useCallback(
|
|
38
42
|
function (e: KeyboardEvent) {
|
|
39
43
|
const { key } = e;
|
|
40
|
-
e.stopPropagation();
|
|
41
44
|
switch (key) {
|
|
42
45
|
case KEYBOARD_KEY_CODES.Escape:
|
|
43
46
|
case KEYBOARD_KEY_CODES.Enter:
|
|
44
47
|
case KEYBOARD_KEY_CODES.Tab:
|
|
45
48
|
ref.current?.focus();
|
|
46
49
|
break;
|
|
47
|
-
default:
|
|
48
|
-
// e.preventDefault();
|
|
49
50
|
}
|
|
50
51
|
onKeyDown(key);
|
|
51
52
|
},
|
|
@@ -25,6 +25,7 @@ import type { PageTag } from '../../use-lunatic/type';
|
|
|
25
25
|
import type { IndexEntry } from '../../utils/search/SearchInterface';
|
|
26
26
|
import { OrchestratorSidebar } from './OrchestratorSidebar';
|
|
27
27
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
28
|
+
import ReactHotkeys from 'react-hot-keys';
|
|
28
29
|
|
|
29
30
|
type Props = {
|
|
30
31
|
source: LunaticSource;
|
|
@@ -253,6 +254,12 @@ function OrchestratorForStories(props: Readonly<Props>) {
|
|
|
253
254
|
<OrchestratorOverview overview={overview} goToPage={goToPage} />
|
|
254
255
|
)}
|
|
255
256
|
</OrchestratorSidebar>
|
|
257
|
+
<ReactHotkeys
|
|
258
|
+
key={'alt+enter'}
|
|
259
|
+
keyName={'alt+enter'}
|
|
260
|
+
onKeyDown={handleGoNext}
|
|
261
|
+
filter={() => true}
|
|
262
|
+
/>
|
|
256
263
|
{errorsForModal?.currentErrors && (
|
|
257
264
|
<ModalControls
|
|
258
265
|
errors={errorsForModal.currentErrors}
|