@crystaldesign/content-item 25.11.0-beta.3 → 25.11.0-beta.30
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/build/esm/index.js +29 -7
- package/build/types/content-item/src/Components/ContentItemContextProvider/useContentItemContext.d.ts.map +1 -1
- package/build/types/content-item/src/Components/Video/index.d.ts.map +1 -1
- package/build/types/content-item/src/types.d.ts +1 -0
- package/build/types/content-item/src/types.d.ts.map +1 -1
- package/package.json +2 -2
package/build/esm/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import { useState, useDeferredValue, useTransition, useEffect, useCallback, useM
|
|
|
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
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
6
5
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
6
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
7
7
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
8
8
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
9
9
|
import axios from 'axios';
|
|
@@ -240,6 +240,10 @@ var Video = function Video(_ref) {
|
|
|
240
240
|
video = _ref$item.video,
|
|
241
241
|
thumb = _ref$item.thumb,
|
|
242
242
|
loop = _ref$item.loop;
|
|
243
|
+
var _useState = useState(false),
|
|
244
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
245
|
+
showControls = _useState2[0],
|
|
246
|
+
setShowControls = _useState2[1];
|
|
243
247
|
if (!video) return /*#__PURE__*/jsx(Fragment, {});
|
|
244
248
|
if (video.includes('youtube.com') || video.includes('youtu.be')) {
|
|
245
249
|
if (thumb) return /*#__PURE__*/jsx("div", {
|
|
@@ -268,10 +272,24 @@ var Video = function Video(_ref) {
|
|
|
268
272
|
className: videoClass,
|
|
269
273
|
"aria-disabled": thumb,
|
|
270
274
|
disablePictureInPicture: thumb,
|
|
271
|
-
controls: !thumb,
|
|
275
|
+
controls: !thumb && showControls,
|
|
272
276
|
playsInline: true,
|
|
273
277
|
autoPlay: !thumb,
|
|
274
278
|
loop: !thumb && loop,
|
|
279
|
+
onClick: function onClick() {
|
|
280
|
+
return setShowControls(true);
|
|
281
|
+
},
|
|
282
|
+
onTouchStart: function onTouchStart() {
|
|
283
|
+
return setShowControls(true);
|
|
284
|
+
} // for iOS Safari
|
|
285
|
+
,
|
|
286
|
+
onMouseEnter: function onMouseEnter() {
|
|
287
|
+
return setShowControls(true);
|
|
288
|
+
},
|
|
289
|
+
onMouseLeave: function onMouseLeave() {
|
|
290
|
+
return setShowControls(false);
|
|
291
|
+
} // optional: hide again
|
|
292
|
+
,
|
|
275
293
|
children: /*#__PURE__*/jsx("source", {
|
|
276
294
|
src: video + (thumb ? '#t=2' : ''),
|
|
277
295
|
type: video.includes('.mp4') ? 'video/mp4' : 'video/webm'
|
|
@@ -410,6 +428,7 @@ function _getContentItem() {
|
|
|
410
428
|
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
429
|
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
430
|
var useContentItemContext = function useContentItemContext(_ref) {
|
|
431
|
+
var _navigationState$curr;
|
|
413
432
|
var initialItemId = _ref.initialItemId,
|
|
414
433
|
initialItemCodex = _ref.initialItemCodex,
|
|
415
434
|
initialItemConfiguration = _ref.initialItemConfiguration,
|
|
@@ -497,7 +516,8 @@ var useContentItemContext = function useContentItemContext(_ref) {
|
|
|
497
516
|
content: content,
|
|
498
517
|
loading: loading,
|
|
499
518
|
error: error,
|
|
500
|
-
hasNavigations: hasNavigations
|
|
519
|
+
hasNavigations: hasNavigations,
|
|
520
|
+
currentIdOrCodex: (_navigationState$curr = navigationState.current.id) !== null && _navigationState$curr !== void 0 ? _navigationState$curr : navigationState.current.codex
|
|
501
521
|
};
|
|
502
522
|
return {
|
|
503
523
|
contextValue: contextValue
|
|
@@ -509,7 +529,7 @@ var paddingLeft = "padding-left-The7U";
|
|
|
509
529
|
var headerLeft = "header-left-pbZcL";
|
|
510
530
|
var backButton = "back-button-2IUJb";
|
|
511
531
|
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 position: relative;\n}\n.padding-left-The7U {\n padding-left: 34px !important;\n}\n.header-left-pbZcL {\n display: flex;\n align-items: center;\n width: 90%;\n}\n\n.back-button-2IUJb,\n.close-button-VW8Z5 {\n
|
|
532
|
+
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 position: relative;\n}\n.padding-left-The7U {\n padding-left: 34px !important;\n}\n.header-left-pbZcL {\n display: flex;\n align-items: center;\n width: 90%;\n}\n\n.back-button-2IUJb,\n.close-button-VW8Z5 {\n width: 32px;\n height: 32px;\n cursor: pointer;\n border: 1px solid transparent;\n transition:\n background-color 0.2s ease,\n background-size 0.2s ease,\n border-color 0.2s ease-in,\n background-image 0.2s ease-in;\n padding: 0px;\n border-radius: 50%;\n aspect-ratio: 1 / 1;\n z-index: 1000;\n align-self: center;\n}\n.back-button-2IUJb:hover,\n.close-button-VW8Z5:hover {\n border: 1px solid #aaa;\n}\n\n.back-button-2IUJb {\n background: center / 70% no-repeat url(\"data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 width%3D%2224%22 height%3D%2224%22 viewBox%3D%220 0 24 24%22 fill%3D%22none%22 stroke%3D%22%23cccccc%22 stroke-width%3D%221.5%22 stroke-linecap%3D%22round%22 stroke-linejoin%3D%22round%22%3E %3Cpath d%3D%22m12 19-7-7 7-7%22%3E%3C%2Fpath%3E %3Cpath d%3D%22M19 12H5%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E\");\n}\n\n.close-button-VW8Z5 {\n background: center / 70% no-repeat url(\"data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 height%3D%2248%22 viewBox%3D%220 -960 960 960%22 width%3D%2248%22 fill%3D%22%23ccc%22%3E%3Cpath d%3D%22m249-207-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z%22%2F%3E%3C%2Fsvg%3E\");\n}\n\n.close-button-VW8Z5:hover {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 height%3D%2248%22 viewBox%3D%220 -960 960 960%22 width%3D%2248%22 fill%3D%22%23aaa%22%3E%3Cpath d%3D%22m249-207-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z%22%2F%3E%3C%2Fsvg%3E\");\n}\n";
|
|
513
533
|
styleInject(css_248z$5);
|
|
514
534
|
|
|
515
535
|
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; }
|
|
@@ -672,6 +692,7 @@ var _Gallery = function Gallery(_ref) {
|
|
|
672
692
|
position: 'relative'
|
|
673
693
|
}),
|
|
674
694
|
className: "diva-stop-swipe-detection",
|
|
695
|
+
"data-vaul-no-drag": true,
|
|
675
696
|
children: [!inFullscreen && !disableFullscreen && /*#__PURE__*/jsx("div", {
|
|
676
697
|
className: fullscreenButton,
|
|
677
698
|
onClick: openFullscreenClick
|
|
@@ -837,7 +858,7 @@ function Loader() {
|
|
|
837
858
|
var rootWrapper = "root-wrapper-WNprt";
|
|
838
859
|
var contentWrapper = "content-wrapper-K5XIs";
|
|
839
860
|
var loading = "loading-089Ib";
|
|
840
|
-
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\n.content-wrapper-K5XIs .content-item-link {\n touch-action: manipulation;\n color: #1668dc;\n text-decoration: none;\n background-color: transparent;\n outline: none;\n cursor: pointer;\n transition: color 0.2s ease-in-out;\n}\n\n.content-wrapper-K5XIs .content-item-link:hover {\n color: #15417e;\n}\n";
|
|
861
|
+
var css_248z = ".root-wrapper-WNprt {\n min-height: 60px;\n position: relative;\n overflow: auto;\n overscroll-behavior: contain;\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\n.content-wrapper-K5XIs .content-item-link {\n touch-action: manipulation;\n color: #1668dc;\n text-decoration: none;\n background-color: transparent;\n outline: none;\n cursor: pointer;\n transition: color 0.2s ease-in-out;\n}\n\n.content-wrapper-K5XIs .content-item-link:hover {\n color: #15417e;\n}\n";
|
|
841
862
|
styleInject(css_248z);
|
|
842
863
|
|
|
843
864
|
var ContentItems = function ContentItems(_ref) {
|
|
@@ -845,7 +866,8 @@ var ContentItems = function ContentItems(_ref) {
|
|
|
845
866
|
var _useContentItem = useContentItem(),
|
|
846
867
|
content = _useContentItem.content,
|
|
847
868
|
loading$1 = _useContentItem.loading,
|
|
848
|
-
error = _useContentItem.error
|
|
869
|
+
error = _useContentItem.error,
|
|
870
|
+
currentIdOrCodex = _useContentItem.currentIdOrCodex;
|
|
849
871
|
return /*#__PURE__*/jsxs("div", {
|
|
850
872
|
className: rootWrapper,
|
|
851
873
|
id: 'diva-content-item',
|
|
@@ -860,7 +882,7 @@ var ContentItems = function ContentItems(_ref) {
|
|
|
860
882
|
}, i);
|
|
861
883
|
})]
|
|
862
884
|
})]
|
|
863
|
-
});
|
|
885
|
+
}, currentIdOrCodex);
|
|
864
886
|
};
|
|
865
887
|
|
|
866
888
|
var ContentItemComponent = function ContentItemComponent(props) {
|
|
@@ -1 +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;;
|
|
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;;CAmFjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/Video/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/Video/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAEjC,QAAA,MAAM,KAAK,qCAAsC,KAAK,sBAyCrD,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -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,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;
|
|
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,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AAS,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.11.0-beta.
|
|
3
|
+
"version": "25.11.0-beta.30",
|
|
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": "
|
|
37
|
+
"gitHead": "14eeabb849726be603cb82ed0aa243ceb19f3652"
|
|
38
38
|
}
|