@crystaldesign/content-item 25.3.0-beta.3 → 25.3.0-beta.31
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 +113 -18
- package/build/types/content-item/src/Components/Gallery/index.d.ts +3 -1
- package/build/types/content-item/src/Components/Gallery/index.d.ts.map +1 -1
- package/build/types/content-item/src/Components/Image/index.d.ts +3 -1
- package/build/types/content-item/src/Components/Image/index.d.ts.map +1 -1
- package/build/types/content-item/src/stories/basicItem.stories.d.ts.map +1 -1
- package/build/types/content-item/src/types.d.ts +4 -0
- package/build/types/content-item/src/types.d.ts.map +1 -1
- package/package.json +2 -2
package/build/esm/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import { useDivaCore } from '@crystaldesign/diva-core';
|
|
4
5
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
6
|
import { Swiper, SwiperSlide } from 'swiper/react';
|
|
6
7
|
import { FreeMode, Navigation, Thumbs } from 'swiper/modules';
|
|
@@ -45,8 +46,8 @@ function styleInject(css, ref) {
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
var urlText = "url-text-yHwAC";
|
|
48
|
-
var css_248z$
|
|
49
|
-
styleInject(css_248z$
|
|
49
|
+
var css_248z$5 = ".url-text-yHwAC {\n margin-top: 12px;\n margin-bottom: 12px;\n text-align: right;\n position: relative;\n display: block;\n width: 100%;\n}\n";
|
|
50
|
+
styleInject(css_248z$5);
|
|
50
51
|
|
|
51
52
|
var URL$1 = function URL(_ref) {
|
|
52
53
|
var _ref$item = _ref.item,
|
|
@@ -63,30 +64,90 @@ var URL$1 = function URL(_ref) {
|
|
|
63
64
|
});
|
|
64
65
|
};
|
|
65
66
|
|
|
67
|
+
var imageAndTextWrapper = "image-and-text-wrapper-c1RTN";
|
|
68
|
+
var text = "text-Da-D1";
|
|
69
|
+
var fullscreenButtonWrapper = "fullscreen-button-wrapper-Botqq";
|
|
70
|
+
var fullscreenButton$1 = "fullscreen-button-A4b3x";
|
|
71
|
+
var fullscreenWrapper$1 = "fullscreen-wrapper-GByIA";
|
|
72
|
+
var css_248z$4 = ".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";
|
|
73
|
+
styleInject(css_248z$4);
|
|
74
|
+
|
|
66
75
|
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; }
|
|
67
76
|
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; }
|
|
68
|
-
var
|
|
77
|
+
var _Image = function Image(_ref) {
|
|
69
78
|
var _ref$item = _ref.item,
|
|
70
79
|
image = _ref$item.image,
|
|
71
80
|
cover = _ref$item.cover,
|
|
72
81
|
style = _ref$item.style,
|
|
73
|
-
altText = _ref$item.altText
|
|
82
|
+
altText = _ref$item.altText,
|
|
83
|
+
thumb = _ref$item.thumb,
|
|
84
|
+
inGallery = _ref$item.inGallery,
|
|
85
|
+
disableFullscreen = _ref$item.disableFullscreen,
|
|
86
|
+
inFullscreen = _ref.inFullscreen;
|
|
74
87
|
var styles = {};
|
|
88
|
+
var _useDivaCore = useDivaCore(),
|
|
89
|
+
openFullscreen = _useDivaCore.actions.openFullscreen;
|
|
75
90
|
if (!image) return /*#__PURE__*/jsx(Fragment, {});
|
|
76
91
|
var urlObj = new URL(image);
|
|
92
|
+
var showAltText = !thumb && altText;
|
|
93
|
+
var showFullscreenButton = !inGallery && !inFullscreen && !disableFullscreen && !thumb;
|
|
77
94
|
if (!cover) {
|
|
78
95
|
styles.maxWidth = '100%';
|
|
79
|
-
styles.maxHeight = '100%';
|
|
96
|
+
styles.maxHeight = showAltText && inGallery ? 'calc(100% - 48px)' : '100%';
|
|
80
97
|
} else {
|
|
81
98
|
styles.objectFit = 'cover';
|
|
82
99
|
styles.minWidth = '100%';
|
|
83
|
-
styles.minHeight = '100%';
|
|
100
|
+
styles.minHeight = showAltText && inGallery ? 'calc(100% - 48px)' : '100%';
|
|
84
101
|
}
|
|
85
|
-
|
|
102
|
+
var openFullscreenClick = function openFullscreenClick() {
|
|
103
|
+
openFullscreen({
|
|
104
|
+
absoluteFullscreen: true,
|
|
105
|
+
overwrittenZIndex: 3000000,
|
|
106
|
+
content: /*#__PURE__*/jsxs("div", {
|
|
107
|
+
id: "diva-content-item",
|
|
108
|
+
className: fullscreenWrapper$1,
|
|
109
|
+
children: [/*#__PURE__*/jsx(_Image, {
|
|
110
|
+
item: {
|
|
111
|
+
image: image,
|
|
112
|
+
cover: cover,
|
|
113
|
+
style: style,
|
|
114
|
+
altText: altText,
|
|
115
|
+
thumb: thumb,
|
|
116
|
+
type: 'Image'
|
|
117
|
+
},
|
|
118
|
+
inFullscreen: true
|
|
119
|
+
}), ","]
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
var imageComponent = /*#__PURE__*/jsx("img", {
|
|
86
124
|
alt: altText,
|
|
87
125
|
style: _objectSpread$2(_objectSpread$2({}, styles), style),
|
|
88
126
|
src: urlObj.toString()
|
|
89
127
|
});
|
|
128
|
+
if (showFullscreenButton) {
|
|
129
|
+
imageComponent = /*#__PURE__*/jsxs("div", {
|
|
130
|
+
className: fullscreenButtonWrapper,
|
|
131
|
+
style: styles,
|
|
132
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
133
|
+
className: fullscreenButton$1,
|
|
134
|
+
onClick: openFullscreenClick
|
|
135
|
+
}), imageComponent]
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (showAltText) {
|
|
139
|
+
return /*#__PURE__*/jsxs("div", {
|
|
140
|
+
className: imageAndTextWrapper,
|
|
141
|
+
style: inGallery ? {
|
|
142
|
+
height: '100%'
|
|
143
|
+
} : undefined,
|
|
144
|
+
children: [imageComponent, /*#__PURE__*/jsx("div", {
|
|
145
|
+
className: text,
|
|
146
|
+
children: altText
|
|
147
|
+
})]
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
return imageComponent;
|
|
90
151
|
};
|
|
91
152
|
|
|
92
153
|
var videoClass = "videoClass-jg-N2";
|
|
@@ -155,29 +216,61 @@ var Title = function Title(_ref) {
|
|
|
155
216
|
var css_248z$1 = "/*Free mode*/\n#diva-content-item .swiper-free-mode > .swiper-wrapper {\n transition-timing-function: ease-out;\n margin: 0 auto;\n}\n/*navigation*/\n:root {\n --swiper-navigation-size: 44px;\n}\n#diva-content-item .swiper-button-next,\n#diva-content-item .swiper-button-prev {\n position: absolute;\n top: 50%;\n width: calc(44px / 44 * 27);\n width: calc(var(--swiper-navigation-size) / 44 * 27);\n height: 44px;\n height: var(--swiper-navigation-size);\n margin-top: calc(0px - (44px / 2));\n margin-top: calc(0px - (var(--swiper-navigation-size) / 2));\n z-index: 10;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: #007aff;\n color: var(--swiper-navigation-color, var(--swiper-theme-color));\n}\n#diva-content-item .swiper-button-next.swiper-button-disabled,\n#diva-content-item .swiper-button-prev.swiper-button-disabled {\n opacity: 0.35;\n cursor: auto;\n pointer-events: none;\n}\n#diva-content-item .swiper-button-next.swiper-button-hidden,\n#diva-content-item .swiper-button-prev.swiper-button-hidden {\n opacity: 0;\n cursor: auto;\n pointer-events: none;\n}\n#diva-content-item .swiper-navigation-disabled .swiper-button-next,\n#diva-content-item .swiper-navigation-disabled .swiper-button-prev {\n display: none !important;\n}\n#diva-content-item .swiper-button-next:after,\n#diva-content-item .swiper-button-prev:after {\n text-transform: none !important;\n}\n#diva-content-item .swiper-button-next:after,\n#diva-content-item .swiper-button-prev:after {\n font-family: swiper-icons;\n font-size: 44px;\n font-size: var(--swiper-navigation-size);\n letter-spacing: 0;\n font-feature-settings: ;\n font-variant: normal;\n font-variant: initial;\n line-height: 1;\n}\n#diva-content-item .swiper-button-prev,\n#diva-content-item .swiper-rtl .swiper-button-next {\n left: 10px;\n right: auto;\n}\n#diva-content-item .swiper-button-prev:after,\n#diva-content-item .swiper-rtl .swiper-button-next:after {\n content: 'prev';\n}\n#diva-content-item .swiper-button-next,\n#diva-content-item .swiper-rtl .swiper-button-prev {\n right: 10px;\n left: auto;\n}\n#diva-content-item .swiper-button-next:after,\n#diva-content-item .swiper-rtl .swiper-button-prev:after {\n content: 'next';\n}\n#diva-content-item .swiper-button-lock {\n display: none;\n}\n\n/*swiper min css*/\n\n@font-face {\n font-family: swiper-icons;\n src: url('data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4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JCZgZNBkYGLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA');\n font-weight: 400;\n font-style: normal;\n}\n:root {\n --swiper-theme-color: #007aff;\n}\n#diva-content-item .swiper {\n margin-left: auto;\n margin-right: auto;\n position: relative;\n overflow: hidden;\n list-style: none;\n padding: 0;\n z-index: 1;\n}\n#diva-content-item .swiper-vertical > .swiper-wrapper {\n flex-direction: column;\n}\n#diva-content-item .swiper-wrapper {\n position: relative;\n width: 100%;\n height: 100%;\n z-index: 1;\n display: flex;\n transition-property: transform;\n box-sizing: content-box;\n}\n#diva-content-item .swiper-android .swiper-slide,\n#diva-content-item .swiper-wrapper {\n transform: translate3d(0px, 0, 0);\n}\n#diva-content-item .swiper-pointer-events {\n touch-action: pan-y;\n}\n#diva-content-item .swiper-pointer-events.swiper-vertical {\n touch-action: pan-x;\n}\n#diva-content-item .swiper-slide {\n flex-shrink: 0;\n width: 100%;\n height: 100%;\n position: relative;\n transition-property: transform;\n}\n#diva-content-item .swiper-slide-invisible-blank {\n visibility: hidden;\n}\n#diva-content-item .swiper-autoheight,\n#diva-content-item .swiper-autoheight .swiper-slide {\n height: auto;\n}\n#diva-content-item .swiper-autoheight .swiper-wrapper {\n align-items: flex-start;\n transition-property: transform, height;\n}\n#diva-content-item .swiper-backface-hidden .swiper-slide {\n transform: translateZ(0);\n backface-visibility: hidden;\n}\n#diva-content-item .swiper-3d,\n#diva-content-item .swiper-3d.swiper-css-mode .swiper-wrapper {\n perspective: 1200px;\n}\n#diva-content-item .swiper-3d .swiper-cube-shadow,\n#diva-content-item .swiper-3d .swiper-slide,\n#diva-content-item .swiper-3d .swiper-slide-shadow,\n#diva-content-item .swiper-3d .swiper-slide-shadow-bottom,\n#diva-content-item .swiper-3d .swiper-slide-shadow-left,\n#diva-content-item .swiper-3d .swiper-slide-shadow-right,\n#diva-content-item .swiper-3d .swiper-slide-shadow-top,\n#diva-content-item .swiper-3d .swiper-wrapper {\n transform-style: preserve-3d;\n}\n#diva-content-item .swiper-3d .swiper-slide-shadow,\n#diva-content-item .swiper-3d .swiper-slide-shadow-bottom,\n#diva-content-item .swiper-3d .swiper-slide-shadow-left,\n#diva-content-item .swiper-3d .swiper-slide-shadow-right,\n#diva-content-item .swiper-3d .swiper-slide-shadow-top {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n z-index: 10;\n}\n#diva-content-item .swiper-3d .swiper-slide-shadow {\n background: rgba(0, 0, 0, 0.15);\n}\n#diva-content-item .swiper-3d .swiper-slide-shadow-left {\n background-image: linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n}\n#diva-content-item .swiper-3d .swiper-slide-shadow-right {\n background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n}\n#diva-content-item .swiper-3d .swiper-slide-shadow-top {\n background-image: linear-gradient(to top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n}\n#diva-content-item .swiper-3d .swiper-slide-shadow-bottom {\n background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n}\n#diva-content-item .swiper-css-mode > .swiper-wrapper {\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n#diva-content-item .swiper-css-mode > .swiper-wrapper::-webkit-scrollbar {\n display: none;\n}\n#diva-content-item .swiper-css-mode > .swiper-wrapper > .swiper-slide {\n scroll-snap-align: start start;\n}\n#diva-content-item .swiper-horizontal.swiper-css-mode > .swiper-wrapper {\n scroll-snap-type: x mandatory;\n}\n#diva-content-item .swiper-vertical.swiper-css-mode > .swiper-wrapper {\n scroll-snap-type: y mandatory;\n}\n#diva-content-item .swiper-centered > .swiper-wrapper::before {\n content: '';\n flex-shrink: 0;\n order: 9999;\n}\n[dir=\"ltr\"] #diva-content-item .swiper-centered.swiper-horizontal > .swiper-wrapper > .swiper-slide:first-child {\n margin-left: var(--swiper-centered-offset-before);\n}\n[dir=\"rtl\"] #diva-content-item .swiper-centered.swiper-horizontal > .swiper-wrapper > .swiper-slide:first-child {\n margin-right: var(--swiper-centered-offset-before);\n}\n#diva-content-item .swiper-centered.swiper-horizontal > .swiper-wrapper::before {\n height: 100%;\n min-height: 1px;\n width: var(--swiper-centered-offset-after);\n}\n#diva-content-item .swiper-centered.swiper-vertical > .swiper-wrapper > .swiper-slide:first-child {\n margin-top: var(--swiper-centered-offset-before);\n}\n#diva-content-item .swiper-centered.swiper-vertical > .swiper-wrapper::before {\n width: 100%;\n min-width: 1px;\n height: var(--swiper-centered-offset-after);\n}\n#diva-content-item .swiper-centered > .swiper-wrapper > .swiper-slide {\n scroll-snap-align: center center;\n}\n";
|
|
156
217
|
styleInject(css_248z$1);
|
|
157
218
|
|
|
219
|
+
var fullscreenWrapper = "fullscreen-wrapper-TiWjP";
|
|
220
|
+
var fullscreenButton = "fullscreen-button-unFbw";
|
|
158
221
|
var mySwiper2 = "mySwiper2-mfrK1";
|
|
159
222
|
var mySwiper = "mySwiper-urn8y";
|
|
160
|
-
var css_248z = "#diva-content-item .swiper {\n width: 100%;\n height: 100%;\n}\n#diva-content-item .swiper-slide {\n text-align: center;\n font-size: 18px;\n background: #fff;\n\n /* Center slide text vertically */\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n#diva-content-item .swiper {\n width: 100%;\n height:
|
|
223
|
+
var css_248z = "#diva-content-item .swiper {\n width: 100%;\n height: 100%;\n}\n#diva-content-item .swiper-slide {\n text-align: center;\n font-size: 18px;\n background: #fff;\n\n /* Center slide text vertically */\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.fullscreen-wrapper-TiWjP {\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\n.fullscreen-button-unFbw {\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.mobile #diva-content-item .swiper-slide {\n background: transparent none repeat 0 0 / auto auto padding-box border-box scroll;\n background: initial;\n}\n\n#diva-content-item .swiper {\n width: 100%;\n height: 350px;\n margin-left: auto;\n margin-right: auto;\n}\n\n.diva-fullscreen #DivaContentItemGallery {\n height: 90% !important;\n width: 90% !important;\n}\n\n.diva-fullscreen #diva-content-item .mySwiper2-mfrK1 {\n height: 100%;\n}\n\n#diva-content-item .swiper-slide {\n background-size: cover;\n background-position: center;\n}\n#diva-content-item .mySwiper2-mfrK1 {\n height: 80%;\n width: 100%;\n}\n#diva-content-item .mySwiper-urn8y {\n height: 20%;\n box-sizing: border-box;\n padding: 10px 0;\n}\n#diva-content-item .mySwiper-urn8y .swiper-slide {\n width: 25%;\n height: 100%;\n opacity: 0.4;\n}\n#diva-content-item .mySwiper-urn8y .swiper-slide-thumb-active {\n opacity: 1;\n}\n";
|
|
161
224
|
styleInject(css_248z);
|
|
162
225
|
|
|
163
226
|
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; }
|
|
164
227
|
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; }
|
|
165
|
-
var
|
|
228
|
+
var _Gallery = function Gallery(_ref) {
|
|
166
229
|
var _ref$item = _ref.item,
|
|
167
230
|
content = _ref$item.content,
|
|
168
|
-
wrappingStyle = _ref$item.wrappingStyle
|
|
231
|
+
wrappingStyle = _ref$item.wrappingStyle,
|
|
232
|
+
disableFullscreen = _ref$item.disableFullscreen,
|
|
233
|
+
inFullscreen = _ref.inFullscreen;
|
|
169
234
|
var _useState = useState(null),
|
|
170
235
|
_useState2 = _slicedToArray(_useState, 2),
|
|
171
236
|
thumbsSwiper = _useState2[0],
|
|
172
237
|
setThumbsSwiper = _useState2[1];
|
|
238
|
+
var _useDivaCore = useDivaCore(),
|
|
239
|
+
openFullscreen = _useDivaCore.actions.openFullscreen;
|
|
173
240
|
if (content.length == 0) return /*#__PURE__*/jsx(Fragment, {});
|
|
174
241
|
if (content.length == 1) return /*#__PURE__*/jsx(ContentItem, {
|
|
175
|
-
item: _objectSpread$1({}, content[0])
|
|
242
|
+
item: _objectSpread$1(_objectSpread$1({}, content[0]), {
|
|
243
|
+
disableFullscreen: disableFullscreen
|
|
244
|
+
})
|
|
176
245
|
});
|
|
246
|
+
var openFullscreenClick = function openFullscreenClick() {
|
|
247
|
+
openFullscreen({
|
|
248
|
+
absoluteFullscreen: true,
|
|
249
|
+
overwrittenZIndex: 3000000,
|
|
250
|
+
content: /*#__PURE__*/jsxs("div", {
|
|
251
|
+
id: "diva-content-item",
|
|
252
|
+
className: fullscreenWrapper,
|
|
253
|
+
children: [/*#__PURE__*/jsx(_Gallery, {
|
|
254
|
+
item: {
|
|
255
|
+
content: content,
|
|
256
|
+
wrappingStyle: wrappingStyle,
|
|
257
|
+
type: 'Gallery'
|
|
258
|
+
},
|
|
259
|
+
inFullscreen: true
|
|
260
|
+
}), ","]
|
|
261
|
+
})
|
|
262
|
+
});
|
|
263
|
+
};
|
|
177
264
|
return /*#__PURE__*/jsxs("div", {
|
|
178
|
-
|
|
265
|
+
id: 'DivaContentItemGallery',
|
|
266
|
+
style: _objectSpread$1(_objectSpread$1({}, wrappingStyle), {}, {
|
|
267
|
+
position: 'relative'
|
|
268
|
+
}),
|
|
179
269
|
className: "diva-stop-swipe-detection",
|
|
180
|
-
children: [/*#__PURE__*/jsx(
|
|
270
|
+
children: [!inFullscreen && !disableFullscreen && /*#__PURE__*/jsx("div", {
|
|
271
|
+
className: fullscreenButton,
|
|
272
|
+
onClick: openFullscreenClick
|
|
273
|
+
}), /*#__PURE__*/jsx(Swiper, {
|
|
181
274
|
style: {
|
|
182
275
|
'--swiper-navigation-color': '#fff',
|
|
183
276
|
'--swiper-pagination-color': '#fff'
|
|
@@ -192,7 +285,9 @@ var Gallery = function Gallery(_ref) {
|
|
|
192
285
|
children: content.map(function (item, i) {
|
|
193
286
|
return /*#__PURE__*/jsx(SwiperSlide, {
|
|
194
287
|
children: /*#__PURE__*/jsx(ContentItem, {
|
|
195
|
-
item: item
|
|
288
|
+
item: _objectSpread$1(_objectSpread$1({}, item), {}, {
|
|
289
|
+
inGallery: true
|
|
290
|
+
})
|
|
196
291
|
})
|
|
197
292
|
}, i);
|
|
198
293
|
})
|
|
@@ -207,9 +302,9 @@ var Gallery = function Gallery(_ref) {
|
|
|
207
302
|
children: content.map(function (item, i) {
|
|
208
303
|
return /*#__PURE__*/jsx(SwiperSlide, {
|
|
209
304
|
children: /*#__PURE__*/jsx(ContentItem, {
|
|
210
|
-
item: _objectSpread$1(_objectSpread$1({}, item),
|
|
305
|
+
item: _objectSpread$1(_objectSpread$1({}, item), {}, {
|
|
211
306
|
thumb: true
|
|
212
|
-
}
|
|
307
|
+
})
|
|
213
308
|
})
|
|
214
309
|
}, i);
|
|
215
310
|
})
|
|
@@ -247,11 +342,11 @@ var ContentItem = function ContentItem(_ref) {
|
|
|
247
342
|
var item = _ref.item;
|
|
248
343
|
switch (item.type) {
|
|
249
344
|
case 'Gallery':
|
|
250
|
-
return /*#__PURE__*/jsx(
|
|
345
|
+
return /*#__PURE__*/jsx(_Gallery, {
|
|
251
346
|
item: item
|
|
252
347
|
});
|
|
253
348
|
case 'Image':
|
|
254
|
-
return /*#__PURE__*/jsx(
|
|
349
|
+
return /*#__PURE__*/jsx(_Image, {
|
|
255
350
|
item: item
|
|
256
351
|
});
|
|
257
352
|
case 'RichText':
|
|
@@ -4,6 +4,8 @@ import { GalleryType } from '../../types';
|
|
|
4
4
|
type Props = {
|
|
5
5
|
item: GalleryType;
|
|
6
6
|
};
|
|
7
|
-
declare const Gallery: ({ item: { content, wrappingStyle } }: Props
|
|
7
|
+
declare const Gallery: ({ item: { content, wrappingStyle, disableFullscreen }, inFullscreen }: Props & {
|
|
8
|
+
inFullscreen?: boolean;
|
|
9
|
+
}) => React.JSX.Element;
|
|
8
10
|
export default Gallery;
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/Gallery/index.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/Gallery/index.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO1C,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAEnC,QAAA,MAAM,OAAO,0EAA2E,KAAK,GAAG;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,sBA6DzH,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -3,6 +3,8 @@ import { ImageType } from '../../types';
|
|
|
3
3
|
type Props = {
|
|
4
4
|
item: ImageType;
|
|
5
5
|
};
|
|
6
|
-
declare const Image: ({ item: { image, cover, style, altText } }: Props
|
|
6
|
+
declare const Image: ({ item: { image, cover, style, altText, thumb, inGallery, disableFullscreen }, inFullscreen }: Props & {
|
|
7
|
+
inFullscreen?: boolean;
|
|
8
|
+
}) => React.JSX.Element;
|
|
7
9
|
export default Image;
|
|
8
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/Image/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Components/Image/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAEjC,QAAA,MAAM,KAAK,kGAAmG,KAAK,GAAG;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,sBAoD/I,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basicItem.stories.d.ts","sourceRoot":"","sources":["../../../../../src/stories/basicItem.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kCAAkC,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGvD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CAWhC,CAAC;AACF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,SAAS,CAAC,CAAC;AAExC,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"basicItem.stories.d.ts","sourceRoot":"","sources":["../../../../../src/stories/basicItem.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kCAAkC,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGvD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CAWhC,CAAC;AACF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,SAAS,CAAC,CAAC;AAExC,eAAO,MAAM,cAAc,EAAE,KA8B5B,CAAC"}
|
|
@@ -19,6 +19,7 @@ export interface GalleryType {
|
|
|
19
19
|
type: 'Gallery';
|
|
20
20
|
content: (ImageType | VideoType)[];
|
|
21
21
|
wrappingStyle?: React.CSSProperties;
|
|
22
|
+
disableFullscreen?: boolean;
|
|
22
23
|
}
|
|
23
24
|
export interface ImageType {
|
|
24
25
|
type: 'Image';
|
|
@@ -26,6 +27,9 @@ export interface ImageType {
|
|
|
26
27
|
altText?: string;
|
|
27
28
|
cover?: boolean;
|
|
28
29
|
style?: React.CSSProperties;
|
|
30
|
+
thumb?: boolean;
|
|
31
|
+
inGallery?: boolean;
|
|
32
|
+
disableFullscreen?: boolean;
|
|
29
33
|
}
|
|
30
34
|
export interface VideoType {
|
|
31
35
|
type: 'Video';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,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;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,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;C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": "25.3.0-beta.31",
|
|
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": "4e02d7922c3894835caaf0619ae30776098aeb6b"
|
|
38
38
|
}
|