@inseefr/lunatic 3.2.0 → 3.2.2
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/Question/Question.d.ts +2 -2
- package/lib/components/Question/Question.js +2 -2
- package/lib/components/Question/Question.js.map +1 -1
- package/lib/components/Table/Table.js +3 -6
- package/lib/components/Table/Table.js.map +1 -1
- package/lib/components/library.d.ts +1 -1
- package/lib/components/shared/Table/Table.d.ts +2 -3
- package/lib/components/shared/Table/Table.js +6 -2
- package/lib/components/shared/Table/Table.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import type { PropsWithChildren } from 'react';
|
|
|
3
3
|
/**
|
|
4
4
|
* Surround a question giving additional context with label / description / declarations
|
|
5
5
|
*/
|
|
6
|
-
export declare const Question: (
|
|
7
|
-
type CustomProps = PropsWithChildren<
|
|
6
|
+
export declare const Question: (props: LunaticComponentProps<'Question'>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
type CustomProps = PropsWithChildren<LunaticComponentProps<'Question'>>;
|
|
8
8
|
export declare const CustomQuestion: import("react").ComponentType<CustomProps>;
|
|
9
9
|
export {};
|
|
@@ -5,8 +5,8 @@ import { Declarations } from '../shared/Declarations/Declarations';
|
|
|
5
5
|
/**
|
|
6
6
|
* Surround a question giving additional context with label / description / declarations
|
|
7
7
|
*/
|
|
8
|
-
export const Question = (
|
|
9
|
-
const { errors, disabled, readOnly } = props;
|
|
8
|
+
export const Question = (props) => {
|
|
9
|
+
const { errors, disabled, readOnly, components } = props;
|
|
10
10
|
return (_jsx(CustomQuestion, { ...props, children: _jsx(LunaticComponents, { components: components, componentProps: () => ({
|
|
11
11
|
errors,
|
|
12
12
|
disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Question.js","sourceRoot":"","sources":["../../../src/components/Question/Question.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAA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E,EAAE,GACL,EACD,QAAQ,IACC,CACX,CAAC;AACH,CAAC,CACD,CAAC"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { LunaticComponents } from '../LunaticComponents';
|
|
3
3
|
import { getComponentErrors } from '../shared/ComponentErrors/ComponentErrors';
|
|
4
|
-
import { Label } from '../shared/Label/Label';
|
|
5
4
|
import { Td, Tbody, Tr, TableHeader, Table as BaseTable, } from '../shared/Table';
|
|
6
|
-
import { Declarations } from '../shared/Declarations/Declarations';
|
|
7
5
|
export function Table(props) {
|
|
8
|
-
const { id, body, header, errors,
|
|
9
|
-
|
|
10
|
-
return (_jsxs(_Fragment, { children: [_jsx(Label, { htmlFor: id, id: labelId, children: label }), _jsx(Declarations, { type: "AFTER_QUESTION_TEXT", declarations: declarations, id: id }), _jsxs(BaseTable, { id: id, errors: getComponentErrors(errors, id), children: [_jsx(TableHeader, { header: header }), _jsx(Tbody, { children: body.map((row, rowIndex) => (_jsx(Tr, { row: rowIndex, children: _jsx(LunaticComponents, { components: row, wrapper: ({ colspan, rowspan, ...props }) => (_jsx(Td, { row: rowIndex, colSpan: colspan, rowSpan: rowspan, ...props })) }) }, rowIndex))) })] })] }));
|
|
6
|
+
const { id, body, header, errors, declarations, label } = props;
|
|
7
|
+
return (_jsxs(BaseTable, { id: id, errors: getComponentErrors(errors, id), declarations: declarations, label: label, children: [_jsx(TableHeader, { header: header }), _jsx(Tbody, { children: body.map((row, rowIndex) => (_jsx(Tr, { row: rowIndex, children: _jsx(LunaticComponents, { components: row, wrapper: ({ colspan, rowspan, ...props }) => (_jsx(Td, { row: rowIndex, colSpan: colspan, rowSpan: rowspan, ...props })) }) }, rowIndex))) })] }));
|
|
11
8
|
}
|
|
12
9
|
//# sourceMappingURL=Table.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../src/components/Table/Table.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../src/components/Table/Table.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EACN,EAAE,EACF,KAAK,EACL,EAAE,EACF,WAAW,EACX,KAAK,IAAI,SAAS,GAClB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,UAAU,KAAK,CAAC,KAAqC;IAC1D,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAEhE,OAAO,CACN,MAAC,SAAS,IACT,EAAE,EAAE,EAAE,EACN,MAAM,EAAE,kBAAkB,CAAC,MAAM,EAAE,EAAE,CAAC,EACtC,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,aAEZ,KAAC,WAAW,IAAC,MAAM,EAAE,MAAM,GAAI,EAC/B,KAAC,KAAK,cACJ,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,CAC5B,KAAC,EAAE,IAAC,GAAG,EAAE,QAAQ,YAChB,KAAC,iBAAiB,IAMjB,UAAU,EAAE,GAAG,EACf,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CAC5C,KAAC,EAAE,IACF,GAAG,EAAE,QAAQ,EACb,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,KACZ,KAAK,GACR,CACF,GACA,IAhBqB,QAAQ,CAiB3B,CACL,CAAC,GACK,IACG,CACZ,CAAC;AACH,CAAC"}
|
|
@@ -73,7 +73,7 @@ export declare const library: {
|
|
|
73
73
|
} | undefined;
|
|
74
74
|
componentType?: "Switch" | undefined;
|
|
75
75
|
}>;
|
|
76
|
-
Question: (
|
|
76
|
+
Question: (props: Pick<import("./type").LunaticBaseProps<unknown>, "label" | "description" | "declarations" | "id" | "errors" | "disabled" | "readOnly"> & import("./type").LunaticExtraProps & {
|
|
77
77
|
components: LunaticComponentProps<keyof import("./type").ComponentPropsByType>[];
|
|
78
78
|
componentType?: "Question" | undefined;
|
|
79
79
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { type PropsWithChildren } from 'react';
|
|
2
2
|
import type { LunaticError } from '../../../use-lunatic/type';
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
id?: string;
|
|
3
|
+
import type { LunaticComponentProps } from '../../type';
|
|
4
|
+
type Props = PropsWithChildren<Pick<LunaticComponentProps<'Table'>, 'className' | 'id' | 'label' | 'declarations'> & {
|
|
6
5
|
errors?: LunaticError[];
|
|
7
6
|
}>;
|
|
8
7
|
export declare const Table: React.ComponentType<Props>;
|
|
@@ -3,8 +3,12 @@ import React, {} from 'react';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { slottableComponent } from '../HOC/slottableComponent';
|
|
5
5
|
import { ComponentErrors } from '../ComponentErrors/ComponentErrors';
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { Label } from '../Label/Label';
|
|
7
|
+
import { Declarations } from '../Declarations/Declarations';
|
|
8
|
+
function LunaticTable({ id, className, children, errors, declarations, label, }) {
|
|
9
|
+
const tableId = `table-${id}`;
|
|
10
|
+
const labelId = `label-${id}`;
|
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsx(Label, { htmlFor: tableId, id: labelId, children: label }), _jsx(Declarations, { type: "AFTER_QUESTION_TEXT", declarations: declarations, id: id }), _jsx("table", { id: tableId, className: classnames('lunatic-table', className), children: children }), _jsx(ComponentErrors, { errors: errors })] }));
|
|
8
12
|
}
|
|
9
13
|
export const Table = slottableComponent('Table', LunaticTable);
|
|
10
14
|
//# sourceMappingURL=Table.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../../src/components/shared/Table/Table.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAA0B,MAAM,OAAO,CAAC;AACtD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../../src/components/shared/Table/Table.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAA0B,MAAM,OAAO,CAAC;AACtD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAW5D,SAAS,YAAY,CAAC,EACrB,EAAE,EACF,SAAS,EACT,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,KAAK,GACE;IACP,MAAM,OAAO,GAAG,SAAS,EAAE,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAG,SAAS,EAAE,EAAE,CAAC;IAE9B,OAAO,CACN,8BACC,KAAC,KAAK,IAAC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,YAClC,KAAK,GACC,EACR,KAAC,YAAY,IACZ,IAAI,EAAC,qBAAqB,EAC1B,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,EAAE,GACL,EACF,gBAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE,SAAS,CAAC,YACnE,QAAQ,GACF,EACR,KAAC,eAAe,IAAC,MAAM,EAAE,MAAM,GAAI,IACjC,CACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,kBAAkB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC"}
|