px-react-ui-components 1.0.0
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/.babelrc +3 -0
- package/README.md +126 -0
- package/dist/components/MyAlert/MyAlert.css +113 -0
- package/dist/components/MyAlert/MyAlert.js +109 -0
- package/dist/components/MyContainer/MyContainer.js +59 -0
- package/dist/components/MyContainer/MyContainer.module.css +110 -0
- package/dist/components/MyContainer/MyContainerBody.js +9 -0
- package/dist/components/MyContainer/MyContainerFooter.js +9 -0
- package/dist/components/MyContainer/MyContainerRight.js +10 -0
- package/dist/components/MyEditor/MyEditor.js +292 -0
- package/dist/components/MyEditor/MyEditor.scss +277 -0
- package/dist/components/MyFileUpload/MyFileUpload.js +288 -0
- package/dist/components/MyFileUpload/MyFileUpload.module.css +86 -0
- package/dist/components/MyImageCropper/MyImageCropper.js +95 -0
- package/dist/components/MyInput/MyInput.js +768 -0
- package/dist/components/MyInput/MyInput.module.css +420 -0
- package/dist/components/MyMaps/YandexMaps.js +162 -0
- package/dist/components/MyMenu/MenuItem.js +55 -0
- package/dist/components/MyMenu/MyMenu.module.css +102 -0
- package/dist/components/MyModal/MyModal.css +83 -0
- package/dist/components/MyModal/MyModal.js +71 -0
- package/dist/components/MyModal/MyModalBody.js +9 -0
- package/dist/components/MyModal/MyModalFooter.js +9 -0
- package/dist/components/MyNotFound/MyNotFound.css +22 -0
- package/dist/components/MyNotFound/MyNotFound.js +20 -0
- package/dist/components/MyScrollableCard/MyScrollableCard.js +74 -0
- package/dist/components/MyTable/MyTable.js +310 -0
- package/dist/components/MyTable/MyTable.module.css +350 -0
- package/dist/components/MyTable/MyTableBody.js +9 -0
- package/dist/components/MyTable/MyTableHead.js +9 -0
- package/dist/components/MyTabs/MyTabPane.js +17 -0
- package/dist/components/MyTabs/MyTabs.css +105 -0
- package/dist/components/MyTabs/MyTabs.js +66 -0
- package/dist/components/MyWaiting/MyWaiting.css +28 -0
- package/dist/components/MyWaiting/MyWaiting.js +27 -0
- package/dist/components/MyZoomImage/MyZoomImage.css +0 -0
- package/dist/components/MyZoomImage/MyZoomImage.js +108 -0
- package/dist/index.js +15 -0
- package/package.json +44 -0
- package/src/components/MyAlert/MyAlert.css +113 -0
- package/src/components/MyAlert/MyAlert.jsx +96 -0
- package/src/components/MyContainer/MyContainer.jsx +90 -0
- package/src/components/MyContainer/MyContainer.module.css +110 -0
- package/src/components/MyContainer/MyContainerBody.jsx +8 -0
- package/src/components/MyContainer/MyContainerFooter.jsx +8 -0
- package/src/components/MyContainer/MyContainerRight.jsx +11 -0
- package/src/components/MyEditor/MyEditor.jsx +252 -0
- package/src/components/MyEditor/MyEditor.scss +277 -0
- package/src/components/MyFileUpload/MyFileUpload.jsx +373 -0
- package/src/components/MyFileUpload/MyFileUpload.module.css +86 -0
- package/src/components/MyImageCropper/MyImageCropper.jsx +108 -0
- package/src/components/MyInput/MyInput.jsx +896 -0
- package/src/components/MyInput/MyInput.module.css +420 -0
- package/src/components/MyMaps/YandexMaps.jsx +186 -0
- package/src/components/MyMenu/MenuItem.jsx +62 -0
- package/src/components/MyMenu/MyMenu.module.css +102 -0
- package/src/components/MyModal/MyModal.css +83 -0
- package/src/components/MyModal/MyModal.jsx +78 -0
- package/src/components/MyModal/MyModalBody.jsx +8 -0
- package/src/components/MyModal/MyModalFooter.jsx +8 -0
- package/src/components/MyNotFound/MyNotFound.css +22 -0
- package/src/components/MyNotFound/MyNotFound.jsx +11 -0
- package/src/components/MyScrollableCard/MyScrollableCard.jsx +86 -0
- package/src/components/MyTable/MyTable.jsx +458 -0
- package/src/components/MyTable/MyTable.module.css +350 -0
- package/src/components/MyTable/MyTableBody.jsx +8 -0
- package/src/components/MyTable/MyTableHead.jsx +10 -0
- package/src/components/MyTabs/MyTabPane.jsx +9 -0
- package/src/components/MyTabs/MyTabs.css +105 -0
- package/src/components/MyTabs/MyTabs.jsx +63 -0
- package/src/components/MyWaiting/MyWaiting.css +28 -0
- package/src/components/MyWaiting/MyWaiting.jsx +27 -0
- package/src/components/MyZoomImage/MyZoomImage.css +0 -0
- package/src/components/MyZoomImage/MyZoomImage.jsx +139 -0
- package/src/index.js +15 -0
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
display: block;
|
|
3
|
+
/* width: 100%; */
|
|
4
|
+
width: auto;
|
|
5
|
+
font-size: 15px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.container small {
|
|
9
|
+
padding-left: 5px;
|
|
10
|
+
font-size: 11px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.inputblock {
|
|
14
|
+
display: block;
|
|
15
|
+
position: relative;
|
|
16
|
+
/* width: 100%; */
|
|
17
|
+
width: auto;
|
|
18
|
+
background-color: #fff;
|
|
19
|
+
border: 1px solid #e5e7eb;
|
|
20
|
+
padding-right: 8px;
|
|
21
|
+
padding-left: 15px;
|
|
22
|
+
border-radius: 8px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.inputblockdisabled{
|
|
26
|
+
background-color: #f8fafd;
|
|
27
|
+
border-color: #e5e7eb;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.disabledInput {
|
|
31
|
+
width: 100%;
|
|
32
|
+
min-height: 40px;
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
padding: 8px;
|
|
36
|
+
overflow: auto;
|
|
37
|
+
scrollbar-width: thin;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.caretdown {
|
|
41
|
+
position: absolute;
|
|
42
|
+
right: 10px;
|
|
43
|
+
top: 50%;
|
|
44
|
+
transform: translateY(-50%);
|
|
45
|
+
font-size: 15px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.fileinput,
|
|
49
|
+
.css13cymwtControl,
|
|
50
|
+
.inputblock select,
|
|
51
|
+
.inputblock textarea,
|
|
52
|
+
.inputblock input {
|
|
53
|
+
display: block;
|
|
54
|
+
width: 100%;
|
|
55
|
+
min-height: 41px;
|
|
56
|
+
background: rgba(243, 242, 247, 0.1);
|
|
57
|
+
border: none;
|
|
58
|
+
padding: 10px 0px;
|
|
59
|
+
color: #0a0b0f;
|
|
60
|
+
font-weight: normal;
|
|
61
|
+
font-size: 14px;
|
|
62
|
+
outline: none;
|
|
63
|
+
z-index: 9;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.inputblock:focus-within {
|
|
67
|
+
background-color: #ecf8ff;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.inputblock select {
|
|
71
|
+
padding: 10px 0px 11px 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.fileinput::placeholder,
|
|
75
|
+
.css13cymwtControl::placeholder,
|
|
76
|
+
.inputblock select::placeholder,
|
|
77
|
+
.inputblock textarea::placeholder,
|
|
78
|
+
.inputblock input::placeholder {
|
|
79
|
+
color: #73889d;
|
|
80
|
+
opacity: 0.8;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.fileinput:-internal-autofill-selected,
|
|
84
|
+
.css13cymwtControl:-internal-autofill-selected,
|
|
85
|
+
.inputblock select:-internal-autofill-selected,
|
|
86
|
+
.inputblock textarea:-internal-autofill-selected,
|
|
87
|
+
.inputblock input:-internal-autofill-selected {
|
|
88
|
+
background-color: rgba(243, 242, 247, 0.1) !important;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.inputblock input[type="color"] {
|
|
92
|
+
height: 45px;
|
|
93
|
+
padding: 5px 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.inputblock textarea {
|
|
97
|
+
line-height: unset;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.placeholder {
|
|
101
|
+
position: absolute;
|
|
102
|
+
top: 50%;
|
|
103
|
+
transform: translateY(-50%);
|
|
104
|
+
color: #75899e;
|
|
105
|
+
opacity: 0.8;
|
|
106
|
+
z-index: 0;
|
|
107
|
+
pointer-events: none;
|
|
108
|
+
font-weight: 300;
|
|
109
|
+
font-size: 14px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.inputblock input.filterInput {
|
|
113
|
+
position: absolute;
|
|
114
|
+
display: none;
|
|
115
|
+
left: 10px;
|
|
116
|
+
top: 0px;
|
|
117
|
+
width: calc(100% - 75px) !important;
|
|
118
|
+
padding-left: 5px !important;
|
|
119
|
+
z-index: 2 !important;
|
|
120
|
+
background-color: #f3f2f7 !important;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.inputblockicon input.filterInput {
|
|
124
|
+
left: 40px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.filterInputSelected {
|
|
128
|
+
display: block;
|
|
129
|
+
width: 100%;
|
|
130
|
+
height: 41px;
|
|
131
|
+
padding: 10px 0;
|
|
132
|
+
font-size: 14px;
|
|
133
|
+
font-weight: 300;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.filterInputSelectedSelected {
|
|
137
|
+
position: relative;
|
|
138
|
+
padding-left: 30px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.filterInputSelectedContainer {
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
justify-content: space-between;
|
|
145
|
+
padding-left: 10px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.filterInputSelectedContainerSelected {
|
|
149
|
+
position: relative;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.filterInputSelectedX {
|
|
153
|
+
position: absolute;
|
|
154
|
+
right: 35px;
|
|
155
|
+
top: 50%;
|
|
156
|
+
transform: translateY(-50%);
|
|
157
|
+
font-size: 15px;
|
|
158
|
+
cursor: pointer;
|
|
159
|
+
font-family: monospace;
|
|
160
|
+
border-radius: 50%;
|
|
161
|
+
width: 18px;
|
|
162
|
+
height: 18px;
|
|
163
|
+
background: #e4e4e4;
|
|
164
|
+
text-align: center;
|
|
165
|
+
padding: 0px;
|
|
166
|
+
line-height: 15px;
|
|
167
|
+
color: #000000;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.filterInputSelectedX:hover {
|
|
171
|
+
background: #f0cdcd;
|
|
172
|
+
color: #a34444;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.filterInputList {
|
|
176
|
+
display: none;
|
|
177
|
+
position: absolute;
|
|
178
|
+
left: 5px;
|
|
179
|
+
top: 41px;
|
|
180
|
+
max-height: 300px;
|
|
181
|
+
width: calc(100% - 10px);
|
|
182
|
+
z-index: 99;
|
|
183
|
+
background-color: #fff;
|
|
184
|
+
padding: 0;
|
|
185
|
+
border-radius: 8px;
|
|
186
|
+
overflow: auto;
|
|
187
|
+
scrollbar-width: thin;
|
|
188
|
+
box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.5);
|
|
189
|
+
font-size: 13px;
|
|
190
|
+
font-weight: 300;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.filterInputList.opened {
|
|
194
|
+
display: block;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.filterInputList li {
|
|
198
|
+
cursor: default;
|
|
199
|
+
padding: 6px 15px;
|
|
200
|
+
display: flex;
|
|
201
|
+
flex-direction: column;
|
|
202
|
+
gap: 0px;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.filterInputList .subtextli {
|
|
206
|
+
padding: 4px 15px;
|
|
207
|
+
}
|
|
208
|
+
.filterInputList li .subtext {
|
|
209
|
+
font-size: 11px;
|
|
210
|
+
font-style: italic;
|
|
211
|
+
color: #73889d;
|
|
212
|
+
opacity: 0.8;
|
|
213
|
+
font-weight: 300;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.filterInputList li:hover {
|
|
217
|
+
background-color: #1c61c9;
|
|
218
|
+
color: #fff;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.filterInputList li:hover .subtext,
|
|
222
|
+
.filterInputList li:hover i,
|
|
223
|
+
.filterInputList li:hover span,
|
|
224
|
+
.filterInputList li:hover small {
|
|
225
|
+
color: #fff !important;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.inputblockicon {
|
|
229
|
+
padding-left: 40px;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.inputblockicon .eye,
|
|
233
|
+
.inputblockicon .icon {
|
|
234
|
+
position: absolute;
|
|
235
|
+
left: 5px;
|
|
236
|
+
top: 50%;
|
|
237
|
+
width: 30px;
|
|
238
|
+
transform: translateY(-50%);
|
|
239
|
+
color: #73889d;
|
|
240
|
+
padding: 0px;
|
|
241
|
+
font-size: 22px;
|
|
242
|
+
display: flex;
|
|
243
|
+
align-items: center;
|
|
244
|
+
justify-content: center;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.inputblockicon .icontextarea {
|
|
248
|
+
top: 13px;
|
|
249
|
+
transform: unset;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.inputblockicon .icon {
|
|
253
|
+
z-index: 0;
|
|
254
|
+
pointer-events: none;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.inputblockicon .eye {
|
|
258
|
+
left: unset;
|
|
259
|
+
right: 10px;
|
|
260
|
+
background: unset;
|
|
261
|
+
border: none;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.inputblockicon .eye:hover {
|
|
265
|
+
color: #a3a7ac;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.inputblockicon .placeholder {
|
|
269
|
+
left: 45px;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.error .inputblock{
|
|
273
|
+
border-color: #ff0000 !important;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.fileinput {
|
|
277
|
+
position: relative;
|
|
278
|
+
display: flex;
|
|
279
|
+
flex-direction: row;
|
|
280
|
+
align-items: center;
|
|
281
|
+
justify-content: space-between;
|
|
282
|
+
gap: 5px;
|
|
283
|
+
width: 100%;
|
|
284
|
+
padding: 0px;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.fileImagePreview {
|
|
288
|
+
position: absolute;
|
|
289
|
+
height: 35px;
|
|
290
|
+
width: 35px;
|
|
291
|
+
object-fit: cover;
|
|
292
|
+
border-radius: 5px;
|
|
293
|
+
left: -40px;
|
|
294
|
+
top: 50%;
|
|
295
|
+
transform: translateY(-50%);
|
|
296
|
+
padding: 2px;
|
|
297
|
+
background: #f3f3f3;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.fileImagePreview:hover {
|
|
301
|
+
height: 180px;
|
|
302
|
+
width: 180px;
|
|
303
|
+
z-index: 9999;
|
|
304
|
+
padding: 8px;
|
|
305
|
+
cursor: pointer;
|
|
306
|
+
-webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.35);
|
|
307
|
+
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.35);
|
|
308
|
+
box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.35);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.filename {
|
|
312
|
+
display: block;
|
|
313
|
+
position: relative;
|
|
314
|
+
width: calc(100% - 110px);
|
|
315
|
+
color: #b9bbbd;
|
|
316
|
+
padding: 0 0 0 5px;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.filename small {
|
|
320
|
+
position: absolute;
|
|
321
|
+
right: 0px;
|
|
322
|
+
top: 0px;
|
|
323
|
+
height: 100%;
|
|
324
|
+
font-weight: normal;
|
|
325
|
+
background: #cdcdcd;
|
|
326
|
+
padding: 5px;
|
|
327
|
+
border-radius: 8px;
|
|
328
|
+
line-height: 1;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.filename.selected {
|
|
332
|
+
color: #000;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.filebutton {
|
|
336
|
+
margin-left: auto;
|
|
337
|
+
/* position: absolute;
|
|
338
|
+
right: -2px;
|
|
339
|
+
top: 5px; */
|
|
340
|
+
min-width: 80px;
|
|
341
|
+
/* height: calc(100% - 10px); */
|
|
342
|
+
padding: 8px;
|
|
343
|
+
border: none;
|
|
344
|
+
background: #d0d6de;
|
|
345
|
+
color: #464255;
|
|
346
|
+
border-radius: 8px;
|
|
347
|
+
flex-shrink: 0;
|
|
348
|
+
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.filebutton:hover {
|
|
352
|
+
background: #c7ced6;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.filebuttonremove {
|
|
356
|
+
width: 20px;
|
|
357
|
+
height: 20px;
|
|
358
|
+
background: #c7ced6;
|
|
359
|
+
color: #fff;
|
|
360
|
+
border: none;
|
|
361
|
+
padding: 0px;
|
|
362
|
+
border-radius: 50%;
|
|
363
|
+
font-size: 12px;
|
|
364
|
+
cursor: pointer;
|
|
365
|
+
margin-left: auto;
|
|
366
|
+
flex-shrink: 0;
|
|
367
|
+
|
|
368
|
+
/* position: absolute; */
|
|
369
|
+
/* right: 10px;
|
|
370
|
+
top: 50%;
|
|
371
|
+
transform: translateY(-50%); */
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.description {
|
|
375
|
+
display: block;
|
|
376
|
+
width: 100%;
|
|
377
|
+
font-size: 10px;
|
|
378
|
+
padding-top: 2px;
|
|
379
|
+
color: #737a83;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
@media screen and (max-width: 768px) {
|
|
383
|
+
.container {
|
|
384
|
+
font-size: 14px;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.inputblock {
|
|
388
|
+
padding-right: 6px;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.filebutton {
|
|
392
|
+
min-width: 70px;
|
|
393
|
+
padding: 6px;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.inputblockicon .icon,
|
|
397
|
+
.inputblockicon .eye {
|
|
398
|
+
font-size: 22px;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
@media screen and (max-width: 480px) {
|
|
403
|
+
.container {
|
|
404
|
+
font-size: 11px;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.inputblock {
|
|
408
|
+
padding-right: 4px;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.filebutton {
|
|
412
|
+
min-width: 60px;
|
|
413
|
+
padding: 4px;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
.inputblockicon .icon,
|
|
417
|
+
.inputblockicon .eye {
|
|
418
|
+
font-size: 20px;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
// Global olarak ymaps yükleyicisi
|
|
4
|
+
let ymapsLoader;
|
|
5
|
+
const loadYandexMapsAPI = APIKEY => {
|
|
6
|
+
if (ymapsLoader) {
|
|
7
|
+
return ymapsLoader;
|
|
8
|
+
}
|
|
9
|
+
ymapsLoader = new Promise((resolve, reject) => {
|
|
10
|
+
if (window.ymaps) {
|
|
11
|
+
resolve(window.ymaps);
|
|
12
|
+
} else {
|
|
13
|
+
const script = document.getElementById("yandexmapapi");
|
|
14
|
+
if (!script) {
|
|
15
|
+
const newScript = document.createElement('script');
|
|
16
|
+
newScript.id = "yandexmapapi";
|
|
17
|
+
newScript.src = `https://api-maps.yandex.com/2.1/?apikey=${APIKEY}&lang=tr_TR`;
|
|
18
|
+
newScript.async = true;
|
|
19
|
+
document.head.appendChild(newScript);
|
|
20
|
+
newScript.onload = () => {
|
|
21
|
+
window.ymaps.ready(() => resolve(window.ymaps));
|
|
22
|
+
};
|
|
23
|
+
newScript.onerror = reject;
|
|
24
|
+
} else {
|
|
25
|
+
script.onload = () => {
|
|
26
|
+
window.ymaps.ready(() => resolve(window.ymaps));
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return ymapsLoader;
|
|
32
|
+
};
|
|
33
|
+
const YandexMap = ({
|
|
34
|
+
className = "",
|
|
35
|
+
value = null,
|
|
36
|
+
address = null,
|
|
37
|
+
addressSearch = false,
|
|
38
|
+
onChange = null,
|
|
39
|
+
onAddress = null,
|
|
40
|
+
style = null,
|
|
41
|
+
APIKEY = null
|
|
42
|
+
}) => {
|
|
43
|
+
const [loaded, setLoaded] = useState(false);
|
|
44
|
+
const [position, setPosition] = useState(null);
|
|
45
|
+
const [error, setError] = useState(null);
|
|
46
|
+
const [componentKey] = useState(Date.now() + '' + (Math.floor(Math.random() * (10 - 1)) + 1));
|
|
47
|
+
const markerRef = useRef(null); // Marker için referans
|
|
48
|
+
|
|
49
|
+
const currentLocation = () => {
|
|
50
|
+
if (value) {
|
|
51
|
+
maps_load(parseFloat(value.coords[0]), parseFloat(value.coords[1]), parseInt(value.zoom));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (navigator.geolocation) {
|
|
55
|
+
navigator.geolocation.getCurrentPosition(position => {
|
|
56
|
+
maps_load(position.coords.latitude, position.coords.longitude, 12);
|
|
57
|
+
}, error => {
|
|
58
|
+
console.error(error.message);
|
|
59
|
+
maps_load(40.32110315567054, 32.199745873178124, 8);
|
|
60
|
+
});
|
|
61
|
+
} else {
|
|
62
|
+
maps_load(40.32110315567054, 32.199745873178124, 8);
|
|
63
|
+
setError("Geolocation is not supported by this browser.");
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const maps_load = (coorX, coorY, zoom = 10) => {
|
|
67
|
+
document.getElementById("map" + componentKey).innerHTML = "";
|
|
68
|
+
const myMap = new ymaps.Map("map" + componentKey, {
|
|
69
|
+
center: [coorX, coorY],
|
|
70
|
+
zoom: zoom
|
|
71
|
+
});
|
|
72
|
+
createMarker(myMap, [coorX, coorY], zoom);
|
|
73
|
+
myMap.events.add('click', e => {
|
|
74
|
+
const coords = e.get('coords');
|
|
75
|
+
let curzoom = myMap.getZoom();
|
|
76
|
+
// if (curzoom < 17) {
|
|
77
|
+
// curzoom = 17;
|
|
78
|
+
// myMap.setZoom(curzoom);
|
|
79
|
+
// }
|
|
80
|
+
|
|
81
|
+
setPosition({
|
|
82
|
+
coords: coords,
|
|
83
|
+
zoom: curzoom
|
|
84
|
+
});
|
|
85
|
+
getAddress(coords);
|
|
86
|
+
createMarker(myMap, coords, curzoom);
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
const createMarker = (myMap, coords, curzoom) => {
|
|
90
|
+
if (markerRef.current) {
|
|
91
|
+
myMap.geoObjects.remove(markerRef.current); // Önceki marker'ı kaldır
|
|
92
|
+
}
|
|
93
|
+
const newMarker = new ymaps.Placemark(coords, {
|
|
94
|
+
balloonContent: `Yeni Koordinatlar: ${coords[0]}, ${coords[1]}`
|
|
95
|
+
});
|
|
96
|
+
myMap.geoObjects.add(newMarker);
|
|
97
|
+
markerRef.current = newMarker;
|
|
98
|
+
// myMap.setCenter(coords, curzoom);
|
|
99
|
+
};
|
|
100
|
+
const getAddress = coords => {
|
|
101
|
+
if (!onAddress) return;
|
|
102
|
+
ymaps.geocode(coords).then(res => {
|
|
103
|
+
const firstGeoObject = res.geoObjects.get(0);
|
|
104
|
+
if (firstGeoObject) {
|
|
105
|
+
const address = firstGeoObject.getAddressLine();
|
|
106
|
+
onAddress(address);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
const getAddressCoor = () => {
|
|
111
|
+
const geocodeUrl = `https://geocode-maps.yandex.ru/1.x/?geocode=${encodeURIComponent(address)}&format=json&apikey=${APIKEY}`;
|
|
112
|
+
fetch(geocodeUrl).then(response => response.json()).then(data => {
|
|
113
|
+
if (data.response.GeoObjectCollection.featureMember.length > 0) {
|
|
114
|
+
const firstResult = data.response.GeoObjectCollection.featureMember[0].GeoObject;
|
|
115
|
+
const pos = firstResult.Point.pos.split(' ');
|
|
116
|
+
maps_load(parseFloat(pos[1]), parseFloat(pos[0]), 17);
|
|
117
|
+
}
|
|
118
|
+
}).catch(err => {
|
|
119
|
+
setError(`Hata: ${err.message}`);
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (addressSearch && !markerRef.current && address && address != "") {
|
|
124
|
+
getAddressCoor();
|
|
125
|
+
}
|
|
126
|
+
}, [addressSearch]);
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
if (onChange && loaded) {
|
|
129
|
+
onChange(position);
|
|
130
|
+
}
|
|
131
|
+
}, [position]);
|
|
132
|
+
const opened = () => {
|
|
133
|
+
currentLocation();
|
|
134
|
+
setTimeout(() => {
|
|
135
|
+
setLoaded(true);
|
|
136
|
+
}, 1000);
|
|
137
|
+
};
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (loaded && value) {
|
|
140
|
+
maps_load(parseFloat(value.coords[0]), parseFloat(value.coords[1]), parseInt(value.zoom));
|
|
141
|
+
}
|
|
142
|
+
}, [value]);
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
// if (loaded && value) {
|
|
145
|
+
// maps_load(parseFloat(value.coords[0]), parseFloat(value.coords[1]), parseInt(value.zoom));
|
|
146
|
+
// }
|
|
147
|
+
}, [loaded]);
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
if (!APIKEY) {
|
|
150
|
+
APIKEY = "0d21dc94-68eb-4245-871f-a56081b703b3";
|
|
151
|
+
}
|
|
152
|
+
loadYandexMapsAPI(APIKEY).then(() => {
|
|
153
|
+
opened(); // Harita işlevselliğinizi başlatın
|
|
154
|
+
}).catch(err => console.error("Yandex Maps API yüklenemedi", err));
|
|
155
|
+
}, []);
|
|
156
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
157
|
+
id: "map" + componentKey,
|
|
158
|
+
className: "w-full h-72 " + className,
|
|
159
|
+
style: style
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
export default YandexMap;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Link } from 'react-router-dom';
|
|
3
|
+
import styles from "./MyMenu.module.css";
|
|
4
|
+
import { PiCaretDown, PiCaretUp } from 'react-icons/pi';
|
|
5
|
+
import { GoDotFill } from 'react-icons/go';
|
|
6
|
+
function MenuItem({
|
|
7
|
+
children = null,
|
|
8
|
+
to = "",
|
|
9
|
+
text = "",
|
|
10
|
+
className = null,
|
|
11
|
+
badge = null,
|
|
12
|
+
icon = null,
|
|
13
|
+
title = "",
|
|
14
|
+
defaultOpen = false,
|
|
15
|
+
defaultRoute = "",
|
|
16
|
+
isShortMenu = false
|
|
17
|
+
}) {
|
|
18
|
+
// let selected = window.location.pathname == to || (window.location.pathname == defaultRoute);
|
|
19
|
+
|
|
20
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
21
|
+
const [selected, setSelected] = useState(false);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
setSelected(children ? false : window.location.pathname == to || window.location.pathname == defaultRoute || window.location.pathname.includes(to));
|
|
24
|
+
}, [window.location.pathname]);
|
|
25
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children && /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: styles.menuItemOwner
|
|
27
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: styles.menuItem + " " + (className != null ? className : "") + " " + (selected ? styles.selected : '') + " " + (open ? styles.menuItemOpen : '') + " " + (isShortMenu ? styles.menuItemShortMenu : ''),
|
|
29
|
+
title: title == "" ? text : title,
|
|
30
|
+
onClick: () => setOpen(!open)
|
|
31
|
+
}, icon && /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
className: styles.menuItemIcon
|
|
33
|
+
}, icon), /*#__PURE__*/React.createElement("span", {
|
|
34
|
+
className: styles.menuItemText + " " + (badge != null ? styles.menuItemTextBadge : '')
|
|
35
|
+
}, text, badge != null && typeof badge !== 'object' ? /*#__PURE__*/React.createElement("span", {
|
|
36
|
+
className: styles.menuItemBadge
|
|
37
|
+
}, badge.toString()) : badge), open && /*#__PURE__*/React.createElement(PiCaretUp, {
|
|
38
|
+
className: `font-bold text-2xl ${styles.menuItemIconSubMenu} ${open ? styles.menuItemIconSubMenuOpen : ''}`
|
|
39
|
+
}) || /*#__PURE__*/React.createElement(PiCaretDown, {
|
|
40
|
+
className: `font-bold text-2xl ${styles.menuItemIconSubMenu} ${open ? styles.menuItemIconSubMenuOpen : ''}`
|
|
41
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: styles.menuItemChildren + " " + (open ? styles.menuItemChildrenOpen : '')
|
|
43
|
+
}, children)) || /*#__PURE__*/React.createElement(Link, {
|
|
44
|
+
to: to,
|
|
45
|
+
className: styles.menuItem + " " + (className != null ? className : "") + " " + (selected ? styles.selected : '') + " " + (isShortMenu ? styles.menuItemShortMenu : ''),
|
|
46
|
+
title: title == "" ? text : title
|
|
47
|
+
}, icon && /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: styles.menuItemIcon
|
|
49
|
+
}, icon) || /*#__PURE__*/React.createElement(GoDotFill, null), /*#__PURE__*/React.createElement("span", {
|
|
50
|
+
className: styles.menuItemText + " " + (badge != null ? styles.menuItemTextBadge : '')
|
|
51
|
+
}, text, badge != null && typeof badge !== 'object' ? /*#__PURE__*/React.createElement("span", {
|
|
52
|
+
className: styles.menuItemBadge
|
|
53
|
+
}, badge.toString()) : badge)));
|
|
54
|
+
}
|
|
55
|
+
export default MenuItem;
|