@pop-ui/core 2.2.4 → 2.2.6
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/CHANGELOG.md +18 -0
- package/dist/assets/Montserrat-Bold.woff2 +0 -0
- package/dist/assets/Montserrat-Medium.woff2 +0 -0
- package/dist/assets/Montserrat-SemiBold.woff2 +0 -0
- package/dist/assets/NotoSansKR-Bold.woff2 +0 -0
- package/dist/assets/NotoSansKR-Medium.woff2 +0 -0
- package/dist/assets/NotoSansKR-Regular.woff2 +0 -0
- package/dist/assets/NotoSansKR-SemiBold.woff2 +0 -0
- package/dist/assets/OFL-Montserrat.txt +94 -0
- package/dist/assets/OFL-NotoSansKR.txt +93 -0
- package/dist/core.css +1 -1
- package/dist/core.js +58 -3110
- package/dist/core.umd.cjs +16 -16
- package/dist/esm/components/Button/index.js +75 -0
- package/dist/esm/components/Button/style.js +9 -0
- package/dist/esm/components/Button/styles.module.scss.js +28 -0
- package/dist/esm/components/CalendarDatePicker/index.js +119 -0
- package/dist/esm/components/CalendarDatePicker/styles.module.scss.js +34 -0
- package/dist/esm/components/CalendarDatePicker/utils.js +82 -0
- package/dist/esm/components/Checkbox/index.js +32 -0
- package/dist/esm/components/Checkbox/styles.module.scss.js +9 -0
- package/dist/esm/components/DatePicker/index.js +203 -0
- package/dist/esm/components/DatePicker/styles.module.scss.js +57 -0
- package/dist/esm/components/Dropdown/index.js +61 -0
- package/dist/esm/components/Dropdown/styles.module.scss.js +21 -0
- package/dist/esm/components/ImageInput/ImageInputCropModal.js +91 -0
- package/dist/esm/components/ImageInput/helpers.js +46 -0
- package/dist/esm/components/ImageInput/index.js +379 -0
- package/dist/esm/components/ImageInput/styles.module.scss.js +30 -0
- package/dist/esm/components/LottieInput/helpers.js +48 -0
- package/dist/esm/components/LottieInput/index.js +233 -0
- package/dist/esm/components/LottieInput/styles.module.scss.js +14 -0
- package/dist/esm/components/Map/Map.js +48 -0
- package/dist/esm/components/Map/NaverMapContext.js +78 -0
- package/dist/esm/components/Map/markerClustering.js +305 -0
- package/dist/esm/components/Map/markerStyles.js +351 -0
- package/dist/esm/components/Map/useLocation.js +40 -0
- package/dist/esm/components/Map/useMap.js +95 -0
- package/dist/esm/components/MapInfo/index.js +120 -0
- package/dist/esm/components/MapInfo/styles.module.scss.js +24 -0
- package/dist/esm/components/Modal/index.js +52 -0
- package/dist/esm/components/Pagination/index.js +45 -0
- package/dist/esm/components/Pagination/style.module.scss.js +13 -0
- package/dist/esm/components/Radio/index.js +29 -0
- package/dist/esm/components/Radio/styles.module.scss.js +9 -0
- package/dist/esm/components/SearchBar/index.js +60 -0
- package/dist/esm/components/SearchBar/styles.module.scss.js +25 -0
- package/dist/esm/components/SegmentButton/index.js +25 -0
- package/dist/esm/components/SegmentButton/styles.module.scss.js +9 -0
- package/dist/esm/components/Tab/index.js +14 -0
- package/dist/esm/components/Tab/styles.module.scss.js +10 -0
- package/dist/esm/components/TextField/index.js +99 -0
- package/dist/esm/components/TextField/styles.module.scss.js +28 -0
- package/dist/esm/components/TimePicker/index.js +33 -0
- package/dist/esm/components/TimePicker/styles.module.scss.js +9 -0
- package/dist/esm/components/Toast/index.js +35 -0
- package/dist/esm/components/Toast/styles.module.scss.js +14 -0
- package/dist/esm/components/Toggle/index.js +48 -0
- package/dist/esm/components/Toggle/styles.module.scss.js +9 -0
- package/dist/esm/components/Tooltip/index.js +25 -0
- package/dist/esm/components/Tooltip/styles.module.scss.js +12 -0
- package/dist/esm/components/shared/MultiItemInput/Dropzone.js +30 -0
- package/dist/esm/components/shared/MultiItemInput/SortableEmptySlot.js +29 -0
- package/dist/esm/components/shared/MultiItemInput/TileShell.js +113 -0
- package/dist/esm/components/shared/MultiItemInput/helpers.js +23 -0
- package/dist/esm/components/shared/MultiItemInput/styles.module.scss.js +30 -0
- package/dist/esm/components/shared/MultiItemInput/usePositionGrid.js +49 -0
- package/dist/esm/components/shared/MultiItemInput/useSortableGrid.js +20 -0
- package/dist/esm/theme/ThemeProvider.js +46 -0
- package/dist/esm/theme/cssVariables.js +29 -0
- package/dist/esm/theme/mantineTheme.js +36 -0
- package/package.json +2 -2
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const p = (e) => {
|
|
3
|
+
const { name: r, icon: t } = e;
|
|
4
|
+
return `
|
|
5
|
+
<div class="pin-marker">
|
|
6
|
+
${t ? `<img src="${t}" alt="${r}" width="40" height="40" />` : `
|
|
7
|
+
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8
|
+
<g>
|
|
9
|
+
<path d="M18.7686 1.26235C11.6407 0.936128 5.75293 6.62941 5.75293 13.6913C5.75293 22.565 11.76 30.0415 15.1594 33.4869C16.8117 35.1766 19.5261 35.1761 21.1779 33.4854C24.318 30.2845 29.8102 23.653 30.5636 15.5539L30.5637 15.5531C31.2237 8.38935 26.1199 1.59187 18.7686 1.26235ZM18.7686 1.26235L18.7229 2.26131L18.7676 1.2623C18.768 1.26232 18.7683 1.26234 18.7686 1.26235Z" fill="#FF6C6C" stroke="white" stroke-width="2" stroke-miterlimit="10"/>
|
|
10
|
+
<path d="M18.4084 18.2387C20.8523 18.2387 22.8334 16.2575 22.8334 13.8137C22.8334 11.3698 20.8523 9.38867 18.4084 9.38867C15.9645 9.38867 13.9834 11.3698 13.9834 13.8137C13.9834 16.2575 15.9645 18.2387 18.4084 18.2387Z" fill="white"/>
|
|
11
|
+
</g>
|
|
12
|
+
</svg>
|
|
13
|
+
`}
|
|
14
|
+
<div class="pin-marker-name">${r}</div>
|
|
15
|
+
</div>
|
|
16
|
+
`;
|
|
17
|
+
}, s = (e) => {
|
|
18
|
+
const { discountRate: r, price: t, originalPrice: i, category: a, active: o, title: n } = e;
|
|
19
|
+
return `
|
|
20
|
+
<div class="popdeal-marker" active="${!!o}">
|
|
21
|
+
<div class="popdeal-marker-section">
|
|
22
|
+
<div class="popdeal-marker-section-header">
|
|
23
|
+
<span class="popdeal-marker-title">${n}</span>
|
|
24
|
+
${a ? `<span class="popdeal-marker-category">${a}</span>` : ""}
|
|
25
|
+
</div>
|
|
26
|
+
<div class="popdeal-marker-section-price">
|
|
27
|
+
${i ? `<span class="popdeal-marker-original_price">${i.toLocaleString()}원</span>` : ""}
|
|
28
|
+
${r ? `<span class="popdeal-marker-discount_rate">${r}%</span>` : ""}
|
|
29
|
+
<span class="popdeal-marker-discounted_price">${t.toLocaleString()}원</span>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
`;
|
|
34
|
+
}, l = (e) => {
|
|
35
|
+
const { title: r, icon: t } = e;
|
|
36
|
+
return `
|
|
37
|
+
<div class="pi-marker">
|
|
38
|
+
${t ? `<img class="pi-marker-icon" src="${t}" alt="" width="32px" height="32px" />` : ""}
|
|
39
|
+
<span class="pi-marker-text">${r}</span>
|
|
40
|
+
</div>
|
|
41
|
+
`;
|
|
42
|
+
}, d = (e) => {
|
|
43
|
+
const { title: r, icon: t, address: i } = e;
|
|
44
|
+
return `
|
|
45
|
+
<div class="pi-expanded-marker">
|
|
46
|
+
${t ? `<img class="pi-expanded-marker-icon" src="${t}" alt="" width="32px" height="32px" />` : ""}
|
|
47
|
+
<div class="pi-expanded-marker-content">
|
|
48
|
+
<div class="pi-expanded-marker-title">${r}</div>
|
|
49
|
+
${i ? `<div class="pi-expanded-marker-address">${i}</div>` : ""}
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
`;
|
|
53
|
+
}, c = (e) => `
|
|
54
|
+
<div class="cluster-marker">
|
|
55
|
+
<span class="cluster-marker-text">${e.count}</span>
|
|
56
|
+
</div>
|
|
57
|
+
`, x = (e) => {
|
|
58
|
+
switch (e.type) {
|
|
59
|
+
case "pin":
|
|
60
|
+
return p(e);
|
|
61
|
+
case "popdeal":
|
|
62
|
+
return s(e);
|
|
63
|
+
case "pi":
|
|
64
|
+
return l(e);
|
|
65
|
+
case "pi-expanded":
|
|
66
|
+
return d(e);
|
|
67
|
+
case "cluster":
|
|
68
|
+
return c(e);
|
|
69
|
+
default:
|
|
70
|
+
return "";
|
|
71
|
+
}
|
|
72
|
+
}, m = `
|
|
73
|
+
/* Common marker styles */
|
|
74
|
+
[class$="marker"] {
|
|
75
|
+
user-select: none;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Pin Marker */
|
|
79
|
+
.pin-marker {
|
|
80
|
+
position: relative;
|
|
81
|
+
z-index: 10;
|
|
82
|
+
transform: translate(-50%, -100%);
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
gap: 8px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.pin-marker-name {
|
|
91
|
+
min-width: max-content;
|
|
92
|
+
color: #1A1A1A;
|
|
93
|
+
text-align: center;
|
|
94
|
+
font-weight: 700;
|
|
95
|
+
font-size: 14px;
|
|
96
|
+
line-height: 1.4;
|
|
97
|
+
text-shadow:
|
|
98
|
+
-2px -2px 0 white,
|
|
99
|
+
2px -2px 0 white,
|
|
100
|
+
-2px 2px 0 white,
|
|
101
|
+
2px 2px 0 white;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Popdeal Marker */
|
|
105
|
+
.popdeal-marker {
|
|
106
|
+
transform: translate(-50%, -100%);
|
|
107
|
+
padding: 10px 16px;
|
|
108
|
+
width: fit-content;
|
|
109
|
+
max-width: 210px;
|
|
110
|
+
position: relative;
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: column;
|
|
113
|
+
justify-content: center;
|
|
114
|
+
align-items: center;
|
|
115
|
+
gap: 4px;
|
|
116
|
+
transition: border-color 0.2s ease-in-out;
|
|
117
|
+
word-break: keep-all;
|
|
118
|
+
background: white;
|
|
119
|
+
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.12);
|
|
120
|
+
border-radius: 12px;
|
|
121
|
+
color: #3D3D3D;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.popdeal-marker:hover {
|
|
125
|
+
z-index: 10;
|
|
126
|
+
filter: drop-shadow(0px 4px 12px rgba(0, 0, 0, 0.12));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.popdeal-marker::after {
|
|
130
|
+
content: "";
|
|
131
|
+
display: block;
|
|
132
|
+
width: 12px;
|
|
133
|
+
height: 12px;
|
|
134
|
+
position: absolute;
|
|
135
|
+
bottom: -7px;
|
|
136
|
+
left: 50%;
|
|
137
|
+
right: 50%;
|
|
138
|
+
background: white;
|
|
139
|
+
transform: translate(-50%) rotate(45deg);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.popdeal-marker[active="true"] {
|
|
143
|
+
z-index: 10;
|
|
144
|
+
border: 2px solid #00C4C4;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.popdeal-marker[active="true"]::after {
|
|
148
|
+
border-right: 2px solid #00C4C4;
|
|
149
|
+
border-bottom: 2px solid #00C4C4;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.popdeal-marker[active="false"] {
|
|
153
|
+
border: 1px solid #F5F5F5;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.popdeal-marker[active="false"]::after {
|
|
157
|
+
border-right: 1px solid #F5F5F5;
|
|
158
|
+
border-bottom: 1px solid #F5F5F5;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.popdeal-marker-section {
|
|
162
|
+
display: flex;
|
|
163
|
+
flex-direction: column;
|
|
164
|
+
justify-content: center;
|
|
165
|
+
align-items: center;
|
|
166
|
+
gap: 0;
|
|
167
|
+
flex-wrap: nowrap;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.popdeal-marker-section-header {
|
|
171
|
+
display: flex;
|
|
172
|
+
justify-content: center;
|
|
173
|
+
align-items: center;
|
|
174
|
+
gap: 4px;
|
|
175
|
+
flex-wrap: nowrap;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.popdeal-marker-section-price {
|
|
179
|
+
display: flex;
|
|
180
|
+
justify-content: center;
|
|
181
|
+
align-items: center;
|
|
182
|
+
gap: 0 4px;
|
|
183
|
+
flex-wrap: wrap;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.popdeal-marker-title {
|
|
187
|
+
font-weight: 700;
|
|
188
|
+
font-size: 14px;
|
|
189
|
+
text-align: center;
|
|
190
|
+
width: 100%;
|
|
191
|
+
display: -webkit-box;
|
|
192
|
+
-webkit-line-clamp: 2;
|
|
193
|
+
-webkit-box-orient: vertical;
|
|
194
|
+
overflow: hidden;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.popdeal-marker-discount_rate {
|
|
198
|
+
color: #00C4C4;
|
|
199
|
+
font-weight: 600;
|
|
200
|
+
font-size: 14px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.popdeal-marker-discounted_price {
|
|
204
|
+
color: #3D3D3D;
|
|
205
|
+
font-weight: 600;
|
|
206
|
+
font-size: 14px;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.popdeal-marker-original_price {
|
|
210
|
+
width: 100%;
|
|
211
|
+
color: #B3B3B3;
|
|
212
|
+
text-align: center;
|
|
213
|
+
font-size: 14px;
|
|
214
|
+
text-decoration: line-through;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.popdeal-marker-category {
|
|
218
|
+
color: #6E6E6E;
|
|
219
|
+
font-weight: 600;
|
|
220
|
+
font-size: 12px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.popdeal-marker-category::before {
|
|
224
|
+
content: "|";
|
|
225
|
+
color: #B3B3B3;
|
|
226
|
+
margin-right: 4px;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* PI Marker */
|
|
230
|
+
.pi-marker {
|
|
231
|
+
transform: translate(-50%, -50%);
|
|
232
|
+
z-index: 10;
|
|
233
|
+
position: relative;
|
|
234
|
+
display: flex;
|
|
235
|
+
flex-direction: column;
|
|
236
|
+
align-items: center;
|
|
237
|
+
justify-content: center;
|
|
238
|
+
gap: 4px;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.pi-marker-icon {
|
|
242
|
+
width: 32px;
|
|
243
|
+
height: 32px;
|
|
244
|
+
object-fit: cover;
|
|
245
|
+
border-radius: 50%;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.pi-marker-text {
|
|
249
|
+
position: absolute;
|
|
250
|
+
top: calc(100% + 5px);
|
|
251
|
+
left: 50%;
|
|
252
|
+
transform: translateX(-50%);
|
|
253
|
+
min-width: max-content;
|
|
254
|
+
padding: 4px 8px;
|
|
255
|
+
background: white;
|
|
256
|
+
font-size: 12px;
|
|
257
|
+
border-radius: 99px;
|
|
258
|
+
color: #3D3D3D;
|
|
259
|
+
box-shadow: 0 0.432px 0.864px 0 rgba(0, 0, 0, 0.28);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/* PI Expanded Marker */
|
|
263
|
+
.pi-expanded-marker {
|
|
264
|
+
transform: translate(-50%, -50%);
|
|
265
|
+
z-index: 100;
|
|
266
|
+
position: relative;
|
|
267
|
+
display: flex;
|
|
268
|
+
flex-direction: column;
|
|
269
|
+
align-items: center;
|
|
270
|
+
justify-content: center;
|
|
271
|
+
gap: 4px;
|
|
272
|
+
filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.12));
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.pi-expanded-marker-icon {
|
|
276
|
+
width: 32px;
|
|
277
|
+
height: 32px;
|
|
278
|
+
object-fit: cover;
|
|
279
|
+
border-radius: 50%;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.pi-expanded-marker-content {
|
|
283
|
+
position: absolute;
|
|
284
|
+
bottom: calc(100% + 10px);
|
|
285
|
+
left: 50%;
|
|
286
|
+
transform: translateX(-50%);
|
|
287
|
+
width: max-content;
|
|
288
|
+
max-width: 200px;
|
|
289
|
+
padding: 16px;
|
|
290
|
+
word-break: keep-all;
|
|
291
|
+
display: flex;
|
|
292
|
+
flex-direction: column;
|
|
293
|
+
align-items: center;
|
|
294
|
+
justify-content: center;
|
|
295
|
+
background: white;
|
|
296
|
+
border-radius: 8px;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.pi-expanded-marker-title {
|
|
300
|
+
font-weight: 600;
|
|
301
|
+
font-size: 14px;
|
|
302
|
+
text-align: center;
|
|
303
|
+
color: #1A1A1A;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.pi-expanded-marker-address {
|
|
307
|
+
font-size: 14px;
|
|
308
|
+
color: #6E6E6E;
|
|
309
|
+
width: 100%;
|
|
310
|
+
text-align: center;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/* Cluster Marker */
|
|
314
|
+
.cluster-marker {
|
|
315
|
+
width: fit-content;
|
|
316
|
+
min-width: 52px;
|
|
317
|
+
height: 36px;
|
|
318
|
+
padding: 13px;
|
|
319
|
+
position: relative;
|
|
320
|
+
display: flex;
|
|
321
|
+
align-items: center;
|
|
322
|
+
justify-content: center;
|
|
323
|
+
border-radius: 12px;
|
|
324
|
+
background: #00C4C4;
|
|
325
|
+
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.12);
|
|
326
|
+
transform: translate(-50%, -50%);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.cluster-marker-text {
|
|
330
|
+
font-weight: 700;
|
|
331
|
+
font-size: 15px;
|
|
332
|
+
color: white;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.cluster-marker::after {
|
|
336
|
+
content: "";
|
|
337
|
+
display: block;
|
|
338
|
+
width: 12px;
|
|
339
|
+
height: 12px;
|
|
340
|
+
position: absolute;
|
|
341
|
+
bottom: -2px;
|
|
342
|
+
left: 50%;
|
|
343
|
+
right: 50%;
|
|
344
|
+
background: #00C4C4;
|
|
345
|
+
transform: translate(-50%) rotate(45deg);
|
|
346
|
+
}
|
|
347
|
+
`;
|
|
348
|
+
export {
|
|
349
|
+
x as getMarkerHTML,
|
|
350
|
+
m as markerStyles
|
|
351
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as r, useRef as d, useEffect as m } from "react";
|
|
3
|
+
import { toast as p } from "../Toast/index.js";
|
|
4
|
+
const E = "위치 정보를 불러오는 데 실패했어요.", L = "위치 서비스 권한과 네트워크 상태를 확인해주세요.", y = ({
|
|
5
|
+
isActive: n = !1,
|
|
6
|
+
errorMessage: s = E,
|
|
7
|
+
errorDescription: a = L
|
|
8
|
+
}) => {
|
|
9
|
+
const [l, o] = r(!1), [c, i] = r(!1), [f, u] = r(null), e = d(!1);
|
|
10
|
+
return m(() => {
|
|
11
|
+
if (n && typeof navigator < "u" && "geolocation" in navigator) {
|
|
12
|
+
if (e.current) return;
|
|
13
|
+
e.current = !0, requestAnimationFrame(() => {
|
|
14
|
+
o(!0);
|
|
15
|
+
});
|
|
16
|
+
const g = {
|
|
17
|
+
enableHighAccuracy: !0,
|
|
18
|
+
timeout: 1e4,
|
|
19
|
+
maximumAge: 0
|
|
20
|
+
};
|
|
21
|
+
navigator.geolocation.getCurrentPosition(
|
|
22
|
+
(t) => {
|
|
23
|
+
u({
|
|
24
|
+
latitude: t.coords.latitude,
|
|
25
|
+
longitude: t.coords.longitude
|
|
26
|
+
}), o(!1), i(!1), e.current = !1;
|
|
27
|
+
},
|
|
28
|
+
(t) => {
|
|
29
|
+
u(null), console.error("Geolocation error:", t), p({
|
|
30
|
+
message: `${s} ${a}`
|
|
31
|
+
}), o(!1), i(!0), e.current = !1;
|
|
32
|
+
},
|
|
33
|
+
g
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}, [n, s, a]), { position: f, isLoading: l, isError: c };
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
y as useLocation
|
|
40
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as v, useRef as p, useCallback as a, useEffect as S } from "react";
|
|
3
|
+
import { makeMarkerClustering as x } from "./markerClustering.js";
|
|
4
|
+
import { getMarkerHTML as M } from "./markerStyles.js";
|
|
5
|
+
import { useNaverMap as h } from "./NaverMapContext.js";
|
|
6
|
+
const B = (n) => {
|
|
7
|
+
const { naver: t } = h(), [o, g] = v([]), c = p(
|
|
8
|
+
/* @__PURE__ */ new Map()
|
|
9
|
+
), f = p(null), L = a(
|
|
10
|
+
(e) => {
|
|
11
|
+
if (!n || !t) return null;
|
|
12
|
+
const i = M(e), r = new t.maps.Marker({
|
|
13
|
+
...e,
|
|
14
|
+
position: new t.maps.LatLng(e.position.latitude, e.position.longitude),
|
|
15
|
+
map: n,
|
|
16
|
+
icon: {
|
|
17
|
+
content: i
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return e.onClick && t.maps.Event.addListener(r, "click", () => {
|
|
21
|
+
e.onClick(e.id);
|
|
22
|
+
}), g((s) => [...s, r]), c.current.set(e.id, { marker: r, data: e }), r;
|
|
23
|
+
},
|
|
24
|
+
[n, t]
|
|
25
|
+
), d = a(
|
|
26
|
+
(e, i) => {
|
|
27
|
+
const r = c.current.get(e);
|
|
28
|
+
if (!r || !t)
|
|
29
|
+
return;
|
|
30
|
+
const { marker: s, data: u } = r, m = { ...u, ...i }, l = s.getElement();
|
|
31
|
+
if (l) {
|
|
32
|
+
const k = l.querySelector(".popdeal-marker");
|
|
33
|
+
k && "active" in i && k.setAttribute("active", String(!!i.active));
|
|
34
|
+
}
|
|
35
|
+
c.current.set(e, { marker: s, data: m });
|
|
36
|
+
},
|
|
37
|
+
[t]
|
|
38
|
+
), w = a(() => {
|
|
39
|
+
o.forEach((e) => {
|
|
40
|
+
e && e.setMap(null);
|
|
41
|
+
}), g([]), c.current.clear(), f.current && (f.current.setMap(null), f.current = null);
|
|
42
|
+
}, [o]), C = a(
|
|
43
|
+
(e) => {
|
|
44
|
+
!n || !t || n.panTo(new t.maps.LatLng(e.latitude, e.longitude));
|
|
45
|
+
},
|
|
46
|
+
[n, t]
|
|
47
|
+
), E = a(
|
|
48
|
+
(e) => {
|
|
49
|
+
if (!n || !t || e.length === 0) return;
|
|
50
|
+
const i = new t.maps.LatLngBounds(
|
|
51
|
+
new t.maps.LatLng(e[0].latitude, e[0].longitude),
|
|
52
|
+
new t.maps.LatLng(e[0].latitude, e[0].longitude)
|
|
53
|
+
);
|
|
54
|
+
e.forEach((r) => {
|
|
55
|
+
i.extend(new t.maps.LatLng(r.latitude, r.longitude));
|
|
56
|
+
}), n.fitBounds(i);
|
|
57
|
+
},
|
|
58
|
+
[n, t]
|
|
59
|
+
);
|
|
60
|
+
return S(() => {
|
|
61
|
+
if (!t || !n || o.length === 0) return;
|
|
62
|
+
const e = x(t), r = {
|
|
63
|
+
content: M({
|
|
64
|
+
type: "cluster",
|
|
65
|
+
count: 0
|
|
66
|
+
}),
|
|
67
|
+
size: new t.maps.Size(96, 96),
|
|
68
|
+
anchor: new t.maps.Point(20, 20)
|
|
69
|
+
}, s = new e({
|
|
70
|
+
minClusterSize: 2,
|
|
71
|
+
maxZoom: 17,
|
|
72
|
+
map: n,
|
|
73
|
+
markers: o,
|
|
74
|
+
disableClickZoom: !1,
|
|
75
|
+
gridSize: 120,
|
|
76
|
+
icons: [r],
|
|
77
|
+
indexGenerator: [10, 100, 200, 500, 1e3],
|
|
78
|
+
averageCenter: !1,
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
stylingFunction: (u, m) => {
|
|
82
|
+
if (u && typeof u.getElement == "function") {
|
|
83
|
+
const l = u.getElement().querySelector(".cluster-marker-text");
|
|
84
|
+
l && (l.textContent = String(m));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return f.current = s, () => {
|
|
89
|
+
s.setMap(null);
|
|
90
|
+
};
|
|
91
|
+
}, [t, n, o]), { addMarker: L, updateMarker: d, clearMarkers: w, panTo: C, fitBounds: E };
|
|
92
|
+
};
|
|
93
|
+
export {
|
|
94
|
+
B as useMap
|
|
95
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
3
|
+
import { IconMap as L, ColorGray800 as U, IconMapMarker as H, ColorAqua500 as S } from "@pop-ui/foundation";
|
|
4
|
+
import { useState as T, useCallback as s, useEffect as g, useMemo as $ } from "react";
|
|
5
|
+
import { Button as j } from "../Button/index.js";
|
|
6
|
+
import { toast as G } from "../Toast/index.js";
|
|
7
|
+
import r from "./styles.module.scss.js";
|
|
8
|
+
import { usePopUIConfig as Z } from "../../theme/ThemeProvider.js";
|
|
9
|
+
import { NaverMapProvider as K } from "../Map/NaverMapContext.js";
|
|
10
|
+
import { Map as F } from "../Map/Map.js";
|
|
11
|
+
const J = 60, eo = ({
|
|
12
|
+
location: k,
|
|
13
|
+
marker: v,
|
|
14
|
+
direction: l,
|
|
15
|
+
toast: N,
|
|
16
|
+
naverClientId: b,
|
|
17
|
+
onExpandRequest: d,
|
|
18
|
+
onClick: y,
|
|
19
|
+
height: p = 200
|
|
20
|
+
}) => {
|
|
21
|
+
const w = Z(), M = b || w.naverClientId, { title: t, address: i, latitude: a, longitude: n } = k, P = l?.label ?? "길찾기", I = N?.addressCopied ?? "주소 복사 완료", [m, u] = T(null), x = p - J, A = s((o) => {
|
|
22
|
+
o && o.map && u(o);
|
|
23
|
+
}, []), D = s(() => {
|
|
24
|
+
d?.();
|
|
25
|
+
}, [d]), C = s(
|
|
26
|
+
(o, f, B) => {
|
|
27
|
+
if (o && o.map && a && n)
|
|
28
|
+
try {
|
|
29
|
+
o.addMarker(f), B?.();
|
|
30
|
+
} catch (E) {
|
|
31
|
+
console.error("Error creating map marker:", E);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
[a, n]
|
|
35
|
+
), _ = s(
|
|
36
|
+
(o, f) => {
|
|
37
|
+
o && o.map && a && n && (o.clearMarkers(), C(
|
|
38
|
+
o,
|
|
39
|
+
{
|
|
40
|
+
id: `location-marker-${t}`,
|
|
41
|
+
type: f,
|
|
42
|
+
position: { latitude: a, longitude: n },
|
|
43
|
+
title: t,
|
|
44
|
+
icon: v?.imageUrl,
|
|
45
|
+
address: i
|
|
46
|
+
},
|
|
47
|
+
() => {
|
|
48
|
+
o.panTo({ latitude: a, longitude: n });
|
|
49
|
+
}
|
|
50
|
+
));
|
|
51
|
+
},
|
|
52
|
+
[a, n, t, v?.imageUrl, i, C]
|
|
53
|
+
);
|
|
54
|
+
g(() => {
|
|
55
|
+
a && n && m && _(m, "pi");
|
|
56
|
+
}, [m, a, n, _]), g(() => () => {
|
|
57
|
+
u(null);
|
|
58
|
+
}, []);
|
|
59
|
+
const h = s(() => {
|
|
60
|
+
typeof navigator < "u" && navigator.clipboard && (navigator.clipboard.writeText(i), G(I));
|
|
61
|
+
}, [i, I]), z = $(() => l?.url ? l.url : `https://map.naver.com/p/search/${encodeURIComponent(t)}`, [l?.url, t]);
|
|
62
|
+
return M ? /* @__PURE__ */ c("div", { className: r.MapInfo, style: { height: p }, onClick: y, children: [
|
|
63
|
+
/* @__PURE__ */ e(K, { clientId: M, children: /* @__PURE__ */ c("div", { className: r.MapInfo__Preview, onClick: D, children: [
|
|
64
|
+
/* @__PURE__ */ e(
|
|
65
|
+
F,
|
|
66
|
+
{
|
|
67
|
+
onLoad: A,
|
|
68
|
+
options: {
|
|
69
|
+
width: "100%",
|
|
70
|
+
height: `${x}px`,
|
|
71
|
+
center: {
|
|
72
|
+
lat: a,
|
|
73
|
+
lng: n
|
|
74
|
+
},
|
|
75
|
+
zoom: 15,
|
|
76
|
+
minZoom: 15,
|
|
77
|
+
maxZoom: 15,
|
|
78
|
+
draggable: !1,
|
|
79
|
+
keyboardShortcuts: !1,
|
|
80
|
+
mapTypeControl: !1,
|
|
81
|
+
scaleControl: !1,
|
|
82
|
+
logoControl: !1,
|
|
83
|
+
mapDataControl: !1,
|
|
84
|
+
zoomControl: !1
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
d && /* @__PURE__ */ e("div", { className: r.MapInfo__ExpandButton, children: /* @__PURE__ */ e(L, { color: U, size: 18 }) })
|
|
89
|
+
] }) }),
|
|
90
|
+
/* @__PURE__ */ c("div", { className: r.MapInfo__AddressBar, children: [
|
|
91
|
+
/* @__PURE__ */ c("div", { className: r.MapInfo__AddressContent, children: [
|
|
92
|
+
/* @__PURE__ */ e(H, { color: S, size: 24, variant: "filled" }),
|
|
93
|
+
/* @__PURE__ */ e(
|
|
94
|
+
"span",
|
|
95
|
+
{
|
|
96
|
+
className: r.MapInfo__Address,
|
|
97
|
+
onClick: h,
|
|
98
|
+
role: "button",
|
|
99
|
+
tabIndex: 0,
|
|
100
|
+
onKeyDown: (o) => o.key === "Enter" && h(),
|
|
101
|
+
children: i
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ e(
|
|
106
|
+
"a",
|
|
107
|
+
{
|
|
108
|
+
className: r.MapInfo__DirectionLink,
|
|
109
|
+
href: z,
|
|
110
|
+
target: "_blank",
|
|
111
|
+
rel: "noreferrer",
|
|
112
|
+
children: /* @__PURE__ */ e(j, { variant: "basic", size: "sm", className: r.MapInfo__DirectionButton, children: P })
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] })
|
|
116
|
+
] }) : /* @__PURE__ */ e("div", { className: r.MapInfo, style: { height: p }, children: /* @__PURE__ */ e("div", { className: r.MapInfo__NoClientId, children: "naverClientId가 필요합니다. PopUIProvider 또는 props로 전달해주세요." }) });
|
|
117
|
+
};
|
|
118
|
+
export {
|
|
119
|
+
eo as MapInfo
|
|
120
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const _ = "styles-module__MapInfo___scB-5", n = "styles-module__MapInfo__NoClientId___YBM4o", o = "styles-module__MapInfo__Preview___FJbQN", e = "styles-module__MapInfo__ExpandButton___8KySg", s = "styles-module__MapInfo__AddressBar___mKkK6", t = "styles-module__MapInfo__AddressContent___XG1Uz", a = "styles-module__MapInfo__Address___iXO6N", d = "styles-module__MapInfo__DirectionLink___eGnf-", p = "styles-module__MapInfo__DirectionButton___gTWpj", I = {
|
|
3
|
+
MapInfo: _,
|
|
4
|
+
MapInfo__NoClientId: n,
|
|
5
|
+
MapInfo__Preview: o,
|
|
6
|
+
MapInfo__ExpandButton: e,
|
|
7
|
+
MapInfo__AddressBar: s,
|
|
8
|
+
MapInfo__AddressContent: t,
|
|
9
|
+
MapInfo__Address: a,
|
|
10
|
+
MapInfo__DirectionLink: d,
|
|
11
|
+
MapInfo__DirectionButton: p
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
_ as MapInfo,
|
|
15
|
+
a as MapInfo__Address,
|
|
16
|
+
s as MapInfo__AddressBar,
|
|
17
|
+
t as MapInfo__AddressContent,
|
|
18
|
+
p as MapInfo__DirectionButton,
|
|
19
|
+
d as MapInfo__DirectionLink,
|
|
20
|
+
e as MapInfo__ExpandButton,
|
|
21
|
+
n as MapInfo__NoClientId,
|
|
22
|
+
o as MapInfo__Preview,
|
|
23
|
+
I as default
|
|
24
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import { Modal as f } from "@mantine/core";
|
|
4
|
+
import { IconX as a, ColorGray600 as d, ColorGray900 as c } from "@pop-ui/foundation";
|
|
5
|
+
const p = (e) => ({
|
|
6
|
+
// fullScreen이면 Mantine의 radius 0을 인라인 radius로 덮지 않는다.
|
|
7
|
+
...e ? {} : { content: { borderRadius: "12px" } },
|
|
8
|
+
title: {
|
|
9
|
+
fontSize: "16px",
|
|
10
|
+
fontWeight: "700",
|
|
11
|
+
lineHeight: "150%",
|
|
12
|
+
color: c
|
|
13
|
+
},
|
|
14
|
+
header: {
|
|
15
|
+
padding: "16px"
|
|
16
|
+
},
|
|
17
|
+
body: {
|
|
18
|
+
paddingInline: 0
|
|
19
|
+
}
|
|
20
|
+
}), g = (e, n) => {
|
|
21
|
+
if (typeof e == "function")
|
|
22
|
+
return e;
|
|
23
|
+
const o = p(n), t = { ...o, ...e };
|
|
24
|
+
return Object.keys(o).forEach((r) => {
|
|
25
|
+
t[r] = { ...o[r], ...e?.[r] };
|
|
26
|
+
}), t;
|
|
27
|
+
}, x = ({
|
|
28
|
+
size: e = "md",
|
|
29
|
+
width: n,
|
|
30
|
+
withCloseButton: o = !1,
|
|
31
|
+
fullScreen: t = !1,
|
|
32
|
+
styles: r,
|
|
33
|
+
...s
|
|
34
|
+
}) => {
|
|
35
|
+
let l = 768;
|
|
36
|
+
return e === "xs" ? l = 360 : e === "sm" ? l = 544 : e === "lg" ? l = 1e3 : e === "xl" && (l = 1200), /* @__PURE__ */ i(
|
|
37
|
+
f,
|
|
38
|
+
{
|
|
39
|
+
size: n || l,
|
|
40
|
+
fullScreen: t,
|
|
41
|
+
styles: g(r, t),
|
|
42
|
+
withCloseButton: o,
|
|
43
|
+
closeButtonProps: {
|
|
44
|
+
icon: /* @__PURE__ */ i(a, { size: 18, color: d })
|
|
45
|
+
},
|
|
46
|
+
...s
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
x as Modal
|
|
52
|
+
};
|