@meduza/ui-kit-2 0.1.6 → 0.1.8
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/MaterialTitle/MaterialTitle.types.d.ts +2 -2
- package/dist/Popover/Popover.types.d.ts +2 -2
- package/dist/Tag/Tag.types.d.ts +2 -2
- package/dist/ui-kit-2.cjs.development.js +47 -42
- package/dist/ui-kit-2.cjs.development.js.map +1 -1
- package/dist/ui-kit-2.cjs.production.min.js +1 -1
- package/dist/ui-kit-2.cjs.production.min.js.map +1 -1
- package/dist/ui-kit-2.esm.js +47 -42
- package/dist/ui-kit-2.esm.js.map +1 -1
- package/dist/ui-kit.css +870 -870
- package/dist/utils/DangerousHtml.d.ts +3 -3
- package/package.json +1 -1
- package/src/ChapterBlock/index.tsx +3 -6
- package/src/DocumentItemsCount/DocumentItemsCount.stories.tsx +1 -1
- package/src/GroupedBlock/GroupedBlock.stories.tsx +1 -1
- package/src/GroupedBlock/GroupedBlock.types.ts +1 -1
- package/src/HalfBlock/HalfBlock.types.ts +1 -1
- package/src/Image/index.tsx +1 -0
- package/src/ListBlock/ListBlock.stories.tsx +1 -1
- package/src/ListBlock/index.tsx +1 -2
- package/src/MaterialTitle/MaterialTitle.types.ts +2 -1
- package/src/MediaCaption/MediaCaption.types.ts +2 -2
- package/src/Meta/Meta.stories.tsx +1 -1
- package/src/Popover/Popover.types.ts +2 -1
- package/src/SimpleBlock/index.tsx +6 -8
- package/src/SourceBlock/index.tsx +1 -2
- package/src/SvgSymbol/SvgSymbol.stories.tsx +1 -1
- package/src/Tag/Tag.types.ts +3 -1
- package/src/Toolbar/Toolbar.stories.tsx +0 -1
- package/src/utils/DangerousHtml.tsx +23 -13
package/dist/Tag/Tag.types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export declare type TagSizes = 'small' | 'large';
|
|
3
3
|
export declare type TagThemes = 'dark' | 'gold' | 'gray' | 'light' | 'inherit';
|
|
4
4
|
export declare type TagStyleContexts = 'isInToolbar' | 'isInSpoiler' | 'isInDropdown';
|
|
5
5
|
export interface TagProps {
|
|
6
|
-
children: JSX.Element[] | JSX.Element;
|
|
6
|
+
children: React.ReactNode | JSX.Element[] | JSX.Element;
|
|
7
7
|
styleContext?: string | string[];
|
|
8
8
|
theme: TagThemes;
|
|
9
9
|
size: TagSizes;
|
|
@@ -301,6 +301,20 @@ var viewportSize = (function () {
|
|
|
301
301
|
};
|
|
302
302
|
});
|
|
303
303
|
|
|
304
|
+
var POST_MESSAGE_PREFIX = 'mdzKitMsg';
|
|
305
|
+
|
|
306
|
+
var postMessage = function postMessage(element, action) {
|
|
307
|
+
var target = window.top;
|
|
308
|
+
var msg = POST_MESSAGE_PREFIX + "=" + JSON.stringify({
|
|
309
|
+
element: element,
|
|
310
|
+
action: action
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
if (typeof target !== 'undefined') {
|
|
314
|
+
target.postMessage(msg, '*');
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
|
|
304
318
|
var MediaQuerySizes = {
|
|
305
319
|
MOBILE: 512,
|
|
306
320
|
PORTRAIT_TABLET: 768,
|
|
@@ -989,21 +1003,20 @@ var DangerousHTML = function DangerousHTML(_ref) {
|
|
|
989
1003
|
});
|
|
990
1004
|
}, []);
|
|
991
1005
|
React.useEffect(function () {
|
|
992
|
-
if (canRenderHtml && html.indexOf('script') > -1 && element.current) {
|
|
993
|
-
element.current.innerHTML = html;
|
|
994
|
-
replaceScriptElementsRecursive(element.current);
|
|
1006
|
+
if (canRenderHtml && html.indexOf('script') > -1 && element.current.firstChild) {
|
|
1007
|
+
element.current.firstElementChild.innerHTML = html;
|
|
1008
|
+
replaceScriptElementsRecursive(element.current.firstChild);
|
|
995
1009
|
prepareAnchors();
|
|
996
1010
|
}
|
|
997
|
-
}, [canRenderHtml, element, html]);
|
|
998
|
-
return React__default.createElement(
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
ref: element,
|
|
1011
|
+
}, [canRenderHtml, element, html, replaceScriptElementsRecursive, prepareAnchors]);
|
|
1012
|
+
return React__default.createElement("div", {
|
|
1013
|
+
ref: element
|
|
1014
|
+
}, React__default.createElement(TagName, {
|
|
1002
1015
|
className: className,
|
|
1003
1016
|
dangerouslySetInnerHTML: {
|
|
1004
1017
|
__html: html
|
|
1005
1018
|
}
|
|
1006
|
-
});
|
|
1019
|
+
}));
|
|
1007
1020
|
};
|
|
1008
1021
|
|
|
1009
1022
|
var styles$h = {"root":"EmbedBlock-module_root__28k9U","object":"EmbedBlock-module_object__2_UZ7","objectWrap":"EmbedBlock-module_objectWrap__1aDVd","proportional":"EmbedBlock-module_proportional__3lAv4","attachment":"EmbedBlock-module_attachment__2pE0t","default":"EmbedBlock-module_default__LSDny","xs":"EmbedBlock-module_xs__1hFgW","full":"EmbedBlock-module_full__1TEjx","super_full":"EmbedBlock-module_super_full__1Fn9A","figure":"EmbedBlock-module_figure__vAvcN","dark":"EmbedBlock-module_dark__1be2G","isInGroupedBlock":"EmbedBlock-module_isInGroupedBlock__3r_i-","gameEmbed":"EmbedBlock-module_gameEmbed__AZQSo","mobile":"EmbedBlock-module_mobile__1P-eo","desktop":"EmbedBlock-module_desktop__SF5a_","control":"EmbedBlock-module_control__xr8dZ","raw_html":"EmbedBlock-module_raw_html__MQoAA","mobileFullwidth":"EmbedBlock-module_mobileFullwidth__QFFLH","card":"EmbedBlock-module_card__KTbvp","slide":"EmbedBlock-module_slide__3cL3M","cc":"EmbedBlock-module_cc__1BQ5g","isInAnswer":"EmbedBlock-module_isInAnswer__tLlgs","picture":"EmbedBlock-module_picture__186q0","wrapper":"EmbedBlock-module_wrapper__33XvX"};
|
|
@@ -1317,15 +1330,18 @@ var CardTitle = function CardTitle(_ref) {
|
|
|
1317
1330
|
var styles$k = {"root":"ChapterBlock-module_root__1WyVn","subtitle":"ChapterBlock-module_subtitle__3TXll","mobile":"ChapterBlock-module_mobile__CiO0w","desktop":"ChapterBlock-module_desktop__tk1Nk"};
|
|
1318
1331
|
|
|
1319
1332
|
var ChapterBlock = function ChapterBlock(_ref) {
|
|
1320
|
-
var block = _ref.block,
|
|
1321
|
-
|
|
1333
|
+
var _ref$block = _ref.block,
|
|
1334
|
+
data = _ref$block.data,
|
|
1335
|
+
onlyOn = _ref$block.only_on,
|
|
1322
1336
|
styleContext = _ref.styleContext;
|
|
1323
1337
|
return React__default.createElement("div", {
|
|
1324
1338
|
"data-testid": "chapter-block",
|
|
1325
1339
|
className: makeClassName([[styles$k.root, true], [styles$k[onlyOn], !!onlyOn]])
|
|
1326
|
-
}, React__default.createElement(
|
|
1340
|
+
}, React__default.createElement("div", {
|
|
1327
1341
|
className: makeClassName([[styles$k.subtitle, true], [styles$k[styleContext], !!styleContext && !!styles$k[styleContext]]]),
|
|
1328
|
-
|
|
1342
|
+
dangerouslySetInnerHTML: {
|
|
1343
|
+
__html: data
|
|
1344
|
+
}
|
|
1329
1345
|
}));
|
|
1330
1346
|
};
|
|
1331
1347
|
|
|
@@ -1388,7 +1404,7 @@ var SimpleBlock = function SimpleBlock(_ref) {
|
|
|
1388
1404
|
type = _ref$block.type,
|
|
1389
1405
|
onlyOn = _ref$block.only_on,
|
|
1390
1406
|
styleContext = _ref.styleContext;
|
|
1391
|
-
var
|
|
1407
|
+
var TagName;
|
|
1392
1408
|
var classNames = [[styles$o[type], !!type && !!styles$o[type]], [styles$o[onlyOn], true]];
|
|
1393
1409
|
|
|
1394
1410
|
if (styleContext) {
|
|
@@ -1401,24 +1417,25 @@ var SimpleBlock = function SimpleBlock(_ref) {
|
|
|
1401
1417
|
case 'note_caption':
|
|
1402
1418
|
case 'note_credit':
|
|
1403
1419
|
{
|
|
1404
|
-
|
|
1420
|
+
TagName = 'p';
|
|
1405
1421
|
break;
|
|
1406
1422
|
}
|
|
1407
1423
|
|
|
1408
1424
|
case 'lead_hr':
|
|
1409
1425
|
{
|
|
1410
|
-
|
|
1426
|
+
TagName = 'div';
|
|
1411
1427
|
break;
|
|
1412
1428
|
}
|
|
1413
1429
|
|
|
1414
1430
|
default:
|
|
1415
|
-
|
|
1431
|
+
TagName = type;
|
|
1416
1432
|
}
|
|
1417
1433
|
|
|
1418
|
-
return React__default.createElement(
|
|
1434
|
+
return React__default.createElement(TagName, {
|
|
1419
1435
|
className: makeClassName(classNames),
|
|
1420
|
-
|
|
1421
|
-
|
|
1436
|
+
dangerouslySetInnerHTML: {
|
|
1437
|
+
__html: data
|
|
1438
|
+
}
|
|
1422
1439
|
});
|
|
1423
1440
|
};
|
|
1424
1441
|
|
|
@@ -1440,10 +1457,11 @@ var ListBlock = function ListBlock(_ref) {
|
|
|
1440
1457
|
return React__default.createElement(TagName, {
|
|
1441
1458
|
className: makeClassName(classNames)
|
|
1442
1459
|
}, data.map(function (item, index) {
|
|
1443
|
-
return React__default.createElement(
|
|
1460
|
+
return React__default.createElement("li", {
|
|
1444
1461
|
key: index,
|
|
1445
|
-
|
|
1446
|
-
|
|
1462
|
+
dangerouslySetInnerHTML: {
|
|
1463
|
+
__html: item
|
|
1464
|
+
}
|
|
1447
1465
|
});
|
|
1448
1466
|
}));
|
|
1449
1467
|
};
|
|
@@ -1509,10 +1527,11 @@ var SourceBlock = function SourceBlock(_ref) {
|
|
|
1509
1527
|
target: "_blank",
|
|
1510
1528
|
rel: "noopener noreferrer"
|
|
1511
1529
|
}, quote.map(function (item, index) {
|
|
1512
|
-
return React__default.createElement(
|
|
1530
|
+
return React__default.createElement("p", {
|
|
1513
1531
|
key: index,
|
|
1514
|
-
|
|
1515
|
-
|
|
1532
|
+
dangerouslySetInnerHTML: {
|
|
1533
|
+
__html: item.data
|
|
1534
|
+
}
|
|
1516
1535
|
});
|
|
1517
1536
|
}), React__default.createElement("footer", null, React__default.createElement("cite", {
|
|
1518
1537
|
className: styles$r.origin
|
|
@@ -2067,20 +2086,6 @@ var ImportantLead = function ImportantLead(_ref) {
|
|
|
2067
2086
|
}));
|
|
2068
2087
|
};
|
|
2069
2088
|
|
|
2070
|
-
var POST_MESSAGE_PREFIX = 'mdzKitMsg';
|
|
2071
|
-
|
|
2072
|
-
var postMessage$1 = function postMessage(element, action) {
|
|
2073
|
-
var target = window.top;
|
|
2074
|
-
var msg = POST_MESSAGE_PREFIX + "=" + JSON.stringify({
|
|
2075
|
-
element: element,
|
|
2076
|
-
action: action
|
|
2077
|
-
});
|
|
2078
|
-
|
|
2079
|
-
if (typeof target !== 'undefined') {
|
|
2080
|
-
target.postMessage(msg, '*');
|
|
2081
|
-
}
|
|
2082
|
-
};
|
|
2083
|
-
|
|
2084
2089
|
var styles$y = {"root":"Spoiler-module_root__1OfSR","header":"Spoiler-module_header__1rZUs","body":"Spoiler-module_body__Q1e_c","spoiled":"Spoiler-module_spoiled__1A5r4","footer":"Spoiler-module_footer__23mh7","spoilerSticky":"Spoiler-module_spoilerSticky__3Kd30","center":"Spoiler-module_center__tq1m0","full":"Spoiler-module_full__1QFqR","default":"Spoiler-module_default__2Kjx8","mobile":"Spoiler-module_mobile__2BPt8","desktop":"Spoiler-module_desktop__1BIFJ"};
|
|
2085
2090
|
|
|
2086
2091
|
var Spoiler = function Spoiler(_ref) {
|
|
@@ -2103,7 +2108,7 @@ var Spoiler = function Spoiler(_ref) {
|
|
|
2103
2108
|
setSpoiled(!spoiled);
|
|
2104
2109
|
|
|
2105
2110
|
if (spoiled) {
|
|
2106
|
-
postMessage
|
|
2111
|
+
postMessage('closeSpoiler', 'click');
|
|
2107
2112
|
var rect = ref.current.getBoundingClientRect();
|
|
2108
2113
|
|
|
2109
2114
|
if (rect.top < 0) {
|
|
@@ -2112,7 +2117,7 @@ var Spoiler = function Spoiler(_ref) {
|
|
|
2112
2117
|
});
|
|
2113
2118
|
}
|
|
2114
2119
|
} else {
|
|
2115
|
-
postMessage
|
|
2120
|
+
postMessage('openSpoiler', 'click');
|
|
2116
2121
|
}
|
|
2117
2122
|
};
|
|
2118
2123
|
|