@pop-ui/core 2.2.4 → 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 (62) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/core.js +58 -3110
  3. package/dist/core.umd.cjs +16 -16
  4. package/dist/esm/components/Button/index.js +75 -0
  5. package/dist/esm/components/Button/style.js +9 -0
  6. package/dist/esm/components/Button/styles.module.scss.js +28 -0
  7. package/dist/esm/components/CalendarDatePicker/index.js +119 -0
  8. package/dist/esm/components/CalendarDatePicker/styles.module.scss.js +34 -0
  9. package/dist/esm/components/CalendarDatePicker/utils.js +82 -0
  10. package/dist/esm/components/Checkbox/index.js +32 -0
  11. package/dist/esm/components/Checkbox/styles.module.scss.js +9 -0
  12. package/dist/esm/components/DatePicker/index.js +203 -0
  13. package/dist/esm/components/DatePicker/styles.module.scss.js +57 -0
  14. package/dist/esm/components/Dropdown/index.js +61 -0
  15. package/dist/esm/components/Dropdown/styles.module.scss.js +21 -0
  16. package/dist/esm/components/ImageInput/ImageInputCropModal.js +91 -0
  17. package/dist/esm/components/ImageInput/helpers.js +46 -0
  18. package/dist/esm/components/ImageInput/index.js +379 -0
  19. package/dist/esm/components/ImageInput/styles.module.scss.js +30 -0
  20. package/dist/esm/components/LottieInput/helpers.js +48 -0
  21. package/dist/esm/components/LottieInput/index.js +233 -0
  22. package/dist/esm/components/LottieInput/styles.module.scss.js +14 -0
  23. package/dist/esm/components/Map/Map.js +48 -0
  24. package/dist/esm/components/Map/NaverMapContext.js +78 -0
  25. package/dist/esm/components/Map/markerClustering.js +305 -0
  26. package/dist/esm/components/Map/markerStyles.js +351 -0
  27. package/dist/esm/components/Map/useLocation.js +40 -0
  28. package/dist/esm/components/Map/useMap.js +95 -0
  29. package/dist/esm/components/MapInfo/index.js +120 -0
  30. package/dist/esm/components/MapInfo/styles.module.scss.js +24 -0
  31. package/dist/esm/components/Modal/index.js +52 -0
  32. package/dist/esm/components/Pagination/index.js +45 -0
  33. package/dist/esm/components/Pagination/style.module.scss.js +13 -0
  34. package/dist/esm/components/Radio/index.js +29 -0
  35. package/dist/esm/components/Radio/styles.module.scss.js +9 -0
  36. package/dist/esm/components/SearchBar/index.js +60 -0
  37. package/dist/esm/components/SearchBar/styles.module.scss.js +25 -0
  38. package/dist/esm/components/SegmentButton/index.js +25 -0
  39. package/dist/esm/components/SegmentButton/styles.module.scss.js +9 -0
  40. package/dist/esm/components/Tab/index.js +14 -0
  41. package/dist/esm/components/Tab/styles.module.scss.js +10 -0
  42. package/dist/esm/components/TextField/index.js +99 -0
  43. package/dist/esm/components/TextField/styles.module.scss.js +28 -0
  44. package/dist/esm/components/TimePicker/index.js +33 -0
  45. package/dist/esm/components/TimePicker/styles.module.scss.js +9 -0
  46. package/dist/esm/components/Toast/index.js +35 -0
  47. package/dist/esm/components/Toast/styles.module.scss.js +14 -0
  48. package/dist/esm/components/Toggle/index.js +48 -0
  49. package/dist/esm/components/Toggle/styles.module.scss.js +9 -0
  50. package/dist/esm/components/Tooltip/index.js +25 -0
  51. package/dist/esm/components/Tooltip/styles.module.scss.js +12 -0
  52. package/dist/esm/components/shared/MultiItemInput/Dropzone.js +30 -0
  53. package/dist/esm/components/shared/MultiItemInput/SortableEmptySlot.js +29 -0
  54. package/dist/esm/components/shared/MultiItemInput/TileShell.js +113 -0
  55. package/dist/esm/components/shared/MultiItemInput/helpers.js +23 -0
  56. package/dist/esm/components/shared/MultiItemInput/styles.module.scss.js +30 -0
  57. package/dist/esm/components/shared/MultiItemInput/usePositionGrid.js +49 -0
  58. package/dist/esm/components/shared/MultiItemInput/useSortableGrid.js +20 -0
  59. package/dist/esm/theme/ThemeProvider.js +46 -0
  60. package/dist/esm/theme/cssVariables.js +29 -0
  61. package/dist/esm/theme/mantineTheme.js +36 -0
  62. package/package.json +2 -2
@@ -0,0 +1,91 @@
1
+ "use client";
2
+ import { jsx as a, jsxs as h } from "react/jsx-runtime";
3
+ import { Stack as b, Group as j } from "@mantine/core";
4
+ import { ColorWhite as p } from "@pop-ui/foundation";
5
+ import { useState as m } from "react";
6
+ import I from "react-easy-crop";
7
+ import { Button as f } from "../Button/index.js";
8
+ import { Modal as k } from "../Modal/index.js";
9
+ async function x(t, o) {
10
+ const s = t.url ?? "";
11
+ if (!s) return null;
12
+ const c = await new Promise((r, i) => {
13
+ const e = new Image();
14
+ e.crossOrigin = "anonymous", e.onload = () => r(e), e.onerror = i, e.src = s;
15
+ }), n = document.createElement("canvas");
16
+ n.width = o.width, n.height = o.height;
17
+ const l = n.getContext("2d");
18
+ if (!l) return null;
19
+ l.drawImage(
20
+ c,
21
+ o.x,
22
+ o.y,
23
+ o.width,
24
+ o.height,
25
+ 0,
26
+ 0,
27
+ o.width,
28
+ o.height
29
+ );
30
+ const d = t.file?.name ?? t.url?.split("/").pop() ?? "image";
31
+ return new Promise((r, i) => {
32
+ n.toBlob((e) => {
33
+ e ? r(new File([e], `cropped_${d}`, { type: "image/jpeg" })) : i(new Error("Failed to create blob"));
34
+ }, "image/jpeg");
35
+ });
36
+ }
37
+ function E({
38
+ item: t,
39
+ isOpen: o,
40
+ aspect: s = 1,
41
+ onClose: c,
42
+ onSubmit: n
43
+ }) {
44
+ const [l, d] = m({ x: 0, y: 0 }), [r, i] = m(1), [e, y] = m(null), [w, u] = m(!1), C = async () => {
45
+ if (!(!e || !t)) {
46
+ u(!0);
47
+ try {
48
+ const g = await x(t, e);
49
+ g && n(g);
50
+ } finally {
51
+ u(!1);
52
+ }
53
+ }
54
+ };
55
+ return /* @__PURE__ */ a(
56
+ k,
57
+ {
58
+ opened: o && !!t,
59
+ onClose: c,
60
+ size: "md",
61
+ title: "이미지 수정",
62
+ withCloseButton: !0,
63
+ children: /* @__PURE__ */ h(b, { children: [
64
+ /* @__PURE__ */ a("div", { style: { position: "relative", height: 320, background: p }, children: /* @__PURE__ */ a(
65
+ I,
66
+ {
67
+ image: t?.url ?? "",
68
+ crop: l,
69
+ zoom: r,
70
+ aspect: s,
71
+ minZoom: 0.5,
72
+ maxZoom: 10,
73
+ objectFit: "cover",
74
+ onCropChange: d,
75
+ onZoomChange: i,
76
+ onCropComplete: (g, v) => y(v),
77
+ style: { containerStyle: { backgroundColor: p } }
78
+ }
79
+ ) }),
80
+ /* @__PURE__ */ h(j, { justify: "flex-end", style: { padding: "0 16px" }, children: [
81
+ /* @__PURE__ */ a(f, { variant: "basic", onClick: c, children: "취소" }),
82
+ /* @__PURE__ */ a(f, { variant: "primary", isLoading: w, onClick: C, children: "적용하기" })
83
+ ] })
84
+ ] })
85
+ },
86
+ t?.id
87
+ );
88
+ }
89
+ export {
90
+ E as ImageInputCropModal
91
+ };
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ import { generateItemId as c } from "../shared/MultiItemInput/helpers.js";
3
+ import { getPlaceholderCount as p, reorderItemPositions as j, reorderItems as O } from "../shared/MultiItemInput/helpers.js";
4
+ function m(t, e, o) {
5
+ const r = [...e].sort((n, u) => n.name.localeCompare(u.name)), i = o != null ? o - t.length : 1 / 0, s = r.slice(0, i).map((n) => ({
6
+ id: c(),
7
+ file: n,
8
+ url: URL.createObjectURL(n)
9
+ }));
10
+ return [...t, ...s];
11
+ }
12
+ function f(t, e) {
13
+ const o = t.find((r) => r.id === e);
14
+ return o?.url?.startsWith("blob:") && URL.revokeObjectURL(o.url), t.filter((r) => r.id !== e);
15
+ }
16
+ function l(t, e, o) {
17
+ return t.map((r) => r.id !== e ? r : (r.url?.startsWith("blob:") && URL.revokeObjectURL(r.url), { ...r, file: o, url: URL.createObjectURL(o) }));
18
+ }
19
+ function I(t, e, o) {
20
+ return l(t, e, o);
21
+ }
22
+ function U(t, e, o) {
23
+ const r = {
24
+ id: c(),
25
+ file: e,
26
+ url: URL.createObjectURL(e),
27
+ position: o
28
+ };
29
+ return [...t, r];
30
+ }
31
+ function b(t) {
32
+ for (const e of t)
33
+ e.url?.startsWith("blob:") && URL.revokeObjectURL(e.url);
34
+ }
35
+ export {
36
+ U as addItemAtPosition,
37
+ m as addItems,
38
+ I as cropItem,
39
+ f as deleteItem,
40
+ c as generateItemId,
41
+ p as getPlaceholderCount,
42
+ j as reorderItemPositions,
43
+ O as reorderItems,
44
+ l as replaceItem,
45
+ b as revokeItemUrls
46
+ };
@@ -0,0 +1,379 @@
1
+ "use client";
2
+ import { jsxs as f, jsx as r, Fragment as oe } from "react/jsx-runtime";
3
+ import { DndContext as le, closestCenter as ie } from "@dnd-kit/core";
4
+ import { SortableContext as se, rectSortingStrategy as ae } from "@dnd-kit/sortable";
5
+ import { Input as ce } from "@mantine/core";
6
+ import { IMAGE_MIME_TYPE as j } from "@mantine/dropzone";
7
+ import { IconPhoto as F, ColorRed700 as H, ColorAqua700 as L, IconX as de, ColorGray600 as ue, IconEdit as fe, IconOpenInFull as pe, ColorGray900 as me } from "@pop-ui/foundation";
8
+ import { useState as O, useRef as Y, useEffect as V } from "react";
9
+ import { Button as W } from "../Button/index.js";
10
+ import { Modal as Ie } from "../Modal/index.js";
11
+ import { revokeItemUrls as he, replaceItem as xe, deleteItem as ge, addItemAtPosition as be, addItems as ye, cropItem as Pe } from "./helpers.js";
12
+ import { ImageInputCropModal as ve } from "./ImageInputCropModal.js";
13
+ import s from "./styles.module.scss.js";
14
+ import { PlaceholderDropzone as q } from "../shared/MultiItemInput/Dropzone.js";
15
+ import { SortableEmptySlot as Ce } from "../shared/MultiItemInput/SortableEmptySlot.js";
16
+ import { TileShell as $e } from "../shared/MultiItemInput/TileShell.js";
17
+ import { usePositionGrid as we } from "../shared/MultiItemInput/usePositionGrid.js";
18
+ function J(e) {
19
+ if (!e) return !1;
20
+ try {
21
+ const l = new URL(e).protocol;
22
+ return l === "http:" || l === "https:";
23
+ } catch {
24
+ return !1;
25
+ }
26
+ }
27
+ function Ee(e) {
28
+ J(e) && window.open(e, "_blank", "noopener,noreferrer");
29
+ }
30
+ function Se(e) {
31
+ return e ? e.join(",") : "image/*";
32
+ }
33
+ function X({
34
+ item: e,
35
+ sortableId: l,
36
+ index: d,
37
+ totalCount: A,
38
+ width: h,
39
+ height: x,
40
+ accept: u,
41
+ canDelete: $,
42
+ hasLink: P,
43
+ hasEdit: w,
44
+ readOnly: g,
45
+ isLoading: b,
46
+ onLinkClick: v,
47
+ onDelete: B,
48
+ onReplace: C,
49
+ onEdit: y,
50
+ onPreview: c
51
+ }) {
52
+ const E = Y(null), S = v ? !!e.url : J(e.url);
53
+ return /* @__PURE__ */ f(
54
+ $e,
55
+ {
56
+ id: l ?? e.id,
57
+ totalCount: A,
58
+ width: h,
59
+ height: x,
60
+ readOnly: g,
61
+ isLoading: b,
62
+ itemIsLoading: e.isLoading,
63
+ canDelete: $,
64
+ isDragHandleOverlay: !0,
65
+ hasLink: P && S,
66
+ linkUrl: e.url,
67
+ onLinkClick: P && S ? () => v ? v(e) : e.url && Ee(e.url) : void 0,
68
+ onDelete: () => B(e.id),
69
+ deleteAriaLabel: "이미지 삭제",
70
+ onTileClick: () => E.current?.click(),
71
+ onFileDrop: (i) => {
72
+ if (u) {
73
+ if (!u.includes(i.type)) return;
74
+ } else if (!i.type.startsWith("image/")) return;
75
+ C(e.id, i);
76
+ },
77
+ children: [
78
+ /* @__PURE__ */ r(
79
+ "input",
80
+ {
81
+ ref: E,
82
+ type: "file",
83
+ accept: Se(u),
84
+ style: { display: "none" },
85
+ onChange: (i) => {
86
+ const D = i.target.files?.[0];
87
+ D && C(e.id, D), i.target.value = "";
88
+ }
89
+ }
90
+ ),
91
+ /* @__PURE__ */ f("div", { className: s.TileContent, children: [
92
+ /* @__PURE__ */ r(
93
+ "img",
94
+ {
95
+ src: e.url,
96
+ alt: e.file?.name ?? `이미지 ${d + 1}`,
97
+ className: s.TileImage
98
+ }
99
+ ),
100
+ w && !g && /* @__PURE__ */ r(
101
+ "button",
102
+ {
103
+ type: "button",
104
+ className: `${s.OverlayButton} ${s.OverlayButtonLeft}`,
105
+ "aria-label": "이미지 편집",
106
+ title: "편집",
107
+ disabled: b || e.isLoading,
108
+ onClick: (i) => {
109
+ i.stopPropagation(), y(e);
110
+ },
111
+ children: /* @__PURE__ */ r(fe, { size: 18 })
112
+ }
113
+ ),
114
+ e.url && /* @__PURE__ */ r(
115
+ "button",
116
+ {
117
+ type: "button",
118
+ className: `${s.OverlayButton} ${s.OverlayButtonRight}`,
119
+ "aria-label": "이미지 확대보기",
120
+ title: "크게 보기",
121
+ disabled: b || e.isLoading,
122
+ onClick: (i) => {
123
+ i.stopPropagation(), c(e);
124
+ },
125
+ children: /* @__PURE__ */ r(pe, { size: 18, color: me })
126
+ }
127
+ )
128
+ ] })
129
+ ]
130
+ }
131
+ );
132
+ }
133
+ const Ve = ({
134
+ value: e = [],
135
+ onChange: l,
136
+ accept: d,
137
+ length: A,
138
+ width: h = 160,
139
+ height: x = 200,
140
+ placeholder: u = "이미지를 넣어주세요",
141
+ hasIcon: $ = !0,
142
+ hasLink: P = !1,
143
+ onLinkClick: w,
144
+ hasEdit: g = !1,
145
+ canDelete: b = !0,
146
+ minLength: v,
147
+ maxLength: B,
148
+ errorMsg: C,
149
+ isLoading: y,
150
+ readOnly: c,
151
+ gap: E = 8
152
+ }) => {
153
+ const {
154
+ isPositionMode: S,
155
+ resolvedMaxLength: i,
156
+ placeholderCount: D,
157
+ slotIds: K,
158
+ sortableItems: Q,
159
+ sensors: Z,
160
+ handleDragEnd: ee,
161
+ getMetaIndex: M
162
+ } = we({ value: e, length: A, minLength: v, maxLength: B, onChange: l }), p = !!C, [z, N] = O(null), [T, R] = O(null), m = T ? e.find((n) => n.id === T.id && n.url === T.url) ?? null : null;
163
+ T && !m && R(null);
164
+ const k = Y(e);
165
+ V(() => {
166
+ k.current = e;
167
+ }, [e]), V(() => () => he(k.current), []);
168
+ const te = (n) => {
169
+ if (c) return;
170
+ const t = e.length, o = ye(e, n, i);
171
+ o.length !== t && l?.(o, {
172
+ action: "create",
173
+ itemId: o[t].id,
174
+ index: t
175
+ });
176
+ }, re = (n, t) => {
177
+ if (c) return;
178
+ const o = t[0];
179
+ if (!o) return;
180
+ const a = be(e, o, n);
181
+ l?.(a, {
182
+ action: "create",
183
+ itemId: a[a.length - 1].id,
184
+ index: n
185
+ });
186
+ }, U = (n) => {
187
+ if (c) return;
188
+ const t = M(n), o = ge(e, n);
189
+ l?.(o, { action: "delete", itemId: n, index: t });
190
+ }, _ = (n, t) => {
191
+ if (c) return;
192
+ const o = M(n), a = xe(e, n, t);
193
+ l?.(a, { action: "replace", itemId: n, index: o });
194
+ }, ne = (n) => {
195
+ if (!z) return;
196
+ const t = z.id, o = M(t), a = Pe(e, t, n);
197
+ N(null), l?.(a, { action: "crop", itemId: t, index: o });
198
+ }, G = (n) => {
199
+ const t = typeof u == "function" ? u(n) : u;
200
+ return typeof t != "string" ? t : t.split(`
201
+ `).map((o, a) => /* @__PURE__ */ r("span", { children: o }, a));
202
+ };
203
+ return /* @__PURE__ */ f("div", { children: [
204
+ /* @__PURE__ */ r(le, { sensors: Z, collisionDetection: ie, onDragEnd: ee, children: /* @__PURE__ */ r(se, { items: Q, strategy: ae, children: /* @__PURE__ */ r("div", { className: s.Container, style: { gap: E }, children: S ? Array.from({ length: i }, (n, t) => {
205
+ const o = K[t], a = e.find((I) => I.position === t);
206
+ return a ? /* @__PURE__ */ r(
207
+ X,
208
+ {
209
+ item: a,
210
+ sortableId: o,
211
+ index: t,
212
+ totalCount: i,
213
+ width: h,
214
+ height: x,
215
+ accept: d,
216
+ canDelete: b,
217
+ hasLink: P,
218
+ hasEdit: g,
219
+ readOnly: c ?? !1,
220
+ isLoading: y,
221
+ onLinkClick: w,
222
+ onDelete: U,
223
+ onReplace: _,
224
+ onEdit: N,
225
+ onPreview: (I) => {
226
+ I.url && R({ id: I.id, url: I.url });
227
+ }
228
+ },
229
+ o
230
+ ) : !c && /* @__PURE__ */ r(Ce, { id: o, children: /* @__PURE__ */ f(
231
+ q,
232
+ {
233
+ onDrop: (I) => re(t, I),
234
+ accept: d ?? j,
235
+ multiple: !1,
236
+ isLoading: y,
237
+ isError: p,
238
+ width: h,
239
+ height: x,
240
+ children: [
241
+ $ && /* @__PURE__ */ r(F, { size: 36, color: p ? H : L }),
242
+ u && /* @__PURE__ */ r(
243
+ "div",
244
+ {
245
+ className: `${s.PlaceholderText}${p ? ` ${s.PlaceholderTextError}` : ""}`,
246
+ children: G(t)
247
+ }
248
+ )
249
+ ]
250
+ }
251
+ ) }, o);
252
+ }) : /* @__PURE__ */ f(oe, { children: [
253
+ e.map((n, t) => /* @__PURE__ */ r(
254
+ X,
255
+ {
256
+ item: n,
257
+ index: t,
258
+ totalCount: e.length,
259
+ width: h,
260
+ height: x,
261
+ accept: d,
262
+ canDelete: b,
263
+ hasLink: P,
264
+ hasEdit: g,
265
+ readOnly: c ?? !1,
266
+ isLoading: y,
267
+ onLinkClick: w,
268
+ onDelete: U,
269
+ onReplace: _,
270
+ onEdit: N,
271
+ onPreview: (o) => {
272
+ o.url && R({ id: o.id, url: o.url });
273
+ }
274
+ },
275
+ n.id
276
+ )),
277
+ !c && Array.from({ length: D }, (n, t) => /* @__PURE__ */ f(
278
+ q,
279
+ {
280
+ onDrop: te,
281
+ accept: d ?? j,
282
+ multiple: i !== 1,
283
+ isLoading: y,
284
+ isError: p,
285
+ width: h,
286
+ height: x,
287
+ children: [
288
+ $ && /* @__PURE__ */ r(F, { size: 36, color: p ? H : L }),
289
+ u && /* @__PURE__ */ r(
290
+ "div",
291
+ {
292
+ className: `${s.PlaceholderText}${p ? ` ${s.PlaceholderTextError}` : ""}`,
293
+ children: G(t)
294
+ }
295
+ )
296
+ ]
297
+ },
298
+ `placeholder-${t}`
299
+ ))
300
+ ] }) }) }) }),
301
+ p && /* @__PURE__ */ r(ce.Error, { mt: 8, children: C }),
302
+ g && /* @__PURE__ */ r(
303
+ ve,
304
+ {
305
+ item: z,
306
+ isOpen: !!z,
307
+ onClose: () => N(null),
308
+ onSubmit: ne
309
+ }
310
+ ),
311
+ /* @__PURE__ */ r(
312
+ Ie,
313
+ {
314
+ opened: !!m,
315
+ onClose: () => R(null),
316
+ title: m?.file?.name ?? "이미지 미리보기",
317
+ size: "xl",
318
+ centered: !0,
319
+ xOffset: 16,
320
+ yOffset: 16,
321
+ withCloseButton: !0,
322
+ closeButtonProps: {
323
+ "aria-label": "이미지 미리보기 닫기",
324
+ icon: /* @__PURE__ */ r(de, { size: 18, color: ue })
325
+ },
326
+ styles: {
327
+ content: {
328
+ flex: "0 1 auto",
329
+ width: "fit-content",
330
+ maxWidth: "calc(100vw - 32px)",
331
+ maxHeight: "calc(100dvh - 32px)"
332
+ },
333
+ body: { padding: "16px" }
334
+ },
335
+ children: m && /* @__PURE__ */ r(De, { item: m }, `${m.id}:${m.url}`)
336
+ }
337
+ )
338
+ ] });
339
+ };
340
+ function De({ item: e }) {
341
+ const [l, d] = O(!1);
342
+ return /* @__PURE__ */ f("div", { className: s.PreviewContent, children: [
343
+ /* @__PURE__ */ f("div", { className: s.PreviewControls, role: "group", "aria-label": "이미지 크기 보기", children: [
344
+ /* @__PURE__ */ r(
345
+ W,
346
+ {
347
+ variant: l ? "basic" : "primary",
348
+ size: "sm",
349
+ "aria-label": "화면에 맞춤",
350
+ "aria-pressed": !l,
351
+ onClick: () => d(!1),
352
+ children: "화면에 맞춤"
353
+ }
354
+ ),
355
+ /* @__PURE__ */ r(
356
+ W,
357
+ {
358
+ variant: l ? "primary" : "basic",
359
+ size: "sm",
360
+ "aria-label": "원본 크기 (100%)",
361
+ "aria-pressed": l,
362
+ onClick: () => d(!0),
363
+ children: "원본 크기 (100%)"
364
+ }
365
+ )
366
+ ] }),
367
+ /* @__PURE__ */ r(
368
+ "div",
369
+ {
370
+ "data-size-mode": l ? "original" : "fit",
371
+ className: `${s.PreviewViewport}${l ? ` ${s.PreviewOriginal}` : ""}`,
372
+ children: /* @__PURE__ */ r("img", { src: e.url, alt: e.file?.name ?? "이미지 미리보기" })
373
+ }
374
+ )
375
+ ] });
376
+ }
377
+ export {
378
+ Ve as ImageInput
379
+ };
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ const e = "styles-module__Container___ZyeJM", t = "styles-module__TileContent___Ofq9-", o = "styles-module__TileImage___6aKmW", l = "styles-module__OverlayButton___AYBJ0", _ = "styles-module__OverlayButtonLeft___t8SaP", r = "styles-module__OverlayButtonRight___IOvjw", n = "styles-module__PreviewControls___iu0Yk", s = "styles-module__PreviewContent___8f8d2", i = "styles-module__PreviewViewport___7-I5L", a = "styles-module__PreviewOriginal___PgXTM", u = "styles-module__PlaceholderText___nhLhy", y = "styles-module__PlaceholderTextError___jYZ8j", v = {
3
+ Container: e,
4
+ TileContent: t,
5
+ TileImage: o,
6
+ OverlayButton: l,
7
+ OverlayButtonLeft: _,
8
+ OverlayButtonRight: r,
9
+ PreviewControls: n,
10
+ PreviewContent: s,
11
+ PreviewViewport: i,
12
+ PreviewOriginal: a,
13
+ PlaceholderText: u,
14
+ PlaceholderTextError: y
15
+ };
16
+ export {
17
+ e as Container,
18
+ l as OverlayButton,
19
+ _ as OverlayButtonLeft,
20
+ r as OverlayButtonRight,
21
+ u as PlaceholderText,
22
+ y as PlaceholderTextError,
23
+ s as PreviewContent,
24
+ n as PreviewControls,
25
+ a as PreviewOriginal,
26
+ i as PreviewViewport,
27
+ t as TileContent,
28
+ o as TileImage,
29
+ v as default
30
+ };
@@ -0,0 +1,48 @@
1
+ "use client";
2
+ import { generateItemId as a } from "../shared/MultiItemInput/helpers.js";
3
+ import { getPlaceholderCount as w, reorderItems as g } from "../shared/MultiItemInput/helpers.js";
4
+ function s(t) {
5
+ if (!t || typeof t != "object" || Array.isArray(t)) return !1;
6
+ const e = t;
7
+ return "v" in e && "fr" in e && "ip" in e && "op" in e && "w" in e && "h" in e && "layers" in e && Array.isArray(e.layers);
8
+ }
9
+ function m(t) {
10
+ return new Promise((e) => {
11
+ const n = new FileReader();
12
+ n.onload = (r) => {
13
+ try {
14
+ const i = JSON.parse(r.target?.result);
15
+ e(s(i) ? i : null);
16
+ } catch {
17
+ e(null);
18
+ }
19
+ }, n.onerror = () => e(null), n.readAsText(t);
20
+ });
21
+ }
22
+ function f(t, e, n) {
23
+ const r = [...e].sort((o, l) => o.name.localeCompare(l.name)), i = n != null ? n - t.length : 1 / 0, c = r.slice(0, i).map((o) => ({
24
+ id: a(),
25
+ file: o
26
+ }));
27
+ return [...t, ...c];
28
+ }
29
+ function p(t, e) {
30
+ return t.filter((n) => n.id !== e);
31
+ }
32
+ function y(t, e, n) {
33
+ const r = {
34
+ id: a(),
35
+ file: e,
36
+ position: n
37
+ };
38
+ return [...t, r];
39
+ }
40
+ export {
41
+ y as addItemAtPosition,
42
+ f as addItems,
43
+ p as deleteItem,
44
+ w as getPlaceholderCount,
45
+ s as isValidLottieJSON,
46
+ m as parseLottieFile,
47
+ g as reorderItems
48
+ };