@mjhls/mjh-framework 1.0.310 → 1.0.312

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.310
2
+ # mjh-framework v. 1.0.312
3
3
 
4
4
  > Foundation Framework
5
5
 
@@ -18,7 +18,7 @@ var Router = require('next/router');
18
18
  var Router__default = _interopDefault(Router);
19
19
  require('react-dom');
20
20
  require('./index-fa0fb52c.js');
21
- var YoutubeGroup = require('./YoutubeGroup-44b6c266.js');
21
+ var YoutubeGroup = require('./YoutubeGroup-93aa7a6c.js');
22
22
  var index_esm = require('./index.esm-340d3792.js');
23
23
 
24
24
  var VideoSeriesListing = function (_React$Component) {
@@ -499,6 +499,7 @@ GROQ query -
499
499
  */
500
500
  var YoutubeGroup = function YoutubeGroup(props) {
501
501
  // Props should be an array of objects containing Thumbnail, title, and URL
502
+ var innerSlider = React.useRef(null);
502
503
 
503
504
  React.useEffect(function () {
504
505
  //IE11 Polyfill
@@ -510,27 +511,33 @@ var YoutubeGroup = function YoutubeGroup(props) {
510
511
  function scrollSlider(e, direction) {
511
512
  var slide = e.target.parentElement;
512
513
  var scrollOffset = slide.scrollLeft;
513
- var viewableWidth = slide.clientWidth > 700 ? 3 * (document.querySelector('.tile').scrollWidth + 8) : document.querySelector('.tile').scrollWidth + 8;
514
+ var viewableWidth = slide.clientWidth;
514
515
  var scrollDirection = void 0;
516
+
515
517
  if (direction === 'next') {
516
518
  scrollDirection = scrollOffset + viewableWidth;
519
+
520
+ if (scrollDirection > innerSlider.current.offsetWidth) {
521
+ scrollDirection = 0;
522
+ }
517
523
  }
518
524
  if (direction === 'prev') {
519
525
  scrollDirection = scrollOffset - viewableWidth;
520
- }
521
526
 
522
- if (slide.clientWidth <= scrollDirection) {
523
- scrollDirection = 0;
527
+ if (scrollOffset === 0) {
528
+ scrollDirection = innerSlider.current.offsetWidth;
529
+ }
524
530
  }
525
-
526
531
  slide.scrollTo({
527
532
  left: scrollDirection,
528
533
  behavior: 'smooth'
529
534
  });
530
535
  }
536
+
531
537
  function handleClick(url, vidIndex) {
532
538
  props.setState(url, vidIndex);
533
539
  }
540
+
534
541
  var _props$current = props.current,
535
542
  current = _props$current === undefined ? '' : _props$current;
536
543
 
@@ -557,7 +564,7 @@ var YoutubeGroup = function YoutubeGroup(props) {
557
564
  ),
558
565
  React__default.createElement(
559
566
  'div',
560
- { className: 'row__inner' },
567
+ { ref: innerSlider, className: 'row__inner' },
561
568
  props.dataset && props.dataset.map(function (video, index) {
562
569
  // If there is a current prop, means this will overlay a currently playing video
563
570
  if (current !== '') {
@@ -6,7 +6,7 @@ require('prop-types');
6
6
  require('next/link');
7
7
  require('react-dom');
8
8
  require('./index-fa0fb52c.js');
9
- var YoutubeGroup = require('./YoutubeGroup-44b6c266.js');
9
+ var YoutubeGroup = require('./YoutubeGroup-93aa7a6c.js');
10
10
 
11
11
 
12
12
 
package/dist/cjs/index.js CHANGED
@@ -41,7 +41,7 @@ var ThumbnailCard = require('./ThumbnailCard.js');
41
41
  var TaxonomyCard = require('./TaxonomyCard-a8a64f98.js');
42
42
  require('./react-social-icons-cd0d9d3b.js');
43
43
  var GroupDeck = require('./GroupDeck.js');
44
- var YoutubeGroup = require('./YoutubeGroup-44b6c266.js');
44
+ var YoutubeGroup = require('./YoutubeGroup-93aa7a6c.js');
45
45
  var reactBootstrap = require('react-bootstrap');
46
46
  var QueueDeckExpanded = require('./QueueDeckExpanded.js');
47
47
  var index_esm = require('./index.esm-340d3792.js');
@@ -16170,6 +16170,21 @@ var renderAuthor = function renderAuthor(authorName, authorURL, index, length) {
16170
16170
  }
16171
16171
  };
16172
16172
 
16173
+ var get_content_placement_url = function get_content_placement_url(cp) {
16174
+ var cp_url = '';
16175
+ if (cp.ancestor && typeof cp.ancestor === 'string') {
16176
+ cp_url += (cp_url === '' ? '' : '/') + cp.ancestor;
16177
+ }
16178
+
16179
+ if (!cp.ancestor && cp.parent && typeof cp.parent === 'string') {
16180
+ console.log('cp.parent:', cp.parent);
16181
+ cp_url += (cp_url === '' ? '' : '/') + cp.parent;
16182
+ }
16183
+
16184
+ cp_url += (cp_url === '' ? '' : '/') + cp.path;
16185
+ return cp_url;
16186
+ };
16187
+
16173
16188
  var Article = function Article(props) {
16174
16189
  var client = props.client,
16175
16190
  pageview = props.pageview,
@@ -16193,7 +16208,8 @@ var Article = function Article(props) {
16193
16208
  nationalPage = props.nationalPage,
16194
16209
  ISIContent = props.ISIContent,
16195
16210
  changeUrl = props.changeUrl,
16196
- shareOptions = props.shareOptions;
16211
+ shareOptions = props.shareOptions,
16212
+ cpModificationRequired = props.cpModificationRequired;
16197
16213
 
16198
16214
 
16199
16215
  var urlFor = function urlFor(source) {
@@ -16232,6 +16248,7 @@ var Article = function Article(props) {
16232
16248
  var shareSummary = summary;
16233
16249
  var shareImage = thumbnail && thumbnail.asset ? urlFor(thumbnail.asset).url() : shareImageDefault;
16234
16250
  var siteName = props.website.title;
16251
+
16235
16252
  return React__default.createElement(
16236
16253
  React__default.Fragment,
16237
16254
  null,
@@ -16322,7 +16339,10 @@ var Article = function Article(props) {
16322
16339
  Dropdown.Menu,
16323
16340
  null,
16324
16341
  content_placement.length > 0 ? content_placement.map(function (cp, index) {
16325
- var href = '/' + cp.path;
16342
+ var cp_url = cpModificationRequired ? get_content_placement_url(cp) : cp.path;
16343
+ var href = '/' + cp_url;
16344
+ console.log('cp:', cp);
16345
+ console.log('href:', href);
16326
16346
  return React__default.createElement(
16327
16347
  Dropdown.Item,
16328
16348
  { key: index, href: href },
@@ -16382,7 +16402,9 @@ var ArticleQueue = function ArticleQueue(props) {
16382
16402
  _props$sponsoredTaxon = props.sponsoredTaxonomies,
16383
16403
  sponsoredTaxonomies = _props$sponsoredTaxon === undefined ? [] : _props$sponsoredTaxon,
16384
16404
  _props$maxListLength = props.maxListLength,
16385
- maxListLength = _props$maxListLength === undefined ? 10 : _props$maxListLength;
16405
+ maxListLength = _props$maxListLength === undefined ? 10 : _props$maxListLength,
16406
+ _props$cpModification = props.cpModificationRequired,
16407
+ cpModificationRequired = _props$cpModification === undefined ? false : _props$cpModification;
16386
16408
 
16387
16409
  var _useState = React.useState(''),
16388
16410
  _useState2 = slicedToArray._slicedToArray(_useState, 2),
@@ -16462,8 +16484,13 @@ var ArticleQueue = function ArticleQueue(props) {
16462
16484
  var content_placement_urls = [];
16463
16485
  if (content_placement && prevUrl && prevUrl.length) {
16464
16486
  content_placement.forEach(function (item) {
16465
- if (includes_1(prevUrl, item.path)) {
16466
- content_placement_urls.push(item.path);
16487
+ var path = item.path;
16488
+ if (cpModificationRequired) {
16489
+ path = get_content_placement_url(item);
16490
+ }
16491
+
16492
+ if (includes_1(prevUrl, path)) {
16493
+ content_placement_urls.push(path);
16467
16494
  }
16468
16495
  });
16469
16496
  }
@@ -16471,7 +16498,7 @@ var ArticleQueue = function ArticleQueue(props) {
16471
16498
  if (content_placement) {
16472
16499
  if (content_placement_urls.length === 0) {
16473
16500
  content_placement_urls = content_placement.map(function (item) {
16474
- return item.path;
16501
+ return cpModificationRequired ? get_content_placement_url(item) : item.path;
16475
16502
  });
16476
16503
  }
16477
16504
  } else {
@@ -16644,7 +16671,7 @@ var ArticleQueue = function ArticleQueue(props) {
16644
16671
  visibilitySensor.InfiniteScroll,
16645
16672
  { dataLength: queueData.length, next: loadmore, scrollThreshold: 0.8, hasMore: true },
16646
16673
  queueData.map(function (article, index) {
16647
- return React__default.createElement(Article, _extends$2._extends({ key: index }, props, { changeUrl: changeUrl, article: article }));
16674
+ return React__default.createElement(Article, _extends$2._extends({ key: index }, props, { changeUrl: changeUrl, article: article, cpModificationRequired: cpModificationRequired }));
16648
16675
  })
16649
16676
  );
16650
16677
  } else {
@@ -12,7 +12,7 @@ import 'next/link';
12
12
  import { withRouter } from 'next/router';
13
13
  import 'react-dom';
14
14
  import './index-5f9f807a.js';
15
- import { Y as YoutubeGroup } from './YoutubeGroup-a3ea5e8e.js';
15
+ import { Y as YoutubeGroup } from './YoutubeGroup-e7e16d0e.js';
16
16
  import { a as IoIosArrowForward } from './index.esm-536609db.js';
17
17
 
18
18
  var VideoSeriesListing = function (_React$Component) {
@@ -1,5 +1,5 @@
1
1
  import { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpers-0c4b6f40.js';
2
- import React__default, { useEffect } from 'react';
2
+ import React__default, { useRef, useEffect } from 'react';
3
3
  import 'next/link';
4
4
  import { L as LazyLoad } from './index-5f9f807a.js';
5
5
 
@@ -494,6 +494,7 @@ GROQ query -
494
494
  */
495
495
  var YoutubeGroup = function YoutubeGroup(props) {
496
496
  // Props should be an array of objects containing Thumbnail, title, and URL
497
+ var innerSlider = useRef(null);
497
498
 
498
499
  useEffect(function () {
499
500
  //IE11 Polyfill
@@ -505,27 +506,33 @@ var YoutubeGroup = function YoutubeGroup(props) {
505
506
  function scrollSlider(e, direction) {
506
507
  var slide = e.target.parentElement;
507
508
  var scrollOffset = slide.scrollLeft;
508
- var viewableWidth = slide.clientWidth > 700 ? 3 * (document.querySelector('.tile').scrollWidth + 8) : document.querySelector('.tile').scrollWidth + 8;
509
+ var viewableWidth = slide.clientWidth;
509
510
  var scrollDirection = void 0;
511
+
510
512
  if (direction === 'next') {
511
513
  scrollDirection = scrollOffset + viewableWidth;
514
+
515
+ if (scrollDirection > innerSlider.current.offsetWidth) {
516
+ scrollDirection = 0;
517
+ }
512
518
  }
513
519
  if (direction === 'prev') {
514
520
  scrollDirection = scrollOffset - viewableWidth;
515
- }
516
521
 
517
- if (slide.clientWidth <= scrollDirection) {
518
- scrollDirection = 0;
522
+ if (scrollOffset === 0) {
523
+ scrollDirection = innerSlider.current.offsetWidth;
524
+ }
519
525
  }
520
-
521
526
  slide.scrollTo({
522
527
  left: scrollDirection,
523
528
  behavior: 'smooth'
524
529
  });
525
530
  }
531
+
526
532
  function handleClick(url, vidIndex) {
527
533
  props.setState(url, vidIndex);
528
534
  }
535
+
529
536
  var _props$current = props.current,
530
537
  current = _props$current === undefined ? '' : _props$current;
531
538
 
@@ -552,7 +559,7 @@ var YoutubeGroup = function YoutubeGroup(props) {
552
559
  ),
553
560
  React__default.createElement(
554
561
  'div',
555
- { className: 'row__inner' },
562
+ { ref: innerSlider, className: 'row__inner' },
556
563
  props.dataset && props.dataset.map(function (video, index) {
557
564
  // If there is a current prop, means this will overlay a currently playing video
558
565
  if (current !== '') {
@@ -4,4 +4,4 @@ import 'prop-types';
4
4
  import 'next/link';
5
5
  import 'react-dom';
6
6
  import './index-5f9f807a.js';
7
- export { Y as default } from './YoutubeGroup-a3ea5e8e.js';
7
+ export { Y as default } from './YoutubeGroup-e7e16d0e.js';
package/dist/esm/index.js CHANGED
@@ -36,8 +36,8 @@ export { T as TaxonomyCard } from './TaxonomyCard-ea494c28.js';
36
36
  import './react-social-icons-a7d5c5c7.js';
37
37
  import GroupDeck from './GroupDeck.js';
38
38
  export { default as GroupDeck } from './GroupDeck.js';
39
- import { g as getYoutubeId } from './YoutubeGroup-a3ea5e8e.js';
40
- export { Y as YoutubeGroup } from './YoutubeGroup-a3ea5e8e.js';
39
+ import { g as getYoutubeId } from './YoutubeGroup-e7e16d0e.js';
40
+ export { Y as YoutubeGroup } from './YoutubeGroup-e7e16d0e.js';
41
41
  import { Spinner as Spinner$1, Container as Container$1, Row as Row$1, Col as Col$1, Carousel, Table, Figure as Figure$1, Button as Button$1, ProgressBar, Card, Form } from 'react-bootstrap';
42
42
  export { default as QueueDeckExpanded } from './QueueDeckExpanded.js';
43
43
  import { I as IoMdArrowDropdown } from './index.esm-536609db.js';
@@ -16168,6 +16168,21 @@ var renderAuthor = function renderAuthor(authorName, authorURL, index, length) {
16168
16168
  }
16169
16169
  };
16170
16170
 
16171
+ var get_content_placement_url = function get_content_placement_url(cp) {
16172
+ var cp_url = '';
16173
+ if (cp.ancestor && typeof cp.ancestor === 'string') {
16174
+ cp_url += (cp_url === '' ? '' : '/') + cp.ancestor;
16175
+ }
16176
+
16177
+ if (!cp.ancestor && cp.parent && typeof cp.parent === 'string') {
16178
+ console.log('cp.parent:', cp.parent);
16179
+ cp_url += (cp_url === '' ? '' : '/') + cp.parent;
16180
+ }
16181
+
16182
+ cp_url += (cp_url === '' ? '' : '/') + cp.path;
16183
+ return cp_url;
16184
+ };
16185
+
16171
16186
  var Article = function Article(props) {
16172
16187
  var client = props.client,
16173
16188
  pageview = props.pageview,
@@ -16191,7 +16206,8 @@ var Article = function Article(props) {
16191
16206
  nationalPage = props.nationalPage,
16192
16207
  ISIContent = props.ISIContent,
16193
16208
  changeUrl = props.changeUrl,
16194
- shareOptions = props.shareOptions;
16209
+ shareOptions = props.shareOptions,
16210
+ cpModificationRequired = props.cpModificationRequired;
16195
16211
 
16196
16212
 
16197
16213
  var urlFor = function urlFor(source) {
@@ -16230,6 +16246,7 @@ var Article = function Article(props) {
16230
16246
  var shareSummary = summary;
16231
16247
  var shareImage = thumbnail && thumbnail.asset ? urlFor(thumbnail.asset).url() : shareImageDefault;
16232
16248
  var siteName = props.website.title;
16249
+
16233
16250
  return React__default.createElement(
16234
16251
  React__default.Fragment,
16235
16252
  null,
@@ -16320,7 +16337,10 @@ var Article = function Article(props) {
16320
16337
  Dropdown.Menu,
16321
16338
  null,
16322
16339
  content_placement.length > 0 ? content_placement.map(function (cp, index) {
16323
- var href = '/' + cp.path;
16340
+ var cp_url = cpModificationRequired ? get_content_placement_url(cp) : cp.path;
16341
+ var href = '/' + cp_url;
16342
+ console.log('cp:', cp);
16343
+ console.log('href:', href);
16324
16344
  return React__default.createElement(
16325
16345
  Dropdown.Item,
16326
16346
  { key: index, href: href },
@@ -16380,7 +16400,9 @@ var ArticleQueue = function ArticleQueue(props) {
16380
16400
  _props$sponsoredTaxon = props.sponsoredTaxonomies,
16381
16401
  sponsoredTaxonomies = _props$sponsoredTaxon === undefined ? [] : _props$sponsoredTaxon,
16382
16402
  _props$maxListLength = props.maxListLength,
16383
- maxListLength = _props$maxListLength === undefined ? 10 : _props$maxListLength;
16403
+ maxListLength = _props$maxListLength === undefined ? 10 : _props$maxListLength,
16404
+ _props$cpModification = props.cpModificationRequired,
16405
+ cpModificationRequired = _props$cpModification === undefined ? false : _props$cpModification;
16384
16406
 
16385
16407
  var _useState = useState(''),
16386
16408
  _useState2 = _slicedToArray(_useState, 2),
@@ -16460,8 +16482,13 @@ var ArticleQueue = function ArticleQueue(props) {
16460
16482
  var content_placement_urls = [];
16461
16483
  if (content_placement && prevUrl && prevUrl.length) {
16462
16484
  content_placement.forEach(function (item) {
16463
- if (includes_1(prevUrl, item.path)) {
16464
- content_placement_urls.push(item.path);
16485
+ var path = item.path;
16486
+ if (cpModificationRequired) {
16487
+ path = get_content_placement_url(item);
16488
+ }
16489
+
16490
+ if (includes_1(prevUrl, path)) {
16491
+ content_placement_urls.push(path);
16465
16492
  }
16466
16493
  });
16467
16494
  }
@@ -16469,7 +16496,7 @@ var ArticleQueue = function ArticleQueue(props) {
16469
16496
  if (content_placement) {
16470
16497
  if (content_placement_urls.length === 0) {
16471
16498
  content_placement_urls = content_placement.map(function (item) {
16472
- return item.path;
16499
+ return cpModificationRequired ? get_content_placement_url(item) : item.path;
16473
16500
  });
16474
16501
  }
16475
16502
  } else {
@@ -16642,7 +16669,7 @@ var ArticleQueue = function ArticleQueue(props) {
16642
16669
  InfiniteScroll,
16643
16670
  { dataLength: queueData.length, next: loadmore, scrollThreshold: 0.8, hasMore: true },
16644
16671
  queueData.map(function (article, index) {
16645
- return React__default.createElement(Article, _extends$2({ key: index }, props, { changeUrl: changeUrl, article: article }));
16672
+ return React__default.createElement(Article, _extends$2({ key: index }, props, { changeUrl: changeUrl, article: article, cpModificationRequired: cpModificationRequired }));
16646
16673
  })
16647
16674
  );
16648
16675
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.310",
3
+ "version": "1.0.312",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",