@mjhls/mjh-framework 1.0.284 → 1.0.286

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.
@@ -2,7 +2,6 @@ import { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpe
2
2
  import React__default, { useEffect } from 'react';
3
3
  import 'next/link';
4
4
  import { L as LazyLoad } from './index-5f9f807a.js';
5
- import smoothscroll from 'smoothscroll-polyfill';
6
5
 
7
6
  var getYoutubeId = createCommonjsModule(function (module, exports) {
8
7
  (function (root, factory) {
@@ -53,6 +52,439 @@ var getYoutubeId = createCommonjsModule(function (module, exports) {
53
52
  }));
54
53
  });
55
54
 
55
+ var smoothscroll = createCommonjsModule(function (module, exports) {
56
+ /* smoothscroll v0.4.4 - 2019 - Dustan Kasten, Jeremias Menichelli - MIT License */
57
+ (function () {
58
+
59
+ // polyfill
60
+ function polyfill() {
61
+ // aliases
62
+ var w = window;
63
+ var d = document;
64
+
65
+ // return if scroll behavior is supported and polyfill is not forced
66
+ if (
67
+ 'scrollBehavior' in d.documentElement.style &&
68
+ w.__forceSmoothScrollPolyfill__ !== true
69
+ ) {
70
+ return;
71
+ }
72
+
73
+ // globals
74
+ var Element = w.HTMLElement || w.Element;
75
+ var SCROLL_TIME = 468;
76
+
77
+ // object gathering original scroll methods
78
+ var original = {
79
+ scroll: w.scroll || w.scrollTo,
80
+ scrollBy: w.scrollBy,
81
+ elementScroll: Element.prototype.scroll || scrollElement,
82
+ scrollIntoView: Element.prototype.scrollIntoView
83
+ };
84
+
85
+ // define timing method
86
+ var now =
87
+ w.performance && w.performance.now
88
+ ? w.performance.now.bind(w.performance)
89
+ : Date.now;
90
+
91
+ /**
92
+ * indicates if a the current browser is made by Microsoft
93
+ * @method isMicrosoftBrowser
94
+ * @param {String} userAgent
95
+ * @returns {Boolean}
96
+ */
97
+ function isMicrosoftBrowser(userAgent) {
98
+ var userAgentPatterns = ['MSIE ', 'Trident/', 'Edge/'];
99
+
100
+ return new RegExp(userAgentPatterns.join('|')).test(userAgent);
101
+ }
102
+
103
+ /*
104
+ * IE has rounding bug rounding down clientHeight and clientWidth and
105
+ * rounding up scrollHeight and scrollWidth causing false positives
106
+ * on hasScrollableSpace
107
+ */
108
+ var ROUNDING_TOLERANCE = isMicrosoftBrowser(w.navigator.userAgent) ? 1 : 0;
109
+
110
+ /**
111
+ * changes scroll position inside an element
112
+ * @method scrollElement
113
+ * @param {Number} x
114
+ * @param {Number} y
115
+ * @returns {undefined}
116
+ */
117
+ function scrollElement(x, y) {
118
+ this.scrollLeft = x;
119
+ this.scrollTop = y;
120
+ }
121
+
122
+ /**
123
+ * returns result of applying ease math function to a number
124
+ * @method ease
125
+ * @param {Number} k
126
+ * @returns {Number}
127
+ */
128
+ function ease(k) {
129
+ return 0.5 * (1 - Math.cos(Math.PI * k));
130
+ }
131
+
132
+ /**
133
+ * indicates if a smooth behavior should be applied
134
+ * @method shouldBailOut
135
+ * @param {Number|Object} firstArg
136
+ * @returns {Boolean}
137
+ */
138
+ function shouldBailOut(firstArg) {
139
+ if (
140
+ firstArg === null ||
141
+ typeof firstArg !== 'object' ||
142
+ firstArg.behavior === undefined ||
143
+ firstArg.behavior === 'auto' ||
144
+ firstArg.behavior === 'instant'
145
+ ) {
146
+ // first argument is not an object/null
147
+ // or behavior is auto, instant or undefined
148
+ return true;
149
+ }
150
+
151
+ if (typeof firstArg === 'object' && firstArg.behavior === 'smooth') {
152
+ // first argument is an object and behavior is smooth
153
+ return false;
154
+ }
155
+
156
+ // throw error when behavior is not supported
157
+ throw new TypeError(
158
+ 'behavior member of ScrollOptions ' +
159
+ firstArg.behavior +
160
+ ' is not a valid value for enumeration ScrollBehavior.'
161
+ );
162
+ }
163
+
164
+ /**
165
+ * indicates if an element has scrollable space in the provided axis
166
+ * @method hasScrollableSpace
167
+ * @param {Node} el
168
+ * @param {String} axis
169
+ * @returns {Boolean}
170
+ */
171
+ function hasScrollableSpace(el, axis) {
172
+ if (axis === 'Y') {
173
+ return el.clientHeight + ROUNDING_TOLERANCE < el.scrollHeight;
174
+ }
175
+
176
+ if (axis === 'X') {
177
+ return el.clientWidth + ROUNDING_TOLERANCE < el.scrollWidth;
178
+ }
179
+ }
180
+
181
+ /**
182
+ * indicates if an element has a scrollable overflow property in the axis
183
+ * @method canOverflow
184
+ * @param {Node} el
185
+ * @param {String} axis
186
+ * @returns {Boolean}
187
+ */
188
+ function canOverflow(el, axis) {
189
+ var overflowValue = w.getComputedStyle(el, null)['overflow' + axis];
190
+
191
+ return overflowValue === 'auto' || overflowValue === 'scroll';
192
+ }
193
+
194
+ /**
195
+ * indicates if an element can be scrolled in either axis
196
+ * @method isScrollable
197
+ * @param {Node} el
198
+ * @param {String} axis
199
+ * @returns {Boolean}
200
+ */
201
+ function isScrollable(el) {
202
+ var isScrollableY = hasScrollableSpace(el, 'Y') && canOverflow(el, 'Y');
203
+ var isScrollableX = hasScrollableSpace(el, 'X') && canOverflow(el, 'X');
204
+
205
+ return isScrollableY || isScrollableX;
206
+ }
207
+
208
+ /**
209
+ * finds scrollable parent of an element
210
+ * @method findScrollableParent
211
+ * @param {Node} el
212
+ * @returns {Node} el
213
+ */
214
+ function findScrollableParent(el) {
215
+ while (el !== d.body && isScrollable(el) === false) {
216
+ el = el.parentNode || el.host;
217
+ }
218
+
219
+ return el;
220
+ }
221
+
222
+ /**
223
+ * self invoked function that, given a context, steps through scrolling
224
+ * @method step
225
+ * @param {Object} context
226
+ * @returns {undefined}
227
+ */
228
+ function step(context) {
229
+ var time = now();
230
+ var value;
231
+ var currentX;
232
+ var currentY;
233
+ var elapsed = (time - context.startTime) / SCROLL_TIME;
234
+
235
+ // avoid elapsed times higher than one
236
+ elapsed = elapsed > 1 ? 1 : elapsed;
237
+
238
+ // apply easing to elapsed time
239
+ value = ease(elapsed);
240
+
241
+ currentX = context.startX + (context.x - context.startX) * value;
242
+ currentY = context.startY + (context.y - context.startY) * value;
243
+
244
+ context.method.call(context.scrollable, currentX, currentY);
245
+
246
+ // scroll more if we have not reached our destination
247
+ if (currentX !== context.x || currentY !== context.y) {
248
+ w.requestAnimationFrame(step.bind(w, context));
249
+ }
250
+ }
251
+
252
+ /**
253
+ * scrolls window or element with a smooth behavior
254
+ * @method smoothScroll
255
+ * @param {Object|Node} el
256
+ * @param {Number} x
257
+ * @param {Number} y
258
+ * @returns {undefined}
259
+ */
260
+ function smoothScroll(el, x, y) {
261
+ var scrollable;
262
+ var startX;
263
+ var startY;
264
+ var method;
265
+ var startTime = now();
266
+
267
+ // define scroll context
268
+ if (el === d.body) {
269
+ scrollable = w;
270
+ startX = w.scrollX || w.pageXOffset;
271
+ startY = w.scrollY || w.pageYOffset;
272
+ method = original.scroll;
273
+ } else {
274
+ scrollable = el;
275
+ startX = el.scrollLeft;
276
+ startY = el.scrollTop;
277
+ method = scrollElement;
278
+ }
279
+
280
+ // scroll looping over a frame
281
+ step({
282
+ scrollable: scrollable,
283
+ method: method,
284
+ startTime: startTime,
285
+ startX: startX,
286
+ startY: startY,
287
+ x: x,
288
+ y: y
289
+ });
290
+ }
291
+
292
+ // ORIGINAL METHODS OVERRIDES
293
+ // w.scroll and w.scrollTo
294
+ w.scroll = w.scrollTo = function() {
295
+ // avoid action when no arguments are passed
296
+ if (arguments[0] === undefined) {
297
+ return;
298
+ }
299
+
300
+ // avoid smooth behavior if not required
301
+ if (shouldBailOut(arguments[0]) === true) {
302
+ original.scroll.call(
303
+ w,
304
+ arguments[0].left !== undefined
305
+ ? arguments[0].left
306
+ : typeof arguments[0] !== 'object'
307
+ ? arguments[0]
308
+ : w.scrollX || w.pageXOffset,
309
+ // use top prop, second argument if present or fallback to scrollY
310
+ arguments[0].top !== undefined
311
+ ? arguments[0].top
312
+ : arguments[1] !== undefined
313
+ ? arguments[1]
314
+ : w.scrollY || w.pageYOffset
315
+ );
316
+
317
+ return;
318
+ }
319
+
320
+ // LET THE SMOOTHNESS BEGIN!
321
+ smoothScroll.call(
322
+ w,
323
+ d.body,
324
+ arguments[0].left !== undefined
325
+ ? ~~arguments[0].left
326
+ : w.scrollX || w.pageXOffset,
327
+ arguments[0].top !== undefined
328
+ ? ~~arguments[0].top
329
+ : w.scrollY || w.pageYOffset
330
+ );
331
+ };
332
+
333
+ // w.scrollBy
334
+ w.scrollBy = function() {
335
+ // avoid action when no arguments are passed
336
+ if (arguments[0] === undefined) {
337
+ return;
338
+ }
339
+
340
+ // avoid smooth behavior if not required
341
+ if (shouldBailOut(arguments[0])) {
342
+ original.scrollBy.call(
343
+ w,
344
+ arguments[0].left !== undefined
345
+ ? arguments[0].left
346
+ : typeof arguments[0] !== 'object' ? arguments[0] : 0,
347
+ arguments[0].top !== undefined
348
+ ? arguments[0].top
349
+ : arguments[1] !== undefined ? arguments[1] : 0
350
+ );
351
+
352
+ return;
353
+ }
354
+
355
+ // LET THE SMOOTHNESS BEGIN!
356
+ smoothScroll.call(
357
+ w,
358
+ d.body,
359
+ ~~arguments[0].left + (w.scrollX || w.pageXOffset),
360
+ ~~arguments[0].top + (w.scrollY || w.pageYOffset)
361
+ );
362
+ };
363
+
364
+ // Element.prototype.scroll and Element.prototype.scrollTo
365
+ Element.prototype.scroll = Element.prototype.scrollTo = function() {
366
+ // avoid action when no arguments are passed
367
+ if (arguments[0] === undefined) {
368
+ return;
369
+ }
370
+
371
+ // avoid smooth behavior if not required
372
+ if (shouldBailOut(arguments[0]) === true) {
373
+ // if one number is passed, throw error to match Firefox implementation
374
+ if (typeof arguments[0] === 'number' && arguments[1] === undefined) {
375
+ throw new SyntaxError('Value could not be converted');
376
+ }
377
+
378
+ original.elementScroll.call(
379
+ this,
380
+ // use left prop, first number argument or fallback to scrollLeft
381
+ arguments[0].left !== undefined
382
+ ? ~~arguments[0].left
383
+ : typeof arguments[0] !== 'object' ? ~~arguments[0] : this.scrollLeft,
384
+ // use top prop, second argument or fallback to scrollTop
385
+ arguments[0].top !== undefined
386
+ ? ~~arguments[0].top
387
+ : arguments[1] !== undefined ? ~~arguments[1] : this.scrollTop
388
+ );
389
+
390
+ return;
391
+ }
392
+
393
+ var left = arguments[0].left;
394
+ var top = arguments[0].top;
395
+
396
+ // LET THE SMOOTHNESS BEGIN!
397
+ smoothScroll.call(
398
+ this,
399
+ this,
400
+ typeof left === 'undefined' ? this.scrollLeft : ~~left,
401
+ typeof top === 'undefined' ? this.scrollTop : ~~top
402
+ );
403
+ };
404
+
405
+ // Element.prototype.scrollBy
406
+ Element.prototype.scrollBy = function() {
407
+ // avoid action when no arguments are passed
408
+ if (arguments[0] === undefined) {
409
+ return;
410
+ }
411
+
412
+ // avoid smooth behavior if not required
413
+ if (shouldBailOut(arguments[0]) === true) {
414
+ original.elementScroll.call(
415
+ this,
416
+ arguments[0].left !== undefined
417
+ ? ~~arguments[0].left + this.scrollLeft
418
+ : ~~arguments[0] + this.scrollLeft,
419
+ arguments[0].top !== undefined
420
+ ? ~~arguments[0].top + this.scrollTop
421
+ : ~~arguments[1] + this.scrollTop
422
+ );
423
+
424
+ return;
425
+ }
426
+
427
+ this.scroll({
428
+ left: ~~arguments[0].left + this.scrollLeft,
429
+ top: ~~arguments[0].top + this.scrollTop,
430
+ behavior: arguments[0].behavior
431
+ });
432
+ };
433
+
434
+ // Element.prototype.scrollIntoView
435
+ Element.prototype.scrollIntoView = function() {
436
+ // avoid smooth behavior if not required
437
+ if (shouldBailOut(arguments[0]) === true) {
438
+ original.scrollIntoView.call(
439
+ this,
440
+ arguments[0] === undefined ? true : arguments[0]
441
+ );
442
+
443
+ return;
444
+ }
445
+
446
+ // LET THE SMOOTHNESS BEGIN!
447
+ var scrollableParent = findScrollableParent(this);
448
+ var parentRects = scrollableParent.getBoundingClientRect();
449
+ var clientRects = this.getBoundingClientRect();
450
+
451
+ if (scrollableParent !== d.body) {
452
+ // reveal element inside parent
453
+ smoothScroll.call(
454
+ this,
455
+ scrollableParent,
456
+ scrollableParent.scrollLeft + clientRects.left - parentRects.left,
457
+ scrollableParent.scrollTop + clientRects.top - parentRects.top
458
+ );
459
+
460
+ // reveal parent in viewport unless is fixed
461
+ if (w.getComputedStyle(scrollableParent).position !== 'fixed') {
462
+ w.scrollBy({
463
+ left: parentRects.left,
464
+ top: parentRects.top,
465
+ behavior: 'smooth'
466
+ });
467
+ }
468
+ } else {
469
+ // reveal element in viewport
470
+ w.scrollBy({
471
+ left: clientRects.left,
472
+ top: clientRects.top,
473
+ behavior: 'smooth'
474
+ });
475
+ }
476
+ };
477
+ }
478
+
479
+ {
480
+ // commonjs
481
+ module.exports = { polyfill: polyfill };
482
+ }
483
+
484
+ }());
485
+ });
486
+ var smoothscroll_1 = smoothscroll.polyfill;
487
+
56
488
  // kick off the polyfill!
57
489
 
58
490
  /*
@@ -4,5 +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-a87b8967.js';
8
- import 'smoothscroll-polyfill';
7
+ export { Y as default } from './YoutubeGroup-562ed456.js';
package/dist/esm/index.js CHANGED
@@ -21,13 +21,13 @@ import { i as imageUrlBuilder } from './index-3849e3fe.js';
21
21
  import './index-5f9f807a.js';
22
22
  import { h as html_decode_1, c as clean_html_1 } from './entities-7cc3bf45.js';
23
23
  import { _ as _slicedToArray } from './slicedToArray-d0a9593a.js';
24
- import { _ as _JSON$stringify, a as _asyncToGenerator, r as regenerator, D as DFPAdSlot, B as Beam } from './AdSlot-cc6a4f74.js';
25
- export { D as AdSlot, B as Beam } from './AdSlot-cc6a4f74.js';
24
+ import { _ as _JSON$stringify, a as _asyncToGenerator, r as regenerator, D as DFPAdSlot, B as Beam } from './AdSlot-03043ffb.js';
25
+ export { D as AdSlot, B as Beam } from './AdSlot-03043ffb.js';
26
26
  import './promise-e3480f1c.js';
27
- import './ADInfeed-fd816c1f.js';
27
+ import './ADInfeed-ac3ac372.js';
28
28
  export { default as DeckContent } from './DeckContent.js';
29
29
  import { i as isFunction_1, a as isArray_1, _ as _arrayMap } from './get-9c285a85.js';
30
- export { A as AD, G as GridContent } from './GridContent-2e9e7528.js';
30
+ export { A as AD, G as GridContent } from './GridContent-96716e42.js';
31
31
  export { default as DeckQueue } from './DeckQueue.js';
32
32
  import 'react-bootstrap/Media';
33
33
  export { default as ThumbnailCard } from './ThumbnailCard.js';
@@ -35,9 +35,8 @@ import { B as BlockContent } from './TaxonomyCard-ee1a22ae.js';
35
35
  export { T as TaxonomyCard } from './TaxonomyCard-ee1a22ae.js';
36
36
  import GroupDeck from './GroupDeck.js';
37
37
  export { default as GroupDeck } from './GroupDeck.js';
38
- import { g as getYoutubeId } from './YoutubeGroup-a87b8967.js';
39
- export { Y as YoutubeGroup } from './YoutubeGroup-a87b8967.js';
40
- import 'smoothscroll-polyfill';
38
+ import { g as getYoutubeId } from './YoutubeGroup-562ed456.js';
39
+ export { Y as YoutubeGroup } from './YoutubeGroup-562ed456.js';
41
40
  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 } from 'react-bootstrap';
42
41
  export { default as QueueDeckExpanded } from './QueueDeckExpanded.js';
43
42
  import { I as IoMdArrowDropdown } from './index.esm-536609db.js';
@@ -49,8 +48,8 @@ export { default as IssueDeck } from './IssueDeck.js';
49
48
  import 'react-bootstrap/Badge';
50
49
  export { default as IssueContentDeck } from './IssueContentDeck.js';
51
50
  import Spinner from 'react-bootstrap/Spinner';
52
- import { M as MdPictureAsPdf, T as TemplateNormal } from './Normal-319bc9fb.js';
53
- export { A as AD728x90, C as Column1, a as Column2, b as Column3, f as HamMagazine, H as Header, L as LeftNav, e as NavDvm, c as NavMagazine, N as NavNative, d as NavNormal, P as PageFilter, S as Search, g as SideFooter, T as TemplateNormal } from './Normal-319bc9fb.js';
51
+ import { M as MdPictureAsPdf, T as TemplateNormal } from './Normal-d27184f4.js';
52
+ export { A as AD728x90, C as Column1, a as Column2, b as Column3, f as HamMagazine, H as Header, L as LeftNav, e as NavDvm, c as NavMagazine, N as NavNative, d as NavNormal, P as PageFilter, S as Search, g as SideFooter, T as TemplateNormal } from './Normal-d27184f4.js';
54
53
  import 'react-bootstrap/ListGroup';
55
54
  import Head from 'next/head';
56
55
  import Accordion from 'react-bootstrap/Accordion';
@@ -61,7 +60,6 @@ import 'react-bootstrap/Navbar';
61
60
  import 'react-bootstrap/NavDropdown';
62
61
  import 'react-bootstrap/Form';
63
62
  import 'react-bootstrap/FormControl';
64
- import Modal from 'react-bootstrap/Modal';
65
63
  import Pagination from 'react-bootstrap/Pagination';
66
64
  import dynamic from 'next/dynamic';
67
65
  import Carousel$1 from 'react-bootstrap/Carousel';
@@ -3028,14 +3026,21 @@ var ADWelcome = function ADWelcome(_ref) {
3028
3026
  adTargeting = _useState2[0],
3029
3027
  setTargeting = _useState2[1];
3030
3028
 
3029
+ var adRef = useRef(null);
3030
+
3031
+ var _useState3 = useState(),
3032
+ _useState4 = _slicedToArray(_useState3, 2),
3033
+ showAd = _useState4[0],
3034
+ setShowAd = _useState4[1];
3035
+
3031
3036
  var calculateTimeLeft = function calculateTimeLeft(timeLeft) {
3032
3037
  return --timeLeft;
3033
3038
  };
3034
3039
 
3035
- var _useState3 = useState(calculateTimeLeft(counter)),
3036
- _useState4 = _slicedToArray(_useState3, 2),
3037
- timeLeft = _useState4[0],
3038
- setTimeLeft = _useState4[1];
3040
+ var _useState5 = useState(calculateTimeLeft(counter + 1)),
3041
+ _useState6 = _slicedToArray(_useState5, 2),
3042
+ timeLeft = _useState6[0],
3043
+ setTimeLeft = _useState6[1];
3039
3044
 
3040
3045
  useEffect(function () {
3041
3046
  if (timeLeft > 0) {
@@ -3047,9 +3052,17 @@ var ADWelcome = function ADWelcome(_ref) {
3047
3052
  }
3048
3053
  });
3049
3054
 
3055
+ useEffect(function () {
3056
+ if (typeof showAd !== 'undefined' && showAd) {
3057
+ adRef.current.style.opacity = '1';
3058
+ } else if (typeof showAd !== 'undefined' && !showAd) {
3059
+ setFlag(true);
3060
+ }
3061
+ }, [showAd]);
3062
+
3050
3063
  return React__default.createElement(
3051
- Modal,
3052
- { show: true, 'aria-labelledby': 'contained-modal-title-vcenter', backdrop: 'static', style: { outline: 'none' }, dialogClassName: 'welcome-modal' },
3064
+ 'div',
3065
+ { ref: adRef, style: { outline: 'none', opacity: 0 }, className: 'welcome-modal' },
3053
3066
  React__default.createElement(
3054
3067
  'div',
3055
3068
  { className: 'right-top', style: { position: 'absolute', top: 0, right: 0, textAlign: 'center', margin: '2rem' } },
@@ -3084,14 +3097,14 @@ var ADWelcome = function ADWelcome(_ref) {
3084
3097
  React__default.createElement('img', { style: { width: '100%' }, src: Website.logo, alt: Website.title })
3085
3098
  ),
3086
3099
  React__default.createElement(
3087
- Modal.Body,
3100
+ 'div',
3088
3101
  { className: title, style: { position: 'relative', width: '300px', height: '250px', margin: 'auto', top: '10rem' } },
3089
- React__default.createElement(DFPAdSlot, { className: className, slotId: slotId, networkID: networkID, sizes: sizes, adUnit: adUnit, targeting: adTargeting, refreshFlag: false })
3102
+ React__default.createElement(DFPAdSlot, { className: className, slotId: slotId, networkID: networkID, sizes: sizes, adUnit: adUnit, targeting: adTargeting, refreshFlag: false, setShowAd: setShowAd })
3090
3103
  ),
3091
3104
  React__default.createElement(
3092
3105
  'style',
3093
3106
  { jsx: 'true' },
3094
- '\n .modal.show {\n padding: 0px;\n }\n .continue-site:hover {\n cursor: pointer;\n }\n\n .welcome-modal {\n max-width: 100% !important;\n margin: 0px !important;\n }\n @media (min-width: 1200px) {\n .modal-backdrop {\n display: block;\n }\n .modal-content {\n display: block;\n height: 100vh;\n }\n }\n '
3107
+ '\n .continue-site:hover {\n cursor: pointer;\n }\n\n .welcome-modal {\n max-width: 100% !important;\n margin: 0px !important;\n }\n '
3095
3108
  )
3096
3109
  );
3097
3110
  };
@@ -14112,46 +14125,63 @@ var RelatedTopicsDropdown = function RelatedTopicsDropdown(_ref) {
14112
14125
  };
14113
14126
 
14114
14127
  /*
14115
- This dropdown is used inside Article body to display related content placement pages
14116
- sample usage: <ArticleDetailDropdown contentPlacement={content_placement} exclude={['News',]} />
14128
+ This dropdown is used inside Article body to display related content placement and document group pages
14129
+ sample usage: <ArticleDetailDropdown article={props.article} exclude={['News']} style={{ backgroundColor: 'var(--primary)', border: 0 }} />
14130
+
14131
+ - accepts any normal html arrtibute (style, id, class)
14117
14132
 
14118
- in article query, need to add '...' to content_placement to retreive additional info needed
14133
+ - in article query, need to add '...' to content_placement to retreive additional info needed, and document_group to retrieve group data if available
14119
14134
 
14120
- 'content_placement': taxonomyMapping[]-> {
14135
+ 'content_placement': taxonomyMapping[]-> {
14121
14136
  ...,
14122
14137
  'ancestor': parent->parent->identifier,
14123
14138
  'parent': parent->identifier,
14124
14139
  'path': identifier
14125
- }
14126
-
14140
+ },
14141
+ 'document_group': documentGroup-> {
14142
+ name,
14143
+ 'parent': parent->identifier,
14144
+ 'path': identifier.current
14145
+ }
14127
14146
  */
14128
14147
 
14129
14148
  var ArticleDetailDropdown = function ArticleDetailDropdown(props) {
14130
- var _props$contentPlaceme = props.contentPlacement,
14131
- contentPlacement = _props$contentPlaceme === undefined ? false : _props$contentPlaceme,
14149
+ var article = props.article,
14132
14150
  _props$exclude = props.exclude,
14133
- exclude = _props$exclude === undefined ? [''] : _props$exclude;
14134
-
14135
- if (contentPlacement.length == 1 && exclude.includes(contentPlacement[0].name) || contentPlacement == false) {
14136
- return null;
14137
- }
14151
+ exclude = _props$exclude === undefined ? [] : _props$exclude;
14138
14152
 
14153
+ var _props = _extends$2({}, props);
14154
+ delete _props.article;
14155
+ delete _props.exclude;
14139
14156
  return React__default.createElement(
14140
14157
  Dropdown,
14141
- { style: { marginBottom: '1rem' } },
14158
+ null,
14142
14159
  React__default.createElement(
14143
14160
  Dropdown.Toggle,
14144
- { variant: 'primary', id: 'partner-dropdown' },
14161
+ _props,
14145
14162
  'Related Topics'
14146
14163
  ),
14147
14164
  React__default.createElement(
14148
14165
  Dropdown.Menu,
14149
14166
  null,
14150
- contentPlacement.map(function (cp, index) {
14151
- var href = cp.parent ? '/' + cp.parent + '/' + cp.path : '/' + cp.path;
14152
- return !exclude.includes(cp.name) && React__default.createElement(
14167
+ article.document_group && React__default.createElement(
14168
+ Dropdown.Item,
14169
+ { href: '/' + article.document_group.parent.current + '/' + article.document_group.path },
14170
+ article.document_group.name
14171
+ ),
14172
+ article.content_placement && article.content_placement.length > 0 && article.content_placement.map(function (cp, i) {
14173
+ if (exclude.includes(cp.name)) return;
14174
+ var href = '';
14175
+ if (cp.ancestor) {
14176
+ href = '/' + cp.ancestor + '/' + cp.identifier;
14177
+ } else if (cp.parent) {
14178
+ href = '/' + cp.parent + '/' + cp.identifier;
14179
+ } else {
14180
+ href = '/' + cp.identifier;
14181
+ }
14182
+ return React__default.createElement(
14153
14183
  Dropdown.Item,
14154
- { key: index, href: href },
14184
+ { key: i, href: href },
14155
14185
  cp.name
14156
14186
  );
14157
14187
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.284",
3
+ "version": "1.0.286",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",