px-react-ui-components 1.0.1 → 1.0.2
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/package.json +13 -1
- package/.babelrc +0 -3
- package/src/components/MyAlert/MyAlert.css +0 -113
- package/src/components/MyAlert/MyAlert.jsx +0 -96
- package/src/components/MyContainer/MyContainer.jsx +0 -90
- package/src/components/MyContainer/MyContainer.module.css +0 -110
- package/src/components/MyContainer/MyContainerBody.jsx +0 -8
- package/src/components/MyContainer/MyContainerFooter.jsx +0 -8
- package/src/components/MyContainer/MyContainerRight.jsx +0 -11
- package/src/components/MyEditor/MyEditor.jsx +0 -252
- package/src/components/MyEditor/MyEditor.scss +0 -277
- package/src/components/MyFileUpload/MyFileUpload.jsx +0 -371
- package/src/components/MyFileUpload/MyFileUpload.module.css +0 -86
- package/src/components/MyImageCropper/MyImageCropper.jsx +0 -108
- package/src/components/MyInput/MyInput.jsx +0 -895
- package/src/components/MyInput/MyInput.module.css +0 -420
- package/src/components/MyMaps/YandexMaps.jsx +0 -186
- package/src/components/MyMenu/MenuItem.jsx +0 -62
- package/src/components/MyMenu/MyMenu.module.css +0 -102
- package/src/components/MyModal/MyModal.css +0 -83
- package/src/components/MyModal/MyModal.jsx +0 -78
- package/src/components/MyModal/MyModalBody.jsx +0 -8
- package/src/components/MyModal/MyModalFooter.jsx +0 -8
- package/src/components/MyNotFound/MyNotFound.css +0 -22
- package/src/components/MyNotFound/MyNotFound.jsx +0 -11
- package/src/components/MyScrollableCard/MyScrollableCard.jsx +0 -86
- package/src/components/MyTable/MyTable.jsx +0 -459
- package/src/components/MyTable/MyTable.module.css +0 -350
- package/src/components/MyTable/MyTableBody.jsx +0 -8
- package/src/components/MyTable/MyTableHead.jsx +0 -10
- package/src/components/MyTabs/MyTabPane.jsx +0 -9
- package/src/components/MyTabs/MyTabs.css +0 -105
- package/src/components/MyTabs/MyTabs.jsx +0 -63
- package/src/components/MyWaiting/MyWaiting.css +0 -28
- package/src/components/MyWaiting/MyWaiting.jsx +0 -27
- package/src/components/MyZoomImage/MyZoomImage.css +0 -0
- package/src/components/MyZoomImage/MyZoomImage.jsx +0 -139
- package/src/index.js +0 -15
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useState } from "react";
|
|
2
|
-
import {
|
|
3
|
-
TransformWrapper,
|
|
4
|
-
TransformComponent,
|
|
5
|
-
useControls,
|
|
6
|
-
} from "react-zoom-pan-pinch";
|
|
7
|
-
import "./MyZoomImage.css";
|
|
8
|
-
import {
|
|
9
|
-
PiMinusBold,
|
|
10
|
-
PiPlusBold,
|
|
11
|
-
PiX,
|
|
12
|
-
PiArrowUpBold,
|
|
13
|
-
PiArrowDownBold,
|
|
14
|
-
PiArrowLeftBold,
|
|
15
|
-
PiArrowRightBold,
|
|
16
|
-
PiArrowsIn,
|
|
17
|
-
} from "react-icons/pi";
|
|
18
|
-
|
|
19
|
-
const Controls = ({ wrapperRef, openArrow }) => {
|
|
20
|
-
|
|
21
|
-
const { zoomIn, zoomOut, resetTransform, centerView } = useControls();
|
|
22
|
-
|
|
23
|
-
const handlePan = (x, y) => {
|
|
24
|
-
if (wrapperRef.current) {
|
|
25
|
-
// debugger
|
|
26
|
-
// Mevcut pozisyonu al
|
|
27
|
-
const state = wrapperRef.current.instance.transformState;
|
|
28
|
-
// Pozisyonu güncelle
|
|
29
|
-
wrapperRef.current.instance.setTransformState(
|
|
30
|
-
state.scale,
|
|
31
|
-
state.positionX + x,
|
|
32
|
-
state.positionY + y
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<div className="absolute flex flex-col gap-1 z-50 top-3 left-5">
|
|
39
|
-
<div className="flex gap-1 mb-3">
|
|
40
|
-
<button
|
|
41
|
-
className="bg-slate-400 hover:bg-slate-500 rounded-full p-2"
|
|
42
|
-
onClick={() => zoomIn()}
|
|
43
|
-
title="Zoom +"
|
|
44
|
-
>
|
|
45
|
-
<PiPlusBold className="text-lg text-white" />
|
|
46
|
-
</button>
|
|
47
|
-
<button
|
|
48
|
-
className="bg-slate-400 hover:bg-slate-500 rounded-full p-2"
|
|
49
|
-
onClick={() => zoomOut()}
|
|
50
|
-
title="Zoom -"
|
|
51
|
-
>
|
|
52
|
-
<PiMinusBold className="text-lg text-white" />
|
|
53
|
-
</button>
|
|
54
|
-
<button
|
|
55
|
-
className="bg-slate-400 hover:bg-slate-500 rounded-full p-2"
|
|
56
|
-
onClick={() => resetTransform()}
|
|
57
|
-
title="Zoom Cancel"
|
|
58
|
-
>
|
|
59
|
-
<PiX className="text-lg text-white" />
|
|
60
|
-
</button>
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
{openArrow && (
|
|
64
|
-
<div className="flex flex-col items-center p-2">
|
|
65
|
-
<button
|
|
66
|
-
className="bg-blue-400 hover:bg-blue-500 rounded-full p-2 mb-1"
|
|
67
|
-
onClick={() => handlePan(0, 30)}
|
|
68
|
-
>
|
|
69
|
-
<PiArrowUpBold className="text-lg text-white" />
|
|
70
|
-
</button>
|
|
71
|
-
|
|
72
|
-
<div className="flex">
|
|
73
|
-
<button
|
|
74
|
-
className="bg-blue-400 hover:bg-blue-500 rounded-full p-2"
|
|
75
|
-
onClick={() => handlePan(30, 0)}
|
|
76
|
-
>
|
|
77
|
-
<PiArrowLeftBold className="text-lg text-white" />
|
|
78
|
-
</button>
|
|
79
|
-
<button
|
|
80
|
-
className="bg-blue-400 hover:bg-blue-500 rounded-full p-2 ml-1 mr-1"
|
|
81
|
-
onClick={() => centerView()}
|
|
82
|
-
title="Center"
|
|
83
|
-
>
|
|
84
|
-
<PiArrowsIn className="text-lg text-white" />
|
|
85
|
-
</button>
|
|
86
|
-
<button
|
|
87
|
-
className="bg-blue-400 hover:bg-blue-500 rounded-full p-2"
|
|
88
|
-
onClick={() => handlePan(-30, 0)}
|
|
89
|
-
>
|
|
90
|
-
<PiArrowRightBold className="text-lg text-white" />
|
|
91
|
-
</button>
|
|
92
|
-
</div>
|
|
93
|
-
<button
|
|
94
|
-
className="bg-blue-400 hover:bg-blue-500 rounded-full p-2 mt-1"
|
|
95
|
-
onClick={() => handlePan(0, -30)}
|
|
96
|
-
>
|
|
97
|
-
<PiArrowDownBold className="text-lg text-white" />
|
|
98
|
-
</button>
|
|
99
|
-
</div>
|
|
100
|
-
)}
|
|
101
|
-
</div>
|
|
102
|
-
);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const MyImageZoom = ({ image, children = null, onZoomChange = null }) => {
|
|
106
|
-
const wrapperRef = useRef(null); // Ref oluştur
|
|
107
|
-
const [openArrow, setOpenArrow] = useState(false);
|
|
108
|
-
|
|
109
|
-
const handlerTransform = (e) => {
|
|
110
|
-
setOpenArrow(e.state.scale != 1);
|
|
111
|
-
|
|
112
|
-
if (onZoomChange != null) {
|
|
113
|
-
onZoomChange(e.state);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
return (
|
|
118
|
-
<div className="zoom-container flex justify-center items-center">
|
|
119
|
-
<TransformWrapper
|
|
120
|
-
ref={wrapperRef}
|
|
121
|
-
className="w-full flex items-center justify-center"
|
|
122
|
-
onTransformed={handlerTransform}
|
|
123
|
-
>
|
|
124
|
-
<Controls wrapperRef={wrapperRef} openArrow={openArrow} />
|
|
125
|
-
<TransformComponent className="w-full flex items-center justify-center">
|
|
126
|
-
{children || (
|
|
127
|
-
<img
|
|
128
|
-
src={image}
|
|
129
|
-
alt="Zoomable"
|
|
130
|
-
className="max-w-full object-cover rounded-md "
|
|
131
|
-
/>
|
|
132
|
-
)}
|
|
133
|
-
</TransformComponent>
|
|
134
|
-
</TransformWrapper>
|
|
135
|
-
</div>
|
|
136
|
-
);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
export default MyImageZoom;
|
package/src/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export { default as MyInput } from './components/MyInput';
|
|
2
|
-
export { default as MyAlert } from './components/MyAlert';
|
|
3
|
-
export { default as MyContainer } from './components/MyContainer';
|
|
4
|
-
export { default as MyEditor } from './components/MyEditor';
|
|
5
|
-
export { default as MyFileUpload } from './components/MyFileUpload';
|
|
6
|
-
export { default as MyImageCropper } from './components/MyImageCropper';
|
|
7
|
-
export { default as MyMaps } from './components/MyMaps';
|
|
8
|
-
export { default as MyMenu } from './components/MyMenu';
|
|
9
|
-
export { default as MyModal } from './components/MyModal';
|
|
10
|
-
export { default as MyNotFound } from './components/MyNotFound';
|
|
11
|
-
export { default as MyScrollableCard } from './components/MyScrollableCard';
|
|
12
|
-
export { default as MyTable } from './components/MyTable';
|
|
13
|
-
export { default as MyTabs } from './components/MyTabs';
|
|
14
|
-
export { default as MyWaiting } from './components/MyWaiting';
|
|
15
|
-
export { default as MyZoomImage } from './components/MyZoomImage';
|