@meduza/ui-kit-2 0.1.4 → 0.1.6

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,8 +1,8 @@
1
1
  import { OptimizedImageItem } from '../Image/Image.types';
2
2
  export interface PopoverData {
3
- title: string;
4
- body: string;
5
- id: string;
3
+ title?: string;
4
+ body?: string;
5
+ id?: string;
6
6
  show: boolean;
7
7
  }
8
8
  export interface SingleDot {
@@ -481,7 +481,7 @@ var Image = function Image(_ref) {
481
481
  })));
482
482
  };
483
483
 
484
- var styles$5 = {"root":"DotsOnImage-module_root__2XP3Q","dot":"DotsOnImage-module_dot__H1wua","popover":"DotsOnImage-module_popover__35Cpj","popoverTitle":"DotsOnImage-module_popoverTitle__343d8"};
484
+ var styles$5 = {"root":"DotsOnImage-module_root__2XP3Q","dot":"DotsOnImage-module_dot__H1wua","popover":"DotsOnImage-module_popover__35Cpj","popoverTitle":"DotsOnImage-module_popoverTitle__343d8","dismiss":"DotsOnImage-module_dismiss__1EWXd"};
485
485
 
486
486
  var DotsOnImage = function DotsOnImage(_ref) {
487
487
  var _ref$block = _ref.block,
@@ -545,7 +545,18 @@ var DotsOnImage = function DotsOnImage(_ref) {
545
545
  display: display
546
546
  })), popover.show && React__default.createElement("div", {
547
547
  className: styles$5.popover
548
- }, React__default.createElement("div", {
548
+ }, React__default.createElement("button", {
549
+ className: styles$5.dismiss,
550
+ type: "button",
551
+ onClick: function onClick() {
552
+ return setPopover({
553
+ show: false
554
+ });
555
+ }
556
+ }, React__default.createElement(SvgSymbol, {
557
+ icon: "cross",
558
+ size: "unset"
559
+ })), React__default.createElement("div", {
549
560
  className: styles$5.popoverTitle
550
561
  }, popover.title), React__default.createElement("div", {
551
562
  className: styles$5.popoverBody,
@@ -995,7 +1006,7 @@ var DangerousHTML = function DangerousHTML(_ref) {
995
1006
  });
996
1007
  };
997
1008
 
998
- 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","youtube":"EmbedBlock-module_youtube__3gGQ5","vimeo":"EmbedBlock-module_vimeo__kpH1s","onetv":"EmbedBlock-module_onetv__3o33d","coub":"EmbedBlock-module_coub__38Mva","facebook_video":"EmbedBlock-module_facebook_video__1_M05","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"};
1009
+ 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"};
999
1010
 
1000
1011
  var EmbedGif = function EmbedGif(_ref) {
1001
1012
  var gif = _ref.gif,
@@ -1084,6 +1095,11 @@ var EmbedBlock = function EmbedBlock(_ref) {
1084
1095
  isPopoverShown = _useState[0],
1085
1096
  setIsPopoverShown = _useState[1];
1086
1097
 
1098
+ var style = {};
1099
+ var isProportional = block.data.height && block.data.width;
1100
+ var fullWidthProviders = ['youtube', 'vimeo', 'onetv', 'coub', 'facebook_video'];
1101
+ var mobileFullwidth = fullWidthProviders.indexOf(provider) || block.type === 'dots_on_image';
1102
+
1087
1103
  var renderCC = function renderCC(context) {
1088
1104
  return React__default.createElement(MediaCaption, {
1089
1105
  credit: data.credit,
@@ -1132,9 +1148,11 @@ var EmbedBlock = function EmbedBlock(_ref) {
1132
1148
 
1133
1149
  case 'dots_on_image':
1134
1150
  {
1135
- return React__default.createElement(DotsOnImage, {
1151
+ return React__default.createElement("div", {
1152
+ className: styles$h.figure
1153
+ }, React__default.createElement(DotsOnImage, {
1136
1154
  block: data
1137
- });
1155
+ }));
1138
1156
  }
1139
1157
 
1140
1158
  default:
@@ -1152,25 +1170,23 @@ var EmbedBlock = function EmbedBlock(_ref) {
1152
1170
  }
1153
1171
  };
1154
1172
 
1155
- var style = {}; // @TODO: Разобраться зачем это было нужно
1156
- // const className = Object.keys(styleContext)
1157
- // .filter(key => key.startsWith('isIn') && styles[key])
1158
- // .reduce((acc, key) => {
1159
- // acc.push([styles[key], true])
1160
- // return acc
1161
- // }, [])
1162
-
1163
- var isProportional = block.data.height && block.data.width;
1164
-
1165
1173
  if (isProportional) {
1166
1174
  style.paddingBottom = block.data.height / block.data.width * 100 + "%";
1167
1175
  style.height = 0;
1168
1176
  }
1169
1177
 
1170
- var classNames = [[styles$h.root, true], [styles$h.cc, cc], [styles$h[display], !!display && styles$h[display]], [styles$h[provider], !!provider && !!styles$h[provider]], [styles$h[onlyOn], !!onlyOn && styles$h[onlyOn]], [styles$h.proportional, isProportional && !!styles$h.proportional]];
1178
+ var classNames = [[styles$h.root, true], [styles$h.cc, cc], [styles$h[display], !!display && styles$h[display]], [styles$h[provider], !!provider && !!styles$h[provider]], [styles$h[onlyOn], !!onlyOn && styles$h[onlyOn]], [styles$h.mobileFullwidth, mobileFullwidth], [styles$h.proportional, isProportional]]; // Убираем из контекста все, что не начинается с приставки isIn,
1179
+ // чтобы не применились лишние модификаторы
1180
+ // TODO: в w6 модификаторы должны передаваться явно
1171
1181
 
1172
1182
  if (styleContext) {
1173
- classNames = makeStyleContext(classNames, styleContext, styles$h);
1183
+ var filteredContext = Object.keys(styleContext).filter(function (key) {
1184
+ return key.startsWith('isIn') && styles$h[key];
1185
+ }).reduce(function (acc, key) {
1186
+ acc.push([styles$h[key], true]);
1187
+ return acc;
1188
+ }, []);
1189
+ classNames = makeStyleContext(classNames, filteredContext, styles$h);
1174
1190
  }
1175
1191
 
1176
1192
  return React__default.createElement("figure", {
@@ -2159,10 +2175,12 @@ var RawHtmlBlock = function RawHtmlBlock(_ref) {
2159
2175
 
2160
2176
  case 'spoiler':
2161
2177
  {
2162
- return React__default.createElement(Spoiler, {
2178
+ return React__default.createElement(BlockProvider, {
2179
+ value: context
2180
+ }, React__default.createElement(Spoiler, {
2163
2181
  block: block,
2164
2182
  styleContext: styleContext
2165
- });
2183
+ }));
2166
2184
  }
2167
2185
 
2168
2186
  case 'cover':