@pop-ui/core 2.2.3 → 2.2.5

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/core.css +1 -1
  3. package/dist/core.js +58 -3110
  4. package/dist/core.umd.cjs +3 -3
  5. package/dist/esm/components/Button/index.js +75 -0
  6. package/dist/esm/components/Button/style.js +9 -0
  7. package/dist/esm/components/Button/styles.module.scss.js +28 -0
  8. package/dist/esm/components/CalendarDatePicker/index.js +119 -0
  9. package/dist/esm/components/CalendarDatePicker/styles.module.scss.js +34 -0
  10. package/dist/esm/components/CalendarDatePicker/utils.js +82 -0
  11. package/dist/esm/components/Checkbox/index.js +32 -0
  12. package/dist/esm/components/Checkbox/styles.module.scss.js +9 -0
  13. package/dist/esm/components/DatePicker/index.js +203 -0
  14. package/dist/esm/components/DatePicker/styles.module.scss.js +57 -0
  15. package/dist/esm/components/Dropdown/index.js +61 -0
  16. package/dist/esm/components/Dropdown/styles.module.scss.js +21 -0
  17. package/dist/esm/components/ImageInput/ImageInputCropModal.js +91 -0
  18. package/dist/esm/components/ImageInput/helpers.js +46 -0
  19. package/dist/esm/components/ImageInput/index.js +379 -0
  20. package/dist/esm/components/ImageInput/styles.module.scss.js +30 -0
  21. package/dist/esm/components/LottieInput/helpers.js +48 -0
  22. package/dist/esm/components/LottieInput/index.js +233 -0
  23. package/dist/esm/components/LottieInput/styles.module.scss.js +14 -0
  24. package/dist/esm/components/Map/Map.js +48 -0
  25. package/dist/esm/components/Map/NaverMapContext.js +78 -0
  26. package/dist/esm/components/Map/markerClustering.js +305 -0
  27. package/dist/esm/components/Map/markerStyles.js +351 -0
  28. package/dist/esm/components/Map/useLocation.js +40 -0
  29. package/dist/esm/components/Map/useMap.js +95 -0
  30. package/dist/esm/components/MapInfo/index.js +120 -0
  31. package/dist/esm/components/MapInfo/styles.module.scss.js +24 -0
  32. package/dist/esm/components/Modal/index.js +52 -0
  33. package/dist/esm/components/Pagination/index.js +45 -0
  34. package/dist/esm/components/Pagination/style.module.scss.js +13 -0
  35. package/dist/esm/components/Radio/index.js +29 -0
  36. package/dist/esm/components/Radio/styles.module.scss.js +9 -0
  37. package/dist/esm/components/SearchBar/index.js +60 -0
  38. package/dist/esm/components/SearchBar/styles.module.scss.js +25 -0
  39. package/dist/esm/components/SegmentButton/index.js +25 -0
  40. package/dist/esm/components/SegmentButton/styles.module.scss.js +9 -0
  41. package/dist/esm/components/Tab/index.js +14 -0
  42. package/dist/esm/components/Tab/styles.module.scss.js +10 -0
  43. package/dist/esm/components/TextField/index.js +99 -0
  44. package/dist/esm/components/TextField/styles.module.scss.js +28 -0
  45. package/dist/esm/components/TimePicker/index.js +33 -0
  46. package/dist/esm/components/TimePicker/styles.module.scss.js +9 -0
  47. package/dist/esm/components/Toast/index.js +35 -0
  48. package/dist/esm/components/Toast/styles.module.scss.js +14 -0
  49. package/dist/esm/components/Toggle/index.js +48 -0
  50. package/dist/esm/components/Toggle/styles.module.scss.js +9 -0
  51. package/dist/esm/components/Tooltip/index.js +25 -0
  52. package/dist/esm/components/Tooltip/styles.module.scss.js +12 -0
  53. package/dist/esm/components/shared/MultiItemInput/Dropzone.js +30 -0
  54. package/dist/esm/components/shared/MultiItemInput/SortableEmptySlot.js +29 -0
  55. package/dist/esm/components/shared/MultiItemInput/TileShell.js +113 -0
  56. package/dist/esm/components/shared/MultiItemInput/helpers.js +23 -0
  57. package/dist/esm/components/shared/MultiItemInput/styles.module.scss.js +30 -0
  58. package/dist/esm/components/shared/MultiItemInput/usePositionGrid.js +49 -0
  59. package/dist/esm/components/shared/MultiItemInput/useSortableGrid.js +20 -0
  60. package/dist/esm/theme/ThemeProvider.js +46 -0
  61. package/dist/esm/theme/cssVariables.js +29 -0
  62. package/dist/esm/theme/mantineTheme.js +36 -0
  63. package/package.json +2 -2
@@ -0,0 +1,48 @@
1
+ "use client";
2
+ import { jsx as M } from "react/jsx-runtime";
3
+ import { useRef as y, useState as I, useMemo as g, useEffect as o } from "react";
4
+ import { markerStyles as C } from "./markerStyles.js";
5
+ import { useNaverMap as S } from "./NaverMapContext.js";
6
+ import { useMap as N } from "./useMap.js";
7
+ const k = ({ options: h, onLoad: s }) => {
8
+ const r = y(null), v = y(null), { createMap: u } = S(), [n, a] = I(null), p = N(n), { width: i = "100%", height: l = "100%", ...c } = h || {}, m = g(() => c, [JSON.stringify(c)]);
9
+ return o(() => {
10
+ if (typeof document > "u" || document.getElementById("pop-ui-map-marker-styles")) return;
11
+ const e = document.createElement("style");
12
+ return e.id = "pop-ui-map-marker-styles", e.textContent = C, document.head.appendChild(e), v.current = e, () => {
13
+ };
14
+ }, []), o(() => {
15
+ let t = null, e = null;
16
+ if (n && (n.destroy(), a(null)), r.current && r.current.isConnected) {
17
+ const f = () => r.current && r.current.isConnected && (t = u(r, m), t) ? (a(t), !0) : !1;
18
+ if (!f()) {
19
+ let d = 0;
20
+ const x = 50;
21
+ e = setInterval(() => {
22
+ d++, (f() || d >= x) && e && (clearInterval(e), e = null);
23
+ }, 100);
24
+ }
25
+ return () => {
26
+ e && clearInterval(e), t && (t.destroy(), t = null);
27
+ };
28
+ }
29
+ return () => {
30
+ e && clearInterval(e), t && (t.destroy(), t = null);
31
+ };
32
+ }, [u, m]), o(() => {
33
+ n && s && s({ map: n, ...p });
34
+ }, [n, s, p]), /* @__PURE__ */ M(
35
+ "div",
36
+ {
37
+ ref: r,
38
+ style: {
39
+ width: typeof i == "number" ? `${i}px` : i,
40
+ height: typeof l == "number" ? `${l}px` : l
41
+ }
42
+ }
43
+ );
44
+ };
45
+ k.displayName = "Map";
46
+ export {
47
+ k as Map
48
+ };
@@ -0,0 +1,78 @@
1
+ "use client";
2
+ import { jsx as h } from "react/jsx-runtime";
3
+ import { useState as l, useEffect as x, useCallback as y, createContext as P, useContext as g } from "react";
4
+ const f = P(null), m = "naver-map-script", A = (r, s) => new Promise((o, n) => {
5
+ if (typeof window < "u" && window.naver?.maps) {
6
+ o();
7
+ return;
8
+ }
9
+ const t = document.getElementById(m);
10
+ if (t) {
11
+ t.addEventListener("load", () => o()), t.addEventListener(
12
+ "error",
13
+ () => n(new Error("Failed to load Naver Map script"))
14
+ );
15
+ return;
16
+ }
17
+ const e = document.createElement("script");
18
+ e.id = m, e.src = `https://oapi.map.naver.com/openapi/v3/maps.js?ncpKeyId=${r}&language=${s}`, e.async = !0, e.onload = () => {
19
+ o();
20
+ }, e.onerror = () => {
21
+ n(new Error("Failed to load Naver Map script"));
22
+ }, document.head.appendChild(e);
23
+ }), S = ({
24
+ clientId: r,
25
+ language: s = "ko",
26
+ children: o
27
+ }) => {
28
+ const [n, t] = l(null), [e, v] = l({}), [d, w] = l(null);
29
+ x(() => {
30
+ typeof window > "u" || A(r, s).then(() => {
31
+ window.naver && t(window.naver);
32
+ }).catch((a) => {
33
+ console.error("Naver Map script loading failed:", a), w(a);
34
+ });
35
+ }, [r, s]);
36
+ const M = y(
37
+ (a, C) => {
38
+ const i = n || (typeof window < "u" ? window.naver : null);
39
+ if (!i || (!n && window.naver && t(window.naver), !a.current))
40
+ return null;
41
+ const c = a.current;
42
+ if (!c.isConnected)
43
+ return null;
44
+ try {
45
+ const p = {
46
+ center: new i.maps.LatLng(37.5665, 126.978),
47
+ // 서울 시청 기본 좌표
48
+ zoom: 11,
49
+ maxZoom: 20,
50
+ minZoom: 11,
51
+ mapTypeControl: !1,
52
+ scaleControl: !1,
53
+ logoControl: !1,
54
+ mapDataControl: !1,
55
+ zoomControl: !1,
56
+ ...C
57
+ }, u = new i.maps.Map(c, p);
58
+ return v((N) => {
59
+ const E = c.getAttribute("id") || "default";
60
+ return { ...N, [E]: u };
61
+ }), u;
62
+ } catch (p) {
63
+ return console.error("Map creation error:", p), null;
64
+ }
65
+ },
66
+ [n]
67
+ );
68
+ return d && console.error("NaverMapProvider error:", d), /* @__PURE__ */ h(f.Provider, { value: { naver: n, createMap: M, maps: e }, children: o });
69
+ }, b = () => {
70
+ const r = g(f);
71
+ if (!r)
72
+ throw new Error("useNaverMap must be used within NaverMapProvider");
73
+ return r;
74
+ };
75
+ export {
76
+ S as NaverMapProvider,
77
+ b as useNaverMap
78
+ };
@@ -0,0 +1,305 @@
1
+ "use client";
2
+ function M(i) {
3
+ const m = function(t) {
4
+ this.DEFAULT_OPTIONS = {
5
+ map: null,
6
+ markers: [],
7
+ disableClickZoom: !0,
8
+ minClusterSize: 2,
9
+ maxZoom: 13,
10
+ gridSize: 100,
11
+ icons: [],
12
+ indexGenerator: [10, 100, 200, 500, 1e3],
13
+ averageCenter: !1,
14
+ stylingFunction: function() {
15
+ }
16
+ }, this._clusters = [], this._mapRelations = null, this._markerRelations = [], this.setOptions(i.maps.Util.extend({}, this.DEFAULT_OPTIONS, t), !0), this.setMap(t.map || null);
17
+ };
18
+ i.maps.Util.ClassExtend(m, i.maps.OverlayView, {
19
+ onAdd: function() {
20
+ const t = this.getMap();
21
+ this._mapRelations = i.maps.Event.addListener(
22
+ t,
23
+ "idle",
24
+ i.maps.Util.bind(this._onIdle, this)
25
+ ), this.getMarkers().length > 0 && (this._createClusters(), this._updateClusters());
26
+ },
27
+ draw: i.maps.Util.noop,
28
+ onRemove: function() {
29
+ i.maps.Event.removeListener(this._mapRelation), this._clearClusters(), this._geoTree = null, this._mapRelation = null;
30
+ },
31
+ setOptions: function(t) {
32
+ const e = this;
33
+ if (typeof t == "string") {
34
+ const s = t, n = arguments[1];
35
+ e.set(s, n);
36
+ } else {
37
+ const s = arguments[1];
38
+ i.maps.Util.forEach(t, function(n, r) {
39
+ r !== "map" && e.set(r, n);
40
+ }), t.map && !s && e.setMap(t.map);
41
+ }
42
+ },
43
+ getOptions: function(t) {
44
+ const e = this, s = {};
45
+ return t !== void 0 ? e.get(t) : (i.maps.Util.forEach(e.DEFAULT_OPTIONS, function(n, r) {
46
+ s[r] = e.get(r);
47
+ }), s);
48
+ },
49
+ getMinClusterSize: function() {
50
+ return this.getOptions("minClusterSize");
51
+ },
52
+ setMinClusterSize: function(t) {
53
+ this.setOptions("minClusterSize", t);
54
+ },
55
+ getMaxZoom: function() {
56
+ return this.getOptions("maxZoom");
57
+ },
58
+ setMaxZoom: function(t) {
59
+ this.setOptions("maxZoom", t);
60
+ },
61
+ getGridSize: function() {
62
+ return this.getOptions("gridSize");
63
+ },
64
+ setGridSize: function(t) {
65
+ this.setOptions("gridSize", t);
66
+ },
67
+ getIndexGenerator: function() {
68
+ return this.getOptions("indexGenerator");
69
+ },
70
+ setIndexGenerator: function(t) {
71
+ this.setOptions("indexGenerator", t);
72
+ },
73
+ getMarkers: function() {
74
+ return this.getOptions("markers");
75
+ },
76
+ setMarkers: function(t) {
77
+ this.setOptions("markers", t);
78
+ },
79
+ getIcons: function() {
80
+ return this.getOptions("icons");
81
+ },
82
+ setIcons: function(t) {
83
+ this.setOptions("icons", t);
84
+ },
85
+ getStylingFunction: function() {
86
+ return this.getOptions("stylingFunction");
87
+ },
88
+ setStylingFunction: function(t) {
89
+ this.setOptions("stylingFunction", t);
90
+ },
91
+ getDisableClickZoom: function() {
92
+ return this.getOptions("disableClickZoom");
93
+ },
94
+ setDisableClickZoom: function(t) {
95
+ this.setOptions("disableClickZoom", t);
96
+ },
97
+ getAverageCenter: function() {
98
+ return this.getOptions("averageCenter");
99
+ },
100
+ setAverageCenter: function(t) {
101
+ this.setOptions("averageCenter", t);
102
+ },
103
+ changed: function(t, e) {
104
+ if (this.getMap())
105
+ switch (t) {
106
+ case "marker":
107
+ case "minClusterSize":
108
+ case "gridSize":
109
+ case "averageCenter":
110
+ this._redraw();
111
+ break;
112
+ case "indexGenerator":
113
+ case "icons":
114
+ this._clusters.forEach(function(n) {
115
+ n.updateIcon();
116
+ });
117
+ break;
118
+ case "maxZoom":
119
+ this._clusters.forEach(function(n) {
120
+ n.getCount() > 1 && n.checkByZoomAndMinClusterSize();
121
+ });
122
+ break;
123
+ case "stylingFunction":
124
+ this._clusters.forEach(function(n) {
125
+ n.updateCount();
126
+ });
127
+ break;
128
+ case "disableClickZoom":
129
+ let s = "enableClickZoom";
130
+ e && (s = "disableClickZoom"), this._clusters.forEach(function(n) {
131
+ n[s]();
132
+ });
133
+ break;
134
+ }
135
+ },
136
+ _createClusters: function() {
137
+ const t = this.getMap();
138
+ if (!t) return;
139
+ const e = t.getBounds(), s = this.getMarkers();
140
+ for (let n = 0, r = s.length; n < r; n++) {
141
+ const o = s[n], c = o.getPosition();
142
+ if (!e.hasLatLng(c)) continue;
143
+ this._getClosestCluster(c).addMarker(o), this._markerRelations.push(
144
+ i.maps.Event.addListener(
145
+ o,
146
+ "dragend",
147
+ i.maps.Util.bind(this._onDragEnd, this)
148
+ )
149
+ );
150
+ }
151
+ },
152
+ _updateClusters: function() {
153
+ const t = this._clusters;
154
+ for (let e = 0, s = t.length; e < s; e++)
155
+ t[e].updateCluster();
156
+ },
157
+ _clearClusters: function() {
158
+ const t = this._clusters;
159
+ for (let e = 0, s = t.length; e < s; e++)
160
+ t[e].destroy();
161
+ i.maps.Event.removeListener(this._markerRelations), this._markerRelations = [], this._clusters = [];
162
+ },
163
+ _redraw: function() {
164
+ this._clearClusters(), this._createClusters(), this._updateClusters();
165
+ },
166
+ _getClosestCluster: function(t) {
167
+ const e = this.getProjection(), s = this._clusters;
168
+ let n = null, r = 1 / 0;
169
+ for (let o = 0, c = s.length; o < c; o++) {
170
+ const u = s[o], a = u.getCenter();
171
+ if (u.isInBounds(t)) {
172
+ const l = e.getDistance(a, t);
173
+ l < r && (r = l, n = u);
174
+ }
175
+ }
176
+ return n || (n = new h(this), this._clusters.push(n)), n;
177
+ },
178
+ _onIdle: function() {
179
+ this._redraw();
180
+ },
181
+ _onDragEnd: function() {
182
+ this._redraw();
183
+ }
184
+ });
185
+ const h = function(t) {
186
+ this._clusterCenter = null, this._clusterBounds = null, this._clusterMarker = null, this._relation = null, this._clusterMember = [], this._markerClusters = t;
187
+ };
188
+ return h.prototype = {
189
+ constructor: h,
190
+ addMarker: function(t) {
191
+ if (!this._isMember(t)) {
192
+ if (!this._clusterCenter) {
193
+ const e = t.getPosition();
194
+ this._clusterCenter = e, this._clusterBounds = this._calcBounds(e);
195
+ }
196
+ this._clusterMember.push(t);
197
+ }
198
+ },
199
+ destroy: function() {
200
+ i.maps.Event.removeListener(this._relation);
201
+ const t = this._clusterMember;
202
+ for (let e = 0, s = t.length; e < s; e++)
203
+ t[e].setMap(null);
204
+ this._clusterMarker.setMap(null), this._clusterMarker = null, this._clusterCenter = null, this._clusterBounds = null, this._relation = null, this._clusterMember = [];
205
+ },
206
+ getCenter: function() {
207
+ return this._clusterCenter;
208
+ },
209
+ getBounds: function() {
210
+ return this._clusterBounds;
211
+ },
212
+ getCount: function() {
213
+ return this._clusterMember.length;
214
+ },
215
+ getClusterMember: function() {
216
+ return this._clusterMember;
217
+ },
218
+ isInBounds: function(t) {
219
+ return this._clusterBounds && this._clusterBounds.hasLatLng(t);
220
+ },
221
+ enableClickZoom: function() {
222
+ if (this._relation) return;
223
+ const t = this._markerClusters.getMap();
224
+ this._relation = i.maps.Event.addListener(
225
+ this._clusterMarker,
226
+ "click",
227
+ i.maps.Util.bind(function(e) {
228
+ t.morph(e.coord, t.getZoom() + 1);
229
+ }, this)
230
+ );
231
+ },
232
+ disableClickZoom: function() {
233
+ this._relation && (i.maps.Event.removeListener(this._relation), this._relation = null);
234
+ },
235
+ updateCluster: function() {
236
+ if (!this._clusterMarker) {
237
+ let t;
238
+ this._markerClusters.getAverageCenter() ? t = this._calcAverageCenter(this._clusterMember) : t = this._clusterCenter, this._clusterMarker = new i.maps.Marker({
239
+ position: t,
240
+ map: this._markerClusters.getMap()
241
+ }), this._markerClusters.getDisableClickZoom() || this.enableClickZoom();
242
+ }
243
+ this.updateIcon(), this.updateCount(), this.checkByZoomAndMinClusterSize();
244
+ },
245
+ checkByZoomAndMinClusterSize: function() {
246
+ const t = this._markerClusters, e = t.getMinClusterSize(), s = t.getMaxZoom(), n = t.getMap().getZoom();
247
+ this.getCount() < e ? this._showMember() : (this._hideMember(), s <= n && this._showMember());
248
+ },
249
+ updateCount: function() {
250
+ const t = this._markerClusters.getStylingFunction();
251
+ t && t(this._clusterMarker, this.getCount());
252
+ },
253
+ updateIcon: function() {
254
+ const t = this.getCount();
255
+ let e = this._getIndex(t);
256
+ const s = this._markerClusters.getIcons();
257
+ e = Math.max(e, 0), e = Math.min(e, s.length - 1), this._clusterMarker.setIcon(s[e]);
258
+ },
259
+ _showMember: function() {
260
+ const t = this._markerClusters.getMap(), e = this._clusterMarker, s = this._clusterMember;
261
+ for (let n = 0, r = s.length; n < r; n++)
262
+ s[n].setMap(t);
263
+ e && e.setMap(null);
264
+ },
265
+ _hideMember: function() {
266
+ const t = this._markerClusters.getMap(), e = this._clusterMarker, s = this._clusterMember;
267
+ for (let n = 0, r = s.length; n < r; n++)
268
+ s[n].setMap(null);
269
+ e && !e.getMap() && e.setMap(t);
270
+ },
271
+ _calcBounds: function(t) {
272
+ const e = this._markerClusters.getMap(), s = new i.maps.LatLngBounds(t.clone(), t.clone()), n = e.getBounds(), r = e.getProjection(), o = r.fromCoordToOffset(n.getNE()), c = r.fromCoordToOffset(n.getSW()), u = r.fromCoordToOffset(s.getNE()), a = r.fromCoordToOffset(s.getSW()), l = this._markerClusters.getGridSize() / 2;
273
+ u.add(l, -l), a.add(-l, l);
274
+ const f = Math.min(o.x, u.x), _ = Math.max(o.y, u.y), g = Math.max(c.x, a.x), p = Math.min(c.y, a.y), d = r.fromOffsetToCoord(new i.maps.Point(f, _)), C = r.fromOffsetToCoord(new i.maps.Point(g, p));
275
+ return new i.maps.LatLngBounds(C, d);
276
+ },
277
+ _getIndex: function(t) {
278
+ const e = this._markerClusters.getIndexGenerator();
279
+ if (i.maps.Util.isFunction(e))
280
+ return e(t);
281
+ if (i.maps.Util.isArray(e)) {
282
+ let s = 0;
283
+ for (let n = 0, r = e.length; n < r; n++) {
284
+ const o = e[n];
285
+ if (t < o) break;
286
+ s++;
287
+ }
288
+ return s;
289
+ }
290
+ return 0;
291
+ },
292
+ _isMember: function(t) {
293
+ return this._clusterMember.indexOf(t) !== -1;
294
+ },
295
+ _calcAverageCenter: function(t) {
296
+ const e = t.length, s = [0, 0];
297
+ for (let n = 0; n < e; n++)
298
+ s[0] += t[n].position.x, s[1] += t[n].position.y;
299
+ return s[0] /= e, s[1] /= e, new i.maps.Point(s[0], s[1]);
300
+ }
301
+ }, m;
302
+ }
303
+ export {
304
+ M as makeMarkerClustering
305
+ };