@mjhls/mjh-framework 1.0.142 → 1.0.143

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.142
2
+ # mjh-framework v. 1.0.143
3
3
 
4
4
 
5
5
 
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import React__default, { Component, useState, useEffect, useRef, createContext, createElement } from 'react';
1
+ import React__default, { Component, useState, useEffect, useRef, createElement, createContext } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import reactDom from 'react-dom';
4
4
  import Container from 'react-bootstrap/Container';
@@ -6331,13 +6331,13 @@ var GridContent = function (_React$Component) {
6331
6331
  Card.Body,
6332
6332
  { style: { padding: '20px' } },
6333
6333
  React__default.createElement(
6334
- Link,
6335
- { href: _this2.page + '/[url]', as: _this2.page + '/' + get_1(row, 'url.current') },
6334
+ Card.Title,
6335
+ null,
6336
6336
  React__default.createElement(
6337
- 'a',
6338
- null,
6337
+ Link,
6338
+ { href: _this2.page + '/[url]', as: _this2.page + '/' + get_1(row, 'url.current') },
6339
6339
  React__default.createElement(
6340
- Card.Title,
6340
+ 'a',
6341
6341
  null,
6342
6342
  row.title
6343
6343
  )
@@ -6394,7 +6394,7 @@ var GridContent = function (_React$Component) {
6394
6394
  { href: linkHref },
6395
6395
  React__default.createElement(
6396
6396
  'a',
6397
- { className: index$$1 === 0 || index$$1 % 4 === 0 ? '' : 'card-image' },
6397
+ { target: row.url && row.url.target ? '_blank' : '_self', className: index$$1 === 0 || index$$1 % 4 === 0 ? '' : 'card-image' },
6398
6398
  React__default.createElement(
6399
6399
  LazyLoad,
6400
6400
  { height: _this2.props.imageHeight },
@@ -6414,7 +6414,7 @@ var GridContent = function (_React$Component) {
6414
6414
  { href: linkHref },
6415
6415
  React__default.createElement(
6416
6416
  'a',
6417
- null,
6417
+ { target: row.url && row.url.target ? '_blank' : '_self' },
6418
6418
  React__default.createElement(
6419
6419
  Card.Title,
6420
6420
  null,
@@ -6741,11 +6741,11 @@ var DeckQueue = function (_React$Component) {
6741
6741
  Card.Body,
6742
6742
  { style: { padding: '20px' } },
6743
6743
  row.title && React__default.createElement(
6744
- Link,
6745
- { href: _this2.page + '/[url]', as: _this2.page + '/' + get_1(row, 'url.current') },
6744
+ Card.Title,
6745
+ null,
6746
6746
  React__default.createElement(
6747
- Card.Title,
6748
- null,
6747
+ Link,
6748
+ { href: _this2.page + '/[url]', as: _this2.page + '/' + get_1(row, 'url.current') },
6749
6749
  row.title
6750
6750
  )
6751
6751
  ),
@@ -6765,11 +6765,11 @@ var DeckQueue = function (_React$Component) {
6765
6765
  )
6766
6766
  ),
6767
6767
  row.summary && React__default.createElement(
6768
- Link,
6769
- { href: _this2.page + '/[url]', as: _this2.page + '/' + get_1(row, 'url.current') },
6768
+ Card.Text,
6769
+ null,
6770
6770
  React__default.createElement(
6771
- Card.Text,
6772
- null,
6771
+ Link,
6772
+ { href: _this2.page + '/[url]', as: _this2.page + '/' + get_1(row, 'url.current') },
6773
6773
  row.summary
6774
6774
  )
6775
6775
  )
@@ -7534,6 +7534,7 @@ var cardLoader = function cardLoader(data, builder, mapping, values, seoPaginate
7534
7534
  Media$1,
7535
7535
  {
7536
7536
  key: article._id ? article._id : index$$1,
7537
+ className: article._type == 'feature' ? 'feature-media' : '',
7537
7538
  style: { flexDirection: article._type == 'feature' ? 'column' : 'row', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
7538
7539
  (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
7539
7540
  Link,
@@ -7604,7 +7605,7 @@ var cardLoader = function cardLoader(data, builder, mapping, values, seoPaginate
7604
7605
  React__default.createElement(
7605
7606
  'style',
7606
7607
  { jsx: 'true' },
7607
- '\n .img-wrapper img {\n max-height: 240px;\n height: auto;\n width: 100%;\n object-fit: contain;\n }\n .feature-wrapper {\n width: 100%;\n }\n .feature-wrapper img {\n width: 100%;\n margin-bottom: 1em;\n }\n @media only screen and (min-width: 768px) {\n \n .img-wrapper > img {\n padding-right: 1em;\n }\n }\n @media only screen and (max-width: 767px) {\n .img-wrapper {\n width: 100%;\n }\n .img-wrapper img {\n padding-bottom: 1em;\n }\n .media {\n flex-direction: column;\n }\n }\n '
7608
+ '\n .feature-media > .media-body {\n -webkit-box-flex: none;\n -ms-flex: none;\n flex: none;\n }\n .img-wrapper img {\n max-height: 240px;\n height: auto;\n width: 100%;\n object-fit: contain;\n }\n .feature-wrapper {\n width: 100%;\n }\n .feature-wrapper img {\n width: 100%;\n margin-bottom: 1em;\n }\n @media only screen and (min-width: 768px) {\n .img-wrapper > img {\n padding-right: 1em;\n }\n }\n @media only screen and (max-width: 767px) {\n .img-wrapper {\n width: 100%;\n }\n .img-wrapper img {\n padding-bottom: 1em;\n }\n .media {\n flex-direction: column;\n }\n }\n '
7608
7609
  )
7609
7610
  );
7610
7611
  };
@@ -10301,8 +10302,8 @@ var FigureComponent = function FigureComponent(_ref) {
10301
10302
 
10302
10303
  var _useState = useState(null),
10303
10304
  _useState2 = slicedToArray(_useState, 2),
10304
- captionWidth = _useState2[0],
10305
- setcaptionWidth = _useState2[1];
10305
+ imageWidth = _useState2[0],
10306
+ setimageWidth = _useState2[1];
10306
10307
 
10307
10308
  var _useState3 = useState(''),
10308
10309
  _useState4 = slicedToArray(_useState3, 2),
@@ -10313,65 +10314,68 @@ var FigureComponent = function FigureComponent(_ref) {
10313
10314
  alt = node$$1.alt,
10314
10315
  blank = node$$1.blank,
10315
10316
  link = node$$1.link,
10316
- widthP = node$$1.widthP,
10317
+ _node$widthP = node$$1.widthP,
10318
+ widthP = _node$widthP === undefined ? 'auto' : _node$widthP,
10317
10319
  _node$alignment = node$$1.alignment,
10318
10320
  alignment = _node$alignment === undefined ? 'center' : _node$alignment;
10319
10321
 
10320
- var imgWidth = widthP ? widthP + '%' : '100%';
10321
10322
 
10322
10323
  var figureMargin = void 0;
10323
10324
  if (imgFloat === 'none') {
10324
10325
  figureMargin = '0 auto 1rem';
10325
10326
  }
10326
10327
  if (imgFloat === 'left') {
10327
- figureMargin = '0 10% 1rem 1rem';
10328
+ figureMargin = '0 1.5rem 1.5rem 10%';
10328
10329
  }
10329
10330
  if (imgFloat === 'right') {
10330
- figureMargin = '0 1rem 1rem 10%';
10331
+ figureMargin = '0 10% 1.5rem 1.5rem';
10331
10332
  }
10332
10333
 
10333
10334
  var loadImg = function loadImg() {
10334
- setcaptionWidth(imgElement.current.width);
10335
+ if (widthP == 'auto') {
10336
+ setimageWidth(imgElement.current.naturalWidth);
10337
+ } else {
10338
+ setimageWidth(widthP + '%');
10339
+ }
10335
10340
  };
10336
10341
 
10342
+ useEffect(function () {
10343
+ if (widthP == 'auto') {
10344
+ setimageWidth(imgElement.current.naturalWidth + 'px');
10345
+ } else {
10346
+ setimageWidth(widthP + '%');
10347
+ }
10348
+ }, [imageWidth]);
10349
+
10337
10350
  useEffect(function () {
10338
10351
  var screenWidth = window.innerWidth;
10339
10352
  if (screenWidth > 1000) {
10340
10353
  var align = alignment.toLowerCase() === 'center' ? 'none' : alignment.toLowerCase();
10341
10354
  setimgFloat(align);
10342
10355
  }
10356
+
10343
10357
  // eslint-disable-next-line react-hooks/exhaustive-deps
10344
10358
  }, []);
10345
10359
 
10346
10360
  return React__default.createElement(
10347
10361
  Figure,
10348
- { className: 'd-block text-center mb-3', style: { width: imgWidth, float: imgFloat, clear: 'both', margin: figureMargin } },
10362
+ { className: 'd-block text-center mb-3', style: { width: imageWidth, float: imgFloat, clear: 'both', margin: figureMargin, maxWidth: '100%' } },
10349
10363
  link ? React__default.createElement(
10350
10364
  'a',
10351
10365
  { href: link, target: blank ? '_blank' : '_self' },
10352
- React__default.createElement(Figure.Image, {
10353
- ref: imgElement,
10354
- onLoad: loadImg,
10355
- src: urlFor$1(node$$1, client).url(),
10356
- alt: alt && alt
10357
- }),
10366
+ React__default.createElement(Figure.Image, { style: { width: '100%' }, className: 'figure-image', ref: imgElement, onLoad: loadImg, src: urlFor$1(node$$1, client).url(), alt: alt && alt }),
10358
10367
  caption && React__default.createElement(
10359
10368
  Figure.Caption,
10360
- { style: { width: captionWidth } },
10369
+ { style: { width: '100%', maxWidth: '100%' } },
10361
10370
  caption
10362
10371
  )
10363
10372
  ) : React__default.createElement(
10364
10373
  React__default.Fragment,
10365
10374
  null,
10366
- React__default.createElement(Figure.Image, {
10367
- ref: imgElement,
10368
- onLoad: loadImg,
10369
- src: urlFor$1(node$$1, client).url(),
10370
- alt: alt && alt
10371
- }),
10375
+ React__default.createElement(Figure.Image, { style: { width: '100%' }, className: 'figure-image', ref: imgElement, onLoad: loadImg, src: urlFor$1(node$$1, client).url(), alt: alt && alt }),
10372
10376
  caption && React__default.createElement(
10373
10377
  Figure.Caption,
10374
- { style: { width: captionWidth } },
10378
+ { style: { width: '100%', maxWidth: '100%' } },
10375
10379
  caption
10376
10380
  )
10377
10381
  )
@@ -14033,7 +14037,22 @@ var Media$2 = function Media$$1(_ref) {
14033
14037
 
14034
14038
  var renderFigure = function renderFigure(uploadDoc, poster, blank, caption) {
14035
14039
  if (uploadDoc && uploadDoc.asset) {
14036
- if (poster && poster.asset) {
14040
+ if (poster && poster.asset && caption && caption !== '') {
14041
+ return React__default.createElement(
14042
+ Figure,
14043
+ { className: 'mb-3' },
14044
+ React__default.createElement(
14045
+ 'a',
14046
+ { href: uploadDoc.asset.url, target: blank ? '_blank' : '_self' },
14047
+ React__default.createElement(Figure.Image, { src: urlFor(poster).url(), fluid: true }),
14048
+ React__default.createElement(
14049
+ Figure.Caption,
14050
+ { className: 'text-center' },
14051
+ caption
14052
+ )
14053
+ )
14054
+ );
14055
+ } else if (poster && poster.asset) {
14037
14056
  return React__default.createElement(
14038
14057
  Figure,
14039
14058
  { className: 'mb-3' },
@@ -14076,11 +14095,27 @@ var Video = function Video(_ref) {
14076
14095
  var node = _ref.node,
14077
14096
  accountIDs = _ref.accountIDs;
14078
14097
  var source = node.source,
14079
- videoID = node.videoID;
14098
+ videoID = node.videoID,
14099
+ experienceID = node.experienceID;
14080
14100
 
14081
14101
  if (source === 'brightcove' && accountIDs.brightcove) {
14082
- return React__default.createElement(ReactPlayerLoader, { accountId: accountIDs.brightcove.accountId, videoId: videoID, playerId: accountIDs.brightcove.playerId, attrs: { className: 'brightcove' } });
14102
+ if (videoID) {
14103
+ return React__default.createElement(ReactPlayerLoader, { accountId: accountIDs.brightcove.accountId, videoId: videoID, playerId: accountIDs.brightcove.playerId, attrs: { className: 'brightcove' } });
14104
+ } else if (experienceID) {
14105
+ return React__default.createElement('iframe', {
14106
+ src: 'https://players.brightcove.net/' + accountIDs.brightcove.accountId + '/experience_' + experienceID + '/index.html',
14107
+ allowFullScreen: 'true',
14108
+ webkitallowfullscreen: 'true',
14109
+ mozallowfullscreen: 'true',
14110
+ frameBorder: 'none',
14111
+ scrolling: 'no',
14112
+ height: '411',
14113
+ width: '100%'
14114
+ });
14115
+ }
14116
+ return null;
14083
14117
  }
14118
+
14084
14119
  // TODO - add players for other video types
14085
14120
  return null;
14086
14121
  };