@gusun/design-system 0.1.0 → 0.1.1

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.
@@ -1,1994 +0,0 @@
1
- import { T as e, i as t, k as n, o as r, s as i } from "./tokens-CbcaxhkP.js";
2
- import { Children as a, Fragment as o, cloneElement as s, forwardRef as c, isValidElement as l, useCallback as u, useEffect as d, useId as f, useLayoutEffect as p, useMemo as m, useReducer as h, useRef as g, useState as _ } from "react";
3
- import { AlignCenter as v, AlignJustify as y, AlignLeft as b, AlignRight as x, Baseline as S, Bold as C, Braces as w, ChevronDown as T, ChevronRight as E, Highlighter as D, Image as O, Italic as k, Link as A, LoaderCircle as j, Minus as M, MoreHorizontal as N, Plus as P, Redo2 as F, RotateCcw as I, Search as ee, Strikethrough as te, Table as L, Type as R, Underline as z, Undo2 as B } from "lucide-react";
4
- import { createPortal as ne } from "react-dom";
5
- import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
6
- import { EditorContent as re, useEditor as ie } from "@tiptap/react";
7
- import { StarterKit as ae } from "@tiptap/starter-kit";
8
- import { TextStyle as oe } from "@tiptap/extension-text-style";
9
- import { Color as W } from "@tiptap/extension-color";
10
- import { Highlight as G } from "@tiptap/extension-highlight";
11
- import { TextAlign as se } from "@tiptap/extension-text-align";
12
- import { Image as ce } from "@tiptap/extension-image";
13
- import { Table as le, TableCell as ue, TableHeader as de, TableRow as K } from "@tiptap/extension-table";
14
- import { Node as q, mergeAttributes as fe } from "@tiptap/core";
15
- //#region src/components/Slot.tsx
16
- function pe(e, t) {
17
- return (n) => {
18
- e?.(n), t?.(n);
19
- };
20
- }
21
- function me(...e) {
22
- return (t) => {
23
- for (let n of e) n && (typeof n == "function" ? n(t) : n.current = t);
24
- };
25
- }
26
- function he(e, t) {
27
- let n = { ...t };
28
- for (let r in e) {
29
- let i = e[r], a = t[r];
30
- /^on[A-Z]/.test(r) ? n[r] = a ? pe(a, i) : i : r === "className" ? n[r] = [a, i].filter(Boolean).join(" ") : r === "style" ? n[r] = {
31
- ...a,
32
- ...i
33
- } : n[r] = i === void 0 ? a : i;
34
- }
35
- return n;
36
- }
37
- function ge({ children: e, content: t, ref: n, ...r }) {
38
- if (!l(e)) return console.warn("Slot(asChild): 유효한 단일 엘리먼트 자식 하나가 필요합니다."), null;
39
- let i = e, a = i.ref, o = he(r, i.props);
40
- return t !== void 0 && (o.children = t), (n || a) && (o.ref = me(n, a)), s(i, o);
41
- }
42
- //#endregion
43
- //#region src/components/Tooltip.tsx
44
- var _e = {
45
- error: {
46
- bg: n["error-tooltip-bg"],
47
- fg: n["error-tooltip-text"]
48
- },
49
- normal: {
50
- bg: n["normal-tooltip-bg"],
51
- fg: n["normal-tooltip-text"]
52
- }
53
- }, ve = {
54
- top: "-top-spacing-2 left-spacing-5",
55
- bottom: "-bottom-spacing-2 left-spacing-5"
56
- };
57
- function ye({ children: e, variant: t = "error", beak: n = "top", className: r = "" }) {
58
- let i = _e[t] ?? _e.error;
59
- return /* @__PURE__ */ U("div", {
60
- role: "tooltip",
61
- style: {
62
- backgroundColor: i.bg,
63
- color: i.fg
64
- },
65
- className: `relative inline-flex items-center rounded-round-4 px-spacing-5 py-spacing-2 drop-shadow-[0px_2px_2px_rgba(13,13,13,0.12)] ${r}`,
66
- children: [n !== "none" && /* @__PURE__ */ H("span", {
67
- "aria-hidden": "true",
68
- style: { backgroundColor: i.bg },
69
- className: `absolute h-spacing-5 w-spacing-5 rotate-45 rounded-[1px] ${ve[n] ?? ve.top}`
70
- }), /* @__PURE__ */ H("p", {
71
- className: "relative whitespace-nowrap text-12",
72
- children: e
73
- })]
74
- });
75
- }
76
- //#endregion
77
- //#region src/components/TruncatingText.tsx
78
- function be({ children: e, as: t = "p", className: n = "", ...r }) {
79
- let i = g(null), a = g(null), [o, s] = _(null), [c, l] = _(null);
80
- return p(() => {
81
- if (!o || !a.current) return;
82
- let e = a.current.offsetWidth, t = a.current.offsetHeight, n = o.top - 6 - t;
83
- n < 4 && (n = o.bottom + 6);
84
- let r = o.left;
85
- r + e > window.innerWidth - 4 && (r = window.innerWidth - e - 4), r < 4 && (r = 4), l({
86
- top: n,
87
- left: r
88
- });
89
- }, [o]), /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H(t, {
90
- ref: i,
91
- onMouseEnter: () => {
92
- let e = i.current;
93
- e && e.scrollWidth > e.clientWidth && s(e.getBoundingClientRect());
94
- },
95
- onMouseLeave: () => {
96
- s(null), l(null);
97
- },
98
- className: `truncate ${n}`,
99
- ...r,
100
- children: e
101
- }), o && ne(/* @__PURE__ */ H("div", {
102
- ref: a,
103
- className: "pointer-events-none fixed z-[1000]",
104
- style: {
105
- left: c ? c.left : o.left,
106
- top: c ? c.top : o.top,
107
- visibility: c ? "visible" : "hidden"
108
- },
109
- children: /* @__PURE__ */ H(ye, {
110
- variant: "normal",
111
- beak: "none",
112
- children: e
113
- })
114
- }), document.body)] });
115
- }
116
- //#endregion
117
- //#region src/components/useHoverTooltip.tsx
118
- function xe(e, { delay: t = 300 } = {}) {
119
- let [n, r] = _(null), [i, a] = _(null), o = g(null), s = g(void 0), c = !!e;
120
- d(() => () => clearTimeout(s.current), []);
121
- let l = u((e) => {
122
- if (!c) return;
123
- let n = e.currentTarget;
124
- clearTimeout(s.current), s.current = setTimeout(() => r(n.getBoundingClientRect()), t);
125
- }, [c, t]), f = u(() => {
126
- clearTimeout(s.current), r(null), a(null);
127
- }, []);
128
- return p(() => {
129
- if (!n || !o.current) return;
130
- let e = o.current.offsetWidth, t = o.current.offsetHeight, r = n.bottom + 6;
131
- r + t > window.innerHeight - 4 && (r = n.top - 6 - t);
132
- let i = n.left + n.width / 2 - e / 2;
133
- i + e > window.innerWidth - 4 && (i = window.innerWidth - e - 4), i < 4 && (i = 4), a({
134
- top: r,
135
- left: i
136
- });
137
- }, [n]), {
138
- onMouseEnter: l,
139
- onMouseLeave: f,
140
- tooltip: n ? ne(/* @__PURE__ */ H("div", {
141
- ref: o,
142
- className: "pointer-events-none fixed z-[1000]",
143
- style: {
144
- left: i ? i.left : n.left,
145
- top: i ? i.top : n.bottom,
146
- visibility: i ? "visible" : "hidden"
147
- },
148
- children: /* @__PURE__ */ H(ye, {
149
- variant: "normal",
150
- beak: "none",
151
- children: e
152
- })
153
- }), document.body) : null
154
- };
155
- }
156
- //#endregion
157
- //#region src/components/Button.tsx
158
- function J({ children: e, size: t = "32", variant: n = "fill", color: r = "black", weight: i = "normal", leftIcon: a = null, rightIcon: o = null, icon: s = null, disabled: c = !1, loading: u = !1, truncate: d = !1, width: f = "hug", showTooltip: m = !0, tooltip: h, asChild: _ = !1, onClick: v, onMouseEnter: y, onMouseLeave: b, className: x = "", ...S }) {
159
- let C = c || u, w = !!s, T = xe(w && m ? h ?? S["aria-label"] : null), E = t === "18" || t === "24" ? 14 : 16, D = f === "fill" && n !== "underline", O = g(null), k = _ && l(e) ? e : null, A = k ? k.props.children : e;
160
- p(() => {
161
- let e = O.current;
162
- if (!e || d || D) {
163
- e && D && (e.style.width = "");
164
- return;
165
- }
166
- e.style.width = "", e.style.width = e.offsetWidth + "px";
167
- }, [
168
- e,
169
- t,
170
- n,
171
- a,
172
- o,
173
- s,
174
- c,
175
- u,
176
- d,
177
- D
178
- ]);
179
- let M = `inline-flex items-center justify-center relative font-pretendard ${n === "underline" && i === "semibold" ? "font-semibold" : "font-normal"} whitespace-nowrap rounded-round-4 transition-colors select-none focus:outline-none`, N = d ? "min-w-0 max-w-full" : "", P = D ? "w-full" : "", F;
180
- F = n === "underline" ? t === "24" ? "min-h-[24px] text-[12px] leading-5 tracking-[0px]" : "min-h-[32px] text-[14px] leading-6 tracking-[0px]" : w ? t === "18" ? "min-h-[18px] min-w-[18px] p-spacing-2" : t === "24" ? "min-h-[24px] min-w-[24px] p-spacing-2" : "min-h-[32px] min-w-[32px] p-spacing-3" : t === "24" ? "min-h-[24px] min-w-[24px] px-spacing-5 py-spacing-2 text-[12px] leading-5 tracking-[0px]" : "min-h-[32px] min-w-[32px] px-spacing-6 py-spacing-3 text-[14px] leading-6 tracking-[0px]";
181
- let I;
182
- if (n === "fill") I = C ? "bg-button-fill-disabled-bg text-button-fill-disabled-fg cursor-not-allowed" : "bg-button-fill-default-bg text-button-fill-default-fg cursor-pointer hover:bg-button-fill-hover-bg focus-visible:bg-button-fill-hover-bg active:bg-button-fill-default-bg";
183
- else if (n === "line") I = C ? "bg-button-line-disabled-bg text-button-line-disabled-fg cursor-not-allowed" : "bg-button-line-default-bg text-button-line-default-fg ring-1 ring-inset ring-button-line-default-line cursor-pointer hover:bg-button-line-hover-bg hover:ring-button-line-hover-line focus-visible:bg-button-line-hover-bg focus-visible:ring-button-line-hover-line active:bg-button-line-default-bg active:ring-button-line-default-line";
184
- else if (n === "underline") {
185
- let e = {
186
- black: "text-button-underline-black-fg",
187
- red: "text-button-underline-red-fg",
188
- blue: "text-button-underline-blue-fg",
189
- green: "text-button-underline-green-fg",
190
- violet: "text-button-underline-violet-fg",
191
- pink: "text-button-underline-pink-fg",
192
- orange: "text-button-underline-orange-fg"
193
- };
194
- I = C ? "bg-transparent text-font-icon-2 cursor-not-allowed" : `bg-transparent ${e[r] ?? e.black} cursor-pointer hover:underline focus-visible:underline active:no-underline`;
195
- } else I = C ? "bg-transparent text-font-icon-2 cursor-not-allowed" : "bg-transparent text-button-ghost-default-fg cursor-pointer hover:bg-button-ghost-hover-bg focus-visible:bg-button-ghost-hover-bg active:bg-transparent";
196
- let ee = /* @__PURE__ */ U(V, { children: [u && /* @__PURE__ */ H("span", {
197
- className: "absolute inset-0 flex items-center justify-center",
198
- children: /* @__PURE__ */ H(j, {
199
- size: E,
200
- strokeWidth: 1.8,
201
- className: "animate-spin text-font-icon-3"
202
- })
203
- }), /* @__PURE__ */ H("span", {
204
- className: `inline-flex items-center gap-spacing-3 ${d ? "min-w-0" : ""} ${u ? "opacity-0" : ""}`,
205
- children: w ? /* @__PURE__ */ H(s, {
206
- size: E,
207
- strokeWidth: 1.8
208
- }) : /* @__PURE__ */ U(V, { children: [
209
- a && /* @__PURE__ */ H(a, {
210
- size: E,
211
- strokeWidth: 1.8,
212
- className: "shrink-0"
213
- }),
214
- d ? /* @__PURE__ */ H(be, {
215
- as: "span",
216
- className: "min-w-0",
217
- children: A
218
- }) : A,
219
- o && /* @__PURE__ */ H(o, {
220
- size: E,
221
- strokeWidth: 1.8,
222
- className: "shrink-0"
223
- })
224
- ] })
225
- })] }), te = `${M} ${F} ${I} ${N} ${P} ${x}`, L = (e) => {
226
- y?.(e), T.onMouseEnter(e);
227
- }, R = (e) => {
228
- b?.(e), T.onMouseLeave();
229
- };
230
- return /* @__PURE__ */ U(V, { children: [k ? /* @__PURE__ */ H(ge, {
231
- ref: O,
232
- content: ee,
233
- className: te,
234
- "aria-disabled": C || void 0,
235
- onClick: C ? void 0 : v,
236
- onMouseEnter: L,
237
- onMouseLeave: R,
238
- ...S,
239
- children: k
240
- }) : /* @__PURE__ */ H("button", {
241
- ref: O,
242
- className: te,
243
- disabled: C,
244
- onClick: C ? void 0 : v,
245
- onMouseEnter: L,
246
- onMouseLeave: R,
247
- ...S,
248
- children: ee
249
- }), T.tooltip] });
250
- }
251
- //#endregion
252
- //#region src/components/Input.tsx
253
- var Se = "ring-inset ring-text-field-hover-line hover:ring-2 focus-within:ring-2 focus-within:ring-text-field-focused-line", Ce = {
254
- 32: {
255
- box: "min-h-[32px] px-spacing-6 py-spacing-3",
256
- text: "text-14"
257
- },
258
- 22: {
259
- box: "min-h-[22px] px-spacing-5 py-spacing-2",
260
- text: "text-12 leading-18"
261
- }
262
- };
263
- function Y({ value: e, defaultValue: t, onChange: n, placeholder: r = "텍스트를 입력하세요", size: i = "32", disabled: a = !1, readOnly: o = !1, error: s = !1, errorMessage: c = "", width: l = 200, className: u = "", inputProps: d = {}, ...f }) {
264
- let p = !a && !o, m = typeof l == "number" ? `${l}px` : l, h = Ce[i] ?? Ce[32], g = a ? "text-text-field-disabled-text" : o ? "text-text-field-readonly-text" : "text-text-field-filled-text", _ = a ? "placeholder:text-text-field-disabled-text" : "placeholder:text-text-field-default-text";
265
- return /* @__PURE__ */ U("div", {
266
- style: { width: m },
267
- className: `relative flex items-center gap-spacing-3 rounded-round-4 bg-text-field-default-bg transition-shadow ${h.box} ${p ? Se : "cursor-not-allowed"} ${u}`,
268
- ...f,
269
- children: [/* @__PURE__ */ H("input", {
270
- value: e,
271
- defaultValue: t,
272
- onChange: n,
273
- placeholder: r,
274
- disabled: a,
275
- readOnly: o,
276
- "aria-invalid": s || void 0,
277
- className: `min-w-0 flex-1 bg-transparent outline-none ${h.text} ${_} disabled:cursor-not-allowed read-only:cursor-default ${g}`,
278
- ...d
279
- }), s && c && /* @__PURE__ */ H("div", {
280
- className: "absolute left-0 top-full z-10 mt-spacing-2",
281
- children: /* @__PURE__ */ H(ye, {
282
- variant: "error",
283
- beak: "top",
284
- children: c
285
- })
286
- })]
287
- });
288
- }
289
- //#endregion
290
- //#region src/components/ScrollArea.tsx
291
- var we = 24, X = 6, Te = 16;
292
- function Ee(e, t) {
293
- let n = e.querySelector("[data-scroll-sticky-top]"), r = n ? n.offsetHeight : 0, i = t && e.scrollWidth > e.clientWidth + 1 ? Te : 0;
294
- return {
295
- topInset: r,
296
- trackH: e.clientHeight - r - i - X * 2
297
- };
298
- }
299
- var De = {
300
- default: {
301
- base: e["scroll-bar"],
302
- active: e["scroll-bar-hover"]
303
- },
304
- light: {
305
- base: e["scroll-bar-light"],
306
- active: e["scroll-bar-light-hover"]
307
- }
308
- }, Oe = "before:absolute before:-inset-spacing-2 before:content-['']";
309
- function ke({ orientation: e, thumb: t, active: n, colors: r, onDown: i, onEnter: a, onLeave: o }) {
310
- let s = e === "vertical", c = s ? "right-spacing-3 w-spacing-4" : "bottom-spacing-3 h-spacing-4", l = s ? {
311
- top: `${t.pos}px`,
312
- height: `${t.size}px`
313
- } : {
314
- left: `${t.pos}px`,
315
- width: `${t.size}px`
316
- };
317
- return /* @__PURE__ */ H("div", {
318
- onMouseDown: i,
319
- onMouseEnter: a,
320
- onMouseLeave: o,
321
- className: `absolute cursor-pointer rounded-round-00 ${Oe} ${c}`,
322
- style: {
323
- ...l,
324
- opacity: +!!t.visible,
325
- pointerEvents: t.visible ? "auto" : "none",
326
- backgroundColor: n ? r.active : r.base
327
- }
328
- });
329
- }
330
- function Ae({ children: e, maxHeight: t, horizontal: n = !1, variant: r = "default", onViewport: i, onScroll: a, vScrollEl: o = null, className: s = "", contentClassName: c = "", ...l }) {
331
- let f = De[r] ?? De.default, m = g(null), h = g(null), v = u((e) => {
332
- m.current = e, i?.(e);
333
- }, [i]), y = g(!1), b = g(!1), [x, S] = _({
334
- pos: 0,
335
- size: 0,
336
- visible: !1
337
- }), [C, w] = _({
338
- pos: 0,
339
- size: 0,
340
- visible: !1
341
- }), [T, E] = _(!1), [D, O] = _(!1), k = typeof t == "number" ? `${t}px` : t, A = u(() => {
342
- let e = m.current;
343
- if (o) {
344
- let t = h.current?.getBoundingClientRect().top ?? 0, r = o.getBoundingClientRect().top - t, i = n && e && e.scrollWidth > e.clientWidth + 1 ? Te : 0;
345
- return {
346
- vEl: o,
347
- topInset: r,
348
- sizeInset: 0,
349
- trackH: o.clientHeight - i - X * 2
350
- };
351
- }
352
- let { topInset: t, trackH: r } = Ee(e, n);
353
- return {
354
- vEl: e,
355
- topInset: t,
356
- sizeInset: t,
357
- trackH: r
358
- };
359
- }, [o, n]), j = u(() => {
360
- let e = m.current;
361
- if (!e) return;
362
- let { scrollWidth: t, clientWidth: r, scrollLeft: i } = e, { vEl: a, topInset: o, sizeInset: s, trackH: c } = A(), { scrollHeight: l, clientHeight: u, scrollTop: d } = a;
363
- if (l <= u + 1) S((e) => e.visible ? {
364
- ...e,
365
- visible: !1
366
- } : e);
367
- else {
368
- let e = Math.max((u - s) / (l - s) * c, we);
369
- S({
370
- pos: X + o + d / (l - u) * (c - e),
371
- size: e,
372
- visible: !0
373
- });
374
- }
375
- if (!n || t <= r + 1) w((e) => e.visible ? {
376
- ...e,
377
- visible: !1
378
- } : e);
379
- else {
380
- let e = r - X * 2, n = Math.max(r / t * e, we);
381
- w({
382
- pos: X + i / (t - r) * (e - n),
383
- size: n,
384
- visible: !0
385
- });
386
- }
387
- }, [n, A]), M = g(0), N = u(() => {
388
- M.current ||= requestAnimationFrame(() => {
389
- M.current = 0, j();
390
- });
391
- }, [j]);
392
- d(() => () => {
393
- M.current &&= (cancelAnimationFrame(M.current), 0);
394
- }, []), p(() => {
395
- N();
396
- let e = m.current;
397
- if (!e) return;
398
- let t = new ResizeObserver(N);
399
- return t.observe(e), () => t.disconnect();
400
- }, [N, e]), p(() => {
401
- if (!o) return;
402
- o.addEventListener("scroll", N);
403
- let e = new ResizeObserver(N);
404
- return e.observe(o), () => {
405
- o.removeEventListener("scroll", N), e.disconnect();
406
- };
407
- }, [o, N]);
408
- let P = g(null);
409
- d(() => () => P.current?.(), []);
410
- let F = (e, t) => {
411
- e.preventDefault(), e.stopPropagation();
412
- let n = t === "vertical", r = n ? y : b, i = n ? E : O, a = n ? A().vEl : m.current;
413
- r.current = !0, i(!0);
414
- let o = n ? e.clientY : e.clientX, s = n ? a.scrollTop : a.scrollLeft, c = n ? a.scrollHeight - a.clientHeight : a.scrollWidth - a.clientWidth, l = (n ? A().trackH : a.clientWidth - X * 2) - (n ? x.size : C.size), u = l > 0 ? c / l : 0, d = (e) => {
415
- let t = (n ? e.clientY : e.clientX) - o;
416
- n ? a.scrollTop = s + t * u : a.scrollLeft = s + t * u;
417
- }, f = () => {
418
- r.current = !1, i(!1), document.body.style.userSelect = "", window.removeEventListener("mousemove", d), window.removeEventListener("mouseup", f), P.current = null;
419
- };
420
- document.body.style.userSelect = "none", window.addEventListener("mousemove", d), window.addEventListener("mouseup", f), P.current = f;
421
- };
422
- return /* @__PURE__ */ U("div", {
423
- ref: h,
424
- className: `${/(^|\s)(absolute|fixed|relative|sticky)(\s|$)/.test(s) ? "" : "relative"} ${s}`,
425
- ...l,
426
- children: [
427
- /* @__PURE__ */ H("div", {
428
- ref: v,
429
- onScroll: (e) => {
430
- N(), a?.(e);
431
- },
432
- className: `hide-native-scroll ${n ? "overflow-auto" : "overflow-y-auto"} ${c}`,
433
- style: { maxHeight: k },
434
- children: e
435
- }),
436
- /* @__PURE__ */ H(ke, {
437
- orientation: "vertical",
438
- thumb: x,
439
- active: T,
440
- colors: f,
441
- onDown: (e) => F(e, "vertical"),
442
- onEnter: () => E(!0),
443
- onLeave: () => {
444
- y.current || E(!1);
445
- }
446
- }),
447
- n && /* @__PURE__ */ H(ke, {
448
- orientation: "horizontal",
449
- thumb: C,
450
- active: D,
451
- colors: f,
452
- onDown: (e) => F(e, "horizontal"),
453
- onEnter: () => O(!0),
454
- onLeave: () => {
455
- b.current || O(!1);
456
- }
457
- })
458
- ]
459
- });
460
- }
461
- //#endregion
462
- //#region src/components/chipStyles.ts
463
- var je = {
464
- gray: "text-chip-gray-default-text border-chip-gray-default-line bg-chip-gray-default-bg hover:text-chip-gray-hover-text hover:border-chip-gray-hover-line hover:bg-chip-gray-hover-bg focus-visible:text-chip-gray-hover-text focus-visible:border-chip-gray-hover-line focus-visible:bg-chip-gray-hover-bg data-[chain-focus]:text-chip-gray-hover-text data-[chain-focus]:border-chip-gray-hover-line data-[chain-focus]:bg-chip-gray-hover-bg",
465
- red: "text-chip-red-default-text border-chip-red-default-line bg-chip-red-default-bg hover:text-chip-red-hover-text hover:border-chip-red-hover-line hover:bg-chip-red-hover-bg focus-visible:text-chip-red-hover-text focus-visible:border-chip-red-hover-line focus-visible:bg-chip-red-hover-bg data-[chain-focus]:text-chip-red-hover-text data-[chain-focus]:border-chip-red-hover-line data-[chain-focus]:bg-chip-red-hover-bg",
466
- blue: "text-chip-blue-default-text border-chip-blue-default-line bg-chip-blue-default-bg hover:text-chip-blue-hover-text hover:border-chip-blue-hover-line hover:bg-chip-blue-hover-bg focus-visible:text-chip-blue-hover-text focus-visible:border-chip-blue-hover-line focus-visible:bg-chip-blue-hover-bg data-[chain-focus]:text-chip-blue-hover-text data-[chain-focus]:border-chip-blue-hover-line data-[chain-focus]:bg-chip-blue-hover-bg",
467
- black: "text-chip-black-default-text border-chip-black-default-line bg-chip-black-default-bg hover:text-chip-black-hover-text hover:border-chip-black-hover-line hover:bg-chip-black-hover-bg focus-visible:text-chip-black-hover-text focus-visible:border-chip-black-hover-line focus-visible:bg-chip-black-hover-bg data-[chain-focus]:text-chip-black-hover-text data-[chain-focus]:border-chip-black-hover-line data-[chain-focus]:bg-chip-black-hover-bg",
468
- green: "text-chip-green-default-text border-chip-green-default-line bg-chip-green-default-bg hover:text-chip-green-hover-text hover:border-chip-green-hover-line hover:bg-chip-green-hover-bg focus-visible:text-chip-green-hover-text focus-visible:border-chip-green-hover-line focus-visible:bg-chip-green-hover-bg data-[chain-focus]:text-chip-green-hover-text data-[chain-focus]:border-chip-green-hover-line data-[chain-focus]:bg-chip-green-hover-bg",
469
- violet: "text-chip-violet-default-text border-chip-violet-default-line bg-chip-violet-default-bg hover:text-chip-violet-hover-text hover:border-chip-violet-hover-line hover:bg-chip-violet-hover-bg focus-visible:text-chip-violet-hover-text focus-visible:border-chip-violet-hover-line focus-visible:bg-chip-violet-hover-bg data-[chain-focus]:text-chip-violet-hover-text data-[chain-focus]:border-chip-violet-hover-line data-[chain-focus]:bg-chip-violet-hover-bg",
470
- pink: "text-chip-pink-default-text border-chip-pink-default-line bg-chip-pink-default-bg hover:text-chip-pink-hover-text hover:border-chip-pink-hover-line hover:bg-chip-pink-hover-bg focus-visible:text-chip-pink-hover-text focus-visible:border-chip-pink-hover-line focus-visible:bg-chip-pink-hover-bg data-[chain-focus]:text-chip-pink-hover-text data-[chain-focus]:border-chip-pink-hover-line data-[chain-focus]:bg-chip-pink-hover-bg",
471
- orange: "text-chip-orange-default-text border-chip-orange-default-line bg-chip-orange-default-bg hover:text-chip-orange-hover-text hover:border-chip-orange-hover-line hover:bg-chip-orange-hover-bg focus-visible:text-chip-orange-hover-text focus-visible:border-chip-orange-hover-line focus-visible:bg-chip-orange-hover-bg data-[chain-focus]:text-chip-orange-hover-text data-[chain-focus]:border-chip-orange-hover-line data-[chain-focus]:bg-chip-orange-hover-bg"
472
- }, Me = c(function({ icon: e = null, children: t, size: n = "24", open: r = !1, disabled: i = !1, readOnly: a = !1, interactive: o, maxWidth: s, fill: c = !1, className: l = "", ...u }, d) {
473
- let f = o ?? (!i && !a), p = i ? "text-font-icon-2" : r ? "text-font-icon-3" : "text-font-icon-5", m = i || a ? "text-font-icon-2" : "text-font-icon-5", h = n === "20" ? "text-12" : "text-14", g = n === "20" ? 14 : 16;
474
- return /* @__PURE__ */ U("span", {
475
- ref: d,
476
- className: `group min-w-0 select-none items-center gap-spacing-3 focus:outline-none ${c ? "flex w-full justify-between" : "inline-flex"} ${f ? "cursor-pointer" : i ? "cursor-not-allowed" : "cursor-default"} ${l}`,
477
- ...u,
478
- children: [
479
- e && /* @__PURE__ */ H(e, {
480
- size: g,
481
- strokeWidth: 1.8,
482
- className: `shrink-0 ${m}`
483
- }),
484
- /* @__PURE__ */ H(be, {
485
- style: s ? { maxWidth: s } : void 0,
486
- className: `min-w-0 font-normal ${c ? "flex-1" : ""} ${h} ${p} ${f ? "group-hover:underline group-focus-visible:underline" : ""}`,
487
- children: t
488
- }),
489
- /* @__PURE__ */ H(T, {
490
- size: g,
491
- strokeWidth: 1.8,
492
- className: `pointer-events-none shrink-0 transition-transform ${m} ${r ? "rotate-180" : ""}`
493
- })
494
- ]
495
- });
496
- }), Ne = "ring-inset ring-text-field-hover-line hover:ring-2 focus-within:ring-2 focus-within:ring-text-field-focused-line";
497
- function Pe({ value: e, defaultValue: t, onChange: n, onSubmit: r, placeholder: i = "검색어를 입력하세요", disabled: a = !1, width: o = 200, className: s = "", inputProps: c = {}, ...l }) {
498
- return /* @__PURE__ */ U("div", {
499
- style: { width: typeof o == "number" ? `${o}px` : o },
500
- className: `group relative flex min-h-[32px] items-center gap-spacing-3 rounded-round-4 bg-text-field-default-bg px-spacing-6 py-spacing-3 transition-shadow ${a ? "cursor-not-allowed" : Ne} ${s}`,
501
- ...l,
502
- children: [/* @__PURE__ */ H(ee, {
503
- size: 16,
504
- strokeWidth: 1.8,
505
- className: `shrink-0 ${a ? "text-text-field-disabled-icon" : "text-text-field-default-text group-focus-within:text-text-field-filled-text"}`
506
- }), /* @__PURE__ */ H("input", {
507
- type: "search",
508
- value: e,
509
- defaultValue: t,
510
- onChange: n,
511
- placeholder: i,
512
- disabled: a,
513
- className: "min-w-0 flex-1 bg-transparent text-14 text-text-field-filled-text outline-none placeholder:text-text-field-default-text disabled:cursor-not-allowed disabled:text-text-field-disabled-text disabled:placeholder:text-text-field-disabled-text [&::-webkit-search-cancel-button]:appearance-none",
514
- ...c,
515
- onKeyDown: (e) => {
516
- e.key === "Enter" && r && r(e.currentTarget.value), c?.onKeyDown?.(e);
517
- }
518
- })]
519
- });
520
- }
521
- //#endregion
522
- //#region src/components/Checkbox.tsx
523
- var Fe = {
524
- 3: "gap-spacing-3",
525
- 4: "gap-spacing-4",
526
- 5: "gap-spacing-5",
527
- 6: "gap-spacing-6",
528
- 7: "gap-spacing-7"
529
- };
530
- function Ie({ className: e }) {
531
- return /* @__PURE__ */ H("svg", {
532
- viewBox: "0 0 8.34188 6.51667",
533
- fill: "currentColor",
534
- "aria-hidden": "true",
535
- className: e,
536
- children: /* @__PURE__ */ H("path", { d: "M2.84188 4.11667L6.64188 0.316667C6.85299 0.105556 7.08355 0 7.33355 0C7.58355 0 7.8141 0.105556 8.02521 0.316667C8.23633 0.527778 8.34188 0.761111 8.34188 1.01667C8.34188 1.27222 8.23633 1.50556 8.02521 1.71667L3.54188 6.21667C3.34188 6.41667 3.10577 6.51667 2.83355 6.51667C2.56132 6.51667 2.32521 6.41667 2.12521 6.21667L0.308547 4.4C0.0974359 4.18889 -0.00534188 3.95556 0.000213675 3.7C0.00576923 3.44444 0.114103 3.21111 0.325214 3C0.536325 2.78889 0.769658 2.68333 1.02521 2.68333C1.28077 2.68333 1.5141 2.78889 1.72521 3L2.84188 4.11667Z" })
537
- });
538
- }
539
- function Le({ checked: e, defaultChecked: t = !1, onChange: n, disabled: r = !1, label: i, className: a = "", ...o }) {
540
- let s = e !== void 0, [c, l] = _(t), u = s ? e : c, d = (e) => {
541
- s || l(e.target.checked), n?.(e);
542
- }, f = "group-hover:ring-2 group-hover:ring-offset-1", p = "peer-focus-visible:ring-2 peer-focus-visible:ring-offset-1", m;
543
- m = r ? u ? "bg-checkbox-selected-disabled-bg" : "bg-checkbox-disabled-bg" : u ? `bg-checkbox-selected-bg ${f} group-hover:ring-checkbox-selected-hover-outline ${p} peer-focus-visible:ring-checkbox-selected-hover-outline` : `bg-checkbox-unselected-bg ${f} group-hover:ring-checkbox-hover-outline ${p} peer-focus-visible:ring-checkbox-hover-outline`;
544
- let h = r ? "text-checkbox-disabled-check" : "text-checkbox-check", g = r ? "text-checkbox-disabled-text" : "text-checkbox-text";
545
- return /* @__PURE__ */ U("label", {
546
- className: `group relative inline-flex items-center gap-spacing-4 ${r ? "cursor-not-allowed" : "cursor-pointer"} ${a}`,
547
- children: [
548
- /* @__PURE__ */ H("input", {
549
- type: "checkbox",
550
- className: "peer sr-only",
551
- checked: u,
552
- onChange: d,
553
- disabled: r,
554
- ...o
555
- }),
556
- /* @__PURE__ */ H("span", {
557
- className: `flex size-[16px] shrink-0 items-center justify-center rounded-round-3 transition-shadow ${m}`,
558
- children: /* @__PURE__ */ H(Ie, { className: `w-[8px] ${u ? h : "invisible"}` })
559
- }),
560
- i != null && /* @__PURE__ */ H("span", {
561
- className: `text-14 ${g}`,
562
- children: i
563
- })
564
- ]
565
- });
566
- }
567
- function Re({ items: e = [], value: t, defaultValue: n = [], onChange: r, direction: i = "vertical", gap: a = "7", disabled: o = !1, className: s = "", ...c }) {
568
- let l = t !== void 0, [u, d] = _(n), f = t === void 0 ? u : t, p = (e, t) => {
569
- let n = t ? [...f, e] : f.filter((t) => t !== e);
570
- l || d(n), r?.(n, {
571
- value: e,
572
- checked: t
573
- });
574
- }, m = Fe[a] ?? Fe[7];
575
- return /* @__PURE__ */ H("div", {
576
- role: "group",
577
- className: `inline-flex ${i === "horizontal" ? "flex-row items-center" : "flex-col items-start"} ${m} ${s}`,
578
- ...c,
579
- children: e.map((e) => /* @__PURE__ */ H(Le, {
580
- label: e.label,
581
- checked: f.includes(e.value),
582
- disabled: o || e.disabled,
583
- onChange: (t) => p(e.value, t.target.checked)
584
- }, e.value))
585
- });
586
- }
587
- //#endregion
588
- //#region src/components/PopoverMenu.tsx
589
- function ze({ children: e, topArea: t = "none", searchValue: n, onSearchChange: r, searchPlaceholder: i = "검색어를 입력하세요", searchInputProps: a = {}, inputValue: o, onInputChange: s, inputPlaceholder: c = "텍스트를 입력하세요", inputProps: l = {}, footer: u = !1, footerStart: d = null, footerText: f = null, footerCheckbox: p = !1, footerChecked: m = !1, onFooterCheckChange: h, footerCheckLabel: g = "전체 선택", footerReset: _ = !1, onFooterReset: v, footerResetLabel: y = "초기화", footerResetIcon: b = I, cancelText: x = "취소", onCancel: S, confirmText: C = "확인", onConfirm: w, confirmVariant: T = "fill", confirmDisabled: E = !1, confirmLoading: D = !1, showCancel: O = !0, showConfirm: k = !0, footerButtonsFill: A = !1, width: j = 304, className: M = "", ...N }) {
590
- let P = typeof j == "number" ? `${j}px` : j, F = null;
591
- return d == null ? p ? F = /* @__PURE__ */ H(Le, {
592
- label: g,
593
- checked: m,
594
- onChange: h
595
- }) : _ ? F = /* @__PURE__ */ H(J, {
596
- variant: "underline",
597
- size: "32",
598
- leftIcon: b,
599
- onClick: v,
600
- children: y
601
- }) : f != null && (F = /* @__PURE__ */ H("p", {
602
- className: "text-14 text-font-icon-5",
603
- children: f
604
- })) : F = typeof d == "string" ? /* @__PURE__ */ H("p", {
605
- className: "text-14 text-font-icon-5",
606
- children: d
607
- }) : d, /* @__PURE__ */ U("div", {
608
- style: { width: P },
609
- onKeyDown: (e) => {
610
- !u || !k || e.key !== "Enter" || e.defaultPrevented || E || D || (e.preventDefault(), w?.());
611
- },
612
- tabIndex: u && k ? -1 : void 0,
613
- className: `flex flex-col gap-spacing-1 overflow-hidden rounded-round-4 outline outline-1 outline-list-popover-outline bg-list-popover-bg shadow-[0px_2px_5px_0px_rgba(13,13,13,0.12)] ${M}`,
614
- ...N,
615
- children: [
616
- t === "search" && /* @__PURE__ */ H("div", {
617
- className: "w-full bg-list-group-bg p-spacing-5",
618
- children: /* @__PURE__ */ H(Pe, {
619
- value: n,
620
- onChange: r,
621
- placeholder: i,
622
- width: "100%",
623
- inputProps: a
624
- })
625
- }),
626
- t === "input" && /* @__PURE__ */ H("div", {
627
- className: "w-full bg-list-group-bg p-spacing-5",
628
- children: /* @__PURE__ */ H(Y, {
629
- value: o,
630
- onChange: s,
631
- placeholder: c,
632
- width: "100%",
633
- inputProps: l
634
- })
635
- }),
636
- e,
637
- u && /* @__PURE__ */ U("div", {
638
- className: `flex w-full items-center bg-list-group-bg py-spacing-5 ${A ? "px-spacing-5" : "justify-between pl-spacing-6 pr-spacing-5"}`,
639
- children: [!A && /* @__PURE__ */ H("div", {
640
- className: "flex min-w-0 items-center",
641
- children: F
642
- }), /* @__PURE__ */ U(vt, {
643
- gap: "5",
644
- width: A ? "fill" : "hug",
645
- className: A ? "" : "shrink-0",
646
- children: [O && /* @__PURE__ */ H(J, {
647
- variant: "line",
648
- size: "32",
649
- onClick: S,
650
- children: x
651
- }), k && /* @__PURE__ */ H(J, {
652
- variant: T,
653
- size: "32",
654
- disabled: E,
655
- loading: D,
656
- onClick: w,
657
- children: C
658
- })]
659
- })]
660
- })
661
- ]
662
- });
663
- }
664
- function Be({ children: e, className: t = "", ...n }) {
665
- return /* @__PURE__ */ H("div", {
666
- className: `flex w-full items-stretch gap-spacing-1 ${t}`,
667
- ...n,
668
- children: e
669
- });
670
- }
671
- function Ve({ children: e, className: t = "", ...n }) {
672
- return /* @__PURE__ */ H("div", {
673
- className: `flex min-w-0 flex-1 flex-col gap-spacing-1 ${t}`,
674
- ...n,
675
- children: e
676
- });
677
- }
678
- function He({ title: e, children: t, grow: n = !1, className: r = "", ...i }) {
679
- return /* @__PURE__ */ U("div", {
680
- className: `w-full bg-list-group-bg py-spacing-4 ${n ? "min-h-0 flex-1" : ""} ${r}`,
681
- ...i,
682
- children: [e != null && /* @__PURE__ */ H("p", {
683
- className: "px-spacing-6 py-spacing-2 text-12 text-font-icon-3",
684
- children: e
685
- }), t]
686
- });
687
- }
688
- //#endregion
689
- //#region src/components/ListEmpty.tsx
690
- function Ue({ message: e = "검색 결과가 없습니다.", className: t = "", ...n }) {
691
- return /* @__PURE__ */ H("div", {
692
- className: `flex w-full items-center justify-center bg-list-empty-bg px-spacing-6 py-spacing-9 text-14 text-list-empty-text ${t}`,
693
- ...n,
694
- children: e
695
- });
696
- }
697
- //#endregion
698
- //#region src/components/ListGroup.tsx
699
- var We = 32, Ge = 6, Ke = {
700
- 2: "gap-spacing-2",
701
- 3: "gap-spacing-3"
702
- }, qe = {
703
- 2: 2,
704
- 3: 4
705
- };
706
- function Je({ children: e, maxVisible: t = 6, gap: n, empty: r = !1, emptyMessage: i, className: o = "", ...s }) {
707
- let c = n ? qe[n] : 0, l = t * We + c * (t - 1) + Ge * 2, u = r || a.count(e) === 0;
708
- return /* @__PURE__ */ H("div", {
709
- className: `w-full bg-list-group-bg ${o}`,
710
- ...s,
711
- children: /* @__PURE__ */ H(Ae, {
712
- maxHeight: l,
713
- contentClassName: `py-spacing-4 ${n ? `flex flex-col ${Ke[n]}` : ""}`,
714
- children: u ? /* @__PURE__ */ H(Ue, { message: i }) : e
715
- })
716
- });
717
- }
718
- //#endregion
719
- //#region src/components/Tag.tsx
720
- var Ye = {
721
- blue: "bg-tag-blue-bg text-tag-blue-text",
722
- red: "bg-tag-red-bg text-tag-red-text",
723
- gray: "bg-tag-gray-bg text-tag-gray-text",
724
- black: "bg-tag-black-bg text-tag-black-text"
725
- };
726
- function Xe({ children: e = "태그", color: t = "blue", width: n = "hug", className: r = "", ...i }) {
727
- let a = Ye[t] ?? Ye.blue;
728
- return /* @__PURE__ */ H("span", {
729
- className: `${n === "fill" ? "flex w-full" : "inline-flex shrink-0"} items-center justify-center rounded-round-4 px-spacing-4 py-spacing-1 text-12 ${a} ${r}`,
730
- ...i,
731
- children: e
732
- });
733
- }
734
- var Ze = {
735
- blue: "bg-new-tag-blue-bg",
736
- red: "bg-new-tag-red-bg",
737
- black: "bg-new-tag-black-bg"
738
- };
739
- function Qe({ color: e = "blue", children: t = "N", className: n = "", ...r }) {
740
- return /* @__PURE__ */ H("span", {
741
- className: `inline-flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-round-00 text-12 font-semibold text-new-tag-title ${Ze[e] ?? Ze.blue} ${n}`,
742
- ...r,
743
- children: t
744
- });
745
- }
746
- //#endregion
747
- //#region src/components/Radio.tsx
748
- var $e = {
749
- 3: "gap-spacing-3",
750
- 4: "gap-spacing-4",
751
- 5: "gap-spacing-5",
752
- 6: "gap-spacing-6",
753
- 7: "gap-spacing-7"
754
- };
755
- function et({ checked: e, defaultChecked: t = !1, onChange: n, disabled: r = !1, label: i, name: a, value: o, className: s = "", ...c }) {
756
- let l = e !== void 0, [u, d] = _(t), f = l ? e : u, p = (e) => {
757
- l || d(e.target.checked), n?.(e);
758
- }, m = "group-hover:ring-2 group-hover:ring-offset-1", h = "peer-focus-visible:ring-2 peer-focus-visible:ring-offset-1", g;
759
- g = r ? f ? "bg-radio-selected-disabled-bg" : "bg-radio-disabled-bg" : f ? `bg-radio-selected-bg ${m} group-hover:ring-radio-selected-hover-outline ${h} peer-focus-visible:ring-radio-selected-hover-outline` : `bg-radio-unselected-bg ${m} group-hover:ring-radio-hover-outline ${h} peer-focus-visible:ring-radio-hover-outline`;
760
- let v = r ? "bg-radio-disabled-point" : "bg-radio-point", y = r ? "text-radio-disabled-text" : "text-radio-text";
761
- return /* @__PURE__ */ U("label", {
762
- className: `group relative inline-flex items-center gap-spacing-4 ${r ? "cursor-not-allowed" : "cursor-pointer"} ${s}`,
763
- children: [
764
- /* @__PURE__ */ H("input", {
765
- type: "radio",
766
- className: "peer sr-only",
767
- checked: f,
768
- onChange: p,
769
- disabled: r,
770
- name: a,
771
- value: o,
772
- ...c
773
- }),
774
- /* @__PURE__ */ H("span", {
775
- className: `flex h-spacing-7 w-spacing-7 shrink-0 items-center justify-center rounded-round-00 transition-shadow ${g}`,
776
- children: /* @__PURE__ */ H("span", { className: `h-spacing-4 w-spacing-4 rounded-round-00 ${v} ${f ? "" : "invisible"}` })
777
- }),
778
- i != null && /* @__PURE__ */ H("span", {
779
- className: `text-14 ${y}`,
780
- children: i
781
- })
782
- ]
783
- });
784
- }
785
- function tt({ items: e = [], value: t, defaultValue: n, onChange: r, name: i, direction: a = "vertical", gap: o = "7", disabled: s = !1, className: c = "", ...l }) {
786
- let u = t !== void 0, [d, p] = _(n), m = t === void 0 ? d : t, h = f(), g = i ?? `radio-group-${h}`, v = (e) => {
787
- u || p(e), r?.(e);
788
- }, y = $e[o] ?? $e[7];
789
- return /* @__PURE__ */ H("div", {
790
- role: "radiogroup",
791
- className: `inline-flex ${a === "horizontal" ? "flex-row items-center" : "flex-col items-start"} ${y} ${c}`,
792
- ...l,
793
- children: e.map((e) => /* @__PURE__ */ H(et, {
794
- name: i ?? g,
795
- value: e.value,
796
- label: e.label,
797
- checked: m === e.value,
798
- disabled: s || e.disabled,
799
- onChange: () => v(e.value)
800
- }, e.value))
801
- });
802
- }
803
- //#endregion
804
- //#region src/components/Switch.tsx
805
- function nt({ checked: e, defaultChecked: t = !1, onChange: n, disabled: r = !1, label: i, className: a = "", ...o }) {
806
- let s = e !== void 0, [c, l] = _(t), u = s ? e : c, d = (e) => {
807
- s || l(e.target.checked), n?.(e);
808
- }, f = "group-hover:ring-2 group-hover:ring-offset-1", p = "peer-focus-visible:ring-2 peer-focus-visible:ring-offset-1", m;
809
- m = r ? u ? "bg-switch-selected-disabled-bg" : "bg-switch-disabled-bg" : u ? `bg-switch-selected-bg ${f} group-hover:ring-switch-selected-hover-outline ${p} peer-focus-visible:ring-switch-selected-hover-outline` : `bg-switch-unselected-bg ${f} group-hover:ring-switch-hover-outline ${p} peer-focus-visible:ring-switch-hover-outline`;
810
- let h;
811
- h = r ? u ? "bg-switch-disabled-thumb" : "bg-switch-disabled-thumb-off" : "bg-switch-thumb shadow";
812
- let g = r ? "text-switch-disabled-text" : "text-switch-text";
813
- return /* @__PURE__ */ U("label", {
814
- className: `group relative inline-flex items-center gap-spacing-4 ${r ? "cursor-not-allowed" : "cursor-pointer"} ${a}`,
815
- children: [
816
- /* @__PURE__ */ H("input", {
817
- type: "checkbox",
818
- role: "switch",
819
- className: "peer sr-only",
820
- checked: u,
821
- onChange: d,
822
- disabled: r,
823
- ...o
824
- }),
825
- /* @__PURE__ */ H("span", {
826
- className: `relative h-[16px] w-[28px] shrink-0 rounded-round-5 transition-[background-color,box-shadow] ${m}`,
827
- children: /* @__PURE__ */ H("span", { className: `absolute left-spacing-3 top-1/2 h-[10px] w-[12px] -translate-y-1/2 rounded-round-4 transition-transform ${h} ${u ? "translate-x-spacing-5" : "translate-x-0"}` })
828
- }),
829
- i != null && /* @__PURE__ */ H("span", {
830
- className: `text-14 ${g}`,
831
- children: i
832
- })
833
- ]
834
- });
835
- }
836
- //#endregion
837
- //#region src/components/List.tsx
838
- function Z({ title: e = "list", tag: t = !1, tagText: n = "태그", icon: r = null, checkbox: i = !1, radio: a = !1, checked: o = !1, onCheckChange: s, showSwitch: c = !1, switchChecked: l = !1, onSwitchChange: u, rightButton: d = !1, rightButtonIcon: f = N, rightButtonAriaLabel: p = "더보기", endIcon: m = !1, rightSlot: h = null, selected: g = !1, highlighted: _ = !1, disabled: v = !1, onClick: y, onButtonClick: b, className: x = "", ...S }) {
839
- let C = !v, w = a, T = v ? "bg-list-default-bg cursor-not-allowed" : _ && !w ? "bg-list-hover-bg cursor-pointer" : g || w ? "bg-list-default-bg cursor-pointer" : "bg-list-default-bg cursor-pointer hover:bg-list-hover-bg active:bg-list-pressed-bg", D = v ? "text-list-disabled-text" : g ? "text-list-selected-text" : "text-list-default-text", O = v ? "text-list-disabled-icon" : "text-list-default-icon", k = v ? "text-list-disabled-icon" : g ? "text-list-selected-icon" : "text-list-default-icon", A = (e) => e.stopPropagation();
840
- return /* @__PURE__ */ U("div", {
841
- role: "option",
842
- "aria-selected": g || void 0,
843
- "aria-disabled": v || void 0,
844
- onClick: C ? (e) => {
845
- C && (i ? s?.({ target: { checked: !o } }) : a && !o && s?.({ target: { checked: !0 } }), y?.(e));
846
- } : void 0,
847
- className: `flex min-h-[32px] w-full items-center justify-between px-spacing-6 ${w ? "" : "py-spacing-3"} transition-colors ${T} ${x}`,
848
- ...S,
849
- children: [/* @__PURE__ */ U("div", {
850
- className: "flex min-w-0 flex-1 items-center gap-spacing-4",
851
- children: [
852
- t && /* @__PURE__ */ H(Xe, { children: n }),
853
- i && /* @__PURE__ */ H("span", {
854
- className: "flex shrink-0 items-center",
855
- onClick: A,
856
- children: /* @__PURE__ */ H(Le, {
857
- checked: o,
858
- onChange: s,
859
- disabled: v
860
- })
861
- }),
862
- a && !i && /* @__PURE__ */ H("span", {
863
- className: "flex shrink-0 items-center",
864
- onClick: A,
865
- children: /* @__PURE__ */ H(et, {
866
- checked: o,
867
- onChange: s,
868
- disabled: v
869
- })
870
- }),
871
- r && /* @__PURE__ */ H(r, {
872
- size: 16,
873
- strokeWidth: 1.8,
874
- className: `shrink-0 ${k}`
875
- }),
876
- /* @__PURE__ */ H(be, {
877
- className: `min-w-0 flex-1 text-14 ${D}`,
878
- children: e
879
- })
880
- ]
881
- }), (h || c || d || m) && /* @__PURE__ */ U("div", {
882
- className: "flex shrink-0 items-center gap-spacing-2",
883
- children: [
884
- h,
885
- c && /* @__PURE__ */ H("span", {
886
- className: "flex shrink-0 items-center",
887
- onClick: A,
888
- children: /* @__PURE__ */ H(nt, {
889
- checked: l,
890
- onChange: u,
891
- disabled: v
892
- })
893
- }),
894
- d && /* @__PURE__ */ H("button", {
895
- type: "button",
896
- disabled: v,
897
- onClick: (e) => {
898
- e.stopPropagation(), b?.(e);
899
- },
900
- className: "flex min-h-[24px] min-w-[24px] items-center justify-center rounded-round-4 p-spacing-2 opacity-80 transition-colors hover:bg-button-ghost-hover-bg focus:outline-none focus-visible:bg-button-ghost-hover-bg disabled:cursor-not-allowed",
901
- "aria-label": p,
902
- children: /* @__PURE__ */ H(f, {
903
- size: 14,
904
- strokeWidth: 1.8,
905
- className: O
906
- })
907
- }),
908
- m && /* @__PURE__ */ H(E, {
909
- size: 16,
910
- strokeWidth: 1.8,
911
- className: k
912
- })
913
- ]
914
- })]
915
- });
916
- }
917
- //#endregion
918
- //#region src/components/usePopoverPosition.ts
919
- var rt = parseInt(t["spacing-3"], 10);
920
- function it({ open: e, anchorRef: t, menuRef: n, placement: r = "auto", menuWidth: i, deps: a = [] }) {
921
- let [o, s] = _(null);
922
- return p(() => {
923
- if (!e) {
924
- s(null);
925
- return;
926
- }
927
- let a = () => {
928
- let e = t.current;
929
- if (!e) return;
930
- let a = e.getBoundingClientRect(), o = n.current, c = o?.offsetHeight ?? 0, l = rt, u = i == null ? a.width : typeof i == "number" ? i : o?.offsetWidth ?? a.width, d = i != null && typeof i != "number" ? i : `${u}px`, f, p;
931
- if (r === "auto" ? (f = "auto", p = "auto") : [f, p] = r.split("-"), f === "auto") {
932
- let e = window.innerHeight - a.bottom, t = a.top;
933
- f = e < c + l && t > e ? "top" : "bottom";
934
- }
935
- p === "auto" && (p = a.left + u > window.innerWidth ? "right" : "left");
936
- let m = f === "top" ? a.top - l - c : a.bottom + l, h = p === "right" ? a.right - u : a.left;
937
- s((e) => e && e.top === m && e.left === h && e.width === d ? e : {
938
- position: "fixed",
939
- top: m,
940
- left: h,
941
- width: d
942
- });
943
- };
944
- a();
945
- let o = 0, c = () => {
946
- o ||= requestAnimationFrame(() => {
947
- o = 0, a();
948
- });
949
- };
950
- return window.addEventListener("resize", c), window.addEventListener("scroll", c, !0), () => {
951
- o && cancelAnimationFrame(o), window.removeEventListener("resize", c), window.removeEventListener("scroll", c, !0);
952
- };
953
- }, [
954
- e,
955
- r,
956
- i,
957
- ...a
958
- ]), o;
959
- }
960
- //#endregion
961
- //#region src/components/useOutsideDismiss.ts
962
- function at({ open: e, refs: t, onDismiss: n, guard: r }) {
963
- d(() => {
964
- if (!e) return;
965
- let i = (e) => {
966
- if (t.some((t) => t.current && t.current.contains(e.target)) || r && !r(e)) return;
967
- e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation();
968
- let i = (e) => {
969
- e.stopPropagation(), e.preventDefault();
970
- };
971
- document.addEventListener("click", i, {
972
- capture: !0,
973
- once: !0
974
- }), setTimeout(() => document.removeEventListener("click", i, !0), 300);
975
- let a = document.activeElement;
976
- a instanceof HTMLElement && t.some((e) => e.current && e.current.contains(a)) && a.blur(), n(e);
977
- };
978
- return document.addEventListener("mousedown", i, !0), () => document.removeEventListener("mousedown", i, !0);
979
- });
980
- }
981
- //#endregion
982
- //#region src/components/popoverLayers.ts
983
- var ot = [];
984
- function st(e) {
985
- ot.push(e);
986
- }
987
- function ct(e) {
988
- let t = ot.indexOf(e);
989
- t >= 0 && ot.splice(t, 1);
990
- }
991
- function lt(e) {
992
- return ot[ot.length - 1] === e;
993
- }
994
- function ut() {
995
- return ot.length > 0;
996
- }
997
- //#endregion
998
- //#region src/components/Select.tsx
999
- var dt = "ring-inset ring-text-field-hover-line hover:ring-2 focus-visible:ring-2";
1000
- function ft({ className: e = "" }) {
1001
- return /* @__PURE__ */ U("svg", {
1002
- viewBox: "0 0 2 7",
1003
- width: 2,
1004
- height: 7,
1005
- fill: "currentColor",
1006
- "aria-hidden": "true",
1007
- className: `shrink-0 ${e}`,
1008
- children: [/* @__PURE__ */ H("path", { d: "M2 1C2 1.55228 1.55228 2 1 2C0.447715 2 0 1.55228 0 1C0 0.447715 0.447715 0 1 0C1.55228 0 2 0.447715 2 1Z" }), /* @__PURE__ */ H("path", { d: "M2 6C2 6.55228 1.55228 7 1 7C0.447715 7 0 6.55228 0 6C0 5.44772 0.447715 5 1 5C1.55228 5 2 5.44772 2 6Z" })]
1009
- });
1010
- }
1011
- function pt({ value: e, defaultValue: t = "", onChange: n, options: r = [], multiple: i = !1, confirm: a = !1, variant: o = "box", size: s = "24", weight: c = "normal", defaultOpen: l = !1, tabOpens: f = !1, color: h = "gray", label: v = null, placeholder: y = "선택하세요", disabled: b = !1, readOnly: x = !1, error: S = !1, errorMessage: C = "", width: w = 200, maxWidth: E, menuWidth: D, placement: O = "auto", searchable: k = !1, searchPlaceholder: A = "검색어를 입력하세요", emptyMessage: j = "옵션이 없습니다.", noResultMessage: M = "검색 결과가 없습니다.", className: N = "", ...P }) {
1012
- let F = n, I = e !== void 0, [ee, te] = _(() => i && !Array.isArray(t) ? [] : t), L = e === void 0 ? ee : e, R = m(() => i && Array.isArray(L) ? L : [], [i, L]), [z, B] = _(l), V = i && a, [re, ie] = _([]), ae = g(null), oe = g(!1);
1013
- d(() => {
1014
- if (!z || !k) return;
1015
- let e = setTimeout(() => ae.current?.focus(), 0);
1016
- return () => clearTimeout(e);
1017
- }, [z, k]);
1018
- let [W, G] = _(-1), [se, ce] = _(""), [le, ue] = _(void 0), de = g(null), K = g(null), q = g(null), fe = o === "text", pe = o === "text" && w === "fill", me = o === "chip", he = D ?? (fe || me ? 120 : void 0), ge = i ? void 0 : r.find((e) => e.value === L), _e = i ? r.filter((e) => R.includes(e.value)).map((e) => e.label) : [], ve = i ? _e.length === 0 : !ge, xe = i ? ve ? y : _e.join(", ") : ge ? ge.label : y, J = !b && !x, Se = w === "hug" ? "fit-content" : typeof w == "number" ? `${w}px` : w, Ce = E == null ? void 0 : typeof E == "number" ? `${E}px` : E, Y = k && se.trim() ? r.filter((e) => String(e.label).toLowerCase().includes(se.trim().toLowerCase())) : r, we = u((e) => {
1019
- I || te(e), F?.({ target: { value: e } }), B(!1), K.current?.focus();
1020
- }, [I, F]), X = u((e) => {
1021
- if (V) {
1022
- ie((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
1023
- return;
1024
- }
1025
- let t = R.includes(e) ? R.filter((t) => t !== e) : [...R, e];
1026
- I || te(t), F?.({ target: { value: t } });
1027
- }, [
1028
- V,
1029
- I,
1030
- F,
1031
- R
1032
- ]), Te = u((e) => {
1033
- I || te(e), F?.({ target: { value: e } }), B(!1), K.current?.focus();
1034
- }, [I, F]), Ee = V ? re : R, De = (e) => {
1035
- if (!e?.disabled) return i ? X(e.value) : we(e.value);
1036
- };
1037
- p(() => {
1038
- let e = K.current;
1039
- if (!e || fe || me || w === "hug") {
1040
- ue(void 0);
1041
- return;
1042
- }
1043
- let t = () => {
1044
- let t = getComputedStyle(e), n = parseFloat(t.paddingLeft) || 0, r = parseFloat(t.paddingRight) || 0, i = parseFloat(t.columnGap) || 0, a = e.clientWidth - n - r;
1045
- ue(Math.max(0, a - 16 - i));
1046
- };
1047
- t();
1048
- let n = new ResizeObserver(t);
1049
- return n.observe(e), () => n.disconnect();
1050
- }, [
1051
- w,
1052
- fe,
1053
- me
1054
- ]), d(() => {
1055
- if (z) return st(q), () => ct(q);
1056
- }, [z]), at({
1057
- open: z,
1058
- refs: [de, q],
1059
- guard: () => lt(q),
1060
- onDismiss: () => B(!1)
1061
- }), d(() => {
1062
- if (!z) return;
1063
- let e = (e) => {
1064
- e.key === "Escape" && lt(q) && (e.stopPropagation(), B(!1), K.current?.focus());
1065
- };
1066
- return document.addEventListener("keydown", e, !0), () => document.removeEventListener("keydown", e, !0);
1067
- }, [z]), d(() => {
1068
- if (!z) return;
1069
- ce(""), V && ie(R);
1070
- let e = r.findIndex((e) => i ? R.includes(e.value) : e.value === L);
1071
- G(e >= 0 ? e : 0);
1072
- }, [z]), d(() => {
1073
- !z || W < 0 || (q.current?.querySelector(`[data-option-index="${W}"]`))?.scrollIntoView({ block: "nearest" });
1074
- }, [W, z]);
1075
- let Oe = it({
1076
- open: z,
1077
- anchorRef: K,
1078
- menuRef: q,
1079
- placement: O,
1080
- menuWidth: he,
1081
- deps: [Y.length, se]
1082
- }), ke = (e) => {
1083
- switch (e.key) {
1084
- case "Escape":
1085
- e.preventDefault(), B(!1), K.current?.focus();
1086
- break;
1087
- case "ArrowDown":
1088
- e.preventDefault(), G((e) => Math.min(e + 1, Y.length - 1));
1089
- break;
1090
- case "ArrowUp":
1091
- e.preventDefault(), G((e) => Math.max(e - 1, 0));
1092
- break;
1093
- case "Enter": {
1094
- e.preventDefault();
1095
- let t = Y[W];
1096
- t && De(t);
1097
- break;
1098
- }
1099
- case "Tab":
1100
- !e.shiftKey && W < Y.length - 1 ? (e.preventDefault(), G((e) => Math.min(e + 1, Y.length - 1))) : e.shiftKey && W > 0 ? (e.preventDefault(), G((e) => Math.max(e - 1, 0))) : (B(!1), k && (e.preventDefault(), oe.current = !0, K.current?.focus()));
1101
- break;
1102
- default: break;
1103
- }
1104
- }, Ae = (e) => {
1105
- if (J) {
1106
- if (!z) {
1107
- if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") e.preventDefault(), B(!0);
1108
- else if (f && e.key === "Tab" && !e.shiftKey) {
1109
- if (oe.current) {
1110
- oe.current = !1;
1111
- return;
1112
- }
1113
- e.preventDefault(), B(!0);
1114
- }
1115
- return;
1116
- }
1117
- if (!k) if (e.key === " ") {
1118
- e.preventDefault();
1119
- let t = Y[W];
1120
- t && De(t);
1121
- } else ke(e);
1122
- }
1123
- }, Ne = b ? "text-text-field-disabled-text" : x ? "text-text-field-readonly-text" : ve ? "text-text-field-default-text" : "text-text-field-filled-text", Pe = b ? "text-text-field-disabled-icon" : "text-text-field-default-text group-focus-within:text-text-field-filled-text";
1124
- return /* @__PURE__ */ U("div", {
1125
- ref: de,
1126
- className: `relative ${pe ? "flex w-full" : fe || me ? "inline-flex max-w-full align-middle" : ""} ${N}`,
1127
- style: fe || me ? void 0 : {
1128
- width: Se,
1129
- maxWidth: Ce
1130
- },
1131
- ...P,
1132
- children: [
1133
- fe ? /* @__PURE__ */ H(Me, {
1134
- ref: K,
1135
- role: "combobox",
1136
- "aria-haspopup": "listbox",
1137
- "aria-expanded": z,
1138
- "aria-disabled": b || void 0,
1139
- "aria-invalid": S || void 0,
1140
- tabIndex: J ? 0 : -1,
1141
- onClick: () => J && B((e) => !e),
1142
- onKeyDown: Ae,
1143
- size: s,
1144
- open: z,
1145
- disabled: b,
1146
- readOnly: x,
1147
- interactive: J,
1148
- maxWidth: Ce,
1149
- fill: pe,
1150
- children: xe
1151
- }) : me ? /* @__PURE__ */ U("div", {
1152
- ref: K,
1153
- role: "combobox",
1154
- "aria-haspopup": "listbox",
1155
- "aria-expanded": z,
1156
- "aria-disabled": b || void 0,
1157
- "aria-invalid": S || void 0,
1158
- tabIndex: J ? 0 : -1,
1159
- onClick: () => J && B((e) => !e),
1160
- onKeyDown: Ae,
1161
- style: Ce ? { maxWidth: Ce } : void 0,
1162
- className: `inline-flex min-w-0 items-center gap-spacing-3 rounded-round-4 border pl-spacing-4 pr-spacing-3 py-spacing-1 font-pretendard text-12 font-normal transition-colors focus:outline-none ${je[h] ?? je.gray} ${J ? "cursor-pointer" : "cursor-not-allowed"}`,
1163
- children: [/* @__PURE__ */ H(be, {
1164
- className: `min-w-0 text-12 ${c === "semibold" ? "font-semibold" : "font-normal"}`,
1165
- children: xe
1166
- }), /* @__PURE__ */ H(T, {
1167
- size: 12,
1168
- strokeWidth: 1.8,
1169
- className: `pointer-events-none shrink-0 transition-transform ${z ? "rotate-180" : ""}`
1170
- })]
1171
- }) : /* @__PURE__ */ U("div", {
1172
- ref: K,
1173
- role: "combobox",
1174
- "aria-haspopup": "listbox",
1175
- "aria-expanded": z,
1176
- "aria-disabled": b || void 0,
1177
- "aria-invalid": S || void 0,
1178
- tabIndex: J ? 0 : -1,
1179
- onClick: () => J && B((e) => !e),
1180
- onKeyDown: Ae,
1181
- className: `group relative grid min-h-[32px] grid-cols-[minmax(0,1fr)_auto] items-center gap-spacing-4 rounded-round-4 bg-text-field-default-bg py-spacing-3 pl-spacing-6 pr-spacing-6 transition-shadow focus:outline-none ${J ? `cursor-pointer ${dt}` : "cursor-not-allowed"}`,
1182
- children: [v != null && !ve ? /* @__PURE__ */ U("div", {
1183
- style: le == null ? void 0 : { maxWidth: `${le}px` },
1184
- className: "flex min-w-0 items-center gap-spacing-3",
1185
- children: [
1186
- /* @__PURE__ */ H("span", {
1187
- className: `shrink-0 text-14 font-normal ${Ne}`,
1188
- children: v
1189
- }),
1190
- /* @__PURE__ */ H(ft, { className: "text-font-icon-3" }),
1191
- /* @__PURE__ */ H(be, {
1192
- className: `min-w-0 flex-1 text-14 font-normal ${Ne}`,
1193
- children: xe
1194
- })
1195
- ]
1196
- }) : /* @__PURE__ */ H(be, {
1197
- style: le == null ? void 0 : { maxWidth: `${le}px` },
1198
- className: `text-14 font-normal ${Ne}`,
1199
- children: xe
1200
- }), /* @__PURE__ */ H(T, {
1201
- size: 16,
1202
- strokeWidth: 1.8,
1203
- className: `pointer-events-none shrink-0 transition-transform ${Pe} ${z ? "rotate-180" : ""}`
1204
- })]
1205
- }),
1206
- z && ne(/* @__PURE__ */ H("div", {
1207
- ref: q,
1208
- className: "z-[1000]",
1209
- style: Oe ?? {
1210
- position: "fixed",
1211
- top: 0,
1212
- left: 0,
1213
- visibility: "hidden"
1214
- },
1215
- children: /* @__PURE__ */ H(ze, {
1216
- width: "100%",
1217
- topArea: k ? "search" : "none",
1218
- searchValue: se,
1219
- onSearchChange: (e) => {
1220
- ce(e.target.value), G(0);
1221
- },
1222
- searchPlaceholder: A,
1223
- searchInputProps: k ? {
1224
- ref: ae,
1225
- onKeyDown: ke
1226
- } : {},
1227
- ...V ? {
1228
- footer: !0,
1229
- footerCheckbox: !0,
1230
- footerChecked: r.filter((e) => !e.disabled).length > 0 && r.filter((e) => !e.disabled).every((e) => re.includes(e.value)),
1231
- onFooterCheckChange: () => ie((e) => {
1232
- let t = r.filter((e) => !e.disabled).map((e) => e.value);
1233
- return t.every((t) => e.includes(t)) ? [] : t;
1234
- }),
1235
- onCancel: () => {
1236
- B(!1), K.current?.focus();
1237
- },
1238
- onConfirm: () => Te(re)
1239
- } : {},
1240
- children: Y.length > 0 ? /* @__PURE__ */ H(Je, { children: Y.map((e, t) => i ? /* @__PURE__ */ H(Z, {
1241
- title: e.label,
1242
- checkbox: !0,
1243
- disabled: e.disabled,
1244
- checked: Ee.includes(e.value),
1245
- onCheckChange: e.disabled ? void 0 : () => X(e.value),
1246
- highlighted: !e.disabled && t === W,
1247
- onMouseEnter: () => !e.disabled && G(t),
1248
- "data-option-index": t
1249
- }, e.value) : /* @__PURE__ */ H(Z, {
1250
- title: e.label,
1251
- disabled: e.disabled,
1252
- selected: e.value === L,
1253
- highlighted: !e.disabled && t === W,
1254
- onClick: e.disabled ? void 0 : () => we(e.value),
1255
- onMouseEnter: () => !e.disabled && G(t),
1256
- "data-option-index": t
1257
- }, e.value)) }) : /* @__PURE__ */ H(Ue, { message: k && se.trim() ? M : j })
1258
- })
1259
- }), document.body),
1260
- S && C && !z && /* @__PURE__ */ H("div", {
1261
- className: "absolute left-0 top-full z-10 mt-spacing-2",
1262
- children: /* @__PURE__ */ H(ye, {
1263
- variant: "error",
1264
- beak: "top",
1265
- children: C
1266
- })
1267
- })
1268
- ]
1269
- });
1270
- }
1271
- function mt(e) {
1272
- return /* @__PURE__ */ H(pt, {
1273
- variant: "chip",
1274
- ...e
1275
- });
1276
- }
1277
- //#endregion
1278
- //#region src/components/ButtonGroup.tsx
1279
- var ht = {
1280
- 3: "gap-spacing-3",
1281
- 4: "gap-spacing-4",
1282
- 5: "gap-spacing-5",
1283
- 6: "gap-spacing-6",
1284
- 7: "gap-spacing-7"
1285
- };
1286
- function gt(e) {
1287
- let t = [];
1288
- return a.forEach(e, (e) => {
1289
- l(e) && e.type === o ? t.push(...gt(e.props.children)) : e != null && typeof e != "boolean" && t.push(e);
1290
- }), t;
1291
- }
1292
- var _t = (e) => l(e) && e.type === pt;
1293
- function vt({ children: e, direction: t = "horizontal", gap: n = "5", width: r = "hug", className: i = "", ...a }) {
1294
- let o = t === "vertical" ? "flex-col" : "flex-row", c = ht[n] ?? ht[5], u = r === "fill", d = gt(e), f = d.filter(_t), p = d.filter((e) => !_t(e)), m = (f.length ? [...f, ...p] : d).map((e, t) => {
1295
- if (!l(e)) return e;
1296
- let n = u && e.type === J ? { width: e.props.width ?? "fill" } : {};
1297
- return s(e, {
1298
- key: e.key ?? `bg-${t}`,
1299
- ...n
1300
- });
1301
- });
1302
- return /* @__PURE__ */ H("div", {
1303
- className: `${u ? "flex w-full" : "inline-flex"} ${o} ${c} ${i}`,
1304
- ...a,
1305
- children: m
1306
- });
1307
- }
1308
- //#endregion
1309
- //#region src/components/Popover.tsx
1310
- function Q({ trigger: e, children: t, placement: n = "auto", menuWidth: r, open: i, onOpenChange: a, disabled: o = !1, className: s = "", ...c }) {
1311
- let l = i !== void 0, [f, p] = _(!1), m = l ? i : f, h = g(null), v = g(null), y = u((e) => {
1312
- l || p(e), a?.(e);
1313
- }, [l, a]), b = u(() => y(!1), [y]);
1314
- d(() => {
1315
- if (m) return st(v), () => ct(v);
1316
- }, [m]), at({
1317
- open: m,
1318
- refs: [h, v],
1319
- guard: () => lt(v),
1320
- onDismiss: b
1321
- }), d(() => {
1322
- if (!m) return;
1323
- let e = (e) => {
1324
- e.key === "Escape" && lt(v) && (e.stopPropagation(), b());
1325
- };
1326
- return document.addEventListener("keydown", e, !0), () => document.removeEventListener("keydown", e, !0);
1327
- }, [m, b]);
1328
- let x = it({
1329
- open: m,
1330
- anchorRef: h,
1331
- menuRef: v,
1332
- placement: n,
1333
- menuWidth: r
1334
- });
1335
- return /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("span", {
1336
- ref: h,
1337
- ...c,
1338
- className: `inline-flex ${s}`,
1339
- "aria-haspopup": "menu",
1340
- "aria-expanded": m,
1341
- onClick: (e) => {
1342
- c.onClick?.(e), o || y(!m);
1343
- },
1344
- children: e
1345
- }), m && ne(/* @__PURE__ */ H("div", {
1346
- ref: v,
1347
- className: "z-[1000]",
1348
- style: x ?? {
1349
- position: "fixed",
1350
- top: 0,
1351
- left: 0,
1352
- visibility: "hidden"
1353
- },
1354
- children: typeof t == "function" ? t(b) : t
1355
- }), document.body)] });
1356
- }
1357
- //#endregion
1358
- //#region src/components/EditorToolbar.tsx
1359
- var yt = (e) => e.preventDefault();
1360
- function $({ icon: e, label: t, active: n = !1, disabled: r = !1, onClick: i }) {
1361
- return /* @__PURE__ */ H(J, {
1362
- variant: "ghost",
1363
- size: "24",
1364
- icon: e,
1365
- disabled: r,
1366
- onClick: i,
1367
- onMouseDown: yt,
1368
- "aria-label": t,
1369
- "aria-pressed": n
1370
- });
1371
- }
1372
- function bt({ icon: e, label: t, ariaLabel: n }) {
1373
- return t ? /* @__PURE__ */ H(J, {
1374
- variant: "ghost",
1375
- size: "24",
1376
- leftIcon: e,
1377
- onMouseDown: yt,
1378
- children: t
1379
- }) : /* @__PURE__ */ H(J, {
1380
- variant: "ghost",
1381
- size: "24",
1382
- icon: e,
1383
- onMouseDown: yt,
1384
- title: n,
1385
- "aria-label": n
1386
- });
1387
- }
1388
- function xt() {
1389
- return /* @__PURE__ */ H("span", { className: "mx-spacing-2 self-stretch border-l border-editor-divider" });
1390
- }
1391
- var St = [
1392
- {
1393
- key: "paragraph",
1394
- label: "본문"
1395
- },
1396
- {
1397
- key: "h1",
1398
- label: "제목 1"
1399
- },
1400
- {
1401
- key: "h2",
1402
- label: "제목 2"
1403
- },
1404
- {
1405
- key: "h3",
1406
- label: "제목 3"
1407
- }
1408
- ];
1409
- function Ct({ palette: e, current: t, onPick: n }) {
1410
- return /* @__PURE__ */ H(ze, {
1411
- width: 80,
1412
- children: /* @__PURE__ */ H("div", {
1413
- className: "bg-list-group-bg py-spacing-4",
1414
- children: e.map((e) => {
1415
- let r = t === e.value || e.value === null && !t, i = e.swatch ?? e.value;
1416
- return /* @__PURE__ */ U("button", {
1417
- type: "button",
1418
- onMouseDown: yt,
1419
- onClick: () => n(e.value),
1420
- className: `flex w-full cursor-pointer items-center gap-spacing-4 px-spacing-6 py-spacing-3 text-14 transition-colors hover:bg-list-hover-bg focus:outline-none focus-visible:bg-list-hover-bg ${r ? "text-list-selected-text" : "text-list-default-text"}`,
1421
- children: [/* @__PURE__ */ H("span", {
1422
- className: "inline-block h-[14px] w-[14px] shrink-0 rounded-round-00",
1423
- style: i ? { backgroundColor: i } : void 0
1424
- }), e.label]
1425
- }, e.label);
1426
- })
1427
- })
1428
- });
1429
- }
1430
- function wt({ initialUrl: e = "", placeholder: t, submitLabel: n, onSubmit: r, onRemove: i, removeLabel: a = "해제" }) {
1431
- let [o, s] = _(e), c = () => r(o.trim());
1432
- return /* @__PURE__ */ H(ze, {
1433
- width: 300,
1434
- topArea: "input",
1435
- inputValue: o,
1436
- onInputChange: (e) => s(e.target.value),
1437
- inputPlaceholder: t,
1438
- inputProps: {
1439
- autoFocus: !0,
1440
- onKeyDown: (e) => {
1441
- e.key === "Enter" && (e.preventDefault(), c());
1442
- }
1443
- },
1444
- footer: !0,
1445
- footerButtonsFill: !0,
1446
- showCancel: !!i,
1447
- cancelText: a,
1448
- onCancel: i,
1449
- confirmText: n,
1450
- onConfirm: c
1451
- });
1452
- }
1453
- function Tt({ editor: e, close: t }) {
1454
- return /* @__PURE__ */ H(wt, {
1455
- initialUrl: e.getAttributes("link").href ?? "",
1456
- placeholder: "https://example.com",
1457
- submitLabel: "적용",
1458
- onSubmit: (n) => {
1459
- let r = e.chain().focus().extendMarkRange("link");
1460
- n ? r.setLink({ href: n }).run() : r.unsetLink().run(), t();
1461
- },
1462
- onRemove: () => {
1463
- e.chain().focus().extendMarkRange("link").unsetLink().run(), t();
1464
- }
1465
- });
1466
- }
1467
- function Et({ editor: e, close: t }) {
1468
- return /* @__PURE__ */ H(wt, {
1469
- placeholder: "이미지 주소(URL)",
1470
- submitLabel: "삽입",
1471
- onSubmit: (n) => {
1472
- n && e.chain().focus().setImage({ src: n }).run(), t();
1473
- }
1474
- });
1475
- }
1476
- function Dt({ editor: e, mergeFields: t, close: n }) {
1477
- let [r, i] = _(""), a = t.map((e) => typeof e == "string" ? {
1478
- label: e,
1479
- value: e
1480
- } : e).filter((e) => !r || e.label.toLowerCase().includes(r.toLowerCase())), o = (t) => {
1481
- e.chain().focus().insertContent({
1482
- type: "mergeField",
1483
- attrs: { value: t }
1484
- }).run(), n();
1485
- };
1486
- return /* @__PURE__ */ H(ze, {
1487
- width: 180,
1488
- topArea: "search",
1489
- searchValue: r,
1490
- onSearchChange: (e) => i(e.target.value),
1491
- searchPlaceholder: "필드명 검색",
1492
- searchInputProps: { autoFocus: !0 },
1493
- children: /* @__PURE__ */ H(Je, {
1494
- empty: a.length === 0,
1495
- emptyMessage: "검색 결과 없음",
1496
- children: a.map((e) => /* @__PURE__ */ H(Z, {
1497
- icon: P,
1498
- title: e.label,
1499
- onClick: () => o(e.value)
1500
- }, e.value))
1501
- })
1502
- });
1503
- }
1504
- function Ot({ editor: e, toolbar: t, mergeFields: n = [] }) {
1505
- if (!e) return null;
1506
- let a = (e) => !t || t.includes(e), s = (t) => t(e.chain().focus()).run(), c = e.isActive("heading", { level: 1 }) ? "h1" : e.isActive("heading", { level: 2 }) ? "h2" : e.isActive("heading", { level: 3 }) ? "h3" : "paragraph", l = (e, t) => {
1507
- s(e === "paragraph" ? (e) => e.setParagraph() : (t) => t.toggleHeading({ level: Number(e[1]) })), t();
1508
- }, u = e.getAttributes("textStyle").color ?? null, d = e.getAttributes("highlight").color ?? null, f = (e) => s(e ? (t) => t.setColor(e) : (e) => e.unsetColor()), p = (e) => s(e ? (t) => t.setHighlight({ color: e }) : (e) => e.unsetHighlight()), m = e.isActive("table");
1509
- return /* @__PURE__ */ H("div", {
1510
- className: "flex min-w-0 flex-1 flex-wrap items-center gap-spacing-2",
1511
- children: [
1512
- [a("undo") && /* @__PURE__ */ H($, {
1513
- icon: B,
1514
- label: "실행 취소",
1515
- disabled: !e.can().undo(),
1516
- onClick: () => s((e) => e.undo())
1517
- }, "undo"), a("redo") && /* @__PURE__ */ H($, {
1518
- icon: F,
1519
- label: "다시 실행",
1520
- disabled: !e.can().redo(),
1521
- onClick: () => s((e) => e.redo())
1522
- }, "redo")],
1523
- [a("mergefield") && n.length > 0 && /* @__PURE__ */ H(Q, {
1524
- placement: "auto-left",
1525
- menuWidth: 180,
1526
- trigger: /* @__PURE__ */ H(bt, {
1527
- icon: w,
1528
- label: "머지필드"
1529
- }),
1530
- children: (t) => /* @__PURE__ */ H(Dt, {
1531
- editor: e,
1532
- mergeFields: n,
1533
- close: t
1534
- })
1535
- }, "mergefield")],
1536
- [a("block") && /* @__PURE__ */ H(Q, {
1537
- placement: "auto-left",
1538
- menuWidth: 80,
1539
- trigger: /* @__PURE__ */ H(bt, {
1540
- icon: R,
1541
- label: St.find((e) => e.key === c)?.label
1542
- }),
1543
- children: (e) => /* @__PURE__ */ H(ze, {
1544
- width: 80,
1545
- children: /* @__PURE__ */ H(Je, { children: St.map((t) => /* @__PURE__ */ H(Z, {
1546
- title: t.label,
1547
- selected: c === t.key,
1548
- onClick: () => l(t.key, e)
1549
- }, t.key)) })
1550
- })
1551
- }, "block")],
1552
- [
1553
- a("bold") && /* @__PURE__ */ H($, {
1554
- icon: C,
1555
- label: "굵게",
1556
- active: e.isActive("bold"),
1557
- onClick: () => s((e) => e.toggleBold())
1558
- }, "bold"),
1559
- a("italic") && /* @__PURE__ */ H($, {
1560
- icon: k,
1561
- label: "기울임",
1562
- active: e.isActive("italic"),
1563
- onClick: () => s((e) => e.toggleItalic())
1564
- }, "italic"),
1565
- a("underline") && /* @__PURE__ */ H($, {
1566
- icon: z,
1567
- label: "밑줄",
1568
- active: e.isActive("underline"),
1569
- onClick: () => s((e) => e.toggleUnderline())
1570
- }, "underline"),
1571
- a("strike") && /* @__PURE__ */ H($, {
1572
- icon: te,
1573
- label: "취소선",
1574
- active: e.isActive("strike"),
1575
- onClick: () => s((e) => e.toggleStrike())
1576
- }, "strike")
1577
- ],
1578
- [a("color") && /* @__PURE__ */ H(Q, {
1579
- placement: "auto-left",
1580
- menuWidth: 80,
1581
- trigger: /* @__PURE__ */ H(bt, {
1582
- icon: S,
1583
- ariaLabel: "글자 색"
1584
- }),
1585
- children: () => /* @__PURE__ */ H(Ct, {
1586
- palette: i,
1587
- current: u,
1588
- onPick: f
1589
- })
1590
- }, "color"), a("highlight") && /* @__PURE__ */ H(Q, {
1591
- placement: "auto-left",
1592
- menuWidth: 80,
1593
- trigger: /* @__PURE__ */ H(bt, {
1594
- icon: D,
1595
- ariaLabel: "형광펜"
1596
- }),
1597
- children: () => /* @__PURE__ */ H(Ct, {
1598
- palette: r,
1599
- current: d,
1600
- onPick: p
1601
- })
1602
- }, "highlight")],
1603
- [
1604
- a("align") && /* @__PURE__ */ H($, {
1605
- icon: b,
1606
- label: "왼쪽 정렬",
1607
- active: e.isActive({ textAlign: "left" }),
1608
- onClick: () => s((e) => e.setTextAlign("left"))
1609
- }, "al"),
1610
- a("align") && /* @__PURE__ */ H($, {
1611
- icon: v,
1612
- label: "가운데 정렬",
1613
- active: e.isActive({ textAlign: "center" }),
1614
- onClick: () => s((e) => e.setTextAlign("center"))
1615
- }, "ac"),
1616
- a("align") && /* @__PURE__ */ H($, {
1617
- icon: x,
1618
- label: "오른쪽 정렬",
1619
- active: e.isActive({ textAlign: "right" }),
1620
- onClick: () => s((e) => e.setTextAlign("right"))
1621
- }, "ar"),
1622
- a("align") && /* @__PURE__ */ H($, {
1623
- icon: y,
1624
- label: "양쪽 정렬",
1625
- active: e.isActive({ textAlign: "justify" }),
1626
- onClick: () => s((e) => e.setTextAlign("justify"))
1627
- }, "aj")
1628
- ],
1629
- [
1630
- a("link") && /* @__PURE__ */ H(Q, {
1631
- placement: "auto-left",
1632
- menuWidth: 300,
1633
- trigger: /* @__PURE__ */ H(bt, {
1634
- icon: A,
1635
- ariaLabel: "링크"
1636
- }),
1637
- children: (t) => /* @__PURE__ */ H(Tt, {
1638
- editor: e,
1639
- close: t
1640
- })
1641
- }, "link"),
1642
- a("table") && /* @__PURE__ */ H(Q, {
1643
- placement: "auto-left",
1644
- menuWidth: 140,
1645
- trigger: /* @__PURE__ */ H(bt, {
1646
- icon: L,
1647
- ariaLabel: "표"
1648
- }),
1649
- children: (e) => /* @__PURE__ */ H(ze, {
1650
- width: 140,
1651
- children: /* @__PURE__ */ U(Je, { children: [
1652
- /* @__PURE__ */ H(Z, {
1653
- title: "표 삽입 (3×3)",
1654
- onClick: () => {
1655
- s((e) => e.insertTable({
1656
- rows: 3,
1657
- cols: 3,
1658
- withHeaderRow: !0
1659
- })), e();
1660
- }
1661
- }),
1662
- /* @__PURE__ */ H(Z, {
1663
- title: "위에 행 추가",
1664
- disabled: !m,
1665
- onClick: () => {
1666
- s((e) => e.addRowBefore()), e();
1667
- }
1668
- }),
1669
- /* @__PURE__ */ H(Z, {
1670
- title: "아래에 행 추가",
1671
- disabled: !m,
1672
- onClick: () => {
1673
- s((e) => e.addRowAfter()), e();
1674
- }
1675
- }),
1676
- /* @__PURE__ */ H(Z, {
1677
- title: "행 삭제",
1678
- disabled: !m,
1679
- onClick: () => {
1680
- s((e) => e.deleteRow()), e();
1681
- }
1682
- }),
1683
- /* @__PURE__ */ H(Z, {
1684
- title: "왼쪽에 열 추가",
1685
- disabled: !m,
1686
- onClick: () => {
1687
- s((e) => e.addColumnBefore()), e();
1688
- }
1689
- }),
1690
- /* @__PURE__ */ H(Z, {
1691
- title: "오른쪽에 열 추가",
1692
- disabled: !m,
1693
- onClick: () => {
1694
- s((e) => e.addColumnAfter()), e();
1695
- }
1696
- }),
1697
- /* @__PURE__ */ H(Z, {
1698
- title: "열 삭제",
1699
- disabled: !m,
1700
- onClick: () => {
1701
- s((e) => e.deleteColumn()), e();
1702
- }
1703
- }),
1704
- /* @__PURE__ */ H(Z, {
1705
- title: "표 삭제",
1706
- disabled: !m,
1707
- onClick: () => {
1708
- s((e) => e.deleteTable()), e();
1709
- }
1710
- })
1711
- ] })
1712
- })
1713
- }, "table"),
1714
- a("image") && /* @__PURE__ */ H(Q, {
1715
- placement: "auto-left",
1716
- menuWidth: 300,
1717
- trigger: /* @__PURE__ */ H(bt, {
1718
- icon: O,
1719
- ariaLabel: "이미지"
1720
- }),
1721
- children: (t) => /* @__PURE__ */ H(Et, {
1722
- editor: e,
1723
- close: t
1724
- })
1725
- }, "image"),
1726
- a("hr") && /* @__PURE__ */ H($, {
1727
- icon: M,
1728
- label: "구분선",
1729
- onClick: () => s((e) => e.setHorizontalRule())
1730
- }, "hr")
1731
- ]
1732
- ].map((e) => e.filter(Boolean)).filter((e) => e.length).map((e, t) => /* @__PURE__ */ U(o, { children: [t > 0 && /* @__PURE__ */ H(xt, {}), e] }, t))
1733
- });
1734
- }
1735
- //#endregion
1736
- //#region src/components/SegmentControl.tsx
1737
- var kt = {
1738
- 3: "gap-spacing-3",
1739
- 4: "gap-spacing-4",
1740
- 5: "gap-spacing-5",
1741
- 6: "gap-spacing-6",
1742
- 7: "gap-spacing-7"
1743
- };
1744
- function At({ children: e, size: t = "32", selected: n = !1, disabled: r = !1, leftIcon: i = null, rightIcon: a = null, icon: o = null, onClick: s, className: c = "", ...l }) {
1745
- let u = !!o, d = t === "24" ? 14 : 16, f;
1746
- f = u ? t === "24" ? "min-h-[24px] min-w-[24px] p-spacing-2" : "min-h-[32px] min-w-[32px] px-spacing-5 py-spacing-3" : t === "24" ? "min-h-[24px] min-w-[24px] px-spacing-5 py-spacing-2 text-12" : "min-h-[32px] min-w-[32px] px-spacing-6 py-spacing-3 text-14";
1747
- let p;
1748
- return p = r ? "bg-transparent text-font-icon-2 cursor-not-allowed" : n ? "bg-button-ghost-hover-bg text-font-icon-5 cursor-pointer" : "bg-transparent text-font-icon-3 cursor-pointer hover:bg-button-ghost-hover-bg hover:text-font-icon-5 active:bg-transparent focus-visible:bg-button-ghost-hover-bg focus-visible:text-font-icon-5", /* @__PURE__ */ H("button", {
1749
- type: "button",
1750
- role: "tab",
1751
- "aria-selected": n,
1752
- className: `inline-flex items-center justify-center relative font-pretendard font-normal whitespace-nowrap rounded-round-4 transition-colors select-none focus:outline-none ${f} ${p} ${c}`,
1753
- disabled: r,
1754
- onClick: r ? void 0 : s,
1755
- ...l,
1756
- children: /* @__PURE__ */ H("span", {
1757
- className: "inline-flex items-center gap-spacing-3",
1758
- children: u ? /* @__PURE__ */ H(o, {
1759
- size: d,
1760
- strokeWidth: 1.8
1761
- }) : /* @__PURE__ */ U(V, { children: [
1762
- i && /* @__PURE__ */ H(i, {
1763
- size: d,
1764
- strokeWidth: 1.8,
1765
- className: "shrink-0"
1766
- }),
1767
- e,
1768
- a && /* @__PURE__ */ H(a, {
1769
- size: d,
1770
- strokeWidth: 1.8,
1771
- className: "shrink-0"
1772
- })
1773
- ] })
1774
- })
1775
- });
1776
- }
1777
- function jt({ items: e = [], value: t, defaultValue: n, onChange: r, size: i = "32", gap: a = "5", disabled: o = !1, className: s = "", ...c }) {
1778
- let l = t !== void 0, [u, d] = _(n), f = l ? t : u, p = (e) => {
1779
- l || d(e), r?.(e);
1780
- };
1781
- return /* @__PURE__ */ H("div", {
1782
- role: "tablist",
1783
- className: `inline-flex items-center ${kt[a] ?? kt[5]} ${s}`,
1784
- ...c,
1785
- children: e.map((e) => /* @__PURE__ */ H(At, {
1786
- size: i,
1787
- selected: f === e.value,
1788
- disabled: o || e.disabled,
1789
- leftIcon: e.leftIcon,
1790
- rightIcon: e.rightIcon,
1791
- icon: e.icon,
1792
- "aria-label": e.ariaLabel,
1793
- onClick: () => p(e.value),
1794
- children: e.label
1795
- }, e.value))
1796
- });
1797
- }
1798
- //#endregion
1799
- //#region src/components/MergeFieldNode.ts
1800
- var Mt = "inline-flex items-center gap-spacing-3 rounded-round-4 border border-chip-blue-default-line bg-chip-blue-default-bg pl-spacing-4 pr-spacing-3 py-spacing-1 align-middle font-pretendard text-12 text-chip-blue-default-text transition-colors hover:border-chip-blue-hover-line hover:bg-chip-blue-hover-bg", Nt = "<svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/></svg>", Pt = q.create({
1801
- name: "mergeField",
1802
- group: "inline",
1803
- inline: !0,
1804
- atom: !0,
1805
- selectable: !0,
1806
- addAttributes() {
1807
- return { value: {
1808
- default: "",
1809
- parseHTML: (e) => e.getAttribute("data-merge-field") || e.textContent || "",
1810
- renderHTML: (e) => ({ "data-merge-field": e.value })
1811
- } };
1812
- },
1813
- parseHTML() {
1814
- return [{ tag: "span[data-merge-field]" }];
1815
- },
1816
- renderHTML({ HTMLAttributes: e, node: t }) {
1817
- return [
1818
- "span",
1819
- fe(e),
1820
- t.attrs.value
1821
- ];
1822
- },
1823
- addNodeView() {
1824
- return ({ node: e, editor: t, getPos: n }) => {
1825
- let r = document.createElement("span");
1826
- r.className = Mt, r.contentEditable = "false";
1827
- let i = document.createElement("span");
1828
- i.className = "whitespace-nowrap", i.textContent = e.attrs.value, r.appendChild(i);
1829
- let a = document.createElement("button");
1830
- return a.type = "button", a.className = "flex shrink-0 items-center justify-center", a.setAttribute("aria-label", "머지필드 삭제"), a.innerHTML = Nt, a.addEventListener("mousedown", (e) => e.preventDefault()), a.addEventListener("click", (r) => {
1831
- if (r.preventDefault(), r.stopPropagation(), typeof n != "function") return;
1832
- let i = n();
1833
- i != null && t.chain().focus().deleteRange({
1834
- from: i,
1835
- to: i + e.nodeSize
1836
- }).run();
1837
- }), r.appendChild(a), { dom: r };
1838
- };
1839
- }
1840
- }), Ft = [
1841
- {
1842
- value: "edit",
1843
- label: "편집"
1844
- },
1845
- {
1846
- value: "source",
1847
- label: "HTML"
1848
- },
1849
- {
1850
- value: "preview",
1851
- label: "미리보기"
1852
- }
1853
- ];
1854
- function It() {
1855
- return [
1856
- ae.configure({ link: {
1857
- openOnClick: !1,
1858
- HTMLAttributes: { rel: "noopener noreferrer nofollow" }
1859
- } }),
1860
- oe,
1861
- W,
1862
- G.configure({ multicolor: !0 }),
1863
- se.configure({ types: ["heading", "paragraph"] }),
1864
- ce,
1865
- le.configure({ resizable: !1 }),
1866
- K,
1867
- de,
1868
- ue,
1869
- Pt
1870
- ];
1871
- }
1872
- function Lt({ mode: e, onChange: t, readOnly: n, showSource: r }) {
1873
- let i = n ? Ft.filter((e) => e.value !== "edit") : Ft;
1874
- return r || (i = i.filter((e) => e.value !== "source")), /* @__PURE__ */ H(jt, {
1875
- size: "24",
1876
- gap: "4",
1877
- value: e,
1878
- onChange: (e) => t?.(e),
1879
- items: i
1880
- });
1881
- }
1882
- function Rt({ value: e, defaultValue: t = "", onChange: n, mode: r, onModeChange: i, toolbar: a, mergeFields: o = [], readOnly: s = !1, showSource: c = !0, placeholder: l = "내용을 입력하세요.", minHeight: u = 240, maxHeight: f, width: m = "fill", allowSourceEdit: v = !0, className: y = "", ...b }) {
1883
- let x = e !== void 0, S = r !== void 0, [C, w] = _(() => s ? "preview" : "edit"), T = S ? r : C, [, E] = h((e) => e + 1, 0), [D, O] = _(""), k = g(null), A = g(n);
1884
- d(() => {
1885
- A.current = n;
1886
- }, [n]);
1887
- let j = ie({
1888
- editable: !s,
1889
- content: x ? e : t,
1890
- extensions: It(),
1891
- immediatelyRender: !1,
1892
- shouldRerenderOnTransaction: !0
1893
- });
1894
- d(() => {
1895
- if (!j) return;
1896
- let e = () => A.current?.(j.getHTML());
1897
- return j.on("update", e), () => {
1898
- j.off("update", e);
1899
- };
1900
- }, [j]), d(() => {
1901
- j?.setEditable(!s);
1902
- }, [j, s]), d(() => {
1903
- s && !S && C === "edit" && w("preview");
1904
- }, [
1905
- s,
1906
- S,
1907
- C
1908
- ]), d(() => {
1909
- !c && !S && C === "source" && w("edit");
1910
- }, [
1911
- c,
1912
- S,
1913
- C
1914
- ]), p(() => {
1915
- !j || !x || e !== j.getHTML() && (j.commands.setContent(e, { emitUpdate: !1 }), T === "source" && O((t) => t === e ? t : e), E());
1916
- }, [
1917
- j,
1918
- e,
1919
- x,
1920
- T
1921
- ]);
1922
- let M = (e) => {
1923
- e !== T && (j && (T === "source" && (j.commands.setContent(D, { emitUpdate: !1 }), A.current?.(j.getHTML())), e === "source" && O(j.getHTML())), S || w(e), i?.(e));
1924
- }, N = (e) => {
1925
- let t = e.target.value;
1926
- O(t), A.current?.(t);
1927
- };
1928
- p(() => {
1929
- if (T !== "source") return;
1930
- let e = k.current;
1931
- e && (e.style.height = "auto", e.style.height = `${e.scrollHeight}px`);
1932
- }, [T, D]);
1933
- let P = v && !s, F = T === "preview" && j ? j.getHTML() : "", I = typeof u == "number" ? `${u}px` : u, ee = m === "fill" ? "100%" : typeof m == "number" ? `${m}px` : m, te = (e) => f == null ? e : /* @__PURE__ */ H(Ae, {
1934
- maxHeight: f,
1935
- children: e
1936
- }), L;
1937
- return T === "source" ? (L = /* @__PURE__ */ H("textarea", {
1938
- ref: k,
1939
- value: D,
1940
- onChange: N,
1941
- readOnly: !P,
1942
- spellCheck: !1,
1943
- className: "block w-full resize-none overflow-hidden bg-editor-source-bg px-spacing-7 py-spacing-6 font-mono text-13 text-editor-source-text outline-none",
1944
- style: { minHeight: I }
1945
- }), L = f == null ? L : /* @__PURE__ */ H(Ae, {
1946
- maxHeight: f,
1947
- variant: "light",
1948
- children: L
1949
- })) : L = te(T === "preview" ? /* @__PURE__ */ H("div", {
1950
- className: "tiptap-prose px-spacing-7 py-spacing-6",
1951
- style: { minHeight: I },
1952
- dangerouslySetInnerHTML: { __html: F }
1953
- }) : /* @__PURE__ */ U("div", {
1954
- className: "relative tiptap-prose cursor-text px-spacing-7 py-spacing-6",
1955
- style: { minHeight: I },
1956
- onMouseDown: (e) => {
1957
- j && !e.target.closest(".tiptap") && (e.preventDefault(), j.commands.focus("end"));
1958
- },
1959
- children: [j?.isEmpty && /* @__PURE__ */ H("p", {
1960
- className: "pointer-events-none absolute left-spacing-7 top-spacing-6 text-14 leading-30 text-editor-placeholder",
1961
- children: l
1962
- }), /* @__PURE__ */ H(re, { editor: j })]
1963
- })), /* @__PURE__ */ U("div", {
1964
- className: `overflow-hidden rounded-round-4 border border-editor-outline bg-white ${y}`,
1965
- style: { width: ee },
1966
- ...b,
1967
- children: [/* @__PURE__ */ H("div", {
1968
- className: "border-b border-editor-divider bg-editor-toolbar-bg",
1969
- children: /* @__PURE__ */ U("div", {
1970
- className: "flex items-center justify-between gap-spacing-5 px-spacing-5 py-spacing-3",
1971
- children: [T === "edit" && !s ? /* @__PURE__ */ H(Ot, {
1972
- editor: j,
1973
- toolbar: a,
1974
- mergeFields: o
1975
- }) : /* @__PURE__ */ H("span", {
1976
- className: "text-12 text-font-icon-5",
1977
- children: T === "source" ? "HTML 소스" : T === "preview" ? "미리보기" : ""
1978
- }), /* @__PURE__ */ H("div", {
1979
- className: "shrink-0",
1980
- children: /* @__PURE__ */ H(Lt, {
1981
- mode: T,
1982
- onChange: M,
1983
- readOnly: s,
1984
- showSource: c
1985
- })
1986
- })]
1987
- })
1988
- }), L]
1989
- });
1990
- }
1991
- //#endregion
1992
- export { Pe as A, Ue as C, He as D, Be as E, J as F, xe as I, be as L, je as M, Ae as N, Le as O, Y as P, ye as R, Je as S, Ve as T, nt as _, Ot as a, Qe as b, pt as c, lt as d, st as f, Z as g, it as h, jt as i, Me as j, Re as k, mt as l, at as m, Pt as n, Q as o, ct as p, At as r, vt as s, Rt as t, ut as u, et as v, ze as w, Xe as x, tt as y, ge as z };
1993
-
1994
- //# sourceMappingURL=Editor-wECQz1CV.js.map