infinity-forge 8.5.0 → 8.5.1
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.
|
@@ -3,24 +3,70 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
3
3
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
4
|
return cooked;
|
|
5
5
|
};
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
6
39
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
40
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
41
|
};
|
|
9
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
43
|
exports.ZoomOnHover = void 0;
|
|
11
44
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
12
|
-
var react_1 = require("react");
|
|
45
|
+
var react_1 = __importStar(require("react"));
|
|
13
46
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
14
|
-
var Container = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 100%;\n"], ["\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 100%;\n"])));
|
|
47
|
+
var Container = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 100%;\n cursor: zoom-in;\n"], ["\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 100%;\n cursor: zoom-in;\n"])));
|
|
15
48
|
var ZoomContent = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n transition: transform 0.3s ease;\n will-change: transform;\n transform: ", ";\n transform-origin: center center;\n"], ["\n width: 100%;\n height: 100%;\n transition: transform 0.3s ease;\n will-change: transform;\n transform: ", ";\n transform-origin: center center;\n"])), function (_a) {
|
|
16
49
|
var isZoomed = _a.isZoomed, zoom = _a.zoom;
|
|
17
50
|
return (isZoomed ? "scale(".concat(zoom, ")") : 'scale(1)');
|
|
18
51
|
});
|
|
52
|
+
var ModalOverlay = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: rgba(0, 0, 0, 0.9);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 9999;\n"], ["\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: rgba(0, 0, 0, 0.9);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 9999;\n"])));
|
|
53
|
+
var ModalImageWrapper = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n max-width: 100%;\n max-height: 100%;\n overflow: auto;\n"], ["\n max-width: 100%;\n max-height: 100%;\n overflow: auto;\n"])));
|
|
19
54
|
var ZoomOnHover = function (_a) {
|
|
20
55
|
var children = _a.children, _b = _a.zoom, zoom = _b === void 0 ? 2 : _b;
|
|
21
56
|
var wrapperRef = (0, react_1.useRef)(null);
|
|
22
57
|
var contentRef = (0, react_1.useRef)(null);
|
|
23
58
|
var _c = (0, react_1.useState)(false), isZoomed = _c[0], setIsZoomed = _c[1];
|
|
59
|
+
var _d = (0, react_1.useState)(false), isMobile = _d[0], setIsMobile = _d[1];
|
|
60
|
+
var _e = (0, react_1.useState)(false), isModalOpen = _e[0], setIsModalOpen = _e[1];
|
|
61
|
+
// Detecta mobile com base na largura da janela
|
|
62
|
+
(0, react_1.useEffect)(function () {
|
|
63
|
+
var checkMobile = function () {
|
|
64
|
+
setIsMobile(window.innerWidth < 1024);
|
|
65
|
+
};
|
|
66
|
+
checkMobile();
|
|
67
|
+
window.addEventListener('resize', checkMobile);
|
|
68
|
+
return function () { return window.removeEventListener('resize', checkMobile); };
|
|
69
|
+
}, []);
|
|
24
70
|
var handleMouseMove = function (e) {
|
|
25
71
|
if (!wrapperRef.current || !contentRef.current)
|
|
26
72
|
return;
|
|
@@ -33,8 +79,19 @@ var ZoomOnHover = function (_a) {
|
|
|
33
79
|
var handleMouseLeave = function () {
|
|
34
80
|
setIsZoomed(false);
|
|
35
81
|
};
|
|
36
|
-
|
|
82
|
+
var handleClick = function () {
|
|
83
|
+
if (isMobile) {
|
|
84
|
+
setIsModalOpen(true);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Container, { ref: wrapperRef, onMouseMove: !isMobile ? handleMouseMove : undefined, onMouseLeave: !isMobile ? handleMouseLeave : undefined, onClick: handleClick, children: (0, jsx_runtime_1.jsx)(ZoomContent, { ref: contentRef, zoom: zoom, isZoomed: !isMobile && isZoomed, children: children }) }), isModalOpen && ((0, jsx_runtime_1.jsx)(ModalOverlay, { onClick: function () { return setIsModalOpen(false); }, children: (0, jsx_runtime_1.jsx)(ModalImageWrapper, { children: react_1.default.cloneElement(children, {
|
|
88
|
+
style: {
|
|
89
|
+
width: '100%',
|
|
90
|
+
height: 'auto',
|
|
91
|
+
objectFit: 'contain',
|
|
92
|
+
},
|
|
93
|
+
}) }) }))] }));
|
|
37
94
|
};
|
|
38
95
|
exports.ZoomOnHover = ZoomOnHover;
|
|
39
|
-
var templateObject_1, templateObject_2;
|
|
96
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
40
97
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/components/zoom-hover/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/components/zoom-hover/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2D;AAC3D,wEAAuC;AAOvC,IAAM,SAAS,GAAG,2BAAM,CAAC,GAAG,wKAAA,qGAM3B,IAAA,CAAC;AAEF,IAAM,WAAW,GAAG,2BAAM,CAAC,GAAG,+NAAqC,iHAKpD,EAAkE,yCAEhF,KAFc,UAAC,EAAkB;QAAhB,QAAQ,cAAA,EAAE,IAAI,UAAA;IAAO,OAAA,CAAC,QAAQ,CA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