@topconsultnpm/sdkui-react-beta 6.12.153 → 6.12.155

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.
@@ -186,7 +186,6 @@ const ImageViewer = ({ fileBlob, alt = 'Image', className }) => {
186
186
  return () => { };
187
187
  }, [imageUrl]);
188
188
  const fullZoom = baseZoom * zoomFactor;
189
- // const zoomPercent = Math.round(fullZoom * 100);
190
189
  const clampTranslation = (tx, ty, zoom) => {
191
190
  const container = containerRef.current;
192
191
  const image = imageRef.current;
@@ -217,13 +216,6 @@ const ImageViewer = ({ fileBlob, alt = 'Image', className }) => {
217
216
  };
218
217
  const handleZoomIn = () => handleZoom(0.25);
219
218
  const handleZoomOut = () => handleZoom(-0.25);
220
- // const handleRotate = () => setRotation(r => (r + 90) % 360);
221
- const handleResetZoom = () => {
222
- setZoomFactor(1);
223
- setTranslateX(0);
224
- setTranslateY(0);
225
- setRotation(0);
226
- };
227
219
  const onMouseDown = (e) => {
228
220
  if (zoomFactor === 1)
229
221
  return;
@@ -314,15 +306,12 @@ const ImageViewer = ({ fileBlob, alt = 'Image', className }) => {
314
306
  }
315
307
  }, 1000);
316
308
  };
317
- // const btnDisabled = useMemo<boolean>(() => {
318
- // return zoomFactor === 1 && translateX === 0 && translateY === 0 && rotation === 0
319
- // }, [zoomFactor, translateX, translateY, rotation])
320
309
  const cursor = useMemo(() => {
321
310
  if (zoomFactor <= 1)
322
311
  return 'default';
323
312
  return isDragging ? 'grabbing' : 'grab';
324
313
  }, [zoomFactor, isDragging]);
325
- return (_jsxs("div", { style: { position: 'relative', width: '100%', height: '100%' }, children: [_jsx(TopToolbar, { children: _jsxs(ToolbarCenter, { children: [_jsx(ToolbarIconButton, { title: 'Diminuisci lo zoom', onClick: handleZoomOut, disabled: zoomFactor <= 0.5, children: _jsx(IconZoomOutLinear, {}) }), _jsx(ToolbarIconButton, { title: 'Aumenta lo zoom', onClick: handleZoomIn, disabled: zoomFactor >= 3, children: _jsx(IconZoomInLinear, {}) }), _jsx(Divider, {}), _jsx(ToolbarIconButton, { title: 'Stampa', onClick: handlePrint, children: _jsx(IconPrintOutline, {}) })] }) }), _jsx(ImageContainer, { ref: containerRef, onMouseDown: onMouseDown, onTouchStart: onMouseDown, "$cursor": cursor, className: className, children: imageUrl && (_jsx(StyledImage, { ref: imageRef, src: imageUrl, alt: alt, "$scale": fullZoom, "$tx": translateX, "$ty": translateY, "$rotate": rotation })) })] }));
314
+ return (_jsxs("div", { style: { position: 'relative', width: '100%', height: '100%', overflow: 'hidden' }, children: [_jsx(TopToolbar, { children: _jsxs(ToolbarCenter, { children: [_jsx(ToolbarIconButton, { title: 'Diminuisci lo zoom', onClick: handleZoomOut, disabled: zoomFactor <= 0.5, children: _jsx(IconZoomOutLinear, {}) }), _jsx(ToolbarIconButton, { title: 'Aumenta lo zoom', onClick: handleZoomIn, disabled: zoomFactor >= 3, children: _jsx(IconZoomInLinear, {}) }), _jsx(Divider, {}), _jsx(ToolbarIconButton, { title: 'Stampa', onClick: handlePrint, children: _jsx(IconPrintOutline, {}) })] }) }), _jsx(ImageContainer, { ref: containerRef, onMouseDown: onMouseDown, onTouchStart: onMouseDown, "$cursor": cursor, className: className, children: imageUrl && (_jsx(StyledImage, { ref: imageRef, src: imageUrl, alt: alt, "$scale": fullZoom, "$tx": translateX, "$ty": translateY, "$rotate": rotation })) })] }));
326
315
  };
327
316
  export const TMNothingToShow = ({ text = '', secondText, fileExt, icon = _jsx(IconPreview, { fontSize: 96 }) }) => {
328
317
  return (_jsx(StyledAnimatedComponentOpacity, { style: { width: '100%', height: '100%' }, children: _jsxs(StyledPanelStatusContainer, { children: [icon, _jsxs(StyledPreviewNotAvailable, { children: [text && _jsx("div", { children: text }), _jsxs("div", { children: [" ", secondText ?? 'Anteprima non disponibile.', fileExt && _jsx("b", { children: ` (*.${fileExt})` })] })] })] }) }));
@@ -342,16 +331,14 @@ const renderedPreview = (tid, did, fileExt, fileSize, fileCount, extHandler, sho
342
331
  return (_jsx(StyledAnimatedComponentOpacity, { style: { width: '100%', height: '100%' }, children: _jsxs(StyledPanelStatusContainer, { children: [_jsx(IconPreview, { fontSize: 96 }), _jsxs("p", { children: [" La dimensione del file \u00E8 ", _jsx("strong", { children: formatBytes(fileSize) }), ". Visualizzare l'anteprima? "] }), _jsx(TMButton, { caption: "Si", onClick: onDownloadShowPreviewClick, showTooltip: false })] }) }));
343
332
  };
344
333
  //#region Styled Components
345
- const StyledPreviewContainer = styled.div `display: flex; justify-content: center; align-items: center; padding: 5px; position: relative; width:100%; height: 100%; `;
334
+ const StyledPreviewContainer = styled.div `display: flex; justify-content: center; align-items: center; position: relative; width:100%; height: 100%; `;
346
335
  export const StyledHeaderIcon = styled.div ` color: ${props => props.$color}; cursor: pointer; display: flex; align-items: center; justify-content: center; &:hover{ color: white ; transition: 200ms ease; } `;
347
336
  export const StyledPanelStatusContainer = styled.div ` width: 100%; height: 100%; padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; `;
348
337
  const StyledPreviewNotAvailable = styled.div ` display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; `;
349
- const ImageContainer = styled.div ` width: 100%; height: 100%; position: absolute; top:40px; overflow: hidden; background: #f5f5f5; touch-action: none; user-select: none; cursor: ${({ $cursor }) => $cursor ?? 'default'}; `;
350
- const ResetButton = styled.button ` display: flex; align-items: center; justify-content: center; background: #707070; color: #f1f1f1; border: none; padding: 6px; border-radius: 4px; cursor: pointer; font-size: 14px; &:disabled { background: #ccc; cursor: not-allowed; } `;
338
+ const ImageContainer = styled.div ` width: calc(100% - 20px); height: 100%; left:10px; position: absolute; top:50px; overflow: hidden; background: #f5f5f5; touch-action: none; user-select: none; cursor: ${({ $cursor }) => $cursor ?? 'default'}; `;
351
339
  const TopToolbar = styled.div ` position: absolute; top: 0; width: 100%; height: 40px; background-color: #e4e4e4; display: flex; justify-content: center; align-items: center; z-index: 10; `;
352
340
  const ToolbarCenter = styled.div ` display: flex; align-items: center; gap: 12px;`;
353
341
  const ToolbarIconButton = styled.button ` background: #f0f0f0; border: none; color: #313131; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; height: 32px; width: 32px; padding: 0; border-radius: 50px; &:hover{ background-color: #c4c4c4; } &:disabled { color: #c2c2c2; cursor: not-allowed; } `;
354
- const ZoomDisplay = styled.div ` color: #535353; font-size: 14px; min-width: 40px; text-align: center; background-color: #f8f8f8; border: 1px solid lightgray; padding: 0 3px; border-radius: 1px; `;
355
342
  const Divider = styled.div `width:1px; height: 20px; background-color: darkgray; `;
356
343
  const StyledImage = styled.img.attrs(props => ({
357
344
  style: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.12.153",
3
+ "version": "6.12.155",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",