@inseefr/lunatic 3.0.2 → 3.0.3-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.
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { LunaticComponents } from '../LunaticComponents';
3
- import { ComponentErrors } from '../shared/ComponentErrors/ComponentErrors';
3
+ import { getComponentErrors } from '../shared/ComponentErrors/ComponentErrors';
4
4
  import { Label } from '../shared/Label/Label';
5
5
  import { Td, Tbody, Tr, TableHeader, Table as BaseTable, } from '../shared/Table';
6
6
  import { Declarations } from '../shared/Declarations/Declarations';
7
7
  export function Table(props) {
8
8
  const { id, body, header, errors, label, declarations } = props;
9
9
  const labelId = `label-${id}`;
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: `table-${id}`, children: [_jsx(TableHeader, { header: header }), _jsx(Tbody, { children: body.map((row, rowIndex) => (_jsx(Tr, { row: rowIndex, children: _jsx(LunaticComponents, { components: row, wrapper: ({ children, index, colspan, rowspan }) => (_jsx(Td, { row: rowIndex, index: index, colSpan: colspan, rowSpan: rowspan, children: children })) }) }, rowIndex))) })] }), _jsx(ComponentErrors, { componentId: id, errors: errors })] }));
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: ({ children, index, colspan, rowspan }) => (_jsx(Td, { row: rowIndex, index: index, colSpan: colspan, rowSpan: rowspan, children: children })) }) }, rowIndex))) })] })] }));
11
11
  }
12
12
  //# 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,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EACN,EAAE,EACF,KAAK,EACL,EAAE,EACF,WAAW,EACX,KAAK,IAAI,SAAS,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAGnE,MAAM,UAAU,KAAK,CAAC,KAAqC;IAC1D,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAChE,MAAM,OAAO,GAAG,SAAS,EAAE,EAAE,CAAC;IAE9B,OAAO,CACN,8BACC,KAAC,KAAK,IAAC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,YAC7B,KAAK,GACC,EACR,KAAC,YAAY,IACZ,IAAI,EAAC,qBAAqB,EAC1B,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,EAAE,GACL,EACF,MAAC,SAAS,IAAC,EAAE,EAAE,SAAS,EAAE,EAAE,aAC3B,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,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CACnD,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J,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,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CACnD,KAAC,EAAE,IACF,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,YAEf,QAAQ,GACL,CACL,GACA,IAlBqB,QAAQ,CAmB3B,CACL,CAAC,GACK,IACG,IACV,CACH,CAAC;AACH,CAAC"}
@@ -1,7 +1,9 @@
1
1
  import React, { type PropsWithChildren } from 'react';
2
+ import type { LunaticError } from '../../../use-lunatic/type';
2
3
  type Props = PropsWithChildren<{
3
4
  className?: string;
4
5
  id?: string;
6
+ errors?: LunaticError[];
5
7
  }>;
6
8
  export declare const Table: React.ComponentType<Props>;
7
9
  export {};
@@ -1,9 +1,10 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, {} from 'react';
3
3
  import classnames from 'classnames';
4
4
  import { slottableComponent } from '../HOC/slottableComponent';
5
- function LunaticTable({ id, className, children }) {
6
- return (_jsx("table", { id: `table-${id}`, className: classnames('lunatic-table', className), children: children }));
5
+ import { ComponentErrors } from '../ComponentErrors/ComponentErrors';
6
+ function LunaticTable({ id, className, children, errors }) {
7
+ return (_jsxs(_Fragment, { children: [_jsx("table", { id: `table-${id}`, className: classnames('lunatic-table', className), children: children }), _jsx(ComponentErrors, { errors: errors })] }));
7
8
  }
8
9
  export const Table = slottableComponent('Table', LunaticTable);
9
10
  //# 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;AAO/D,SAAS,YAAY,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAS;IACvD,OAAO,CACN,gBACC,EAAE,EAAE,SAAS,EAAE,EAAE,EACjB,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE,SAAS,CAAC,YAEhD,QAAQ,GACF,CACR,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,kBAAkB,CAAC,OAAO,EAAE,YAAY,CAAC,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;AAQrE,SAAS,YAAY,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAS;IAC/D,OAAO,CACN,8BACC,gBACC,EAAE,EAAE,SAAS,EAAE,EAAE,EACjB,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE,SAAS,CAAC,YAEhD,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inseefr/lunatic",
3
- "version": "3.0.2",
3
+ "version": "3.0.3-rc.0",
4
4
  "description": "Library of questionnaire components",
5
5
  "type": "module",
6
6
  "repository": {