@vmscloud/moz-ui-components-react 0.1.42
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/dist/avatar.d.ts +27 -0
- package/dist/bridge/ReactRenderer.d.ts +29 -0
- package/dist/collapsible.d.ts +37 -0
- package/dist/components.d.ts +87 -0
- package/dist/createMozComponent.d.ts +14 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +803 -0
- package/dist/index.js.map +1 -0
- package/dist/locale/MozLocaleContext.d.ts +34 -0
- package/dist/locale/index.d.ts +3 -0
- package/dist/popover.d.ts +53 -0
- package/dist/scroll-area.d.ts +23 -0
- package/dist/split-pane.d.ts +24 -0
- package/dist/tooltip.d.ts +40 -0
- package/dist/validator/ValidatorContext.d.ts +17 -0
- package/dist/validator/index.d.ts +3 -0
- package/package.json +68 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,803 @@
|
|
|
1
|
+
var St = Object.defineProperty;
|
|
2
|
+
var Tt = (e, t, o) => t in e ? St(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
|
+
var q = (e, t, o) => Tt(e, typeof t != "symbol" ? t + "" : t, o);
|
|
4
|
+
import { createElement as $, createContext as W, useContext as D, useRef as L, forwardRef as bt, useState as U, useLayoutEffect as st, useEffect as Q, useImperativeHandle as ht, Fragment as At, Children as ct, isValidElement as K, useId as Z, useCallback as _, useMemo as N, cloneElement as F } from "react";
|
|
5
|
+
import { createPortal as gt } from "react-dom";
|
|
6
|
+
import { createRoot as Rt } from "react-dom/client";
|
|
7
|
+
import { koKR as lt, createValidator as Ot, SPLITPANE_SPEC as _t, TOOLTIP_SPEC as It, POPOVER_SPEC as Lt, COLLAPSIBLE_SPEC as xt, AVATAR_SPEC as Mt, SCROLLAREA_SPEC as kt, BUTTON_SPEC as wt, LABEL_SPEC as zt, TOGGLE_SPEC as jt, BREADCRUMB_SPEC as Nt, EMPTYSTATE_SPEC as Bt, CHECKBOX_SPEC as Ut, RADIO_SPEC as Dt, INPUT_SPEC as Kt, PASSWORDINPUT_SPEC as Vt, TEXTAREA_SPEC as Wt, NUMBERINPUT_SPEC as $t, TAB_SPEC as Ft, SLIDER_SPEC as Ht, CALENDAR_SPEC as Gt, DATEINPUT_SPEC as qt, POPUP_SPEC as Xt, SELECT_SPEC as Yt, MULTISELECT_SPEC as Jt, TIMEPICKER_SPEC as Qt, TAGINPUT_SPEC as Zt, CONTEXTMENU_SPEC as te, TABLESELECT_SPEC as ee, TREESELECT_SPEC as oe, CONTROLLER_SPEC as ne, TOAST_SPEC as re } from "@vmscloud/moz-ui-components-core";
|
|
8
|
+
import { createValidator as vo, enUS as So, jaJP as To, koKR as bo, useToast as ho, zhCN as Ao } from "@vmscloud/moz-ui-components-core";
|
|
9
|
+
import { jsx as x, jsxs as se } from "react/jsx-runtime";
|
|
10
|
+
const X = /* @__PURE__ */ new Set();
|
|
11
|
+
let Y = null;
|
|
12
|
+
function et(e) {
|
|
13
|
+
X.add(e), Y == null && (Y = setTimeout(() => {
|
|
14
|
+
Y = null;
|
|
15
|
+
const t = Array.from(X);
|
|
16
|
+
X.clear();
|
|
17
|
+
for (const o of t) o.unmount();
|
|
18
|
+
}, 0));
|
|
19
|
+
}
|
|
20
|
+
class ce {
|
|
21
|
+
constructor() {
|
|
22
|
+
q(this, "contextWrapper", null);
|
|
23
|
+
q(this, "roots", /* @__PURE__ */ new Set());
|
|
24
|
+
}
|
|
25
|
+
/** 외부 Provider 트리를 캡처 */
|
|
26
|
+
setContextWrapper(t) {
|
|
27
|
+
this.contextWrapper = t;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 컨테이너 단위 인스턴스 마운트.
|
|
31
|
+
* component(props) 를 컨테이너에 렌더하고, update(props) 로 갱신, destroy() 로 정리한다.
|
|
32
|
+
*/
|
|
33
|
+
mountInstance(t, o, r) {
|
|
34
|
+
const n = Rt(t);
|
|
35
|
+
this.roots.add(n);
|
|
36
|
+
const c = (s) => {
|
|
37
|
+
const l = $(o, s);
|
|
38
|
+
n.render(this.contextWrapper ? this.contextWrapper(l) : l);
|
|
39
|
+
};
|
|
40
|
+
return c(r), {
|
|
41
|
+
update: (s) => c(s),
|
|
42
|
+
destroy: () => {
|
|
43
|
+
this.roots.delete(n), et(n);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** 전체 인스턴스 언마운트 */
|
|
48
|
+
unmountAll() {
|
|
49
|
+
for (const t of this.roots) et(t);
|
|
50
|
+
this.roots.clear();
|
|
51
|
+
}
|
|
52
|
+
get size() {
|
|
53
|
+
return this.roots.size;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const ut = W(lt), at = W(null);
|
|
57
|
+
function Oe({
|
|
58
|
+
locale: e = lt,
|
|
59
|
+
contextWrapper: t,
|
|
60
|
+
children: o
|
|
61
|
+
}) {
|
|
62
|
+
return $(
|
|
63
|
+
ut.Provider,
|
|
64
|
+
{ value: e },
|
|
65
|
+
$(
|
|
66
|
+
at.Provider,
|
|
67
|
+
{ value: t ?? null },
|
|
68
|
+
o
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
function le() {
|
|
73
|
+
return D(ut);
|
|
74
|
+
}
|
|
75
|
+
function ue() {
|
|
76
|
+
return D(at);
|
|
77
|
+
}
|
|
78
|
+
const tt = W(null);
|
|
79
|
+
function _e({
|
|
80
|
+
children: e
|
|
81
|
+
}) {
|
|
82
|
+
const t = L();
|
|
83
|
+
t.current || (t.current = Ot());
|
|
84
|
+
const o = { validate: t.current.validate, initValidator: t.current.initValidator };
|
|
85
|
+
return $(
|
|
86
|
+
tt.Provider,
|
|
87
|
+
{ value: t.current },
|
|
88
|
+
typeof e == "function" ? e(o) : e
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
function Ie() {
|
|
92
|
+
return D(tt);
|
|
93
|
+
}
|
|
94
|
+
function H(e) {
|
|
95
|
+
return e.startsWith("update:") ? "on" + e.slice(7).charAt(0).toUpperCase() + e.slice(8) + "Change" : "on" + e.charAt(0).toUpperCase() + e.slice(1);
|
|
96
|
+
}
|
|
97
|
+
function ae(e, t) {
|
|
98
|
+
if (Object.is(e, t)) return !0;
|
|
99
|
+
if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
|
|
100
|
+
const o = Object.keys(e), r = Object.keys(t);
|
|
101
|
+
return o.length !== r.length ? !1 : o.every((n) => Object.is(e[n], t[n]));
|
|
102
|
+
}
|
|
103
|
+
function ot(e, t) {
|
|
104
|
+
const o = Object.keys(e), r = Object.keys(t);
|
|
105
|
+
if (o.length !== r.length) return !1;
|
|
106
|
+
for (const n of o)
|
|
107
|
+
if (!Object.prototype.hasOwnProperty.call(t, n) || !Object.is(e[n], t[n])) return !1;
|
|
108
|
+
return !0;
|
|
109
|
+
}
|
|
110
|
+
function m(e) {
|
|
111
|
+
const t = e.models ?? {}, o = /* @__PURE__ */ new Set([
|
|
112
|
+
...e.props,
|
|
113
|
+
...Object.keys(t),
|
|
114
|
+
...Object.values(t).map((n) => n.prop),
|
|
115
|
+
...(e.slots ?? []).map((n) => n === "default" ? "children" : n),
|
|
116
|
+
...(e.emits ?? []).map(H),
|
|
117
|
+
...Object.keys(t).map((n) => H(`update:${n}`)),
|
|
118
|
+
...Object.values(t).map((n) => H(n.event)),
|
|
119
|
+
"children",
|
|
120
|
+
"className",
|
|
121
|
+
"style",
|
|
122
|
+
"id",
|
|
123
|
+
"key",
|
|
124
|
+
"ref",
|
|
125
|
+
// 동적 slot 묶음 — `slots={{ 'a-tab': (scope) => …, a: <Panel/> }}`. Vue 브릿지는 소비자
|
|
126
|
+
// slots 를 전부 등록하지만 React 는 스펙의 정적 목록만 알았다. 이름이 데이터에서 파생되는
|
|
127
|
+
// 코어(Tab)는 이 통로 없이는 React 에서 콘텐츠를 받을 수 없었다.
|
|
128
|
+
"slots"
|
|
129
|
+
]), r = bt((n, c) => {
|
|
130
|
+
const s = L(null), l = L(void 0), p = L(void 0), [P, y] = U(() => /* @__PURE__ */ new Map());
|
|
131
|
+
if (!p.current) {
|
|
132
|
+
const C = {};
|
|
133
|
+
Object.defineProperty(C, "el", {
|
|
134
|
+
get: () => {
|
|
135
|
+
var i;
|
|
136
|
+
return ((i = l.current) == null ? void 0 : i.el) ?? null;
|
|
137
|
+
},
|
|
138
|
+
enumerable: !0
|
|
139
|
+
}), p.current = C;
|
|
140
|
+
}
|
|
141
|
+
const u = L();
|
|
142
|
+
u.current || (u.current = new ce());
|
|
143
|
+
const f = ue();
|
|
144
|
+
u.current.setContextWrapper(f);
|
|
145
|
+
const a = le(), v = D(tt), T = L(n);
|
|
146
|
+
T.current = n;
|
|
147
|
+
const b = ((C, ...i) => {
|
|
148
|
+
const S = H(String(C)), h = T.current[S];
|
|
149
|
+
typeof h == "function" && h(...i);
|
|
150
|
+
}), d = () => {
|
|
151
|
+
const C = T.current, i = {};
|
|
152
|
+
for (const S of Object.keys(C))
|
|
153
|
+
o.has(S) || (i[S] = C[S]);
|
|
154
|
+
for (const S of e.props) i[S] = C[S];
|
|
155
|
+
for (const S of Object.keys(t)) i[t[S].prop] = C[S];
|
|
156
|
+
return C.className != null && (i.class = C.className), C.style != null && (i.style = C.style), C.id != null && (i.id = C.id), i;
|
|
157
|
+
};
|
|
158
|
+
st(() => {
|
|
159
|
+
const C = u.current, i = {};
|
|
160
|
+
for (const E of e.slots ?? []) {
|
|
161
|
+
const O = E === "default" ? "children" : E;
|
|
162
|
+
T.current[O] != null && (i[E] = (A, z) => {
|
|
163
|
+
const M = ({ scope: w }) => {
|
|
164
|
+
const j = T.current[O];
|
|
165
|
+
return (typeof j == "function" ? j(w) : j) ?? null;
|
|
166
|
+
}, k = C.mountInstance(A, M, { scope: z });
|
|
167
|
+
return { update: (w) => k.update({ scope: w }), dispose: k.destroy };
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
const S = (E) => {
|
|
171
|
+
const O = T.current.slots;
|
|
172
|
+
if (!(O == null || O[E] == null))
|
|
173
|
+
return (A, z) => {
|
|
174
|
+
const M = A.getAttribute("data-moz-slot-id") ?? E;
|
|
175
|
+
return y((k) => new Map(k).set(M, { name: E, el: A, scope: z })), {
|
|
176
|
+
// scope 가 값까지 같으면 state 를 건드리지 않는다. 코어는 렌더마다 scope 객체를 새로
|
|
177
|
+
// 만들어 fill 하므로, 무조건 setState 하면 브릿지 재렌더 → core.update → 다시 fill →
|
|
178
|
+
// setState … 로 끝나지 않는 비동기 루프가 된다(소비처 실측: 페이지 테스트 타임아웃).
|
|
179
|
+
update: (k) => y((w) => {
|
|
180
|
+
const j = w.get(M);
|
|
181
|
+
return !j || ae(j.scope, k) ? w : new Map(w).set(M, { ...j, scope: k });
|
|
182
|
+
}),
|
|
183
|
+
dispose: () => y((k) => {
|
|
184
|
+
if (!k.has(M)) return k;
|
|
185
|
+
const w = new Map(k);
|
|
186
|
+
return w.delete(M), w;
|
|
187
|
+
})
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
l.current = e.core(s.current, d(), b, {
|
|
192
|
+
slots: i,
|
|
193
|
+
slotResolver: S,
|
|
194
|
+
locale: a,
|
|
195
|
+
validator: v ?? void 0,
|
|
196
|
+
// 소비자가 실제로 넘긴 prop 키 (controlled 판별)
|
|
197
|
+
providedKeys: Object.keys(T.current)
|
|
198
|
+
});
|
|
199
|
+
const h = l.current.api;
|
|
200
|
+
if (h)
|
|
201
|
+
for (const E of Object.keys(h))
|
|
202
|
+
E !== "el" && (p.current[E] = h[E]);
|
|
203
|
+
return () => {
|
|
204
|
+
var E;
|
|
205
|
+
(E = l.current) == null || E.destroy(), C.unmountAll(), l.current = void 0;
|
|
206
|
+
};
|
|
207
|
+
}, []);
|
|
208
|
+
const g = () => {
|
|
209
|
+
const C = T.current, i = {};
|
|
210
|
+
for (const h of e.slots ?? []) {
|
|
211
|
+
const E = h === "default" ? "children" : h;
|
|
212
|
+
i[E] = C[E];
|
|
213
|
+
}
|
|
214
|
+
const S = C.slots;
|
|
215
|
+
return i.__dynamicSlotKeys = S ? Object.keys(S).sort().join("\0") : "", i;
|
|
216
|
+
}, R = L(null);
|
|
217
|
+
Q(() => {
|
|
218
|
+
const C = l.current;
|
|
219
|
+
if (!C) return;
|
|
220
|
+
const i = d(), S = g(), h = R.current;
|
|
221
|
+
h && h.locale === a && ot(h.props, i) && ot(h.slots, S) || (R.current = { props: i, slots: S, locale: a }, (!h || h.locale !== a) && C.setLocale(a), C.update(i, { replace: !0, sync: e.syncUpdate }));
|
|
222
|
+
}), ht(c, () => p.current, []);
|
|
223
|
+
const I = n.slots, B = Array.from(P, ([C, i]) => {
|
|
224
|
+
const S = I == null ? void 0 : I[i.name], h = (typeof S == "function" ? S(i.scope) : S) ?? null;
|
|
225
|
+
return gt(h, i.el, C);
|
|
226
|
+
});
|
|
227
|
+
return $(
|
|
228
|
+
At,
|
|
229
|
+
null,
|
|
230
|
+
$("div", { ref: s, style: { display: "contents" } }),
|
|
231
|
+
...B
|
|
232
|
+
);
|
|
233
|
+
});
|
|
234
|
+
return r.displayName = e.name, r;
|
|
235
|
+
}
|
|
236
|
+
const ie = m(_t), pe = (e) => null, Le = ({ horizontal: e, children: t }) => {
|
|
237
|
+
const o = ct.toArray(t).filter(
|
|
238
|
+
(c) => K(c) && c.type === pe
|
|
239
|
+
), r = o.map((c) => ({
|
|
240
|
+
size: c.props.size,
|
|
241
|
+
minSize: c.props.minSize,
|
|
242
|
+
maxSize: c.props.maxSize,
|
|
243
|
+
hidden: c.props.hidden
|
|
244
|
+
})), n = {};
|
|
245
|
+
return o.forEach((c, s) => {
|
|
246
|
+
n[`pane-${s}`] = c.props.children;
|
|
247
|
+
}), /* @__PURE__ */ x(ie, { panes: r, horizontal: e, ...n });
|
|
248
|
+
}, fe = m(It), J = /* @__PURE__ */ new Set(), it = 200, de = 100, pt = W({
|
|
249
|
+
delayDuration: it,
|
|
250
|
+
disableHoverableContent: !1
|
|
251
|
+
});
|
|
252
|
+
function xe({
|
|
253
|
+
delayDuration: e = it,
|
|
254
|
+
disableHoverableContent: t = !1,
|
|
255
|
+
children: o
|
|
256
|
+
}) {
|
|
257
|
+
const r = N(
|
|
258
|
+
() => ({ delayDuration: e, disableHoverableContent: t }),
|
|
259
|
+
[e, t]
|
|
260
|
+
);
|
|
261
|
+
return /* @__PURE__ */ x(pt.Provider, { value: r, children: o });
|
|
262
|
+
}
|
|
263
|
+
const ft = W(null);
|
|
264
|
+
function dt(e) {
|
|
265
|
+
const t = D(ft);
|
|
266
|
+
if (!t) throw new Error(`${e} 는 <Tooltip> 안에서만 쓸 수 있습니다.`);
|
|
267
|
+
return t;
|
|
268
|
+
}
|
|
269
|
+
function Me({
|
|
270
|
+
open: e,
|
|
271
|
+
defaultOpen: t = !1,
|
|
272
|
+
onOpenChange: o,
|
|
273
|
+
delayDuration: r,
|
|
274
|
+
disableHoverableContent: n,
|
|
275
|
+
children: c
|
|
276
|
+
}) {
|
|
277
|
+
const s = D(pt), l = r ?? s.delayDuration, p = !(n ?? s.disableHoverableContent), [P, y] = U(t), u = e !== void 0, f = u ? !!e : P, [a, v] = U(null), T = `moz-tooltip-${Z()}`, b = L(null), d = L(null), g = L(o);
|
|
278
|
+
g.current = o;
|
|
279
|
+
const R = _(() => {
|
|
280
|
+
b.current && clearTimeout(b.current), d.current && clearTimeout(d.current), b.current = null, d.current = null;
|
|
281
|
+
}, []), I = _(
|
|
282
|
+
(A) => {
|
|
283
|
+
var z;
|
|
284
|
+
u || y(A), (z = g.current) == null || z.call(g, A);
|
|
285
|
+
},
|
|
286
|
+
[u]
|
|
287
|
+
), B = _(() => {
|
|
288
|
+
R(), I(!0);
|
|
289
|
+
}, [R, I]), C = _(() => {
|
|
290
|
+
if (d.current && (clearTimeout(d.current), d.current = null), !b.current) {
|
|
291
|
+
if (l <= 0) {
|
|
292
|
+
I(!0);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
b.current = setTimeout(() => {
|
|
296
|
+
b.current = null, I(!0);
|
|
297
|
+
}, l);
|
|
298
|
+
}
|
|
299
|
+
}, [l, I]), i = _(() => {
|
|
300
|
+
R(), I(!1);
|
|
301
|
+
}, [R, I]), S = _(() => {
|
|
302
|
+
if (b.current && (clearTimeout(b.current), b.current = null), !p) {
|
|
303
|
+
I(!1);
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
d.current || (d.current = setTimeout(() => {
|
|
307
|
+
d.current = null, I(!1);
|
|
308
|
+
}, de));
|
|
309
|
+
}, [p, I]), h = _(() => {
|
|
310
|
+
d.current && (clearTimeout(d.current), d.current = null);
|
|
311
|
+
}, []);
|
|
312
|
+
Q(() => R, [R]);
|
|
313
|
+
const E = L(i);
|
|
314
|
+
E.current = i, Q(() => {
|
|
315
|
+
if (!f) return;
|
|
316
|
+
const A = () => E.current();
|
|
317
|
+
for (const M of Array.from(J)) M();
|
|
318
|
+
J.add(A);
|
|
319
|
+
const z = (M) => {
|
|
320
|
+
M.key === "Escape" && E.current();
|
|
321
|
+
};
|
|
322
|
+
return document.addEventListener("keydown", z), () => {
|
|
323
|
+
J.delete(A), document.removeEventListener("keydown", z);
|
|
324
|
+
};
|
|
325
|
+
}, [f]);
|
|
326
|
+
const O = N(
|
|
327
|
+
() => ({
|
|
328
|
+
open: f,
|
|
329
|
+
contentId: T,
|
|
330
|
+
anchor: a,
|
|
331
|
+
setAnchor: v,
|
|
332
|
+
hoverable: p,
|
|
333
|
+
openNow: B,
|
|
334
|
+
openDelayed: C,
|
|
335
|
+
closeNow: i,
|
|
336
|
+
closeSoon: S,
|
|
337
|
+
cancelClose: h
|
|
338
|
+
}),
|
|
339
|
+
[f, T, a, p, B, C, i, S, h]
|
|
340
|
+
);
|
|
341
|
+
return /* @__PURE__ */ x(ft.Provider, { value: O, children: c });
|
|
342
|
+
}
|
|
343
|
+
function V(e, t) {
|
|
344
|
+
return (o) => {
|
|
345
|
+
typeof e == "function" && e(o), t();
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
function nt(e, t) {
|
|
349
|
+
e && (typeof e == "function" ? e(t) : e.current = t);
|
|
350
|
+
}
|
|
351
|
+
function ke({ asChild: e = !1, children: t }) {
|
|
352
|
+
const o = dt("TooltipTrigger"), { open: r, contentId: n, setAnchor: c, openNow: s, openDelayed: l, closeNow: p, closeSoon: P } = o, y = K(t) ? t : null, u = (y == null ? void 0 : y.props) ?? {}, f = y == null ? void 0 : y.ref, a = L(f);
|
|
353
|
+
a.current = f;
|
|
354
|
+
const v = L(null), T = _(
|
|
355
|
+
(g) => {
|
|
356
|
+
v.current = g, c(g), nt(a.current, g);
|
|
357
|
+
},
|
|
358
|
+
[c]
|
|
359
|
+
), b = L(f);
|
|
360
|
+
st(() => {
|
|
361
|
+
b.current !== f && (b.current = f, nt(f, v.current));
|
|
362
|
+
});
|
|
363
|
+
const d = {
|
|
364
|
+
ref: T,
|
|
365
|
+
// pointermove·mouseenter 둘 다 받는다 — 포인터 종류·테스트 도구에 따라 어느 하나만 오는
|
|
366
|
+
// 경우가 있어(예: fireEvent.pointerMove / fireEvent.mouseOver) 한쪽만 걸면 조용히 안 열린다.
|
|
367
|
+
onPointerMove: V(u.onPointerMove, l),
|
|
368
|
+
onMouseEnter: V(u.onMouseEnter, l),
|
|
369
|
+
onPointerLeave: V(u.onPointerLeave, P),
|
|
370
|
+
onMouseLeave: V(u.onMouseLeave, P),
|
|
371
|
+
// 클릭하러 온 것이므로 즉시 치운다(누른 순간 가려지지 않게).
|
|
372
|
+
onPointerDown: V(u.onPointerDown, p),
|
|
373
|
+
// 포커스는 지연 없이 — 버블링된 focus 도 받는다(트리거가 감싼 span 인 경우).
|
|
374
|
+
onFocus: V(u.onFocus, s),
|
|
375
|
+
onBlur: V(u.onBlur, p),
|
|
376
|
+
"aria-describedby": r ? n : u["aria-describedby"],
|
|
377
|
+
// 트리거는 열림 상태를 attribute 로도 노출한다 — 소비처가 열려 있는 동안의 트리거 스타일을
|
|
378
|
+
// CSS 만으로 걸 수 있고(`[data-state='open']`), "툴팁이 배선됐는가" 를 DOM 에서 확인할 수 있다.
|
|
379
|
+
"data-state": r ? "open" : "closed"
|
|
380
|
+
};
|
|
381
|
+
return e && y ? F(y, d) : /* @__PURE__ */ x("span", { ...d, children: t });
|
|
382
|
+
}
|
|
383
|
+
function we({
|
|
384
|
+
side: e = "top",
|
|
385
|
+
align: t = "center",
|
|
386
|
+
sideOffset: o = 8,
|
|
387
|
+
collisionPadding: r = 8,
|
|
388
|
+
arrow: n = !0,
|
|
389
|
+
className: c,
|
|
390
|
+
style: s,
|
|
391
|
+
children: l,
|
|
392
|
+
...p
|
|
393
|
+
}) {
|
|
394
|
+
const P = dt("TooltipContent"), { open: y, anchor: u, contentId: f, hoverable: a, cancelClose: v, closeSoon: T } = P, b = L({ cancelClose: v, closeSoon: T });
|
|
395
|
+
b.current = { cancelClose: v, closeSoon: T };
|
|
396
|
+
const d = _(() => b.current.cancelClose(), []), g = _(() => b.current.closeSoon(), []), R = N(() => ({ content: l }), [l]);
|
|
397
|
+
return /* @__PURE__ */ x(
|
|
398
|
+
fe,
|
|
399
|
+
{
|
|
400
|
+
open: y,
|
|
401
|
+
anchor: u,
|
|
402
|
+
side: e,
|
|
403
|
+
align: t,
|
|
404
|
+
sideOffset: o,
|
|
405
|
+
collisionPadding: r,
|
|
406
|
+
arrow: n,
|
|
407
|
+
tooltipId: f,
|
|
408
|
+
className: c,
|
|
409
|
+
style: s,
|
|
410
|
+
slots: R,
|
|
411
|
+
"data-hoverable": a ? "true" : void 0,
|
|
412
|
+
onPointerEnter: a ? d : void 0,
|
|
413
|
+
onPointerLeave: a ? g : void 0,
|
|
414
|
+
...p
|
|
415
|
+
}
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
const Ce = m(Lt), Ct = W(null);
|
|
419
|
+
function G(e) {
|
|
420
|
+
const t = D(Ct);
|
|
421
|
+
if (!t) throw new Error(`${e} 는 <Popover> 안에서만 쓸 수 있습니다.`);
|
|
422
|
+
return t;
|
|
423
|
+
}
|
|
424
|
+
function Et(...e) {
|
|
425
|
+
return (t) => {
|
|
426
|
+
for (const o of e)
|
|
427
|
+
o && (typeof o == "function" ? o(t) : o.current = t);
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
function Pt(e, t) {
|
|
431
|
+
return (o) => {
|
|
432
|
+
typeof e == "function" && e(o), t(o);
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
function ze({ open: e, defaultOpen: t = !1, onOpenChange: o, children: r }) {
|
|
436
|
+
const [n, c] = U(t), s = e !== void 0, l = s ? !!e : n, [p, P] = U(null), [y, u] = U(null), f = `moz-popover-${Z()}`, a = L(o);
|
|
437
|
+
a.current = o;
|
|
438
|
+
const v = _(
|
|
439
|
+
(b) => {
|
|
440
|
+
var d;
|
|
441
|
+
s || c(b), (d = a.current) == null || d.call(a, b);
|
|
442
|
+
},
|
|
443
|
+
[s]
|
|
444
|
+
), T = N(
|
|
445
|
+
() => ({ open: l, setOpen: v, contentId: f, triggerEl: p, anchorEl: y, setTriggerEl: P, setAnchorEl: u }),
|
|
446
|
+
[l, v, f, p, y]
|
|
447
|
+
);
|
|
448
|
+
return /* @__PURE__ */ x(Ct.Provider, { value: T, children: r });
|
|
449
|
+
}
|
|
450
|
+
function je({ asChild: e = !1, children: t }) {
|
|
451
|
+
const { open: o, setOpen: r, contentId: n, setTriggerEl: c } = G("PopoverTrigger"), s = K(t) ? t : null, l = (s == null ? void 0 : s.props) ?? {}, P = {
|
|
452
|
+
ref: N(
|
|
453
|
+
() => Et(c, s == null ? void 0 : s.ref),
|
|
454
|
+
[c, s]
|
|
455
|
+
),
|
|
456
|
+
onClick: Pt(l.onClick, () => r(!o)),
|
|
457
|
+
"aria-haspopup": "dialog",
|
|
458
|
+
"aria-expanded": o,
|
|
459
|
+
"aria-controls": o ? n : void 0,
|
|
460
|
+
"data-state": o ? "open" : "closed"
|
|
461
|
+
};
|
|
462
|
+
return e && s ? F(s, P) : /* @__PURE__ */ x("span", { ...P, children: t });
|
|
463
|
+
}
|
|
464
|
+
function Ne({ asChild: e = !1, children: t }) {
|
|
465
|
+
const { setAnchorEl: o } = G("PopoverAnchor"), r = K(t) ? t : null, n = N(
|
|
466
|
+
() => Et(o, r == null ? void 0 : r.ref),
|
|
467
|
+
[o, r]
|
|
468
|
+
);
|
|
469
|
+
return e && r ? F(r, { ref: n }) : /* @__PURE__ */ x("span", { ref: n, children: t });
|
|
470
|
+
}
|
|
471
|
+
function Be({ asChild: e = !1, children: t }) {
|
|
472
|
+
const { setOpen: o } = G("PopoverClose"), r = K(t) ? t : null, n = (r == null ? void 0 : r.props) ?? {}, c = {
|
|
473
|
+
onClick: Pt(n.onClick, () => o(!1))
|
|
474
|
+
};
|
|
475
|
+
return e && r ? F(r, c) : /* @__PURE__ */ x("button", { type: "button", ...c, children: t });
|
|
476
|
+
}
|
|
477
|
+
function Ue({
|
|
478
|
+
side: e = "bottom",
|
|
479
|
+
align: t = "start",
|
|
480
|
+
sideOffset: o = 4,
|
|
481
|
+
collisionPadding: r = 8,
|
|
482
|
+
matchTriggerWidth: n = !1,
|
|
483
|
+
trapFocus: c = !0,
|
|
484
|
+
className: s,
|
|
485
|
+
style: l,
|
|
486
|
+
onOpenAutoFocus: p,
|
|
487
|
+
onCloseAutoFocus: P,
|
|
488
|
+
onEscapeKeyDown: y,
|
|
489
|
+
onInteractOutside: u,
|
|
490
|
+
children: f,
|
|
491
|
+
...a
|
|
492
|
+
}) {
|
|
493
|
+
const { open: v, setOpen: T, contentId: b, triggerEl: d, anchorEl: g } = G("PopoverContent"), R = L({ setOpen: T, triggerEl: d, anchorEl: g, onOpenAutoFocus: p, onCloseAutoFocus: P, onEscapeKeyDown: y, onInteractOutside: u });
|
|
494
|
+
R.current = { setOpen: T, triggerEl: d, anchorEl: g, onOpenAutoFocus: p, onCloseAutoFocus: P, onEscapeKeyDown: y, onInteractOutside: u };
|
|
495
|
+
const I = _((E) => {
|
|
496
|
+
R.current.setOpen(!1);
|
|
497
|
+
}, []), B = _((E) => {
|
|
498
|
+
var O, A;
|
|
499
|
+
(A = (O = R.current).onEscapeKeyDown) == null || A.call(O, E);
|
|
500
|
+
}, []), C = _((E) => {
|
|
501
|
+
var M, k, w, j;
|
|
502
|
+
const O = (k = (M = E.detail) == null ? void 0 : M.originalEvent) == null ? void 0 : k.target, { triggerEl: A, anchorEl: z } = R.current;
|
|
503
|
+
if (O && (A && A.contains(O) || z && z.contains(O))) {
|
|
504
|
+
E.preventDefault();
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
(j = (w = R.current).onInteractOutside) == null || j.call(w, E);
|
|
508
|
+
}, []), i = _((E) => {
|
|
509
|
+
var O, A;
|
|
510
|
+
(A = (O = R.current).onOpenAutoFocus) == null || A.call(O, E);
|
|
511
|
+
}, []), S = _((E) => {
|
|
512
|
+
var O, A;
|
|
513
|
+
(A = (O = R.current).onCloseAutoFocus) == null || A.call(O, E);
|
|
514
|
+
}, []), h = N(() => ({ content: f }), [f]);
|
|
515
|
+
return /* @__PURE__ */ x(
|
|
516
|
+
Ce,
|
|
517
|
+
{
|
|
518
|
+
open: v,
|
|
519
|
+
anchor: g ?? d,
|
|
520
|
+
side: e,
|
|
521
|
+
align: t,
|
|
522
|
+
sideOffset: o,
|
|
523
|
+
collisionPadding: r,
|
|
524
|
+
matchTriggerWidth: n,
|
|
525
|
+
trapFocus: c,
|
|
526
|
+
popoverId: b,
|
|
527
|
+
className: s,
|
|
528
|
+
style: l,
|
|
529
|
+
slots: h,
|
|
530
|
+
onRequestClose: I,
|
|
531
|
+
onEscapeKeyDown: B,
|
|
532
|
+
onInteractOutside: C,
|
|
533
|
+
onOpenAutoFocus: i,
|
|
534
|
+
onCloseAutoFocus: S,
|
|
535
|
+
...a
|
|
536
|
+
}
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
const Ee = m(xt), mt = W(null);
|
|
540
|
+
function yt(e) {
|
|
541
|
+
const t = D(mt);
|
|
542
|
+
if (!t) throw new Error(`${e} 는 <Collapsible> 안에서만 쓸 수 있습니다.`);
|
|
543
|
+
return t;
|
|
544
|
+
}
|
|
545
|
+
function Pe(...e) {
|
|
546
|
+
return (t) => {
|
|
547
|
+
for (const o of e)
|
|
548
|
+
o && (typeof o == "function" ? o(t) : o.current = t);
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
function rt(e, t) {
|
|
552
|
+
return (o) => {
|
|
553
|
+
typeof e == "function" && e(o), t(o);
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
function vt(e, t) {
|
|
557
|
+
const o = [e, t].filter((r) => typeof r == "string" && r.length > 0).join(" ");
|
|
558
|
+
return o.length > 0 ? o : void 0;
|
|
559
|
+
}
|
|
560
|
+
function De({
|
|
561
|
+
open: e,
|
|
562
|
+
defaultOpen: t = !1,
|
|
563
|
+
onOpenChange: o,
|
|
564
|
+
disabled: r = !1,
|
|
565
|
+
asChild: n = !1,
|
|
566
|
+
className: c,
|
|
567
|
+
style: s,
|
|
568
|
+
children: l,
|
|
569
|
+
...p
|
|
570
|
+
}) {
|
|
571
|
+
const [P, y] = U(t), u = e !== void 0, f = u ? !!e : P, a = `moz-collapsible-${Z()}`, v = L(o);
|
|
572
|
+
v.current = o;
|
|
573
|
+
const T = _(
|
|
574
|
+
(I) => {
|
|
575
|
+
var B;
|
|
576
|
+
u || y(I), (B = v.current) == null || B.call(v, I);
|
|
577
|
+
},
|
|
578
|
+
[u]
|
|
579
|
+
), b = N(
|
|
580
|
+
() => ({ open: f, setOpen: T, contentId: a, disabled: r }),
|
|
581
|
+
[f, T, a, r]
|
|
582
|
+
), d = {
|
|
583
|
+
"data-state": f ? "open" : "closed",
|
|
584
|
+
"data-disabled": r ? "" : void 0,
|
|
585
|
+
...p
|
|
586
|
+
}, g = K(l) ? l : null, R = n && g ? F(g, {
|
|
587
|
+
...d,
|
|
588
|
+
className: vt(g.props.className, c),
|
|
589
|
+
style: s ?? g.props.style
|
|
590
|
+
}) : /* @__PURE__ */ x("div", { ...d, className: c, style: s, children: l });
|
|
591
|
+
return /* @__PURE__ */ x(mt.Provider, { value: b, children: R });
|
|
592
|
+
}
|
|
593
|
+
function Ke({
|
|
594
|
+
asChild: e = !1,
|
|
595
|
+
disabled: t,
|
|
596
|
+
className: o,
|
|
597
|
+
style: r,
|
|
598
|
+
onClick: n,
|
|
599
|
+
children: c,
|
|
600
|
+
...s
|
|
601
|
+
}) {
|
|
602
|
+
const { open: l, setOpen: p, contentId: P, disabled: y } = yt("CollapsibleTrigger"), u = t ?? y, f = _(() => {
|
|
603
|
+
u || p(!l);
|
|
604
|
+
}, [u, l, p]), a = K(c) ? c : null, v = (a == null ? void 0 : a.props) ?? {}, T = {
|
|
605
|
+
"aria-expanded": l,
|
|
606
|
+
"aria-controls": P,
|
|
607
|
+
"data-state": l ? "open" : "closed",
|
|
608
|
+
"data-disabled": u ? "" : void 0,
|
|
609
|
+
...s
|
|
610
|
+
};
|
|
611
|
+
if (e && a) {
|
|
612
|
+
const b = Pe(a.ref);
|
|
613
|
+
return F(a, {
|
|
614
|
+
...T,
|
|
615
|
+
ref: b,
|
|
616
|
+
className: vt(v.className, o),
|
|
617
|
+
style: r ?? v.style,
|
|
618
|
+
// 소비처 onClick 을 먼저 돌리고 토글한다 — 소비처가 stopPropagation 을 걸어도
|
|
619
|
+
// 토글 의미는 유지된다(Radix 와 같은 순서).
|
|
620
|
+
onClick: rt(v.onClick, (d) => {
|
|
621
|
+
n == null || n(d), f();
|
|
622
|
+
}),
|
|
623
|
+
disabled: u || void 0
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
return /* @__PURE__ */ x(
|
|
627
|
+
"button",
|
|
628
|
+
{
|
|
629
|
+
type: "button",
|
|
630
|
+
...T,
|
|
631
|
+
className: o,
|
|
632
|
+
style: r,
|
|
633
|
+
disabled: u || void 0,
|
|
634
|
+
onClick: rt(n, f),
|
|
635
|
+
children: c
|
|
636
|
+
}
|
|
637
|
+
);
|
|
638
|
+
}
|
|
639
|
+
function Ve({
|
|
640
|
+
forceMount: e = !1,
|
|
641
|
+
className: t,
|
|
642
|
+
style: o,
|
|
643
|
+
onHeightChange: r,
|
|
644
|
+
children: n,
|
|
645
|
+
...c
|
|
646
|
+
}) {
|
|
647
|
+
const { open: s, contentId: l, disabled: p } = yt("CollapsibleContent"), P = L({ onHeightChange: r });
|
|
648
|
+
P.current = { onHeightChange: r };
|
|
649
|
+
const y = _((f) => {
|
|
650
|
+
var a, v;
|
|
651
|
+
(v = (a = P.current).onHeightChange) == null || v.call(a, f);
|
|
652
|
+
}, []), u = N(() => ({ content: n }), [n]);
|
|
653
|
+
return /* @__PURE__ */ x(
|
|
654
|
+
Ee,
|
|
655
|
+
{
|
|
656
|
+
open: s,
|
|
657
|
+
forceMount: e,
|
|
658
|
+
contentId: l,
|
|
659
|
+
disabled: p,
|
|
660
|
+
className: t,
|
|
661
|
+
style: o,
|
|
662
|
+
slots: u,
|
|
663
|
+
onHeightChange: y,
|
|
664
|
+
...c
|
|
665
|
+
}
|
|
666
|
+
);
|
|
667
|
+
}
|
|
668
|
+
const me = m(Mt);
|
|
669
|
+
function ye(e) {
|
|
670
|
+
return null;
|
|
671
|
+
}
|
|
672
|
+
function ve(e) {
|
|
673
|
+
return null;
|
|
674
|
+
}
|
|
675
|
+
function We({ className: e, style: t, onLoadingStatusChange: o, children: r, ...n }) {
|
|
676
|
+
let c, s;
|
|
677
|
+
ct.forEach(r, (P) => {
|
|
678
|
+
K(P) && (P.type === ye ? c = P.props : P.type === ve && (s = P.props));
|
|
679
|
+
});
|
|
680
|
+
const l = s == null ? void 0 : s.children, p = N(() => ({ fallback: l }), [l]);
|
|
681
|
+
return /* @__PURE__ */ x(
|
|
682
|
+
me,
|
|
683
|
+
{
|
|
684
|
+
src: c == null ? void 0 : c.src,
|
|
685
|
+
alt: c == null ? void 0 : c.alt,
|
|
686
|
+
imageClass: c == null ? void 0 : c.className,
|
|
687
|
+
fallbackClass: s == null ? void 0 : s.className,
|
|
688
|
+
delayMs: s == null ? void 0 : s.delayMs,
|
|
689
|
+
className: e,
|
|
690
|
+
style: t,
|
|
691
|
+
slots: p,
|
|
692
|
+
onLoadingStatusChange: o,
|
|
693
|
+
...n
|
|
694
|
+
}
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
const Se = m(kt);
|
|
698
|
+
function $e({
|
|
699
|
+
orientation: e = "vertical",
|
|
700
|
+
scrollbarVisibility: t = "always",
|
|
701
|
+
className: o,
|
|
702
|
+
viewportClassName: r,
|
|
703
|
+
scrollbarClassName: n,
|
|
704
|
+
thumbClassName: c,
|
|
705
|
+
viewportRef: s,
|
|
706
|
+
style: l,
|
|
707
|
+
onScroll: p,
|
|
708
|
+
children: P,
|
|
709
|
+
...y
|
|
710
|
+
}) {
|
|
711
|
+
const [u, f] = U(null), a = _(
|
|
712
|
+
(v) => {
|
|
713
|
+
f(v), typeof s == "function" ? s(v) : s && (s.current = v);
|
|
714
|
+
},
|
|
715
|
+
[s]
|
|
716
|
+
);
|
|
717
|
+
return /* @__PURE__ */ se("div", { className: ["moz-scroll-area", o].filter(Boolean).join(" "), style: l, ...y, children: [
|
|
718
|
+
/* @__PURE__ */ x(
|
|
719
|
+
"div",
|
|
720
|
+
{
|
|
721
|
+
ref: a,
|
|
722
|
+
className: ["moz-scroll-area-viewport", r].filter(Boolean).join(" "),
|
|
723
|
+
"data-moz-scroll-area-viewport": "",
|
|
724
|
+
children: P
|
|
725
|
+
}
|
|
726
|
+
),
|
|
727
|
+
/* @__PURE__ */ x(
|
|
728
|
+
Se,
|
|
729
|
+
{
|
|
730
|
+
viewport: u,
|
|
731
|
+
interactionRoot: u == null ? void 0 : u.parentElement,
|
|
732
|
+
scrollbarVisibility: t,
|
|
733
|
+
orientation: e,
|
|
734
|
+
scrollbarClass: n,
|
|
735
|
+
thumbClass: c,
|
|
736
|
+
onScroll: p
|
|
737
|
+
}
|
|
738
|
+
)
|
|
739
|
+
] });
|
|
740
|
+
}
|
|
741
|
+
const Fe = m(wt), He = m(zt), Ge = m(jt), qe = m(Nt), Xe = m(Bt), Ye = m(Ut), Je = m(Dt), Qe = m(Kt), Ze = m(Vt), to = m(Wt), eo = m($t), oo = m(Ft), no = m(Ht), ro = m(Gt), so = m(qt), co = m(Xt), lo = m(Yt), uo = m(Jt), ao = m(Qt), io = m(Zt), po = m(te), fo = m(ee), Co = m(oe), Eo = m(ne), Po = m(re);
|
|
742
|
+
export {
|
|
743
|
+
We as Avatar,
|
|
744
|
+
ve as AvatarFallback,
|
|
745
|
+
ye as AvatarImage,
|
|
746
|
+
qe as BreadCrumb,
|
|
747
|
+
Fe as Button,
|
|
748
|
+
ro as Calendar,
|
|
749
|
+
Ye as CheckBox,
|
|
750
|
+
De as Collapsible,
|
|
751
|
+
Ve as CollapsibleContent,
|
|
752
|
+
Ke as CollapsibleTrigger,
|
|
753
|
+
po as ContextMenu,
|
|
754
|
+
Eo as Controller,
|
|
755
|
+
so as DateInput,
|
|
756
|
+
Xe as EmptyState,
|
|
757
|
+
Qe as Input,
|
|
758
|
+
He as Label,
|
|
759
|
+
Oe as MozConfigProvider,
|
|
760
|
+
at as MozContextWrapperContext,
|
|
761
|
+
ut as MozLocaleContext,
|
|
762
|
+
uo as MultiSelect,
|
|
763
|
+
eo as NumberInput,
|
|
764
|
+
pe as Pane,
|
|
765
|
+
Ze as PasswordInput,
|
|
766
|
+
ze as Popover,
|
|
767
|
+
Ne as PopoverAnchor,
|
|
768
|
+
Be as PopoverClose,
|
|
769
|
+
Ue as PopoverContent,
|
|
770
|
+
je as PopoverTrigger,
|
|
771
|
+
co as Popup,
|
|
772
|
+
Je as Radio,
|
|
773
|
+
ce as ReactRenderer,
|
|
774
|
+
$e as ScrollArea,
|
|
775
|
+
lo as Select,
|
|
776
|
+
no as Slider,
|
|
777
|
+
Le as SplitPane,
|
|
778
|
+
oo as Tab,
|
|
779
|
+
fo as TableSelect,
|
|
780
|
+
io as TagInput,
|
|
781
|
+
to as TextArea,
|
|
782
|
+
ao as TimePicker,
|
|
783
|
+
Po as Toast,
|
|
784
|
+
Ge as Toggle,
|
|
785
|
+
Me as Tooltip,
|
|
786
|
+
we as TooltipContent,
|
|
787
|
+
xe as TooltipProvider,
|
|
788
|
+
ke as TooltipTrigger,
|
|
789
|
+
Co as TreeSelect,
|
|
790
|
+
_e as Validator,
|
|
791
|
+
tt as ValidatorReactContext,
|
|
792
|
+
m as createMozComponent,
|
|
793
|
+
vo as createValidator,
|
|
794
|
+
So as enUS,
|
|
795
|
+
To as jaJP,
|
|
796
|
+
bo as koKR,
|
|
797
|
+
ue as useMozContextWrapper,
|
|
798
|
+
le as useMozLocale,
|
|
799
|
+
ho as useToast,
|
|
800
|
+
Ie as useValidatorContext,
|
|
801
|
+
Ao as zhCN
|
|
802
|
+
};
|
|
803
|
+
//# sourceMappingURL=index.js.map
|