@inseefr/lunatic 3.6.12 → 3.6.13-rc.0
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/components/shared/MDLabel/MDLabel.d.ts +3 -1
- package/components/shared/MDLabel/MDLabel.js +4 -4
- package/components/shared/MDLabel/MDLabel.js.map +1 -1
- package/esm/components/shared/Combobox/ComboboxContent.js +1 -4
- package/esm/components/shared/Combobox/ComboboxContent.js.map +1 -1
- package/esm/components/shared/MDLabel/MDLabel.d.ts +3 -1
- package/esm/components/shared/MDLabel/MDLabel.js +4 -4
- package/esm/components/shared/MDLabel/MDLabel.js.map +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/package.json +2 -1
- package/src/components/shared/Combobox/ComboboxContent.tsx +6 -5
- package/src/components/shared/MDLabel/MDLabel.tsx +26 -6
- package/src/index.ts +2 -0
- 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,QAAQ,EACR,OAAO,EACP,OAAO,EACP,MAAM,EACN,SAAS,EACT,eAAe,GACR;IACP,MAAM,GAAG,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAEzC,MAAM,OAAO,GAAG,IAAA,mBAAW,EAC1B,CAAC,CAAQ,EAAE,EAAE;QACZ,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAqB,CAAC,IAAI,MAAM,EAAE,CAAC;YAC/D,MAAM,EAAE,CAAC;QACV,CAAC;IACF,CAAC,EACD,CAAC,GAAG,EAAE,MAAM,CAAC,CACb,CAAC;IAEF,IAAA,0BAAgB,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAEvC,MAAM,aAAa,GAAG,IAAA,mBAAW,EAChC,UAAU,CAAgB;QACzB,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAClB,QAAQ,GAAG,EAAE,CAAC;YACb,KAAK,8BAAkB,CAAC,MAAM,CAAC;YAC/B,KAAK,8BAAkB,CAAC,KAAK,CAAC;YAC9B,KAAK,8BAAkB,CAAC,GAAG;gBAC1B,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;gBACrB,MAAM;QACR,CAAC;QACD,SAAS,CAAC,GAAG,CAAC,CAAC;IAChB,CAAC,EACD,CAAC,SAAS,CAAC,CACX,CAAC;IAEF,OAAO,CACN,uBAAC,uCAAkB,IAAC,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,YACrE,gCACC,SAAS,EAAE,IAAA,oBAAU,EACpB,GAAG,eAAe,IAAI,SAAS,oBAAoB,EACnD;gBACC,OAAO;aACP,CACD,EACD,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,aAAa,YAEvB,QAAQ,GACJ,GACc,CACrB,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { MarkdownLink } from './MarkdownLink';
|
|
1
2
|
type Props = {
|
|
2
3
|
expression: string;
|
|
4
|
+
MarkdownLinkOverride?: typeof MarkdownLink;
|
|
3
5
|
};
|
|
4
|
-
export declare function MDLabel({ expression }: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function MDLabel({ expression, MarkdownLinkOverride }: Props): import("react/jsx-runtime").JSX.Element;
|
|
5
7
|
export {};
|
|
@@ -10,17 +10,17 @@ const react_markdown_1 = __importDefault(require("react-markdown"));
|
|
|
10
10
|
const MarkdownLink_1 = require("./MarkdownLink");
|
|
11
11
|
const remark_breaks_1 = __importDefault(require("remark-breaks"));
|
|
12
12
|
const remark_emoji_1 = __importDefault(require("remark-emoji"));
|
|
13
|
-
function MDLabel({ expression }) {
|
|
13
|
+
function MDLabel({ expression, MarkdownLinkOverride }) {
|
|
14
14
|
const hasParagraphs = /\n\n/.test(expression);
|
|
15
15
|
const components = {
|
|
16
16
|
p: hasParagraphs ? 'p' : react_1.Fragment,
|
|
17
17
|
br: 'br',
|
|
18
|
-
a: MarkdownA,
|
|
18
|
+
a: (props) => ((0, jsx_runtime_1.jsx)(MarkdownA, { ...props, MarkdownLinkComponent: MarkdownLinkOverride ?? MarkdownLink_1.MarkdownLink })),
|
|
19
19
|
};
|
|
20
20
|
return ((0, jsx_runtime_1.jsx)(react_markdown_1.default, { components: components, remarkPlugins: [[remark_emoji_1.default, { accessible: true }], remark_breaks_1.default], children: expression }));
|
|
21
21
|
}
|
|
22
|
-
const MarkdownA = ({ title, href, children, }) => {
|
|
22
|
+
const MarkdownA = ({ title, href, children, MarkdownLinkComponent, }) => {
|
|
23
23
|
const tooltip = title ? (0, jsx_runtime_1.jsx)(MDLabel, { expression: title }) : null;
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(MarkdownLinkComponent, { href: href, tooltip: tooltip, children: children }));
|
|
25
25
|
};
|
|
26
26
|
//# sourceMappingURL=MDLabel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MDLabel.js","sourceRoot":"","sources":["../../../src/components/shared/MDLabel/MDLabel.tsx"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"MDLabel.js","sourceRoot":"","sources":["../../../src/components/shared/MDLabel/MDLabel.tsx"],"names":[],"mappings":";;;;;AAWA,0BAoBC;;AA/BD,iCAAyD;AACzD,oEAA2D;AAC3D,iDAA8C;AAC9C,kEAAyC;AACzC,gEAAiC;AAOjC,SAAgB,OAAO,CAAC,EAAE,UAAU,EAAE,oBAAoB,EAAS;IAClE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAG;QAClB,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,gBAAQ;QACjC,EAAE,EAAE,IAAI;QACR,CAAC,EAAE,CAAC,KAAqB,EAAE,EAAE,CAAC,CAC7B,uBAAC,SAAS,OACL,KAAK,EACT,qBAAqB,EAAE,oBAAoB,IAAI,2BAAY,GAC1D,CACF;KACsB,CAAC;IACzB,OAAO,CACN,uBAAC,wBAAQ,IACR,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,CAAC,CAAC,sBAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,uBAAY,CAAC,YAE3D,UAAU,GACD,CACX,CAAC;AACH,CAAC;AAQD,MAAM,SAAS,GAAG,CAAC,EAClB,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,qBAAqB,GAKpB,EAAE,EAAE;IACL,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,uBAAC,OAAO,IAAC,UAAU,EAAE,KAAK,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9D,OAAO,CACN,uBAAC,qBAAqB,IAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,YACjD,QAAQ,GACc,CACxB,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
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,SAAS,EACT,eAAe,GACR;IACP,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAEzC,MAAM,OAAO,GAAG,WAAW,CAC1B,CAAC,CAAQ,EAAE,EAAE;;QACZ,IAAI,CAAC,CAAA,MAAA,GAAG,CAAC,OAAO,0CAAE,QAAQ,CAAC,CAAC,CAAC,MAAqB,CAAC,CAAA,IAAI,MAAM,EAAE,CAAC;YAC/D,MAAM,EAAE,CAAC;QACV,CAAC;IACF,CAAC,EACD,CAAC,GAAG,EAAE,MAAM,CAAC,CACb,CAAC;IAEF,gBAAgB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAEvC,MAAM,aAAa,GAAG,WAAW,CAChC,UAAU,CAAgB;;QACzB,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAClB,QAAQ,GAAG,EAAE,CAAC;YACb,KAAK,kBAAkB,CAAC,MAAM,CAAC;YAC/B,KAAK,kBAAkB,CAAC,KAAK,CAAC;YAC9B,KAAK,kBAAkB,CAAC,GAAG;gBAC1B,MAAA,GAAG,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;gBACrB,MAAM;QACR,CAAC;QACD,SAAS,CAAC,GAAG,CAAC,CAAC;IAChB,CAAC,EACD,CAAC,SAAS,CAAC,CACX,CAAC;IAEF,OAAO,CACN,KAAC,kBAAkB,IAAC,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,YACrE,cACC,SAAS,EAAE,UAAU,CACpB,GAAG,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,SAAS,oBAAoB,EACnD;gBACC,OAAO;aACP,CACD,EACD,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,aAAa,YAEvB,QAAQ,GACJ,GACc,CACrB,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { MarkdownLink } from './MarkdownLink';
|
|
1
2
|
type Props = {
|
|
2
3
|
expression: string;
|
|
4
|
+
MarkdownLinkOverride?: typeof MarkdownLink;
|
|
3
5
|
};
|
|
4
|
-
export declare function MDLabel({ expression }: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function MDLabel({ expression, MarkdownLinkOverride }: Props): import("react/jsx-runtime").JSX.Element;
|
|
5
7
|
export {};
|
|
@@ -4,17 +4,17 @@ import Markdown from 'react-markdown';
|
|
|
4
4
|
import { MarkdownLink } from './MarkdownLink';
|
|
5
5
|
import remarkBreaks from 'remark-breaks';
|
|
6
6
|
import emoji from 'remark-emoji';
|
|
7
|
-
export function MDLabel({ expression }) {
|
|
7
|
+
export function MDLabel({ expression, MarkdownLinkOverride }) {
|
|
8
8
|
const hasParagraphs = /\n\n/.test(expression);
|
|
9
9
|
const components = {
|
|
10
10
|
p: hasParagraphs ? 'p' : Fragment,
|
|
11
11
|
br: 'br',
|
|
12
|
-
a: MarkdownA,
|
|
12
|
+
a: (props) => (_jsx(MarkdownA, { ...props, MarkdownLinkComponent: MarkdownLinkOverride !== null && MarkdownLinkOverride !== void 0 ? MarkdownLinkOverride : MarkdownLink })),
|
|
13
13
|
};
|
|
14
14
|
return (_jsx(Markdown, { components: components, remarkPlugins: [[emoji, { accessible: true }], remarkBreaks], children: expression }));
|
|
15
15
|
}
|
|
16
|
-
const MarkdownA = ({ title, href, children, }) => {
|
|
16
|
+
const MarkdownA = ({ title, href, children, MarkdownLinkComponent, }) => {
|
|
17
17
|
const tooltip = title ? _jsx(MDLabel, { expression: title }) : null;
|
|
18
|
-
return (_jsx(
|
|
18
|
+
return (_jsx(MarkdownLinkComponent, { href: href, tooltip: tooltip, children: children }));
|
|
19
19
|
};
|
|
20
20
|
//# sourceMappingURL=MDLabel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MDLabel.js","sourceRoot":"","sources":["../../../../src/components/shared/MDLabel/MDLabel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAA0B,MAAM,OAAO,CAAC;AACzD,OAAO,QAA6B,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"MDLabel.js","sourceRoot":"","sources":["../../../../src/components/shared/MDLabel/MDLabel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAA0B,MAAM,OAAO,CAAC;AACzD,OAAO,QAA6B,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,MAAM,cAAc,CAAC;AAOjC,MAAM,UAAU,OAAO,CAAC,EAAE,UAAU,EAAE,oBAAoB,EAAS;IAClE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAG;QAClB,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ;QACjC,EAAE,EAAE,IAAI;QACR,CAAC,EAAE,CAAC,KAAqB,EAAE,EAAE,CAAC,CAC7B,KAAC,SAAS,OACL,KAAK,EACT,qBAAqB,EAAE,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,GAAI,YAAY,GAC1D,CACF;KACsB,CAAC;IACzB,OAAO,CACN,KAAC,QAAQ,IACR,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,YAAY,CAAC,YAE3D,UAAU,GACD,CACX,CAAC;AACH,CAAC;AAQD,MAAM,SAAS,GAAG,CAAC,EAClB,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,qBAAqB,GAKpB,EAAE,EAAE;IACL,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,UAAU,EAAE,KAAK,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9D,OAAO,CACN,KAAC,qBAAqB,IAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,YACjD,QAAQ,GACc,CACxB,CAAC;AACH,CAAC,CAAC"}
|
package/esm/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { ModalControls } from './components/shared/ModalControls/ModalControls';
|
|
|
7
7
|
export { Button } from './components/shared/Button/Button';
|
|
8
8
|
export { LunaticComponents } from './components/LunaticComponents';
|
|
9
9
|
export { useLunatic } from './use-lunatic/use-lunatic';
|
|
10
|
+
export { MDLabel } from './components/shared/MDLabel/MDLabel';
|
|
10
11
|
export type { LunaticComponentDefinition, LunaticControl, LunaticData, LunaticValues, LunaticError, LunaticExpression, LunaticVariable, LunaticCollectedValue, LunaticStateVariable, LunaticState, LunaticPager, LunaticOptions, LunaticChangesHandler, } from './use-lunatic/type';
|
|
11
12
|
export type { LunaticComponentProps, LunaticExtraProps, } from './components/type';
|
|
12
13
|
export type { LunaticSlotComponents } from './components/shared/HOC/slottableComponent';
|
package/esm/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { ModalControls } from './components/shared/ModalControls/ModalControls';
|
|
|
7
7
|
export { Button } from './components/shared/Button/Button';
|
|
8
8
|
export { LunaticComponents } from './components/LunaticComponents';
|
|
9
9
|
export { useLunatic } from './use-lunatic/use-lunatic';
|
|
10
|
+
export { MDLabel } from './components/shared/MDLabel/MDLabel';
|
|
10
11
|
// Export errors (useful for typeof)
|
|
11
12
|
export { VTLMissingDependencies, VTLExpressionError, VTLMissingDependency, VTLInterpretationError, } from './use-lunatic/commons/variables/errors';
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAyB9D,oCAAoC;AACpC,OAAO,EACN,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,GACtB,MAAM,wCAAwC,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { ModalControls } from './components/shared/ModalControls/ModalControls';
|
|
|
7
7
|
export { Button } from './components/shared/Button/Button';
|
|
8
8
|
export { LunaticComponents } from './components/LunaticComponents';
|
|
9
9
|
export { useLunatic } from './use-lunatic/use-lunatic';
|
|
10
|
+
export { MDLabel } from './components/shared/MDLabel/MDLabel';
|
|
10
11
|
export type { LunaticComponentDefinition, LunaticControl, LunaticData, LunaticValues, LunaticError, LunaticExpression, LunaticVariable, LunaticCollectedValue, LunaticStateVariable, LunaticState, LunaticPager, LunaticOptions, LunaticChangesHandler, } from './use-lunatic/type';
|
|
11
12
|
export type { LunaticComponentProps, LunaticExtraProps, } from './components/type';
|
|
12
13
|
export type { LunaticSlotComponents } from './components/shared/HOC/slottableComponent';
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VTLInterpretationError = exports.VTLMissingDependency = exports.VTLExpressionError = exports.VTLMissingDependencies = exports.useLunatic = exports.LunaticComponents = exports.Button = exports.ModalControls = exports.components = void 0;
|
|
3
|
+
exports.VTLInterpretationError = exports.VTLMissingDependency = exports.VTLExpressionError = exports.VTLMissingDependencies = exports.MDLabel = exports.useLunatic = exports.LunaticComponents = exports.Button = exports.ModalControls = exports.components = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* We should remove this export to avoid `import * as lunatic from "@inseefr/lunatic"` in orchestrators
|
|
6
6
|
* but this is a breaking change
|
|
@@ -15,6 +15,8 @@ var LunaticComponents_1 = require("./components/LunaticComponents");
|
|
|
15
15
|
Object.defineProperty(exports, "LunaticComponents", { enumerable: true, get: function () { return LunaticComponents_1.LunaticComponents; } });
|
|
16
16
|
var use_lunatic_1 = require("./use-lunatic/use-lunatic");
|
|
17
17
|
Object.defineProperty(exports, "useLunatic", { enumerable: true, get: function () { return use_lunatic_1.useLunatic; } });
|
|
18
|
+
var MDLabel_1 = require("./components/shared/MDLabel/MDLabel");
|
|
19
|
+
Object.defineProperty(exports, "MDLabel", { enumerable: true, get: function () { return MDLabel_1.MDLabel; } });
|
|
18
20
|
// Export errors (useful for typeof)
|
|
19
21
|
var errors_1 = require("./use-lunatic/commons/variables/errors");
|
|
20
22
|
Object.defineProperty(exports, "VTLMissingDependencies", { enumerable: true, get: function () { return errors_1.VTLMissingDependencies; } });
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,gDAA6D;AAApD,qGAAA,OAAO,OAAc;AAC9B,iFAAgF;AAAvE,8GAAA,aAAa,OAAA;AACtB,4DAA2D;AAAlD,gGAAA,MAAM,OAAA;AAEf,oEAAmE;AAA1D,sHAAA,iBAAiB,OAAA;AAC1B,yDAAuD;AAA9C,yGAAA,UAAU,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,gDAA6D;AAApD,qGAAA,OAAO,OAAc;AAC9B,iFAAgF;AAAvE,8GAAA,aAAa,OAAA;AACtB,4DAA2D;AAAlD,gGAAA,MAAM,OAAA;AAEf,oEAAmE;AAA1D,sHAAA,iBAAiB,OAAA;AAC1B,yDAAuD;AAA9C,yGAAA,UAAU,OAAA;AAEnB,+DAA8D;AAArD,kGAAA,OAAO,OAAA;AAyBhB,oCAAoC;AACpC,iEAKgD;AAJ/C,gHAAA,sBAAsB,OAAA;AACtB,4GAAA,kBAAkB,OAAA;AAClB,8GAAA,oBAAoB,OAAA;AACpB,gHAAA,sBAAsB,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inseefr/lunatic",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.13-rc.0",
|
|
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
|
},
|
|
@@ -4,14 +4,22 @@ import { MarkdownLink } from './MarkdownLink';
|
|
|
4
4
|
import remarkBreaks from 'remark-breaks';
|
|
5
5
|
import emoji from 'remark-emoji';
|
|
6
6
|
|
|
7
|
-
type Props = {
|
|
7
|
+
type Props = {
|
|
8
|
+
expression: string;
|
|
9
|
+
MarkdownLinkOverride?: typeof MarkdownLink;
|
|
10
|
+
};
|
|
8
11
|
|
|
9
|
-
export function MDLabel({ expression }: Props) {
|
|
12
|
+
export function MDLabel({ expression, MarkdownLinkOverride }: Props) {
|
|
10
13
|
const hasParagraphs = /\n\n/.test(expression);
|
|
11
14
|
const components = {
|
|
12
15
|
p: hasParagraphs ? 'p' : Fragment,
|
|
13
16
|
br: 'br',
|
|
14
|
-
a:
|
|
17
|
+
a: (props: MarkdownAProps) => (
|
|
18
|
+
<MarkdownA
|
|
19
|
+
{...props}
|
|
20
|
+
MarkdownLinkComponent={MarkdownLinkOverride ?? MarkdownLink}
|
|
21
|
+
/>
|
|
22
|
+
),
|
|
15
23
|
} as Partial<Components>;
|
|
16
24
|
return (
|
|
17
25
|
<Markdown
|
|
@@ -22,15 +30,27 @@ export function MDLabel({ expression }: Props) {
|
|
|
22
30
|
</Markdown>
|
|
23
31
|
);
|
|
24
32
|
}
|
|
33
|
+
|
|
34
|
+
type MarkdownAProps = PropsWithChildren<{
|
|
35
|
+
title?: string;
|
|
36
|
+
href: string;
|
|
37
|
+
MarkdownLinkComponent: typeof MarkdownLink;
|
|
38
|
+
}>;
|
|
39
|
+
|
|
25
40
|
const MarkdownA = ({
|
|
26
41
|
title,
|
|
27
42
|
href,
|
|
28
43
|
children,
|
|
29
|
-
|
|
44
|
+
MarkdownLinkComponent,
|
|
45
|
+
}: PropsWithChildren<{
|
|
46
|
+
title?: string;
|
|
47
|
+
href: string;
|
|
48
|
+
MarkdownLinkComponent: typeof MarkdownLink;
|
|
49
|
+
}>) => {
|
|
30
50
|
const tooltip = title ? <MDLabel expression={title} /> : null;
|
|
31
51
|
return (
|
|
32
|
-
<
|
|
52
|
+
<MarkdownLinkComponent href={href} tooltip={tooltip}>
|
|
33
53
|
{children}
|
|
34
|
-
</
|
|
54
|
+
</MarkdownLinkComponent>
|
|
35
55
|
);
|
|
36
56
|
};
|
package/src/index.ts
CHANGED
|
@@ -9,6 +9,8 @@ export { Button } from './components/shared/Button/Button';
|
|
|
9
9
|
export { LunaticComponents } from './components/LunaticComponents';
|
|
10
10
|
export { useLunatic } from './use-lunatic/use-lunatic';
|
|
11
11
|
|
|
12
|
+
export { MDLabel } from './components/shared/MDLabel/MDLabel';
|
|
13
|
+
|
|
12
14
|
export type {
|
|
13
15
|
LunaticComponentDefinition,
|
|
14
16
|
LunaticControl,
|
|
@@ -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}
|