@inseefr/lunatic 3.0.1 → 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"}
@@ -37,6 +37,7 @@ import type { CustomCheckboxGroup } from '../../CheckboxGroup/CustomCheckboxGrou
37
37
  import type { RouterLink } from '../MDLabel/RouterLink';
38
38
  import type { SummaryResponses, SummaryTitle } from '../../Summary/Summary';
39
39
  import type { LunaticComponentProps } from '../../type';
40
+ import type { MarkdownLink } from '../MDLabel/MarkdownLink';
40
41
  /**
41
42
  * Contains the type of every customizable component
42
43
  */
@@ -93,6 +94,7 @@ export type LunaticSlotComponents = {
93
94
  ComponentWrapper: ComponentType<PropsWithChildren<LunaticComponentProps & {
94
95
  index: number;
95
96
  }>>;
97
+ MarkdownLink: typeof MarkdownLink;
96
98
  };
97
99
  export declare const SlotsProvider: ({ slots, children, }: PropsWithChildren<{
98
100
  slots?: Partial<LunaticSlotComponents>;
@@ -1 +1 @@
1
- {"version":3,"file":"slottableComponent.js","sourceRoot":"","sources":["../../../../src/components/shared/HOC/slottableComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEN,aAAa,EAGb,UAAU,GACV,MAAM,OAAO,CAAC;AAqHf,MAAM,KAAK,GAAG,EAAgD,CAAC;AAE/D,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC7B,KAAK,EACL,QAAQ,GACuD,EAAE,EAAE;IACnE,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,4BAAG,QAAQ,GAAI,CAAC;IACxB,CAAC;IACD,OAAO,CACN,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAAI,KAAK,YAC1C,QAAQ,GACc,CACxB,CAAC;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CACjC,IAAiC,EACjC,iBAAuC;IAEvC,MAAM,kBAAkB,GAAG,CAAC,KAAQ,EAAE,EAAE;QACvC,MAAM,MAAM,GAAG,UAAU,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC;QAEjD,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;YAC9B,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAqB,CAAC;YACvD,OAAO,KAAC,aAAa,OAAK,KAAK,GAAI,CAAC;QACrC,CAAC;QAED,OAAO,KAAC,iBAAiB,OAAK,KAAK,GAAI,CAAC;IACzC,CAAC,CAAC;IACF,kBAAkB,CAAC,WAAW,GAAG,IAAI,CAAC;IACtC,OAAO,kBAAkB,CAAC;AAC3B,CAAC"}
1
+ {"version":3,"file":"slottableComponent.js","sourceRoot":"","sources":["../../../../src/components/shared/HOC/slottableComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEN,aAAa,EAGb,UAAU,GACV,MAAM,OAAO,CAAC;AAuHf,MAAM,KAAK,GAAG,EAAgD,CAAC;AAE/D,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC7B,KAAK,EACL,QAAQ,GACuD,EAAE,EAAE;IACnE,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,4BAAG,QAAQ,GAAI,CAAC;IACxB,CAAC;IACD,OAAO,CACN,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAAI,KAAK,YAC1C,QAAQ,GACc,CACxB,CAAC;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CACjC,IAAiC,EACjC,iBAAuC;IAEvC,MAAM,kBAAkB,GAAG,CAAC,KAAQ,EAAE,EAAE;QACvC,MAAM,MAAM,GAAG,UAAU,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC;QAEjD,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;YAC9B,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAqB,CAAC;YACvD,OAAO,KAAC,aAAa,OAAK,KAAK,GAAI,CAAC;QACrC,CAAC;QAED,OAAO,KAAC,iBAAiB,OAAK,KAAK,GAAI,CAAC;IACzC,CAAC,CAAC;IACF,kBAAkB,CAAC,WAAW,GAAG,IAAI,CAAC;IACtC,OAAO,kBAAkB,CAAC;AAC3B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  type Props = {
2
2
  expression: string;
3
3
  };
4
- export declare const MDLabel: ({ expression }: Props) => import("react/jsx-runtime").JSX.Element;
4
+ export declare function MDLabel({ expression }: Props): import("react/jsx-runtime").JSX.Element;
5
5
  export {};
@@ -1,23 +1,20 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import Markdown from 'react-markdown';
3
- import { MDLabelLink } from './MDLabelLink';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Fragment } from 'react';
3
+ import Markdown, {} from 'react-markdown';
4
+ import { MarkdownLink } from './MarkdownLink';
4
5
  import remarkBreaks from 'remark-breaks';
5
6
  import emoji from 'remark-emoji';
6
- export const MDLabel = ({ expression }) => {
7
- return (_jsx(Markdown, { components: renderComponentsFor(expression), remarkPlugins: [[emoji, { accessible: true }], remarkBreaks], children: expression }));
8
- };
9
- const renderComponentsFor = (expression) => {
7
+ export function MDLabel({ expression }) {
8
+ const hasParagraphs = /\n\n/.test(expression);
10
9
  const components = {
11
- p: (props) => _jsx(_Fragment, { children: props.children }),
10
+ p: hasParagraphs ? 'p' : Fragment,
12
11
  br: 'br',
13
- a: (props) => (_jsx(MDLabelLink, { ...{ ...props } })),
12
+ a: MarkdownA,
14
13
  };
15
- if (/\n\n/.test(expression)) {
16
- return {
17
- ...components,
18
- p: 'p',
19
- };
20
- }
21
- return components;
14
+ return (_jsx(Markdown, { components: components, remarkPlugins: [[emoji, { accessible: true }], remarkBreaks], children: expression }));
15
+ }
16
+ const MarkdownA = ({ title, href, children, }) => {
17
+ const tooltip = title ? _jsx(MDLabel, { expression: title }) : null;
18
+ return (_jsx(MarkdownLink, { href: href, tooltip: tooltip, children: children }));
22
19
  };
23
20
  //# sourceMappingURL=MDLabel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MDLabel.js","sourceRoot":"","sources":["../../../../src/components/shared/MDLabel/MDLabel.tsx"],"names":[],"mappings":";AACA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,MAAM,cAAc,CAAC;AAIjC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,UAAU,EAAS,EAAE,EAAE;IAChD,OAAO,CACN,KAAC,QAAQ,IACR,UAAU,EAAE,mBAAmB,CAAC,UAAU,CAAC,EAC3C,aAAa,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,YAAY,CAAC,YAE3D,UAAU,GACD,CACX,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAC3B,UAAkB,EAC8B,EAAE;IAClD,MAAM,UAAU,GAAG;QAClB,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,4BAAG,KAAK,CAAC,QAAQ,GAAI;QACnC,EAAE,EAAE,IAAI;QACR,CAAC,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AK,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9D,OAAO,CACN,KAAC,YAAY,IAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,YACxC,QAAQ,GACK,CACf,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type PropsWithChildren, type ReactNode } from 'react';
2
+ type Props = PropsWithChildren<{
3
+ href: string;
4
+ tooltip?: ReactNode;
5
+ }>;
6
+ export declare const MarkdownLink: import("react").ComponentType<Props>;
7
+ export {};
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from 'react';
3
+ import { Tooltip } from 'react-tooltip';
4
+ import { RouterLink } from './RouterLink';
5
+ import { slottableComponent } from '../HOC/slottableComponent';
6
+ export const MarkdownLink = slottableComponent('MarkdownLink', ({ href, children, tooltip }) => {
7
+ const id = useId();
8
+ const extraProps = tooltip
9
+ ? { 'data-tooltip-id': `tooltip-${id}`, className: 'link-md' }
10
+ : {};
11
+ const isAbsoluteLink = href.trim().startsWith('/');
12
+ return (_jsxs(_Fragment, { children: [isAbsoluteLink ? (_jsx(RouterLink, { to: href, id: id, ...extraProps, children: children })) : (_jsx("a", { href: href, target: "_blank", rel: "noopener noreferrer", id: id, ...extraProps, children: children })), tooltip && (_jsx(Tooltip, { className: "tooltip-content", id: `tooltip-${id}`, children: tooltip }))] }));
13
+ });
14
+ //# sourceMappingURL=MarkdownLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownLink.js","sourceRoot":"","sources":["../../../../src/components/shared/MDLabel/MarkdownLink.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAA0C,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAI/D,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAC7C,cAAc,EACd,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;IAC/B,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IAEnB,MAAM,UAAU,GAAG,OAAO;QACzB,CAAC,CAAC,EAAE,iBAAiB,EAAE,WAAW,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE;QAC9D,CAAC,CAAC,EAAE,CAAC;IACN,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAEnD,OAAO,CACN,8BACE,cAAc,CAAC,CAAC,CAAC,CACjB,KAAC,UAAU,IAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,KAAM,UAAU,YAC1C,QAAQ,GACG,CACb,CAAC,CAAC,CAAC,CACH,YACC,IAAI,EAAE,IAAI,EACV,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,EAAE,EAAE,EAAE,KACF,UAAU,YAEb,QAAQ,GACN,CACJ,EACA,OAAO,IAAI,CACX,KAAC,OAAO,IAAC,SAAS,EAAC,iBAAiB,EAAC,EAAE,EAAE,WAAW,EAAE,EAAE,YACtD,OAAO,GACC,CACV,IACC,CACH,CAAC;AACH,CAAC,CACD,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.1",
3
+ "version": "3.0.3-rc.0",
4
4
  "description": "Library of questionnaire components",
5
5
  "type": "module",
6
6
  "repository": {
@@ -1,8 +0,0 @@
1
- import { type PropsWithChildren } from 'react';
2
- type Props = PropsWithChildren<{
3
- href: string;
4
- title: string;
5
- }>;
6
- export declare const MDLabelLink: (props: Props) => import("react/jsx-runtime").JSX.Element;
7
- export declare function generateUniqueId(): string;
8
- export {};
@@ -1,35 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { Tooltip } from 'react-tooltip';
4
- import Markdown from 'react-markdown';
5
- import { RouterLink } from './RouterLink';
6
- export const MDLabelLink = (props) => {
7
- const { href, children, title,
8
- // logFunction
9
- } = props;
10
- // Must be replace by useId when queen move to React 18.
11
- const [id] = useState(() => generateUniqueId());
12
- const LinkComponent = (() => {
13
- if (href.trim().startsWith('/')) {
14
- return RouterLink;
15
- }
16
- else {
17
- return 'a';
18
- }
19
- })();
20
- const linkProps = {
21
- ...(href.trim().startsWith('/')
22
- ? { to: href, id }
23
- : { href, target: '_blank', rel: 'noopener noreferrer', id }),
24
- ...(title
25
- ? { 'data-tooltip-id': `tooltip-${id}`, className: 'link-md' }
26
- : {}),
27
- };
28
- return (_jsxs(_Fragment, { children: [_jsx(LinkComponent, { ...linkProps, children: children }), title && (_jsx(Tooltip, { className: "tooltip-content", id: `tooltip-${id}`, children: _jsx(Markdown, { components: { p: (props) => _jsx(_Fragment, { children: props.children }) }, children: title }) }))] }));
29
- };
30
- export function generateUniqueId() {
31
- const timestamp = Date.now().toString(36);
32
- const randomPart = Math.random().toString(36).substring(2, 8);
33
- return `${timestamp}-${randomPart}`;
34
- }
35
- //# sourceMappingURL=MDLabelLink.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MDLabelLink.js","sourceRoot":"","sources":["../../../../src/components/shared/MDLabel/MDLabelLink.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAA0B,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAY,EAAE,EAAE;IAC3C,MAAM,EACL,IAAI,EACJ,QAAQ,EACR,KAAK;IACL,cAAc;MACd,GAAG,KAAK,CAAC;IAEV,wDAAwD;IACxD,MAAM,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAEhD,MAAM,aAAa,GAKd,CAAC,GAAG,EAAE;QACV,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,UAAU,CAAC;QACnB,CAAC;aAAM,CAAC;YACP,OAAO,GAAU,CAAC;QACnB,CAAC;IACF,CAAC,CAAC,EAAE,CAAC;IAEL,MAAM,SAAS,GAAG;QACjB,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;YAC9B,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAClB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,qBAAqB,EAAE,EAAE,EAAE,CAAC;QAC9D,GAAG,CAAC,KAAK;YACR,CAAC,CAAC,EAAE,iBAAiB,EAAE,WAAW,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE;YAC9D,CAAC,CAAC,EAAE,CAAC;KACN,CAAC;IAEF,OAAO,CACN,8BACC,KAAC,aAAa,OAAK,SAAS,YAAG,QAAQ,GAAiB,EACvD,KAAK,IAAI,CACT,KAAC,OAAO,IAAC,SAAS,EAAC,iBAAiB,EAAC,EAAE,EAAE,WAAW,EAAE,EAAE,YACvD,KAAC,QAAQ,IAAC,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,4BAAG,KAAK,CAAC,QAAQ,GAAI,EAAE,YAC3D,KAAK,GACI,GACF,CACV,IACC,CACH,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,UAAU,gBAAgB;IAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9D,OAAO,GAAG,SAAS,IAAI,UAAU,EAAE,CAAC;AACrC,CAAC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=generateUniqueId.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generateUniqueId.js","sourceRoot":"","sources":["../../../../src/components/shared/MDLabel/generateUniqueId.ts"],"names":[],"mappings":""}