@crystaldesign/content-item 25.8.0-beta.2 → 25.8.0-beta.20

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.
Files changed (24) hide show
  1. package/build/esm/index.js +261 -191
  2. package/build/types/content-item/src/Components/ContentItemContextProvider/index.d.ts +16 -0
  3. package/build/types/content-item/src/Components/ContentItemContextProvider/index.d.ts.map +1 -0
  4. package/build/types/content-item/src/Components/ContentItemContextProvider/useContentItemConfiguration.d.ts +12 -0
  5. package/build/types/content-item/src/Components/ContentItemContextProvider/useContentItemConfiguration.d.ts.map +1 -0
  6. package/build/types/content-item/src/Components/ContentItemContextProvider/useContentItemContext.d.ts +6 -0
  7. package/build/types/content-item/src/Components/ContentItemContextProvider/useContentItemContext.d.ts.map +1 -0
  8. package/build/types/content-item/src/Components/ContentItems/index.d.ts +2 -3
  9. package/build/types/content-item/src/Components/ContentItems/index.d.ts.map +1 -1
  10. package/build/types/content-item/src/Components/Header/index.d.ts +9 -0
  11. package/build/types/content-item/src/Components/Header/index.d.ts.map +1 -0
  12. package/build/types/content-item/src/Components/Video/index.d.ts +1 -1
  13. package/build/types/content-item/src/Components/Video/index.d.ts.map +1 -1
  14. package/build/types/content-item/src/index.d.ts +3 -0
  15. package/build/types/content-item/src/index.d.ts.map +1 -1
  16. package/build/types/content-item/src/types.d.ts +8 -3
  17. package/build/types/content-item/src/types.d.ts.map +1 -1
  18. package/package.json +2 -2
  19. package/build/types/content-item/src/Components/ContentItemNavigator/index.d.ts +0 -11
  20. package/build/types/content-item/src/Components/ContentItemNavigator/index.d.ts.map +0 -1
  21. package/build/types/content-item/src/Components/ContentItemNavigator/useContentItemNavigator.d.ts +0 -7
  22. package/build/types/content-item/src/Components/ContentItemNavigator/useContentItemNavigator.d.ts.map +0 -1
  23. package/build/types/content-item/src/Components/ContentItems/useContentItem.d.ts +0 -12
  24. package/build/types/content-item/src/Components/ContentItems/useContentItem.d.ts.map +0 -1
@@ -1,15 +1,15 @@
1
- import { useState, useEffect, useCallback, useMemo, createContext, useContext, useRef, useDeferredValue, useTransition } from 'react';
1
+ import { useState, useDeferredValue, useTransition, useEffect, useCallback, useMemo, createContext, useContext, useRef } from 'react';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import { useDivaCore, useTranslation, DivaError } from '@crystaldesign/diva-core';
5
5
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
6
6
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
7
- import { Swiper, SwiperSlide } from 'swiper/react';
8
- import { FreeMode, Navigation, Thumbs } from 'swiper/modules';
9
7
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
10
8
  import _regeneratorRuntime from '@babel/runtime/regenerator';
11
9
  import axios from 'axios';
12
- import classnames from 'classnames';
10
+ import classNames from 'classnames';
11
+ import { Swiper, SwiperSlide } from 'swiper/react';
12
+ import { FreeMode, Navigation, Thumbs } from 'swiper/modules';
13
13
 
14
14
  (function() {
15
15
  const env = {"STAGE":"production"};
@@ -152,8 +152,8 @@ var fullscreenWrapper$1 = "fullscreen-wrapper-GByIA";
152
152
  var css_248z$8 = ".image-and-text-wrapper-c1RTN {\n display: flex;\n flex-direction: column;\n gap: 6px;\n justify-content: center;\n position: relative;\n}\n\n.text-Da-D1 {\n overflow: auto;\n text-align: center;\n font-size: 14px;\n}\n\n.fullscreen-button-wrapper-Botqq {\n position: relative;\n}\n\n.fullscreen-button-A4b3x {\n cursor: pointer;\n position: absolute;\n width: 20px;\n height: 20px;\n top: 16px;\n right: 8px;\n border-radius: 3px;\n z-index: 1000;\n background: center / 75% no-repeat rgba(255,255,255,0.53333) url(\"data:image/svg+xml,%3Csvg width%3D%2224%22 height%3D%2224%22 viewBox%3D%220 0 24 24%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath d%3D%22M12 1H2C1.44772 1 1 1.44772 1 2V22C1 22.5523 1.44772 23 2 23H21.9999C22.5522 23 22.9999 22.5523 22.9999 22V12M16.0078 1H21.9989C22.5512 1 22.9989 1.44772 22.9989 2V7.99114M22.5002 1.5L13.3195 10.68%22 stroke%3D%22%234B4B4B%22 stroke-width%3D%221.5%22 stroke-linecap%3D%22round%22 stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E\");\n}\n\n.fullscreen-wrapper-GByIA {\n display: flex;\n justify-content: center;\n align-items: center;\n background: #fff;\n position: relative;\n height: 100%;\n width: 100%;\n z-index: 2000005;\n}\n";
153
153
  styleInject(css_248z$8);
154
154
 
155
- function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
156
- function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
155
+ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
156
+ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
157
157
  var _Image = function Image(_ref) {
158
158
  var _ref$item = _ref.item,
159
159
  image = _ref$item.image,
@@ -202,7 +202,7 @@ var _Image = function Image(_ref) {
202
202
  };
203
203
  var imageComponent = /*#__PURE__*/jsx("img", {
204
204
  alt: altText,
205
- style: _objectSpread$2(_objectSpread$2({}, styles), style),
205
+ style: _objectSpread$3(_objectSpread$3({}, styles), style),
206
206
  src: urlObj.toString()
207
207
  });
208
208
  if (showFullscreenButton) {
@@ -238,7 +238,8 @@ styleInject(css_248z$7);
238
238
  var Video = function Video(_ref) {
239
239
  var _ref$item = _ref.item,
240
240
  video = _ref$item.video,
241
- thumb = _ref$item.thumb;
241
+ thumb = _ref$item.thumb,
242
+ loop = _ref$item.loop;
242
243
  if (!video) return /*#__PURE__*/jsx(Fragment, {});
243
244
  if (video.includes('youtube.com') || video.includes('youtu.be')) {
244
245
  if (thumb) return /*#__PURE__*/jsx("div", {
@@ -270,6 +271,7 @@ var Video = function Video(_ref) {
270
271
  controls: !thumb,
271
272
  playsInline: true,
272
273
  autoPlay: !thumb,
274
+ loop: !thumb && loop,
273
275
  children: /*#__PURE__*/jsx("source", {
274
276
  src: video + (thumb ? '#t=2' : ''),
275
277
  type: video.includes('.mp4') ? 'video/mp4' : 'video/webm'
@@ -281,12 +283,137 @@ var title = "title-0S918";
281
283
  var css_248z$6 = ".title-0S918 {\n font-size: 18px;\n font-weight: 500;\n}\n";
282
284
  styleInject(css_248z$6);
283
285
 
284
- function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
285
- function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
286
- var useContentItemNavigator = function useContentItemNavigator(_ref) {
286
+ var useContentItemConfiguration = function useContentItemConfiguration(_ref) {
287
+ var onContentItemLoaded = _ref.onContentItemLoaded,
288
+ currentContentItem = _ref.currentContentItem;
289
+ var _useDivaCore = useDivaCore(),
290
+ _useDivaCore$state = _useDivaCore.state,
291
+ apiConfig = _useDivaCore$state.apiConfig,
292
+ jwt = _useDivaCore$state.jwt;
293
+ var _useTranslation = useTranslation(),
294
+ i18n = _useTranslation.i18n;
295
+ var _ref2 = currentContentItem !== null && currentContentItem !== void 0 ? currentContentItem : {},
296
+ contentItemId = _ref2.id,
297
+ contentItemCodex = _ref2.codex,
298
+ externalConfiguration = _ref2.configuration;
299
+ var _useState = useState(externalConfiguration !== null && externalConfiguration !== void 0 ? externalConfiguration : {
300
+ content: []
301
+ }),
302
+ _useState2 = _slicedToArray(_useState, 2),
303
+ configuration = _useState2[0],
304
+ setConfiguration = _useState2[1];
305
+ var deferredConfiguration = useDeferredValue(configuration);
306
+ var _useTransition = useTransition(),
307
+ _useTransition2 = _slicedToArray(_useTransition, 2),
308
+ isPending = _useTransition2[0],
309
+ startTransition = _useTransition2[1];
310
+ var _useState3 = useState(true),
311
+ _useState4 = _slicedToArray(_useState3, 2),
312
+ loading = _useState4[0],
313
+ setLoading = _useState4[1];
314
+ var _useState5 = useState(null),
315
+ _useState6 = _slicedToArray(_useState5, 2),
316
+ error = _useState6[0],
317
+ setError = _useState6[1];
318
+ useEffect(function () {
319
+ if (contentItemId || contentItemCodex) {
320
+ setLoading(true);
321
+ setError(null);
322
+ getContentItem(apiConfig.catalogService, jwt, contentItemId !== null && contentItemId !== void 0 ? contentItemId : contentItemCodex, i18n.language).then(function (newConfiguration) {
323
+ startTransition(function () {
324
+ setConfiguration(newConfiguration);
325
+ var infoBoxTitle = newConfiguration.content.filter(function (item) {
326
+ return item.type === 'Title' && item.text;
327
+ }).map(function (item) {
328
+ return item.text;
329
+ });
330
+ onContentItemLoaded === null || onContentItemLoaded === void 0 || onContentItemLoaded(infoBoxTitle[0]);
331
+ });
332
+ })["catch"](function (error) {
333
+ setError(error);
334
+ })["finally"](function () {
335
+ setLoading(false);
336
+ });
337
+ }
338
+ }, [contentItemId, contentItemCodex]);
339
+ useEffect(function () {
340
+ if (externalConfiguration) {
341
+ startTransition(function () {
342
+ setConfiguration(externalConfiguration);
343
+ var infoBoxTitle = externalConfiguration.content.filter(function (item) {
344
+ return item.type === 'Title' && item.text;
345
+ }).map(function (item) {
346
+ return item.text;
347
+ });
348
+ onContentItemLoaded === null || onContentItemLoaded === void 0 || onContentItemLoaded(infoBoxTitle[0]);
349
+ });
350
+ setError(null);
351
+ setLoading(false);
352
+ }
353
+ }, [externalConfiguration]);
354
+ return {
355
+ configuration: deferredConfiguration,
356
+ loading: loading || isPending,
357
+ error: error
358
+ };
359
+ };
360
+ function getContentItem(_x, _x2, _x3, _x4) {
361
+ return _getContentItem.apply(this, arguments);
362
+ }
363
+ function _getContentItem() {
364
+ _getContentItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(catalogService, jwt, idOrCodex, lang) {
365
+ var fullUrl, res, resData, _e$response;
366
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
367
+ while (1) switch (_context.prev = _context.next) {
368
+ case 0:
369
+ fullUrl = catalogService + '/contentItems/' + idOrCodex + '?language=' + lang;
370
+ _context.prev = 1;
371
+ _context.next = 4;
372
+ return axios.get(fullUrl, {
373
+ headers: {
374
+ Authorization: 'Bearer ' + jwt
375
+ }
376
+ });
377
+ case 4:
378
+ res = _context.sent;
379
+ resData = res.data;
380
+ if (!(res.status !== 200)) {
381
+ _context.next = 8;
382
+ break;
383
+ }
384
+ throw new DivaError(resData.error || 'Failed to get content item');
385
+ case 8:
386
+ return _context.abrupt("return", resData);
387
+ case 11:
388
+ _context.prev = 11;
389
+ _context.t0 = _context["catch"](1);
390
+ if (!axios.isAxiosError(_context.t0)) {
391
+ _context.next = 15;
392
+ break;
393
+ }
394
+ throw new DivaError(((_e$response = _context.t0.response) === null || _e$response === void 0 || (_e$response = _e$response.data) === null || _e$response === void 0 ? void 0 : _e$response.error) || 'Could not get content item', {
395
+ cause: _context.t0
396
+ });
397
+ case 15:
398
+ throw new DivaError('Could not get content item', {
399
+ cause: _context.t0
400
+ });
401
+ case 16:
402
+ case "end":
403
+ return _context.stop();
404
+ }
405
+ }, _callee, null, [[1, 11]]);
406
+ }));
407
+ return _getContentItem.apply(this, arguments);
408
+ }
409
+
410
+ function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
411
+ function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
412
+ var useContentItemContext = function useContentItemContext(_ref) {
287
413
  var initialItemId = _ref.initialItemId,
288
414
  initialItemCodex = _ref.initialItemCodex,
289
- initialItemConfiguration = _ref.initialItemConfiguration;
415
+ initialItemConfiguration = _ref.initialItemConfiguration,
416
+ onContentItemLoaded = _ref.onContentItemLoaded;
290
417
  var _useState = useState({
291
418
  current: {
292
419
  id: initialItemId,
@@ -328,68 +455,134 @@ var useContentItemNavigator = function useContentItemNavigator(_ref) {
328
455
  };
329
456
  });
330
457
  }, []);
331
- var onContentItemLoaded = useCallback(function (title) {
458
+ var onContentItemLoadedInternal = useCallback(function (title) {
459
+ onContentItemLoaded === null || onContentItemLoaded === void 0 || onContentItemLoaded(title);
332
460
  setNavigationState(function (prev) {
333
- return _objectSpread$1(_objectSpread$1({}, prev), {}, {
334
- current: _objectSpread$1(_objectSpread$1({}, prev.current), {}, {
461
+ return _objectSpread$2(_objectSpread$2({}, prev), {}, {
462
+ current: _objectSpread$2(_objectSpread$2({}, prev.current), {}, {
335
463
  title: title
336
464
  })
337
465
  });
338
466
  });
339
467
  }, []);
340
-
468
+ var _useContentItemConfig = useContentItemConfiguration({
469
+ currentContentItem: navigationState.current,
470
+ onContentItemLoaded: onContentItemLoadedInternal
471
+ }),
472
+ configuration = _useContentItemConfig.configuration,
473
+ error = _useContentItemConfig.error,
474
+ loading = _useContentItemConfig.loading;
475
+ var content = useMemo(function () {
476
+ var _configuration$conten;
477
+ if (((_configuration$conten = configuration.content) === null || _configuration$conten === void 0 || (_configuration$conten = _configuration$conten[0]) === null || _configuration$conten === void 0 ? void 0 : _configuration$conten.type) === 'Title') {
478
+ return _toConsumableArray(configuration.content).slice(1);
479
+ }
480
+ return configuration.content;
481
+ }, [configuration]);
482
+ var renderTitle = useMemo(function () {
483
+ var _configuration$conten2, _configuration$conten3;
484
+ return (configuration === null || configuration === void 0 || (_configuration$conten2 = configuration.content) === null || _configuration$conten2 === void 0 || (_configuration$conten2 = _configuration$conten2[0]) === null || _configuration$conten2 === void 0 ? void 0 : _configuration$conten2.type) === 'Title' ? configuration === null || configuration === void 0 || (_configuration$conten3 = configuration.content) === null || _configuration$conten3 === void 0 ? void 0 : _configuration$conten3[0] : undefined;
485
+ }, [configuration]);
486
+ var hasNavigations = useMemo(function () {
487
+ var _configuration$conten4;
488
+ var c = JSON.stringify((_configuration$conten4 = configuration === null || configuration === void 0 ? void 0 : configuration.content) !== null && _configuration$conten4 !== void 0 ? _configuration$conten4 : []);
489
+ return c.includes('@[codex:') || c.includes('@[id:');
490
+ }, [content]);
341
491
  // Create context value
342
- var contextValue = useMemo(function () {
343
- return {
344
- navigateTo: navigateTo,
345
- onContentItemLoaded: onContentItemLoaded,
346
- canGoBack: navigationState.history.length > 0,
347
- currentContentItem: navigationState.current
348
- };
349
- }, [navigationState.current, navigationState.history.length]);
492
+ var contextValue = {
493
+ navigateTo: navigateTo,
494
+ navigateBack: navigateBack,
495
+ canGoBack: navigationState.history.length > 0,
496
+ renderTitle: renderTitle,
497
+ content: content,
498
+ loading: loading,
499
+ error: error,
500
+ hasNavigations: hasNavigations
501
+ };
350
502
  return {
351
- contextValue: contextValue,
352
- navigateBack: navigateBack
503
+ contextValue: contextValue
353
504
  };
354
505
  };
355
506
 
356
- var navigator = "navigator-C8xIR";
357
- var backButton = "back-button-JNU6b";
358
- var css_248z$5 = ".navigator-C8xIR {\n position: relative;\n width: 100%;\n}\n\n.back-button-JNU6b {\n position: absolute;\n top: 12px;\n left: 8px;\n z-index: 2;\n background: none;\n border: none;\n cursor: pointer;\n font-size: 20px;\n color: #666;\n transition: color 0.2s ease;\n border-radius: 50%;\n width: 34px;\n height: 34px;\n display: flex;\n align-items: center;\n justify-content: center;\n padding-bottom: 4px;\n}\n.back-button-JNU6b:after {\n content: '←';\n display: block;\n text-align: center;\n}\n\n.back-button-JNU6b:hover {\n color: #333;\n background-color: rgba(0, 0, 0, 0.05);\n}\n";
507
+ var header = "header-7dWXW";
508
+ var paddingLeft = "padding-left-The7U";
509
+ var headerLeft = "header-left-pbZcL";
510
+ var backButton = "back-button-2IUJb";
511
+ var closeButton = "close-button-VW8Z5";
512
+ var css_248z$5 = ".header-7dWXW {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 0px 12px;\n width: calc(100% - 24px);\n justify-content: space-between;\n border-bottom: 1px solid lightgray;\n}\n.padding-left-The7U {\n padding-left: 34px;\n}\n.header-left-pbZcL {\n display: flex;\n align-items: center;\n width: 90%;\n}\n\n.back-button-2IUJb {\n background: none;\n border: none;\n cursor: pointer;\n font-size: 20px;\n color: #666;\n transition:\n color 0.2s ease,\n background-color 0.2s ease;\n border-radius: 50%;\n width: 34px;\n height: 34px;\n display: flex;\n align-items: center;\n justify-content: center;\n padding-bottom: 4px;\n}\n\n.back-button-2IUJb:after {\n content: '←';\n display: block;\n text-align: center;\n}\n\n.back-button-2IUJb:hover,\n.close-button-VW8Z5:hover {\n color: #333;\n background-color: rgba(0, 0, 0, 0.05);\n background-size: 45%;\n}\n.close-button-VW8Z5 {\n width: 36px;\n height: 36px;\n background-repeat: no-repeat;\n border-radius: 50%;\n background-position: center center;\n background-size: 40%;\n background-color: transparent;\n transition:\n background-color 0.2s ease,\n background-size 0.2s ease;\n background-image: url(\"data:image/svg+xml,%3Csvg width%3D%2210%22 height%3D%2210%22 viewBox%3D%220 0 10 10%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath d%3D%22M1.35355 0.646447C1.15829 0.451184 0.841709 0.451184 0.646447 0.646447C0.451184 0.841709 0.451184 1.15829 0.646447 1.35355L1.35355 0.646447ZM8.64645 9.35355C8.84171 9.54882 9.15829 9.54882 9.35355 9.35355C9.54882 9.15829 9.54882 8.84171 9.35355 8.64645L8.64645 9.35355ZM9.35355 1.35355C9.54882 1.15829 9.54882 0.841709 9.35355 0.646447C9.15829 0.451184 8.84171 0.451184 8.64645 0.646447L9.35355 1.35355ZM0.646447 8.64645C0.451185 8.84171 0.451185 9.15829 0.646447 9.35355C0.841709 9.54881 1.15829 9.54881 1.35355 9.35355L0.646447 8.64645ZM0.646447 1.35355L8.64645 9.35355L9.35355 8.64645L1.35355 0.646447L0.646447 1.35355ZM8.64645 0.646447L0.646447 8.64645L1.35355 9.35355L9.35355 1.35355L8.64645 0.646447Z%22 fill%3D%22%234F4F4F%22%2F%3E%3C%2Fsvg%3E\");\n\n cursor: pointer;\n}\n";
359
513
  styleInject(css_248z$5);
360
514
 
361
- var ContentItemNavigationContext = /*#__PURE__*/createContext(undefined);
362
- function useContentItemNavigation() {
363
- var context = useContext(ContentItemNavigationContext);
515
+ function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
516
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
517
+ var Header = function Header(_ref) {
518
+ var onClose = _ref.onClose,
519
+ headerClassName = _ref.headerClassName,
520
+ headerWrapperStyle = _ref.headerWrapperStyle;
521
+ var _useContentItem = useContentItem(),
522
+ canGoBack = _useContentItem.canGoBack,
523
+ navigateBack = _useContentItem.navigateBack,
524
+ renderTitle = _useContentItem.renderTitle,
525
+ hasNavigations = _useContentItem.hasNavigations;
526
+ if (!onClose && !canGoBack && !renderTitle) {
527
+ return /*#__PURE__*/jsx(Fragment, {});
528
+ }
529
+ return /*#__PURE__*/jsxs("div", {
530
+ className: classNames(header, headerClassName),
531
+ style: headerWrapperStyle,
532
+ children: [/*#__PURE__*/jsxs("div", {
533
+ className: classNames(headerLeft, !canGoBack && hasNavigations && paddingLeft),
534
+ children: [canGoBack && /*#__PURE__*/jsx("button", {
535
+ className: backButton,
536
+ onClick: navigateBack,
537
+ id: "diva-content-item-back-button",
538
+ "aria-label": "Go back"
539
+ }), renderTitle && /*#__PURE__*/jsx(Title, {
540
+ item: _objectSpread$1(_objectSpread$1({}, renderTitle), {}, {
541
+ style: _objectSpread$1(_objectSpread$1({}, renderTitle.style), {}, {
542
+ borderBottom: 'unset'
543
+ })
544
+ })
545
+ })]
546
+ }), onClose && /*#__PURE__*/jsx("div", {
547
+ className: closeButton,
548
+ onClick: onClose,
549
+ id: "diva-content-item-close-button",
550
+ "aria-label": "Close"
551
+ })]
552
+ });
553
+ };
554
+
555
+ var ContentItemContext = /*#__PURE__*/createContext(undefined);
556
+ function useContentItem() {
557
+ var context = useContext(ContentItemContext);
364
558
  if (!context) {
365
- throw new Error('useContentItemNavigation must be used within a ContentItemNavigator');
559
+ throw new Error('useContentItem must be used within a ContentItemContextProvider');
366
560
  }
367
561
  return context;
368
562
  }
369
- function ContentItemNavigator(_ref) {
563
+ function ContentItemContextProvider(_ref) {
370
564
  var initialItemId = _ref.initialItemId,
371
565
  initialItemCodex = _ref.initialItemCodex,
372
566
  initialItemConfiguration = _ref.initialItemConfiguration,
373
- children = _ref.children;
374
- var _useContentItemNaviga = useContentItemNavigator({
567
+ children = _ref.children,
568
+ headerClassName = _ref.headerClassName,
569
+ headerWrapperStyle = _ref.headerWrapperStyle,
570
+ onClose = _ref.onClose,
571
+ onContentItemLoaded = _ref.onContentItemLoaded;
572
+ var _useContentItemContex = useContentItemContext({
375
573
  initialItemId: initialItemId,
376
574
  initialItemCodex: initialItemCodex,
377
- initialItemConfiguration: initialItemConfiguration
575
+ initialItemConfiguration: initialItemConfiguration,
576
+ onContentItemLoaded: onContentItemLoaded
378
577
  }),
379
- contextValue = _useContentItemNaviga.contextValue,
380
- navigateBack = _useContentItemNaviga.navigateBack;
381
- return /*#__PURE__*/jsx(ContentItemNavigationContext.Provider, {
578
+ contextValue = _useContentItemContex.contextValue;
579
+ return /*#__PURE__*/jsxs(ContentItemContext.Provider, {
382
580
  value: contextValue,
383
- children: /*#__PURE__*/jsxs("div", {
384
- className: navigator,
385
- id: "diva-content-item-navigator",
386
- children: [contextValue.canGoBack && /*#__PURE__*/jsx("button", {
387
- className: backButton,
388
- onClick: navigateBack,
389
- id: "diva-content-item-back-button",
390
- "aria-label": "Go back"
391
- }), children]
392
- })
581
+ children: [/*#__PURE__*/jsx(Header, {
582
+ headerClassName: headerClassName,
583
+ onClose: onClose,
584
+ headerWrapperStyle: headerWrapperStyle
585
+ }), children]
393
586
  });
394
587
  }
395
588
 
@@ -397,8 +590,8 @@ var Title = function Title(_ref) {
397
590
  var _ref$item = _ref.item,
398
591
  text = _ref$item.text,
399
592
  style = _ref$item.style;
400
- var _useContentItemNaviga = useContentItemNavigation(),
401
- navigateTo = _useContentItemNaviga.navigateTo;
593
+ var _useContentItem = useContentItem(),
594
+ navigateTo = _useContentItem.navigateTo;
402
595
  if (!text) return /*#__PURE__*/jsx(Fragment, {});
403
596
  var processedContent = processContentItemLinks(text, navigateTo);
404
597
  return /*#__PURE__*/jsx("h4", {
@@ -520,8 +713,8 @@ var RichText = function RichText(_ref) {
520
713
  text = _ref$item.text,
521
714
  style = _ref$item.style;
522
715
  var containerRef = useRef(null);
523
- var _useContentItemNaviga = useContentItemNavigation(),
524
- navigateTo = _useContentItemNaviga.navigateTo;
716
+ var _useContentItem = useContentItem(),
717
+ navigateTo = _useContentItem.navigateTo;
525
718
  var processedContent = processContentItemLinks(text, navigateTo);
526
719
  useEffect(function () {
527
720
  if (!containerRef.current) return;
@@ -605,134 +798,6 @@ var ContentItem = function ContentItem(_ref) {
605
798
  throw new Error('unkonwn type: ' + item.type);
606
799
  };
607
800
 
608
- var useContentItem = function useContentItem(_ref) {
609
- var onContentItemLoaded = _ref.onContentItemLoaded;
610
- var _useDivaCore = useDivaCore(),
611
- _useDivaCore$state = _useDivaCore.state,
612
- apiConfig = _useDivaCore$state.apiConfig,
613
- jwt = _useDivaCore$state.jwt;
614
- var _useTranslation = useTranslation(),
615
- i18n = _useTranslation.i18n;
616
- var _useContentItemNaviga = useContentItemNavigation(),
617
- _useContentItemNaviga2 = _useContentItemNaviga.currentContentItem,
618
- contentItemId = _useContentItemNaviga2.id,
619
- contentItemCodex = _useContentItemNaviga2.codex,
620
- externalConfiguration = _useContentItemNaviga2.configuration,
621
- onContentItemLoadedFromNavigation = _useContentItemNaviga.onContentItemLoaded;
622
- var _useState = useState(externalConfiguration !== null && externalConfiguration !== void 0 ? externalConfiguration : {
623
- content: []
624
- }),
625
- _useState2 = _slicedToArray(_useState, 2),
626
- configuration = _useState2[0],
627
- setConfiguration = _useState2[1];
628
- var deferredConfiguration = useDeferredValue(configuration);
629
- var _useTransition = useTransition(),
630
- _useTransition2 = _slicedToArray(_useTransition, 2),
631
- isPending = _useTransition2[0],
632
- startTransition = _useTransition2[1];
633
- var _useState3 = useState(true),
634
- _useState4 = _slicedToArray(_useState3, 2),
635
- loading = _useState4[0],
636
- setLoading = _useState4[1];
637
- var _useState5 = useState(null),
638
- _useState6 = _slicedToArray(_useState5, 2),
639
- error = _useState6[0],
640
- setError = _useState6[1];
641
- useEffect(function () {
642
- if (contentItemId || contentItemCodex) {
643
- setLoading(true);
644
- setError(null);
645
- getContentItem(apiConfig.catalogService, jwt, contentItemId !== null && contentItemId !== void 0 ? contentItemId : contentItemCodex, i18n.language).then(function (newConfiguration) {
646
- startTransition(function () {
647
- setConfiguration(newConfiguration);
648
- var infoBoxTitle = newConfiguration.content.filter(function (item) {
649
- return item.type === 'Title' && item.text;
650
- }).map(function (item) {
651
- return item.text;
652
- });
653
- onContentItemLoaded === null || onContentItemLoaded === void 0 || onContentItemLoaded(infoBoxTitle[0]);
654
- onContentItemLoadedFromNavigation(infoBoxTitle[0]);
655
- });
656
- })["catch"](function (error) {
657
- setError(error);
658
- })["finally"](function () {
659
- setLoading(false);
660
- });
661
- }
662
- }, [contentItemId, contentItemCodex]);
663
- useEffect(function () {
664
- if (externalConfiguration) {
665
- startTransition(function () {
666
- setConfiguration(externalConfiguration);
667
- var infoBoxTitle = externalConfiguration.content.filter(function (item) {
668
- return item.type === 'Title' && item.text;
669
- }).map(function (item) {
670
- return item.text;
671
- });
672
- onContentItemLoaded === null || onContentItemLoaded === void 0 || onContentItemLoaded(infoBoxTitle[0]);
673
- onContentItemLoadedFromNavigation(infoBoxTitle[0]);
674
- });
675
- setError(null);
676
- setLoading(false);
677
- }
678
- }, [externalConfiguration]);
679
- return {
680
- configuration: configuration,
681
- deferredConfiguration: deferredConfiguration,
682
- loading: loading || isPending,
683
- error: error
684
- };
685
- };
686
- function getContentItem(_x, _x2, _x3, _x4) {
687
- return _getContentItem.apply(this, arguments);
688
- }
689
- function _getContentItem() {
690
- _getContentItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(catalogService, jwt, idOrCodex, lang) {
691
- var fullUrl, res, resData, _e$response;
692
- return _regeneratorRuntime.wrap(function _callee$(_context) {
693
- while (1) switch (_context.prev = _context.next) {
694
- case 0:
695
- fullUrl = catalogService + '/contentItems/' + idOrCodex + '?language=' + lang;
696
- _context.prev = 1;
697
- _context.next = 4;
698
- return axios.get(fullUrl, {
699
- headers: {
700
- Authorization: 'Bearer ' + jwt
701
- }
702
- });
703
- case 4:
704
- res = _context.sent;
705
- resData = res.data;
706
- if (!(res.status !== 200)) {
707
- _context.next = 8;
708
- break;
709
- }
710
- throw new DivaError(resData.error || 'Failed to get content item');
711
- case 8:
712
- return _context.abrupt("return", resData);
713
- case 11:
714
- _context.prev = 11;
715
- _context.t0 = _context["catch"](1);
716
- if (!axios.isAxiosError(_context.t0)) {
717
- _context.next = 15;
718
- break;
719
- }
720
- throw new DivaError(((_e$response = _context.t0.response) === null || _e$response === void 0 || (_e$response = _e$response.data) === null || _e$response === void 0 ? void 0 : _e$response.error) || 'Could not get content item', {
721
- cause: _context.t0
722
- });
723
- case 15:
724
- throw new DivaError('Could not get content item', {
725
- cause: _context.t0
726
- });
727
- case 16:
728
- case "end":
729
- return _context.stop();
730
- }
731
- }, _callee, null, [[1, 11]]);
732
- }));
733
- return _getContentItem.apply(this, arguments);
734
- }
735
-
736
801
  var errorBox = "error-box-coPDD";
737
802
  var css_248z$2 = ".error-box-coPDD {\n color: red;\n text-align: center;\n padding: 20px;\n border: 1px solid red;\n background-color: #ffeeee;\n border-radius: 4px;\n}\n";
738
803
  styleInject(css_248z$2);
@@ -761,23 +826,24 @@ function Loader() {
761
826
  var rootWrapper = "root-wrapper-WNprt";
762
827
  var contentWrapper = "content-wrapper-K5XIs";
763
828
  var loading = "loading-089Ib";
764
- var css_248z = ".root-wrapper-WNprt {\n min-height: 60px;\n position: relative;\n width: 100%;\n padding-left: 40px;\n}\n\n.content-wrapper-K5XIs {\n transition: opacity 0.2s ease-in-out;\n}\n.content-wrapper-K5XIs.loading-089Ib {\n opacity: 0.5;\n}\n";
829
+ var css_248z = ".root-wrapper-WNprt {\n min-height: 60px;\n position: relative;\n overflow: auto;\n}\n\n.content-wrapper-K5XIs {\n transition: opacity 0.2s ease-in-out;\n}\n.content-wrapper-K5XIs.loading-089Ib {\n opacity: 0.5;\n}\n";
765
830
  styleInject(css_248z);
766
831
 
767
- var ContentItems = function ContentItems(props) {
768
- var _deferredConfiguratio;
769
- var _useContentItem = useContentItem(props),
770
- deferredConfiguration = _useContentItem.deferredConfiguration,
832
+ var ContentItems = function ContentItems(_ref) {
833
+ var wrapperStyle = _ref.wrapperStyle;
834
+ var _useContentItem = useContentItem(),
835
+ content = _useContentItem.content,
771
836
  loading$1 = _useContentItem.loading,
772
837
  error = _useContentItem.error;
773
838
  return /*#__PURE__*/jsxs("div", {
774
839
  className: rootWrapper,
775
840
  id: 'diva-content-item',
776
841
  children: [loading$1 && /*#__PURE__*/jsx(Loader, {}), /*#__PURE__*/jsxs("div", {
777
- className: classnames(contentWrapper, _defineProperty({}, loading, loading$1)),
842
+ className: classNames(contentWrapper, _defineProperty({}, loading, loading$1)),
843
+ style: wrapperStyle,
778
844
  children: [error && /*#__PURE__*/jsx(ErrorBox, {
779
845
  error: error
780
- }), (_deferredConfiguratio = deferredConfiguration.content) === null || _deferredConfiguratio === void 0 ? void 0 : _deferredConfiguratio.map(function (item, i) {
846
+ }), content === null || content === void 0 ? void 0 : content.map(function (item, i) {
781
847
  return /*#__PURE__*/jsx(ContentItem, {
782
848
  item: item
783
849
  }, i);
@@ -787,12 +853,16 @@ var ContentItems = function ContentItems(props) {
787
853
  };
788
854
 
789
855
  var ContentItemComponent = function ContentItemComponent(props) {
790
- return /*#__PURE__*/jsx(ContentItemNavigator, {
856
+ return /*#__PURE__*/jsx(ContentItemContextProvider, {
791
857
  initialItemId: props.contentItemId,
792
858
  initialItemCodex: props.contentItemCodex,
793
859
  initialItemConfiguration: props.configuration,
860
+ wrapperStyle: props.wrapperStyle,
861
+ headerWrapperStyle: props.headerWrapperStyle,
862
+ headerClassName: props.headerClassName,
863
+ onContentItemLoaded: props.onContentItemLoaded,
864
+ onClose: props.onClose,
794
865
  children: /*#__PURE__*/jsx(ContentItems, {
795
- onContentItemLoaded: props.onContentItemLoaded,
796
866
  wrapperStyle: props.wrapperStyle
797
867
  })
798
868
  });
@@ -0,0 +1,16 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { Configuration, ContentItemContextType } from '../../types';
3
+ export interface ContentItemContextProviderProps {
4
+ initialItemId?: string;
5
+ initialItemCodex?: string;
6
+ initialItemConfiguration?: Configuration;
7
+ children?: ReactNode;
8
+ headerClassName?: string;
9
+ headerWrapperStyle?: React.CSSProperties;
10
+ onClose?: () => void;
11
+ wrapperStyle?: React.CSSProperties;
12
+ onContentItemLoaded?: (title: string) => void;
13
+ }
14
+ export declare function useContentItem(): ContentItemContextType;
15
+ export declare function ContentItemContextProvider({ initialItemId, initialItemCodex, initialItemConfiguration, children, headerClassName, headerWrapperStyle, onClose, onContentItemLoaded, }: ContentItemContextProviderProps): React.JSX.Element;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/ContentItemContextProvider/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAA6B,SAAS,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAKpE,MAAM,WAAW,+BAA+B;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,wBAAwB,CAAC,EAAE,aAAa,CAAC;IACzC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACnC,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAID,wBAAgB,cAAc,2BAM7B;AAED,wBAAgB,0BAA0B,CAAC,EACzC,aAAa,EACb,gBAAgB,EAChB,wBAAwB,EACxB,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,mBAAmB,GACpB,EAAE,+BAA+B,qBASjC"}
@@ -0,0 +1,12 @@
1
+ import { Configuration, ContentItemState } from '../../types';
2
+ export interface UseContentItemProps {
3
+ currentContentItem?: ContentItemState;
4
+ onContentItemLoaded?: (title: string) => void;
5
+ }
6
+ export declare const useContentItemConfiguration: ({ onContentItemLoaded, currentContentItem, }: UseContentItemProps) => {
7
+ configuration: Configuration;
8
+ loading: boolean;
9
+ error: Error | null;
10
+ };
11
+ export default useContentItemConfiguration;
12
+ //# sourceMappingURL=useContentItemConfiguration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useContentItemConfiguration.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/ContentItemContextProvider/useContentItemConfiguration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAI9D,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;IACtC,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAED,eAAO,MAAM,2BAA2B,iDAGrC,mBAAmB,KAAG;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAmDrB,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { ContentItemContextType } from '../../types';
2
+ import { ContentItemContextProviderProps } from './index';
3
+ export declare const useContentItemContext: ({ initialItemId, initialItemCodex, initialItemConfiguration, onContentItemLoaded, }: ContentItemContextProviderProps) => {
4
+ contextValue: ContentItemContextType;
5
+ };
6
+ //# sourceMappingURL=useContentItemContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useContentItemContext.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/ContentItemContextProvider/useContentItemContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAoB,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAG1D,eAAO,MAAM,qBAAqB,wFAK/B,+BAA+B;;CAkFjC,CAAC"}
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
- import { UseContentItemProps } from './useContentItem';
3
- interface ContentItemsProps extends UseContentItemProps {
2
+ interface ContentItemsProps {
4
3
  wrapperStyle?: React.CSSProperties;
5
4
  }
6
- declare const ContentItems: (props: ContentItemsProps) => React.JSX.Element;
5
+ declare const ContentItems: ({ wrapperStyle }: ContentItemsProps) => React.JSX.Element;
7
6
  export default ContentItems;
8
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/ContentItems/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAuB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAMvE,UAAU,iBAAkB,SAAQ,mBAAmB;IACrD,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CACpC;AAED,QAAA,MAAM,YAAY,UAAW,iBAAiB,sBAY7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/ContentItems/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,UAAU,iBAAiB;IACzB,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CACpC;AAED,QAAA,MAAM,YAAY,qBAAsB,iBAAiB,sBAYxD,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface HeaderProps {
3
+ onClose?: () => void;
4
+ headerClassName?: string;
5
+ headerWrapperStyle?: React.CSSProperties;
6
+ }
7
+ declare const Header: ({ onClose, headerClassName, headerWrapperStyle }: HeaderProps) => React.JSX.Element;
8
+ export default Header;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/Header/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAKvC,UAAU,WAAW;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC1C;AACD,QAAA,MAAM,MAAM,qDAAsD,WAAW,sBAgB5E,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -3,6 +3,6 @@ import { VideoType } from '../../types';
3
3
  type Props = {
4
4
  item: VideoType;
5
5
  };
6
- declare const Video: ({ item: { video, thumb } }: Props) => React.JSX.Element;
6
+ declare const Video: ({ item: { video, thumb, loop } }: Props) => React.JSX.Element;
7
7
  export default Video;
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/Video/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAEjC,QAAA,MAAM,KAAK,+BAAgC,KAAK,sBA4B/C,CAAC;AAEF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/Video/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAEjC,QAAA,MAAM,KAAK,qCAAsC,KAAK,sBAqCrD,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -9,6 +9,9 @@ export interface ContentItemProps {
9
9
  contentItemId?: string;
10
10
  contentItemCodex?: string;
11
11
  wrapperStyle?: React.CSSProperties;
12
+ headerClassName?: string;
13
+ headerWrapperStyle?: React.CSSProperties;
14
+ onClose?: () => void;
12
15
  onContentItemLoaded?: (title: string) => void;
13
16
  }
14
17
  export declare const ContentItemComponent: React.FC<ContentItemProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAIxC,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACnC,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAED,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAU3D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAIxC,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAED,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAe3D,CAAC"}
@@ -5,11 +5,15 @@ export interface ContentItemState {
5
5
  configuration?: Configuration;
6
6
  title?: string;
7
7
  }
8
- export interface ContentItemNavigationContextType {
8
+ export interface ContentItemContextType {
9
9
  navigateTo: (props: ContentItemState) => void;
10
- onContentItemLoaded: (title: string) => void;
10
+ navigateBack: () => void;
11
11
  canGoBack: boolean;
12
- currentContentItem: ContentItemState;
12
+ content?: ContentItemType[];
13
+ loading?: boolean;
14
+ error?: Error | null;
15
+ renderTitle?: TitleType;
16
+ hasNavigations?: boolean;
13
17
  }
14
18
  export interface Configuration {
15
19
  content: ContentItemType[];
@@ -51,6 +55,7 @@ export interface VideoType {
51
55
  type: 'Video';
52
56
  video: string;
53
57
  thumb?: boolean;
58
+ loop?: boolean;
54
59
  }
55
60
  export interface URLType {
56
61
  type: 'URL';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gCAAgC;IAC/C,UAAU,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC9C,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,SAAS,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,gBAAgB,CAAC;CACtC;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;AAErH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AACD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AACD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AACD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC,EAAE,CAAC;IACnC,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACpC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AACD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AACD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC;CACd"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC9C,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;AAErH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AACD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AACD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AACD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC,EAAE,CAAC;IACnC,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACpC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AACD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AACD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC;CACd"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystaldesign/content-item",
3
- "version": "25.8.0-beta.2",
3
+ "version": "25.8.0-beta.20",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "storybook": "storybook dev -p 6006",
@@ -34,5 +34,5 @@
34
34
  },
35
35
  "module": "build/esm/index.js",
36
36
  "types": "./build/types/content-item/src/index.d.ts",
37
- "gitHead": "4333eeff9a165c43b2421ffe3abb4852c6014f08"
37
+ "gitHead": "9c1dd6cded06b2f44d1b0e6ae5234fa07c37d992"
38
38
  }
@@ -1,11 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { Configuration, ContentItemNavigationContextType } from '../../types';
3
- export interface ContentItemNavigatorProps {
4
- initialItemId?: string;
5
- initialItemCodex?: string;
6
- initialItemConfiguration?: Configuration;
7
- children?: ReactNode;
8
- }
9
- export declare function useContentItemNavigation(): ContentItemNavigationContextType;
10
- export declare function ContentItemNavigator({ initialItemId, initialItemCodex, initialItemConfiguration, children }: ContentItemNavigatorProps): React.JSX.Element;
11
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/ContentItemNavigator/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAA6B,SAAS,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAC;AAI9E,MAAM,WAAW,yBAAyB;IACxC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,wBAAwB,CAAC,EAAE,aAAa,CAAC;IACzC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAID,wBAAgB,wBAAwB,qCAMvC;AAED,wBAAgB,oBAAoB,CAAC,EAAE,aAAa,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,QAAQ,EAAE,EAAE,yBAAyB,qBAWtI"}
@@ -1,7 +0,0 @@
1
- import { ContentItemNavigationContextType } from '../../types';
2
- import { ContentItemNavigatorProps } from './index';
3
- export declare const useContentItemNavigator: ({ initialItemId, initialItemCodex, initialItemConfiguration }: ContentItemNavigatorProps) => {
4
- contextValue: ContentItemNavigationContextType;
5
- navigateBack: () => void;
6
- };
7
- //# sourceMappingURL=useContentItemNavigator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useContentItemNavigator.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/ContentItemNavigator/useContentItemNavigator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gCAAgC,EAAoB,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEpD,eAAO,MAAM,uBAAuB,kEAAmE,yBAAyB;;;CA+D/H,CAAC"}
@@ -1,12 +0,0 @@
1
- import { Configuration } from '../../types';
2
- export interface UseContentItemProps {
3
- onContentItemLoaded?: (title: string) => void;
4
- }
5
- export declare const useContentItem: ({ onContentItemLoaded, }: UseContentItemProps) => {
6
- configuration: Configuration;
7
- deferredConfiguration: Configuration;
8
- loading: boolean;
9
- error: Error | null;
10
- };
11
- export default useContentItem;
12
- //# sourceMappingURL=useContentItem.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useContentItem.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/ContentItems/useContentItem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C,MAAM,WAAW,mBAAmB;IAClC,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAED,eAAO,MAAM,cAAc,6BAExB,mBAAmB,KAAG;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,qBAAqB,EAAE,aAAa,CAAC;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAyDrB,CAAC;AAEF,eAAe,cAAc,CAAC"}