@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.
- package/CHANGELOG.md +16 -0
- package/dist/core.css +1 -1
- package/dist/core.js +58 -3110
- package/dist/core.umd.cjs +3 -3
- 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,203 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o, jsxs as J } from "react/jsx-runtime";
|
|
3
|
+
import "dayjs/locale/ko.js";
|
|
4
|
+
import { Popover as P, Input as K } from "@mantine/core";
|
|
5
|
+
import { DateTimePicker as Q } from "@mantine/dates";
|
|
6
|
+
import { parseDateValue as H, formatDateDisplay as X, IconCalendar as Z, toValueString as $ } from "@pop-ui/foundation";
|
|
7
|
+
import h from "dayjs";
|
|
8
|
+
import ee from "dayjs/plugin/customParseFormat.js";
|
|
9
|
+
import { useState as W } from "react";
|
|
10
|
+
import { CalendarDatePicker as re } from "../CalendarDatePicker/index.js";
|
|
11
|
+
import e from "./styles.module.scss.js";
|
|
12
|
+
import { getEmptyValueForType as te, mergeClassNamesWithDefault as E, resolveDatePickerValue as ae } from "../CalendarDatePicker/utils.js";
|
|
13
|
+
h.extend(ee);
|
|
14
|
+
const oe = {
|
|
15
|
+
wrapper: e.DatePicker__Wrapper,
|
|
16
|
+
input: e.DatePicker__Input,
|
|
17
|
+
section: e.DatePicker__Section,
|
|
18
|
+
placeholder: e.DatePicker__Placeholder,
|
|
19
|
+
datePickerRoot: e.DatePicker__Root,
|
|
20
|
+
levelsGroup: e.DatePicker__LevelsGroup,
|
|
21
|
+
calendarHeader: e.DatePicker__CalendarHeader,
|
|
22
|
+
calendarHeaderLevel: e.DatePicker__CalendarHeaderLevel,
|
|
23
|
+
calendarHeaderControl: e.DatePicker__CalendarHeaderControl,
|
|
24
|
+
calendarHeaderControlIcon: e.DatePicker__CalendarHeaderControlIcon,
|
|
25
|
+
month: e.DatePicker__Month,
|
|
26
|
+
weekdaysRow: e.DatePicker__WeekdaysRow,
|
|
27
|
+
weekday: e.DatePicker__Weekday,
|
|
28
|
+
monthRow: e.DatePicker__MonthRow,
|
|
29
|
+
monthCell: e.DatePicker__MonthCell,
|
|
30
|
+
day: e.DatePicker__Day,
|
|
31
|
+
timeWrapper: e.DatePicker__TimeWrapper,
|
|
32
|
+
timeInput: e.DatePicker__TimeInput,
|
|
33
|
+
submitButton: e.DatePicker__SubmitButton
|
|
34
|
+
}, ie = {
|
|
35
|
+
dropdown: e.DatePicker__Dropdown,
|
|
36
|
+
arrow: e.DatePicker__DropdownArrow
|
|
37
|
+
}, L = (...t) => t.filter(Boolean).join(" ") || void 0, _ = (t) => {
|
|
38
|
+
if (t == null) return null;
|
|
39
|
+
if (t instanceof Date) return t;
|
|
40
|
+
if (typeof t == "string" && t) {
|
|
41
|
+
const r = t.split("-").map(Number);
|
|
42
|
+
if (r.length === 3 && r[0] && r[1] && r[2])
|
|
43
|
+
return new Date(r[0], r[1] - 1, r[2]);
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}, ke = ({
|
|
47
|
+
size: t = "md",
|
|
48
|
+
type: r = "default",
|
|
49
|
+
withTime: C,
|
|
50
|
+
className: S,
|
|
51
|
+
popoverProps: p,
|
|
52
|
+
rightSection: R,
|
|
53
|
+
rightSectionWidth: Y,
|
|
54
|
+
value: l,
|
|
55
|
+
defaultValue: w,
|
|
56
|
+
onChange: M,
|
|
57
|
+
placeholder: N,
|
|
58
|
+
disabled: s,
|
|
59
|
+
minDate: g,
|
|
60
|
+
maxDate: A,
|
|
61
|
+
displayValueFormat: x = "YYYY년 MM월 DD일",
|
|
62
|
+
valueFormat: F,
|
|
63
|
+
excludedDates: O,
|
|
64
|
+
excludedDays: b,
|
|
65
|
+
highlightToday: j
|
|
66
|
+
}) => {
|
|
67
|
+
const c = F ?? (C ? "YYYY-MM-DD HH:mm" : "YYYY-MM-DD"), [f, m] = W(!1), [B, z] = W(
|
|
68
|
+
() => H(l ?? w, r, c) ?? te(r)
|
|
69
|
+
);
|
|
70
|
+
let u = e["DatePicker--Medium"], k = 18, D = 42;
|
|
71
|
+
t === "sm" ? (u = e["DatePicker--Small"], k = 14, D = 34) : t === "lg" && (u = e["DatePicker--Large"], k = 24, D = 50);
|
|
72
|
+
const v = E(
|
|
73
|
+
ie,
|
|
74
|
+
p?.classNames
|
|
75
|
+
), y = R ?? /* @__PURE__ */ o("span", { "aria-hidden": "true", className: e.DatePicker__Icon, children: /* @__PURE__ */ o(Z, { size: k }) });
|
|
76
|
+
if (C) {
|
|
77
|
+
const i = (d) => {
|
|
78
|
+
if (!d) return null;
|
|
79
|
+
const V = h(d, c, !0);
|
|
80
|
+
return V.isValid() ? V.toDate() : null;
|
|
81
|
+
}, a = l !== void 0, n = a ? i(l) : null, q = i(w);
|
|
82
|
+
return /* @__PURE__ */ o(
|
|
83
|
+
Q,
|
|
84
|
+
{
|
|
85
|
+
className: L(
|
|
86
|
+
e.DatePickerBase,
|
|
87
|
+
e.DatePickerRoot,
|
|
88
|
+
u,
|
|
89
|
+
S
|
|
90
|
+
),
|
|
91
|
+
classNames: E(
|
|
92
|
+
oe,
|
|
93
|
+
void 0
|
|
94
|
+
),
|
|
95
|
+
size: t,
|
|
96
|
+
locale: "ko",
|
|
97
|
+
firstDayOfWeek: 0,
|
|
98
|
+
monthLabelFormat: "YYYY년 MM월",
|
|
99
|
+
valueFormat: "YYYY-MM-DD | a hh:mm",
|
|
100
|
+
rightSection: y,
|
|
101
|
+
rightSectionWidth: Y ?? D,
|
|
102
|
+
popoverProps: {
|
|
103
|
+
offset: 8,
|
|
104
|
+
position: "bottom-start",
|
|
105
|
+
withArrow: !0,
|
|
106
|
+
arrowSize: 10,
|
|
107
|
+
arrowOffset: 20,
|
|
108
|
+
...p,
|
|
109
|
+
classNames: v
|
|
110
|
+
},
|
|
111
|
+
value: a ? n : void 0,
|
|
112
|
+
defaultValue: a ? void 0 : q,
|
|
113
|
+
onChange: (d) => {
|
|
114
|
+
M?.(d ? h(d).format(c) : null);
|
|
115
|
+
},
|
|
116
|
+
placeholder: N,
|
|
117
|
+
disabled: s,
|
|
118
|
+
minDate: g,
|
|
119
|
+
maxDate: A
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
const G = l != null ? H(l, r, c) : void 0, I = ae({
|
|
124
|
+
type: r,
|
|
125
|
+
externalValue: G,
|
|
126
|
+
internalValue: B
|
|
127
|
+
}), T = X(
|
|
128
|
+
I,
|
|
129
|
+
r,
|
|
130
|
+
x
|
|
131
|
+
), U = (i) => {
|
|
132
|
+
let a;
|
|
133
|
+
if (r === "range" && Array.isArray(i)) {
|
|
134
|
+
const n = i;
|
|
135
|
+
a = [_(n[0] ?? null), _(n[1] ?? null)];
|
|
136
|
+
} else r === "multiple" && Array.isArray(i) ? a = i.map((n) => _(n)).filter((n) => n !== null) : a = _(i);
|
|
137
|
+
z(a), M?.($(a, r, c)), r === "default" && a != null && m(!1), r === "range" && Array.isArray(a) && a[0] && a[1] && m(!1);
|
|
138
|
+
};
|
|
139
|
+
return /* @__PURE__ */ o(
|
|
140
|
+
"div",
|
|
141
|
+
{
|
|
142
|
+
className: L(e.DatePickerBase, e.DatePickerRoot, u, S),
|
|
143
|
+
children: /* @__PURE__ */ J(
|
|
144
|
+
P,
|
|
145
|
+
{
|
|
146
|
+
opened: f,
|
|
147
|
+
onClose: () => m(!1),
|
|
148
|
+
offset: 8,
|
|
149
|
+
position: "bottom-start",
|
|
150
|
+
withArrow: !0,
|
|
151
|
+
arrowSize: 10,
|
|
152
|
+
arrowOffset: 20,
|
|
153
|
+
...p,
|
|
154
|
+
classNames: v,
|
|
155
|
+
children: [
|
|
156
|
+
/* @__PURE__ */ o(P.Target, { children: /* @__PURE__ */ o(
|
|
157
|
+
"div",
|
|
158
|
+
{
|
|
159
|
+
className: e.DatePicker__Wrapper,
|
|
160
|
+
"data-expanded": f ? !0 : void 0,
|
|
161
|
+
"data-disabled": s ? !0 : void 0,
|
|
162
|
+
children: /* @__PURE__ */ o(
|
|
163
|
+
K,
|
|
164
|
+
{
|
|
165
|
+
component: "button",
|
|
166
|
+
type: "button",
|
|
167
|
+
classNames: {
|
|
168
|
+
input: e.DatePicker__Input,
|
|
169
|
+
section: e.DatePicker__Section
|
|
170
|
+
},
|
|
171
|
+
onClick: () => !s && m((i) => !i),
|
|
172
|
+
disabled: s,
|
|
173
|
+
rightSection: y,
|
|
174
|
+
rightSectionWidth: Y ?? D,
|
|
175
|
+
"data-expanded": f ? !0 : void 0,
|
|
176
|
+
"data-disabled": s ? !0 : void 0,
|
|
177
|
+
children: T ? /* @__PURE__ */ o("span", { children: T }) : /* @__PURE__ */ o("span", { className: e.DatePicker__Placeholder, children: N })
|
|
178
|
+
}
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
) }),
|
|
182
|
+
/* @__PURE__ */ o(P.Dropdown, { children: /* @__PURE__ */ o(
|
|
183
|
+
re,
|
|
184
|
+
{
|
|
185
|
+
type: r,
|
|
186
|
+
value: I,
|
|
187
|
+
onChange: U,
|
|
188
|
+
excludedDates: O,
|
|
189
|
+
excludedDays: b,
|
|
190
|
+
highlightToday: j,
|
|
191
|
+
minDate: g,
|
|
192
|
+
maxDate: A
|
|
193
|
+
}
|
|
194
|
+
) })
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
};
|
|
201
|
+
export {
|
|
202
|
+
ke as DatePicker
|
|
203
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const e = "styles-module__DatePickerBase___yJlGe", _ = "styles-module__DatePickerRoot___HG6Zb", t = "styles-module__DatePicker__Wrapper___7X5ke", a = "styles-module__DatePicker__Input___sTaqF", r = "styles-module__DatePicker__Placeholder___PZnzX", o = "styles-module__DatePicker__Section___waCJM", c = "styles-module__DatePicker__Icon___fceRx", l = "styles-module__DatePicker__Dropdown___Iy9KE", s = "styles-module__DatePicker__DropdownArrow___zeIIm", i = "styles-module__DatePicker__Root___2Q8qm", D = "styles-module__DatePicker__LevelsGroup___lrWsl", k = "styles-module__DatePicker__CalendarHeader___VI-Of", P = "styles-module__DatePicker__CalendarHeaderLevel___F4DtE", n = "styles-module__DatePicker__CalendarHeaderControl___72yIl", d = "styles-module__DatePicker__CalendarHeaderControlIcon___CnQei", u = "styles-module__DatePicker__Month___W7LuG", m = "styles-module__DatePicker__WeekdaysRow___4NdYk", y = "styles-module__DatePicker__Weekday___tL-rR", p = "styles-module__DatePicker__MonthRow___NSs67", C = "styles-module__DatePicker__MonthCell___iGYhy", I = "styles-module__DatePicker__Day___7LDrl", w = "styles-module__DatePicker__TimeWrapper___BlHZZ", H = "styles-module__DatePicker__TimeInput___Acg-L", R = "styles-module__DatePicker__SubmitButton___6DvfS", W = {
|
|
3
|
+
DatePickerBase: e,
|
|
4
|
+
DatePickerRoot: _,
|
|
5
|
+
"DatePicker--Small": "styles-module__DatePicker--Small___m8asv",
|
|
6
|
+
"DatePicker--Medium": "styles-module__DatePicker--Medium___Po2-B",
|
|
7
|
+
"DatePicker--Large": "styles-module__DatePicker--Large___oQ6EM",
|
|
8
|
+
DatePicker__Wrapper: t,
|
|
9
|
+
DatePicker__Input: a,
|
|
10
|
+
DatePicker__Placeholder: r,
|
|
11
|
+
DatePicker__Section: o,
|
|
12
|
+
DatePicker__Icon: c,
|
|
13
|
+
DatePicker__Dropdown: l,
|
|
14
|
+
DatePicker__DropdownArrow: s,
|
|
15
|
+
DatePicker__Root: i,
|
|
16
|
+
DatePicker__LevelsGroup: D,
|
|
17
|
+
DatePicker__CalendarHeader: k,
|
|
18
|
+
DatePicker__CalendarHeaderLevel: P,
|
|
19
|
+
DatePicker__CalendarHeaderControl: n,
|
|
20
|
+
DatePicker__CalendarHeaderControlIcon: d,
|
|
21
|
+
DatePicker__Month: u,
|
|
22
|
+
DatePicker__WeekdaysRow: m,
|
|
23
|
+
DatePicker__Weekday: y,
|
|
24
|
+
DatePicker__MonthRow: p,
|
|
25
|
+
DatePicker__MonthCell: C,
|
|
26
|
+
DatePicker__Day: I,
|
|
27
|
+
DatePicker__TimeWrapper: w,
|
|
28
|
+
DatePicker__TimeInput: H,
|
|
29
|
+
DatePicker__SubmitButton: R
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
e as DatePickerBase,
|
|
33
|
+
_ as DatePickerRoot,
|
|
34
|
+
k as DatePicker__CalendarHeader,
|
|
35
|
+
n as DatePicker__CalendarHeaderControl,
|
|
36
|
+
d as DatePicker__CalendarHeaderControlIcon,
|
|
37
|
+
P as DatePicker__CalendarHeaderLevel,
|
|
38
|
+
I as DatePicker__Day,
|
|
39
|
+
l as DatePicker__Dropdown,
|
|
40
|
+
s as DatePicker__DropdownArrow,
|
|
41
|
+
c as DatePicker__Icon,
|
|
42
|
+
a as DatePicker__Input,
|
|
43
|
+
D as DatePicker__LevelsGroup,
|
|
44
|
+
u as DatePicker__Month,
|
|
45
|
+
C as DatePicker__MonthCell,
|
|
46
|
+
p as DatePicker__MonthRow,
|
|
47
|
+
r as DatePicker__Placeholder,
|
|
48
|
+
i as DatePicker__Root,
|
|
49
|
+
o as DatePicker__Section,
|
|
50
|
+
R as DatePicker__SubmitButton,
|
|
51
|
+
H as DatePicker__TimeInput,
|
|
52
|
+
w as DatePicker__TimeWrapper,
|
|
53
|
+
y as DatePicker__Weekday,
|
|
54
|
+
m as DatePicker__WeekdaysRow,
|
|
55
|
+
t as DatePicker__Wrapper,
|
|
56
|
+
W as default
|
|
57
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { Input as s, Tooltip as S, Select as u } from "@mantine/core";
|
|
4
|
+
import { IconInfoCircle as b, ColorBlack as v, ColorGray100 as C, IconChevronUp as g, IconChevronDown as y } from "@pop-ui/foundation";
|
|
5
|
+
import { useState as I } from "react";
|
|
6
|
+
import o from "./styles.module.scss.js";
|
|
7
|
+
const k = ({
|
|
8
|
+
label: a,
|
|
9
|
+
labelPosition: w = "top",
|
|
10
|
+
size: l = "md",
|
|
11
|
+
required: _,
|
|
12
|
+
tooltip: c,
|
|
13
|
+
tooltipPosition: h = "top",
|
|
14
|
+
errorMsg: n,
|
|
15
|
+
description: m,
|
|
16
|
+
...f
|
|
17
|
+
}) => {
|
|
18
|
+
const [L, D] = I(!1);
|
|
19
|
+
let t = o["Dropdown__Label--Medium"], p = o["Dropdown--Medium"], i = o["Dropdown__Tooltip--Medium"], r = 18;
|
|
20
|
+
return l === "sm" ? (t = o["Dropdown__Label--Small"], p = o["Dropdown--Small"], i = o["Dropdown__Tooltip--Small"], r = 14) : l === "lg" && (t = o["Dropdown__Label--Large"], p = o["Dropdown--Large"], i = o["Dropdown__Tooltip--Large"], r = 24), /* @__PURE__ */ d(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
className: w === "top" ? o["Dropdown--TopLabel"] : o["Dropdown--LeftLabel"],
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ d("div", { children: [
|
|
26
|
+
a && /* @__PURE__ */ e(s.Label, { required: _, className: t, children: a }),
|
|
27
|
+
c && /* @__PURE__ */ e(S, { label: c, position: h, children: /* @__PURE__ */ e("div", { className: i, children: /* @__PURE__ */ e(b, { size: l === "sm" ? 14 : l === "lg" ? 20 : 16 }) }) })
|
|
28
|
+
] }),
|
|
29
|
+
/* @__PURE__ */ d("div", { children: [
|
|
30
|
+
/* @__PURE__ */ e(
|
|
31
|
+
u,
|
|
32
|
+
{
|
|
33
|
+
...f,
|
|
34
|
+
size: l,
|
|
35
|
+
error: n,
|
|
36
|
+
className: p,
|
|
37
|
+
rightSection: L ? /* @__PURE__ */ e(g, { size: r }) : /* @__PURE__ */ e(y, { size: r }),
|
|
38
|
+
onDropdownOpen: () => D(!0),
|
|
39
|
+
onDropdownClose: () => D(!1),
|
|
40
|
+
styles: {
|
|
41
|
+
option: {
|
|
42
|
+
"&[data-selected]": {
|
|
43
|
+
"&, &:hover": {
|
|
44
|
+
backgroundColor: C,
|
|
45
|
+
color: v
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
m && /* @__PURE__ */ e(s.Description, { className: o.Dropdown__Description, children: m }),
|
|
53
|
+
n && /* @__PURE__ */ e(s.Error, { className: o.Dropdown__ErrorMsg, children: n })
|
|
54
|
+
] })
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
k as Dropdown
|
|
61
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const _ = "styles-module__Dropdown__Description___OQ8bF", o = "styles-module__Dropdown__ErrorMsg___xTP0Y", e = {
|
|
3
|
+
"Dropdown--LeftLabel": "styles-module__Dropdown--LeftLabel___SFObq",
|
|
4
|
+
"Dropdown--TopLabel": "styles-module__Dropdown--TopLabel___-lPhr",
|
|
5
|
+
"Dropdown__Label--Small": "styles-module__Dropdown__Label--Small___xbzOR",
|
|
6
|
+
"Dropdown__Label--Medium": "styles-module__Dropdown__Label--Medium___YtJ2-",
|
|
7
|
+
"Dropdown__Label--Large": "styles-module__Dropdown__Label--Large___sCiJv",
|
|
8
|
+
"Dropdown__Tooltip--Small": "styles-module__Dropdown__Tooltip--Small___rkmaO",
|
|
9
|
+
"Dropdown__Tooltip--Medium": "styles-module__Dropdown__Tooltip--Medium___JTfzy",
|
|
10
|
+
"Dropdown__Tooltip--Large": "styles-module__Dropdown__Tooltip--Large___W-sUq",
|
|
11
|
+
"Dropdown--Small": "styles-module__Dropdown--Small___dRIK7",
|
|
12
|
+
"Dropdown--Medium": "styles-module__Dropdown--Medium___-HZoU",
|
|
13
|
+
"Dropdown--Large": "styles-module__Dropdown--Large___BvV3M",
|
|
14
|
+
Dropdown__Description: _,
|
|
15
|
+
Dropdown__ErrorMsg: o
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
_ as Dropdown__Description,
|
|
19
|
+
o as Dropdown__ErrorMsg,
|
|
20
|
+
e as default
|
|
21
|
+
};
|
|
@@ -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
|
+
};
|