@evergis/react 4.0.98 → 4.0.99
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/dist/components/Dashboard/componentTypes.d.ts +1 -1
- package/dist/components/Dashboard/elements/ElementMarkdown/styled.d.ts +5 -2
- package/dist/components/Dashboard/types.d.ts +14 -0
- package/dist/index.js +36 -5
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +36 -5
- package/dist/react.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/react.esm.js
CHANGED
|
@@ -10060,6 +10060,20 @@ const ElementLink = memo(({ type, elementConfig }) => {
|
|
|
10060
10060
|
: jsx(LocalLink, { style: style, link: link });
|
|
10061
10061
|
});
|
|
10062
10062
|
|
|
10063
|
+
/**
|
|
10064
|
+
* Пер-тег переопределение типографики из конфига. Пустой результат, если для тега
|
|
10065
|
+
* ничего не задано — тогда действует дефолт, объявленный в самом правиле тега.
|
|
10066
|
+
*/
|
|
10067
|
+
const tagTypography = (tag) => ({ $typography }) => {
|
|
10068
|
+
const style = $typography?.[tag];
|
|
10069
|
+
if (!style)
|
|
10070
|
+
return "";
|
|
10071
|
+
return css `
|
|
10072
|
+
${style.fontSize && `font-size: ${style.fontSize};`}
|
|
10073
|
+
${style.lineHeight && `line-height: ${style.lineHeight};`}
|
|
10074
|
+
${style.fontWeight != null && `font-weight: ${style.fontWeight};`}
|
|
10075
|
+
`;
|
|
10076
|
+
};
|
|
10063
10077
|
const MarkdownWrapper = styled.div.withConfig({ displayName: "MarkdownWrapper", componentId: "sc-1iv8z8a" }) `
|
|
10064
10078
|
padding: 0;
|
|
10065
10079
|
background: transparent;
|
|
@@ -10074,6 +10088,7 @@ const MarkdownWrapper = styled.div.withConfig({ displayName: "MarkdownWrapper",
|
|
|
10074
10088
|
letter-spacing: 0.0052rem;
|
|
10075
10089
|
margin: 0 0 1rem 0;
|
|
10076
10090
|
font-weight: 400;
|
|
10091
|
+
${tagTypography("p")}
|
|
10077
10092
|
|
|
10078
10093
|
&:last-child {
|
|
10079
10094
|
margin-bottom: 0;
|
|
@@ -10089,16 +10104,31 @@ const MarkdownWrapper = styled.div.withConfig({ displayName: "MarkdownWrapper",
|
|
|
10089
10104
|
h1 {
|
|
10090
10105
|
font-size: 1.5rem;
|
|
10091
10106
|
line-height: 1.75rem;
|
|
10107
|
+
${tagTypography("h1")}
|
|
10092
10108
|
}
|
|
10093
10109
|
|
|
10094
10110
|
h2 {
|
|
10095
10111
|
font-size: 1.25rem;
|
|
10096
10112
|
line-height: 1.5rem;
|
|
10113
|
+
${tagTypography("h2")}
|
|
10097
10114
|
}
|
|
10098
10115
|
|
|
10099
10116
|
h3 {
|
|
10100
10117
|
font-size: 1rem;
|
|
10101
10118
|
line-height: 1.25rem;
|
|
10119
|
+
${tagTypography("h3")}
|
|
10120
|
+
}
|
|
10121
|
+
|
|
10122
|
+
h4 {
|
|
10123
|
+
${tagTypography("h4")}
|
|
10124
|
+
}
|
|
10125
|
+
|
|
10126
|
+
h5 {
|
|
10127
|
+
${tagTypography("h5")}
|
|
10128
|
+
}
|
|
10129
|
+
|
|
10130
|
+
h6 {
|
|
10131
|
+
${tagTypography("h6")}
|
|
10102
10132
|
}
|
|
10103
10133
|
|
|
10104
10134
|
/* Images */
|
|
@@ -10133,6 +10163,7 @@ const MarkdownWrapper = styled.div.withConfig({ displayName: "MarkdownWrapper",
|
|
|
10133
10163
|
font-size: 0.875rem;
|
|
10134
10164
|
line-height: 1rem;
|
|
10135
10165
|
margin-bottom: 0.5rem;
|
|
10166
|
+
${tagTypography("li")}
|
|
10136
10167
|
}
|
|
10137
10168
|
}
|
|
10138
10169
|
|
|
@@ -10143,6 +10174,7 @@ const MarkdownWrapper = styled.div.withConfig({ displayName: "MarkdownWrapper",
|
|
|
10143
10174
|
border-radius: 0.25rem;
|
|
10144
10175
|
font-family: monospace;
|
|
10145
10176
|
font-size: 0.8125rem;
|
|
10177
|
+
${tagTypography("code")}
|
|
10146
10178
|
}
|
|
10147
10179
|
|
|
10148
10180
|
pre {
|
|
@@ -10195,8 +10227,7 @@ const ElementMarkdown = memo(({ elementConfig, type }) => {
|
|
|
10195
10227
|
const { t } = useGlobalContext();
|
|
10196
10228
|
const [expanded, setExpanded] = useState(false);
|
|
10197
10229
|
const { attributeName, value, options } = elementConfig || {};
|
|
10198
|
-
const { noMargin } = options || {};
|
|
10199
|
-
const expandLength = options?.expandLength || 0;
|
|
10230
|
+
const { noMargin, expandLength = 0, typography } = options || {};
|
|
10200
10231
|
// Get Markdown content from:
|
|
10201
10232
|
// 1. value (static content)
|
|
10202
10233
|
// 2. attribute by attributeName (dynamic content from data)
|
|
@@ -10212,16 +10243,16 @@ const ElementMarkdown = memo(({ elementConfig, type }) => {
|
|
|
10212
10243
|
const shouldShowExpand = expandLength > 0 && markdownString.length > expandLength;
|
|
10213
10244
|
// If expand is not needed, show full content
|
|
10214
10245
|
if (!shouldShowExpand) {
|
|
10215
|
-
return (jsx(MarkdownWrapper, { "$noMargin": noMargin, children: jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [rehypeRaw, [rehypeSanitize, sanitizeSchema]], children: markdownString }) }));
|
|
10246
|
+
return (jsx(MarkdownWrapper, { "$typography": typography, "$noMargin": noMargin, children: jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [rehypeRaw, [rehypeSanitize, sanitizeSchema]], children: markdownString }) }));
|
|
10216
10247
|
}
|
|
10217
10248
|
// Collapsed state
|
|
10218
10249
|
if (!expanded) {
|
|
10219
10250
|
// Truncated content for collapsed state
|
|
10220
10251
|
const truncatedContent = markdownString.substring(0, expandLength);
|
|
10221
|
-
return (jsxs(MarkdownWrapper, { "$noMargin": noMargin, children: [jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [rehypeRaw, [rehypeSanitize, sanitizeSchema]], children: truncatedContent }), jsx(LegendToggler, { onClick: () => setExpanded(true), children: t("more", { ns: "dashboard", defaultValue: "Подробнее" }) })] }));
|
|
10252
|
+
return (jsxs(MarkdownWrapper, { "$typography": typography, "$noMargin": noMargin, children: [jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [rehypeRaw, [rehypeSanitize, sanitizeSchema]], children: truncatedContent }), jsx(LegendToggler, { onClick: () => setExpanded(true), children: t("more", { ns: "dashboard", defaultValue: "Подробнее" }) })] }));
|
|
10222
10253
|
}
|
|
10223
10254
|
// Expanded state
|
|
10224
|
-
return (jsxs(MarkdownWrapper, { "$noMargin": noMargin, children: [jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [rehypeRaw, rehypeSanitize], children: markdownString }), jsx(LegendToggler, { toggled: true, onClick: () => setExpanded(false), children: t("hide", { ns: "dashboard", defaultValue: "Свернуть" }) })] }));
|
|
10255
|
+
return (jsxs(MarkdownWrapper, { "$typography": typography, "$noMargin": noMargin, children: [jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [rehypeRaw, [rehypeSanitize, sanitizeSchema]], children: markdownString }), jsx(LegendToggler, { toggled: true, onClick: () => setExpanded(false), children: t("hide", { ns: "dashboard", defaultValue: "Свернуть" }) })] }));
|
|
10225
10256
|
});
|
|
10226
10257
|
|
|
10227
10258
|
const SmallPreviewContainer = styled.div.withConfig({ displayName: "SmallPreviewContainer", componentId: "sc-1tgzhdl" }) `
|