@connectif/ui-components 2.0.15 → 2.0.17
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,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SxProps } from '@mui/material';
|
|
3
|
+
import { TypographyVariant } from '../../theme/Typography';
|
|
3
4
|
import { InputLabelProps } from './InputLabel';
|
|
4
5
|
import { IconId } from '../icon';
|
|
5
6
|
export type TextFieldProps = {
|
|
@@ -144,6 +145,10 @@ export type TextFieldProps = {
|
|
|
144
145
|
* IconButton and MenuIconButton size must be 'M' or smaller.
|
|
145
146
|
*/
|
|
146
147
|
groupElements?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Specify typography variant on input
|
|
150
|
+
*/
|
|
151
|
+
typographyVariant?: TypographyVariant;
|
|
147
152
|
};
|
|
148
153
|
/**
|
|
149
154
|
* TextField is a component that renders an input field with type="text" or a textarea.
|
|
@@ -4,8 +4,14 @@ type MarkdownContainerProps = {
|
|
|
4
4
|
color: string;
|
|
5
5
|
backgroundColor?: string;
|
|
6
6
|
variant?: TypographyVariant;
|
|
7
|
+
lineHeight?: number;
|
|
8
|
+
codeLineHeight?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Class Name to append to container
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
7
13
|
};
|
|
8
|
-
declare const MarkdownRenderer: ({ text, ...rest }: MarkdownContainerProps & {
|
|
14
|
+
declare const MarkdownRenderer: ({ text, className, ...rest }: MarkdownContainerProps & {
|
|
9
15
|
text: string;
|
|
10
16
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
17
|
export default MarkdownRenderer;
|
package/dist/index.js
CHANGED
|
@@ -13801,7 +13801,7 @@ var ChatMessage = React35.forwardRef(function ChatMessage2({
|
|
|
13801
13801
|
borderStyle: "solid",
|
|
13802
13802
|
borderColor: !backgroundColor2 ? messageType === "incoming" ? grey200 : primary300 : backgroundColor2,
|
|
13803
13803
|
color: messageType === "incoming" ? grey900 : white,
|
|
13804
|
-
borderRadius: "
|
|
13804
|
+
borderRadius: "16px",
|
|
13805
13805
|
...highlightStartEdge && messageType === "outgoing" && {
|
|
13806
13806
|
borderTopRightRadius: "4px"
|
|
13807
13807
|
},
|
|
@@ -18411,11 +18411,14 @@ var InputHelperText_default = InputHelperText;
|
|
|
18411
18411
|
// src/components/input/TextField.tsx
|
|
18412
18412
|
import { Fragment as Fragment20, jsx as jsx98, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
18413
18413
|
var commonInputStylesOptions = {
|
|
18414
|
-
shouldForwardProp: (prop) => prop !== "variant"
|
|
18414
|
+
shouldForwardProp: (prop) => prop !== "variant" && prop !== "typographyVariant"
|
|
18415
18415
|
};
|
|
18416
|
-
function getCommonInputStyles({
|
|
18416
|
+
function getCommonInputStyles({
|
|
18417
|
+
disabled,
|
|
18418
|
+
typographyVariant
|
|
18419
|
+
}) {
|
|
18417
18420
|
return {
|
|
18418
|
-
...variants["body2"],
|
|
18421
|
+
...variants[typographyVariant ?? "body2"],
|
|
18419
18422
|
backgroundColor: "transparent",
|
|
18420
18423
|
display: "block",
|
|
18421
18424
|
width: "0",
|
|
@@ -18483,6 +18486,7 @@ var TextField = React50.forwardRef(function TextField2({
|
|
|
18483
18486
|
readOnly = false,
|
|
18484
18487
|
className = "",
|
|
18485
18488
|
groupElements,
|
|
18489
|
+
typographyVariant,
|
|
18486
18490
|
...restProps
|
|
18487
18491
|
}, ref) {
|
|
18488
18492
|
const [id] = React50.useState(Math.random().toString(10));
|
|
@@ -18581,6 +18585,7 @@ var TextField = React50.forwardRef(function TextField2({
|
|
|
18581
18585
|
maxLength,
|
|
18582
18586
|
onKeyDown,
|
|
18583
18587
|
className: "Slim-Vertical-Scroll",
|
|
18588
|
+
...typographyVariant && { typographyVariant },
|
|
18584
18589
|
onScroll: () => {
|
|
18585
18590
|
if (onScroll) {
|
|
18586
18591
|
const reference = ref || inputRef;
|
|
@@ -18613,6 +18618,7 @@ var TextField = React50.forwardRef(function TextField2({
|
|
|
18613
18618
|
autoComplete,
|
|
18614
18619
|
maxLength,
|
|
18615
18620
|
onKeyDown,
|
|
18621
|
+
...typographyVariant && { typographyVariant },
|
|
18616
18622
|
...restProps
|
|
18617
18623
|
}
|
|
18618
18624
|
)
|
|
@@ -24259,83 +24265,96 @@ var KatexRenderer_default = KatexRenderer;
|
|
|
24259
24265
|
// src/components/markdown/MarkdownRenderer.tsx
|
|
24260
24266
|
import { jsx as jsx137 } from "react/jsx-runtime";
|
|
24261
24267
|
var MarkdownContainer = styled8("div")(
|
|
24262
|
-
({
|
|
24268
|
+
({
|
|
24269
|
+
color: color2,
|
|
24270
|
+
backgroundColor: backgroundColor2 = "transparent",
|
|
24271
|
+
variant,
|
|
24272
|
+
lineHeight,
|
|
24273
|
+
codeLineHeight
|
|
24274
|
+
}) => ({
|
|
24263
24275
|
color: color2,
|
|
24264
24276
|
backgroundColor: backgroundColor2,
|
|
24265
24277
|
borderRadius: "8px",
|
|
24266
24278
|
overflowWrap: "break-word",
|
|
24267
|
-
"& h1, & h2, & h3": {
|
|
24268
|
-
color: color2
|
|
24269
|
-
},
|
|
24279
|
+
"& h1, & h2, & h3": { color: color2 },
|
|
24270
24280
|
"& h1": { fontSize: "1.75rem" },
|
|
24271
24281
|
"& h2": { fontSize: "1.5rem" },
|
|
24272
24282
|
"& h3": { fontSize: "1.25rem" },
|
|
24273
24283
|
"& p": {
|
|
24274
24284
|
...variants[variant || "body2"],
|
|
24275
|
-
margin: "0.5em 0"
|
|
24285
|
+
margin: "0.5em 0",
|
|
24286
|
+
...lineHeight && { lineHeight: `${lineHeight}px` }
|
|
24276
24287
|
},
|
|
24277
24288
|
"& ul, & ol": {
|
|
24278
24289
|
...variants[variant || "body2"],
|
|
24279
24290
|
paddingLeft: "1.5em",
|
|
24280
|
-
margin: "0.5em 0"
|
|
24281
|
-
|
|
24282
|
-
"& li": {
|
|
24283
|
-
marginBottom: "0.25em"
|
|
24291
|
+
margin: "0.5em 0",
|
|
24292
|
+
...lineHeight && { lineHeight: `${lineHeight}px` }
|
|
24284
24293
|
},
|
|
24294
|
+
"& li": { marginBottom: "0.25em" },
|
|
24285
24295
|
"& code": {
|
|
24286
24296
|
background: grey800,
|
|
24287
24297
|
padding: "2px 6px",
|
|
24288
24298
|
borderRadius: "4px",
|
|
24289
24299
|
fontFamily: "Courier New, monospace",
|
|
24290
24300
|
fontSize: "0.9em",
|
|
24291
|
-
color: white
|
|
24301
|
+
color: white,
|
|
24302
|
+
...(codeLineHeight || lineHeight) && {
|
|
24303
|
+
lineHeight: `${codeLineHeight ?? lineHeight}px`
|
|
24304
|
+
}
|
|
24292
24305
|
},
|
|
24293
24306
|
"& pre code": {
|
|
24294
24307
|
display: "block",
|
|
24295
24308
|
padding: "12px",
|
|
24296
|
-
overflowX: "auto"
|
|
24309
|
+
overflowX: "auto",
|
|
24310
|
+
...(codeLineHeight || lineHeight) && {
|
|
24311
|
+
lineHeight: `${codeLineHeight ?? lineHeight}px`
|
|
24312
|
+
}
|
|
24297
24313
|
},
|
|
24298
24314
|
"& table": {
|
|
24299
24315
|
width: "100%",
|
|
24300
24316
|
borderCollapse: "collapse",
|
|
24301
|
-
margin: "1em 0"
|
|
24317
|
+
margin: "1em 0",
|
|
24318
|
+
...lineHeight && { lineHeight: `${lineHeight}px` }
|
|
24302
24319
|
},
|
|
24303
24320
|
"& th, & td": {
|
|
24304
24321
|
border: `1px solid ${grey800}`,
|
|
24305
24322
|
padding: "8px",
|
|
24306
|
-
textAlign: "left"
|
|
24307
|
-
|
|
24308
|
-
"& th": {
|
|
24309
|
-
backgroundColor: grey900,
|
|
24310
|
-
color: white
|
|
24311
|
-
},
|
|
24312
|
-
"& a": {
|
|
24313
|
-
color: primary200,
|
|
24314
|
-
textDecoration: "none"
|
|
24323
|
+
textAlign: "left",
|
|
24324
|
+
...lineHeight && { lineHeight: `${lineHeight}px` }
|
|
24315
24325
|
},
|
|
24316
|
-
"&
|
|
24317
|
-
|
|
24318
|
-
}
|
|
24326
|
+
"& th": { backgroundColor: grey900, color: white },
|
|
24327
|
+
"& a": { color: primary200, textDecoration: "none" },
|
|
24328
|
+
"& a:hover": { textDecoration: "underline" }
|
|
24319
24329
|
})
|
|
24320
24330
|
);
|
|
24331
|
+
var normalizeLatexDelimiters = (s) => {
|
|
24332
|
+
if (!s) {
|
|
24333
|
+
return s;
|
|
24334
|
+
}
|
|
24335
|
+
s = s.replace(/\\\\?\[([\s\S]*?)\\\\?\]/g, (_, inner) => `$$${inner}$$`);
|
|
24336
|
+
s = s.replace(/\\\\?\(([\s\S]*?)\\\\?\)/g, (_, inner) => `$${inner}$`);
|
|
24337
|
+
return s;
|
|
24338
|
+
};
|
|
24321
24339
|
var renderWithMath = (text) => {
|
|
24322
24340
|
const parts = [];
|
|
24323
|
-
const regex = /\$\$([\s\S]+?)\$\$|\$([\s\S]+?)\$/g;
|
|
24341
|
+
const regex = /\$\$([\s\S]+?)\$\$|\$(?!\$)([\s\S]+?)\$/g;
|
|
24324
24342
|
let lastIndex = 0;
|
|
24325
24343
|
let match;
|
|
24326
24344
|
while ((match = regex.exec(text)) !== null) {
|
|
24327
|
-
const [full, blockExpr, inlineExpr] = match;
|
|
24328
24345
|
const start = match.index;
|
|
24329
24346
|
if (start > lastIndex) {
|
|
24330
24347
|
parts.push(text.slice(lastIndex, start));
|
|
24331
24348
|
}
|
|
24332
|
-
|
|
24349
|
+
const block = match[1];
|
|
24350
|
+
const inline = match[2];
|
|
24351
|
+
if (block !== void 0) {
|
|
24333
24352
|
parts.push(
|
|
24334
|
-
/* @__PURE__ */ jsx137(KatexRenderer_default, { block: true, children:
|
|
24353
|
+
/* @__PURE__ */ jsx137(KatexRenderer_default, { block: true, children: block.trim() }, start)
|
|
24335
24354
|
);
|
|
24336
|
-
} else if (
|
|
24355
|
+
} else if (inline !== void 0) {
|
|
24337
24356
|
parts.push(
|
|
24338
|
-
/* @__PURE__ */ jsx137(KatexRenderer_default, { children:
|
|
24357
|
+
/* @__PURE__ */ jsx137(KatexRenderer_default, { children: inline.trim() }, start)
|
|
24339
24358
|
);
|
|
24340
24359
|
}
|
|
24341
24360
|
lastIndex = regex.lastIndex;
|
|
@@ -24345,34 +24364,61 @@ var renderWithMath = (text) => {
|
|
|
24345
24364
|
}
|
|
24346
24365
|
return parts;
|
|
24347
24366
|
};
|
|
24367
|
+
var renderChildrenWithMath = (children) => React76.Children.map(children, (child) => {
|
|
24368
|
+
if (typeof child === "string") {
|
|
24369
|
+
return renderWithMath(child);
|
|
24370
|
+
}
|
|
24371
|
+
if (React76.isValidElement(child)) {
|
|
24372
|
+
return React76.cloneElement(child, {
|
|
24373
|
+
...child.props,
|
|
24374
|
+
children: renderChildrenWithMath(child.props.children)
|
|
24375
|
+
});
|
|
24376
|
+
}
|
|
24377
|
+
return child;
|
|
24378
|
+
});
|
|
24379
|
+
var CodeOrMath = ({ children, ...props }) => {
|
|
24380
|
+
const raw = Array.isArray(children) ? children.map((c) => typeof c === "string" ? c : "").join("") : typeof children === "string" ? children : "";
|
|
24381
|
+
const s = raw.trim();
|
|
24382
|
+
const fullMath = /^\$\$([\s\S]+)\$\$$|^\$(?!\$)([\s\S]+)\$$/;
|
|
24383
|
+
const m = s.match(fullMath);
|
|
24384
|
+
if (m) {
|
|
24385
|
+
const expr = m[1] || m[2] || "";
|
|
24386
|
+
const isBlock = Boolean(m[1]);
|
|
24387
|
+
return /* @__PURE__ */ jsx137(KatexRenderer_default, { block: isBlock, children: expr.trim() });
|
|
24388
|
+
}
|
|
24389
|
+
const maybe = renderWithMath(s);
|
|
24390
|
+
const onlyText = maybe.length === 1 && typeof maybe[0] === "string";
|
|
24391
|
+
return onlyText ? /* @__PURE__ */ jsx137("code", { ...props, children }) : /* @__PURE__ */ jsx137("span", { children: maybe });
|
|
24392
|
+
};
|
|
24348
24393
|
var MarkdownRenderer = ({
|
|
24349
24394
|
text,
|
|
24395
|
+
className,
|
|
24350
24396
|
...rest
|
|
24351
|
-
}) =>
|
|
24352
|
-
|
|
24353
|
-
|
|
24354
|
-
|
|
24355
|
-
|
|
24356
|
-
|
|
24357
|
-
|
|
24358
|
-
|
|
24359
|
-
|
|
24360
|
-
|
|
24361
|
-
|
|
24362
|
-
|
|
24363
|
-
|
|
24364
|
-
|
|
24365
|
-
|
|
24366
|
-
}
|
|
24367
|
-
|
|
24368
|
-
|
|
24369
|
-
}
|
|
24397
|
+
}) => {
|
|
24398
|
+
const normalized = normalizeLatexDelimiters(text || "");
|
|
24399
|
+
return /* @__PURE__ */ jsx137(
|
|
24400
|
+
MarkdownContainer,
|
|
24401
|
+
{
|
|
24402
|
+
className: `markdown-container ${className || ""}`,
|
|
24403
|
+
...rest,
|
|
24404
|
+
children: /* @__PURE__ */ jsx137(
|
|
24405
|
+
Markdown,
|
|
24406
|
+
{
|
|
24407
|
+
options: {
|
|
24408
|
+
forceBlock: true,
|
|
24409
|
+
overrides: {
|
|
24410
|
+
p: {
|
|
24411
|
+
component: ({ children, ...props }) => /* @__PURE__ */ jsx137("p", { ...props, children: renderChildrenWithMath(children) })
|
|
24412
|
+
},
|
|
24413
|
+
code: { component: CodeOrMath }
|
|
24414
|
+
}
|
|
24415
|
+
},
|
|
24416
|
+
children: normalized
|
|
24370
24417
|
}
|
|
24371
|
-
|
|
24372
|
-
}
|
|
24373
|
-
|
|
24374
|
-
|
|
24375
|
-
) });
|
|
24418
|
+
)
|
|
24419
|
+
}
|
|
24420
|
+
);
|
|
24421
|
+
};
|
|
24376
24422
|
var MarkdownRenderer_default = MarkdownRenderer;
|
|
24377
24423
|
|
|
24378
24424
|
// src/components/navbar/Navbar.tsx
|
|
@@ -25928,7 +25974,7 @@ import { Fragment as Fragment35, jsx as jsx169, jsxs as jsxs80 } from "react/jsx
|
|
|
25928
25974
|
var sizes6 = {
|
|
25929
25975
|
M: 400,
|
|
25930
25976
|
L: 500,
|
|
25931
|
-
XL:
|
|
25977
|
+
XL: 640
|
|
25932
25978
|
};
|
|
25933
25979
|
var styles2 = {
|
|
25934
25980
|
backgroundColor: dark900,
|