@mjhls/mjh-framework 1.0.146 → 1.0.149

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # mjh-framework v. 1.0.146
2
+ # mjh-framework v. 1.0.149
3
3
 
4
4
 
5
5
 
package/dist/index.es.js CHANGED
@@ -24,6 +24,7 @@ import { SocialIcon } from 'react-social-icons';
24
24
  import Nav from 'react-bootstrap/Nav';
25
25
  import Navbar from 'react-bootstrap/Navbar';
26
26
  import NavDropdown from 'react-bootstrap/NavDropdown';
27
+ import download from 'downloadjs';
27
28
  import ReactPlayerLoader from '@brightcove/react-player-loader';
28
29
  import ReactPlayer from 'react-player';
29
30
  import Pagination from 'react-bootstrap/Pagination';
@@ -3640,8 +3641,8 @@ var ImageUrlBuilder = /** @class */ (function () {
3640
3641
  return this.withOptions({ quality: quality });
3641
3642
  };
3642
3643
  // Make it a download link. Parameter is default filename.
3643
- ImageUrlBuilder.prototype.forceDownload = function (download) {
3644
- return this.withOptions({ download: download });
3644
+ ImageUrlBuilder.prototype.forceDownload = function (download$$1) {
3645
+ return this.withOptions({ download: download$$1 });
3645
3646
  };
3646
3647
  // Flip image horizontally
3647
3648
  ImageUrlBuilder.prototype.flipHorizontal = function () {
@@ -6250,6 +6251,8 @@ var GridContent = function (_React$Component) {
6250
6251
  );
6251
6252
  }
6252
6253
  } else return null;
6254
+ }, _this.checkExternalUrl = function (url) {
6255
+ return new RegExp(['http', 'https'].join('|')).test(url);
6253
6256
  }, _this.renderMobileAd = function (index$$1, numberOfItemsBeforeAd) {
6254
6257
  var rightItems = _this.props.rightItems;
6255
6258
 
@@ -6369,10 +6372,68 @@ var GridContent = function (_React$Component) {
6369
6372
  { className: 'grid-container' },
6370
6373
  this.state.data && this.state.data.map(function (row, index$$1) {
6371
6374
  var pageNumber = row.pageNumber || _this2.state.page;
6372
- var contentCategoryName = row.contentCategory && row.contentCategory.name && _this2.mapping[row.contentCategory.name] ? row.contentCategory.name : 'Articles';
6373
- var linkHref = _this2.mapping[contentCategoryName] + '/' + row.url.current;
6374
- if (row.url && row.url.current && row.url.externalUrl) {
6375
- linkHref = row.url.current;
6375
+ var linkHref = '' + row.url.current;
6376
+ if (row.blank || _this2.checkExternalUrl(row.url.current)) {
6377
+ return React__default.createElement(
6378
+ React__default.Fragment,
6379
+ { key: itemCounter },
6380
+ React__default.createElement(
6381
+ VisibilitySensor,
6382
+ {
6383
+ onChange: function onChange(isVisible) {
6384
+ isVisible && _this2.changePageNumber(pageNumber);
6385
+ } },
6386
+ React__default.createElement(
6387
+ 'div',
6388
+ { counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
6389
+ React__default.createElement(
6390
+ Card,
6391
+ { className: 'content-card', style: { flexDirection: index$$1 === 0 || index$$1 % 4 === 0 ? 'top' : 'row' } },
6392
+ (row.thumbnail && row.thumbnail.asset || _this2.props.defaultImage) && React__default.createElement(
6393
+ 'a',
6394
+ { href: row.url.current, target: '_blank', className: index$$1 === 0 || index$$1 % 4 === 0 ? '' : 'card-image' },
6395
+ React__default.createElement(
6396
+ LazyLoad,
6397
+ { height: _this2.props.imageHeight },
6398
+ React__default.createElement(Card.Img, {
6399
+ variant: 'top',
6400
+ src: _this2.renderCardImage(row, page),
6401
+ alt: row.thumbnail && row.thumbnail.asset ? row.thumbnail.asset.originalFilename : ''
6402
+ })
6403
+ )
6404
+ ),
6405
+ React__default.createElement(
6406
+ Card.Body,
6407
+ null,
6408
+ React__default.createElement(
6409
+ 'a',
6410
+ { href: row.url.current, target: '_blank' },
6411
+ React__default.createElement(
6412
+ Card.Title,
6413
+ null,
6414
+ row.title
6415
+ )
6416
+ ),
6417
+ _this2.props.showPublished && row.published && React__default.createElement(
6418
+ Card.Subtitle,
6419
+ { style: { marginTop: 0 } },
6420
+ moment(row.published).format('MMMM DD, YYYY')
6421
+ ),
6422
+ _this2.props.showAuthor && row.authorMapping && row.authorMapping.length > 0 && row.authorMapping.map(function (authorDetail, index$$1) {
6423
+ return _this2.renderAuthor(authorDetail, index$$1, row.authorMapping.length);
6424
+ }),
6425
+ React__default.createElement(
6426
+ Card.Text,
6427
+ { className: index$$1 === 0 || index$$1 % 4 === 0 ? '' : 'card-subtext' },
6428
+ row.summary
6429
+ )
6430
+ )
6431
+ )
6432
+ )
6433
+ ),
6434
+ showVideo && (_this2.state.data.length < numberOfItemsBeforeVideo || index$$1 + 1 === numberOfItemsBeforeVideo) && React__default.createElement(VideoPlayer, null),
6435
+ main_36 && _this2.props.rightItems && (index$$1 + 1) % numberOfItemsBeforeAd === 0 && _this2.renderMobileAd(index$$1, numberOfItemsBeforeAd)
6436
+ );
6376
6437
  }
6377
6438
  return React__default.createElement(
6378
6439
  React__default.Fragment,
@@ -6394,7 +6455,7 @@ var GridContent = function (_React$Component) {
6394
6455
  { href: linkHref },
6395
6456
  React__default.createElement(
6396
6457
  'a',
6397
- { target: row.url && row.url.target ? '_blank' : '_self', className: index$$1 === 0 || index$$1 % 4 === 0 ? '' : 'card-image' },
6458
+ { className: index$$1 === 0 || index$$1 % 4 === 0 ? '' : 'card-image' },
6398
6459
  React__default.createElement(
6399
6460
  LazyLoad,
6400
6461
  { height: _this2.props.imageHeight },
@@ -6414,7 +6475,7 @@ var GridContent = function (_React$Component) {
6414
6475
  { href: linkHref },
6415
6476
  React__default.createElement(
6416
6477
  'a',
6417
- { target: row.url && row.url.target ? '_blank' : '_self' },
6478
+ null,
6418
6479
  React__default.createElement(
6419
6480
  Card.Title,
6420
6481
  null,
@@ -14064,6 +14125,19 @@ var Media$2 = function Media$$1(_ref) {
14064
14125
  )
14065
14126
  );
14066
14127
  } else if (caption && caption !== '') {
14128
+ if (uploadDoc.downloadMedia) {
14129
+ return React__default.createElement(
14130
+ 'a',
14131
+ {
14132
+ href: uploadDoc.asset.url,
14133
+ target: '_blank',
14134
+ className: 'd-block',
14135
+ onClick: function onClick() {
14136
+ download(uploadDoc.asset.url, uploadDoc.asset.originalFilename);
14137
+ } },
14138
+ caption
14139
+ );
14140
+ }
14067
14141
  return React__default.createElement(
14068
14142
  'a',
14069
14143
  { href: uploadDoc.asset.url, target: blank ? '_blank' : '_self', className: 'd-block text-center' },
@@ -14787,6 +14861,68 @@ var html_decode = function html_decode(string) {
14787
14861
  };
14788
14862
  var html_decode_1 = html_decode;
14789
14863
 
14864
+ var urlFor$3 = function urlFor(source, builder) {
14865
+ return builder.image(source);
14866
+ };
14867
+
14868
+ var onChangeSlide$1 = function onChangeSlide(selectedIndex, pageview, setCarouselIndex, asPath) {
14869
+ setCarouselIndex(selectedIndex);
14870
+ lib_3.refresh();
14871
+ if (pageview) pageview(asPath);
14872
+ };
14873
+
14874
+ var Slideshow$1 = function Slideshow(_ref) {
14875
+ var slides = _ref.node.slides,
14876
+ client = _ref.client,
14877
+ pageview = _ref.pageview,
14878
+ serializerArguments = _ref.serializerArguments;
14879
+
14880
+ console.log(slides);
14881
+ var router = useRouter();
14882
+
14883
+ var _useState = useState(0),
14884
+ _useState2 = slicedToArray(_useState, 2),
14885
+ carouselIndex = _useState2[0],
14886
+ setCarouselIndex = _useState2[1];
14887
+
14888
+ var builder = imageUrlBuilder(client);
14889
+
14890
+ return React__default.createElement(
14891
+ 'div',
14892
+ { className: 'mt-3 mb-3' },
14893
+ React__default.createElement(
14894
+ Carousel,
14895
+ { activeIndex: carouselIndex, onSelect: function onSelect(selectedIndex, e) {
14896
+ return onChangeSlide$1(selectedIndex, pageview, setCarouselIndex, router.asPath);
14897
+ }, indicators: false },
14898
+ slides && slides.map(function (slide) {
14899
+ if (slide.slideshowImage && slide.slideshowImage.asset) {
14900
+ return React__default.createElement(
14901
+ Carousel.Item,
14902
+ { key: slide._key },
14903
+ React__default.createElement(
14904
+ 'a',
14905
+ { href: slide.slideshowImage.link && slide.slideshowImage.link, target: slide.slideshowImage.blank ? '_blank' : '_self' },
14906
+ React__default.createElement('img', { src: urlFor$3(slide.slideshowImage, builder).url(), alt: slide.slideshowImage.alt || 'slideshow image', style: { width: '100%' } })
14907
+ ),
14908
+ React__default.createElement(
14909
+ 'div',
14910
+ { className: 'p-2' },
14911
+ slide.slideshowImage.caption && React__default.createElement(
14912
+ 'h3',
14913
+ null,
14914
+ slide.slideshowImage.caption
14915
+ ),
14916
+ slide.description && React__default.createElement(BlockContent, { blocks: slide.description, serializers: getSerializers$1(serializerArguments) })
14917
+ )
14918
+ );
14919
+ }
14920
+ return null;
14921
+ })
14922
+ )
14923
+ );
14924
+ };
14925
+
14790
14926
  var convertEntities = function convertEntities(props) {
14791
14927
  if (typeof props === 'string' || props instanceof String) {
14792
14928
  props = html_decode_1(props);
@@ -14882,6 +15018,11 @@ var getSerializers$1 = function getSerializers(client, pageview, videoAccountIDs
14882
15018
 
14883
15019
  var url = '' + drupalLeadSettings.baseUrl + leadID;
14884
15020
  return React__default.createElement(Leads, { url: url });
15021
+ },
15022
+ slideshows: function slideshows(_ref14) {
15023
+ var node = _ref14.node;
15024
+
15025
+ return React__default.createElement(Slideshow$1, { node: node, client: client, pageview: pageview, serializerArguments: (drupalLeadSettings) });
14885
15026
  }
14886
15027
  },
14887
15028
  marks: {
@@ -14911,32 +15052,32 @@ var getSerializers$1 = function getSerializers(client, pageview, videoAccountIDs
14911
15052
  children
14912
15053
  );
14913
15054
  },
14914
- alignleft: function alignleft(_ref14) {
14915
- var children = _ref14.children;
15055
+ alignleft: function alignleft(_ref15) {
15056
+ var children = _ref15.children;
14916
15057
  return React__default.createElement(
14917
15058
  'div',
14918
15059
  { style: { textAlign: 'left' } },
14919
15060
  children
14920
15061
  );
14921
15062
  },
14922
- alignright: function alignright(_ref15) {
14923
- var children = _ref15.children;
15063
+ alignright: function alignright(_ref16) {
15064
+ var children = _ref16.children;
14924
15065
  return React__default.createElement(
14925
15066
  'div',
14926
15067
  { style: { textAlign: 'right' } },
14927
15068
  children
14928
15069
  );
14929
15070
  },
14930
- aligncenter: function aligncenter(_ref16) {
14931
- var children = _ref16.children;
15071
+ aligncenter: function aligncenter(_ref17) {
15072
+ var children = _ref17.children;
14932
15073
  return React__default.createElement(
14933
15074
  'div',
14934
15075
  { style: { textAlign: 'center' } },
14935
15076
  children
14936
15077
  );
14937
15078
  },
14938
- alignjustify: function alignjustify(_ref17) {
14939
- var children = _ref17.children;
15079
+ alignjustify: function alignjustify(_ref18) {
15080
+ var children = _ref18.children;
14940
15081
  return React__default.createElement(
14941
15082
  'div',
14942
15083
  { style: { textAlign: 'justify' } },
@@ -15111,13 +15252,13 @@ var SetCookie = function SetCookie(key, value) {
15111
15252
  cookie.set(key, value, { expires: 1, sameSite: 'none', secure: true });
15112
15253
  };
15113
15254
 
15114
- var urlFor$3 = function urlFor(source, client) {
15255
+ var urlFor$4 = function urlFor(source, client) {
15115
15256
  var builder = imageUrlBuilder(client);
15116
15257
  return builder.image(source);
15117
15258
  };
15118
15259
 
15119
15260
  var renderCardImage$1 = function renderCardImage(thumbnail, client, imageHeight, imageWidth) {
15120
- var url = urlFor$3(thumbnail, client);
15261
+ var url = urlFor$4(thumbnail, client);
15121
15262
  if (imageHeight) url = url.height(imageHeight);
15122
15263
  if (imageWidth) url = url.width(imageWidth);
15123
15264
  return url.url();
@@ -15365,5 +15506,100 @@ var RelatedTopicsDropdown = function RelatedTopicsDropdown(_ref) {
15365
15506
  }
15366
15507
  };
15367
15508
 
15368
- export { ContentCard as DeckContent, GridContent$1 as GridContent, Queue as DeckQueue, ThumbnailCard, TaxonomyCard, GroupDeck, YoutubeGroup, QueueDeckExpanded, VideoSeriesListing$1 as VideoSeriesListing, MasterDeck$1 as MasterDeck, PublicationDeck, IssueDeck, IssueContentDeck, Column1, Column2, Column3, Header, LeftNav, AccordionPanel, SocialShare, PageFilter, NavMagazine, NavNative, NavNormal, NavDvm, TemplateNormal, AD, AD300x250, AD300x250x600, AD728x90, ADFooter, getSerializers$1 as getSerializers, Search, Feature, Breadcrumbs, SetCookie, Hero, AlphabeticList, PdfDownload, RelatedTopicsDropdown };
15509
+ // THIS FILE IS AUTO GENERATED
15510
+ var FaWindowClose = function (props) {
15511
+ return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 512 512"},"child":[{"tag":"path","attr":{"d":"M464 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h416c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-83.6 290.5c4.8 4.8 4.8 12.6 0 17.4l-40.5 40.5c-4.8 4.8-12.6 4.8-17.4 0L256 313.3l-66.5 67.1c-4.8 4.8-12.6 4.8-17.4 0l-40.5-40.5c-4.8-4.8-4.8-12.6 0-17.4l67.1-66.5-67.1-66.5c-4.8-4.8-4.8-12.6 0-17.4l40.5-40.5c4.8-4.8 12.6-4.8 17.4 0l66.5 67.1 66.5-67.1c4.8-4.8 12.6-4.8 17.4 0l40.5 40.5c4.8 4.8 4.8 12.6 0 17.4L313.3 256l67.1 66.5z"}}]})(props);
15512
+ };
15513
+ FaWindowClose.displayName = "FaWindowClose";
15514
+
15515
+ /*****UStream Component*****/
15516
+ /*
15517
+
15518
+ Width and Height(percent or px) prop passed is the floating window, when closed
15519
+ it will take 100% of its parent element
15520
+
15521
+ You can pass in another SRC for Ustream if needed
15522
+
15523
+ If 'close' is passed as prop, the floating window will be removed
15524
+ from DOM once close button is hit
15525
+
15526
+ Example:
15527
+ import { Ustream } from '@mjhls/mjh-framework';
15528
+ <Ustream width={'200px'} height={'120px'} close />
15529
+
15530
+ */
15531
+ /************************* */
15532
+ var Ustream = function Ustream(_ref) {
15533
+ var _ref$width = _ref.width,
15534
+ width = _ref$width === undefined ? '300px' : _ref$width,
15535
+ _ref$height = _ref.height,
15536
+ height = _ref$height === undefined ? '168px' : _ref$height,
15537
+ _ref$close = _ref.close,
15538
+ close = _ref$close === undefined ? false : _ref$close,
15539
+ _ref$src = _ref.src,
15540
+ src = _ref$src === undefined ? 'https://video.ibm.com/embed/23627444?volume=0&autoplay=true' : _ref$src;
15541
+
15542
+ var _useState = useState(width),
15543
+ _useState2 = slicedToArray(_useState, 2),
15544
+ currentWidth = _useState2[0],
15545
+ setWidth = _useState2[1];
15546
+
15547
+ var _useState3 = useState(height),
15548
+ _useState4 = slicedToArray(_useState3, 2),
15549
+ currentHeight = _useState4[0],
15550
+ setHeight = _useState4[1];
15551
+
15552
+ var ustreamContainer = useRef(null);
15553
+
15554
+ useEffect(function () {
15555
+ try {
15556
+ document.querySelector('.ustream-close').addEventListener('click', function (e) {
15557
+ var container = document.getElementById('ustream-container');
15558
+ if (close) {
15559
+ container.remove();
15560
+ } else {
15561
+ container.style.position = 'static';
15562
+ container.style.padding = '0 1rem';
15563
+ container.classList.add('closed');
15564
+ setWidth('100%');
15565
+ //aspect ratio
15566
+ var newHeight = 9 / 16 * ustreamContainer.current.clientWidth;
15567
+ console.log(newHeight);
15568
+ console.log(ustreamContainer);
15569
+ setHeight(newHeight);
15570
+ e.target.remove();
15571
+ }
15572
+ });
15573
+ } catch (err) {}
15574
+ }, []);
15575
+
15576
+ return React__default.createElement(
15577
+ 'div',
15578
+ { id: 'ustream-container', ref: ustreamContainer, style: { width: '' + currentWidth, marginBottom: '1rem' } },
15579
+ React__default.createElement(
15580
+ 'div',
15581
+ { style: { position: 'relative' } },
15582
+ React__default.createElement(
15583
+ 'div',
15584
+ { className: 'ustream-close' },
15585
+ React__default.createElement(FaWindowClose, { style: { fontSize: '1.3rem' } })
15586
+ ),
15587
+ React__default.createElement('iframe', {
15588
+ id: 'ustream-iframe',
15589
+ src: src,
15590
+ webkitallowfullscreen: true,
15591
+ allowFullScreen: true,
15592
+ frameBorder: 'no',
15593
+
15594
+ style: { maxWidth: '100%', height: currentHeight, width: currentWidth } })
15595
+ ),
15596
+ React__default.createElement(
15597
+ 'style',
15598
+ { jsx: 'true' },
15599
+ '\n #ustream-container {\n position: fixed;\n bottom: 0;\n right: 1rem;\n z-index: 999;\n max-width: 100%;\n }\n .ustream-close {\n position: absolute;\n color: white;\n right: 0.5rem;\n top: 0.25rem;\n cursor: pointer;\n font-weight: bold;\n }\n @media screen and (max-width: 768px) {\n #ustream-container:not(.closed) {\n width: 231px !important;\n height: 130px !important;\n }\n #ustream-container:not(.closed) iframe {\n height: 130px !important;\n }\n }\n '
15600
+ )
15601
+ );
15602
+ };
15603
+
15604
+ export { ContentCard as DeckContent, GridContent$1 as GridContent, Queue as DeckQueue, ThumbnailCard, TaxonomyCard, GroupDeck, YoutubeGroup, QueueDeckExpanded, VideoSeriesListing$1 as VideoSeriesListing, MasterDeck$1 as MasterDeck, PublicationDeck, IssueDeck, IssueContentDeck, Column1, Column2, Column3, Header, LeftNav, AccordionPanel, SocialShare, PageFilter, NavMagazine, NavNative, NavNormal, NavDvm, TemplateNormal, AD, AD300x250, AD300x250x600, AD728x90, ADFooter, getSerializers$1 as getSerializers, Search, Feature, Breadcrumbs, SetCookie, Hero, AlphabeticList, PdfDownload, RelatedTopicsDropdown, Ustream };
15369
15605
  //# sourceMappingURL=index.es.js.map