@ohseungik/maru-ui 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.
package/dist/index.js CHANGED
@@ -1,187 +1,187 @@
1
1
  "use client";
2
- import { jsxs as g, jsx as l, Fragment as W } from "react/jsx-runtime";
3
- import { forwardRef as $, useRef as L, useCallback as j, useEffect as D, useId as A, createContext as Q, useContext as X, useState as G, useMemo as ce, Children as ie, isValidElement as le, cloneElement as de, useLayoutEffect as ue } from "react";
4
- function N(...r) {
5
- return r.filter(Boolean).join(" ");
2
+ import { jsxs as L, jsx as l, Fragment as j } from "react/jsx-runtime";
3
+ import { forwardRef as E, useRef as S, useCallback as Q, useEffect as P, useId as O, createContext as re, useContext as se, useState as U, Children as ae, isValidElement as le, cloneElement as ie, useLayoutEffect as ce, useMemo as ye } from "react";
4
+ function T(...s) {
5
+ return s.filter(Boolean).join(" ");
6
6
  }
7
- const me = "maru-Button-module__root__Q2R8-", fe = "maru-Button-module__spinner__ZExvW", Y = {
8
- root: me,
9
- spinner: fe
10
- }, at = $(function({
7
+ const we = "maru-Button-module__root__Q2R8-", Te = "maru-Button-module__spinner__ZExvW", G = {
8
+ root: we,
9
+ spinner: Te
10
+ }, Lt = E(function({
11
11
  variant: e = "primary",
12
- size: o = "md",
12
+ size: t = "md",
13
13
  loading: n = !1,
14
- type: t = "button",
15
- disabled: s = !1,
16
- className: m,
17
- children: c,
18
- ...i
14
+ type: o = "button",
15
+ disabled: a = !1,
16
+ className: u,
17
+ children: i,
18
+ ...c
19
19
  }, d) {
20
- return /* @__PURE__ */ g(
20
+ return /* @__PURE__ */ L(
21
21
  "button",
22
22
  {
23
- ...i,
23
+ ...c,
24
24
  ref: d,
25
- type: t,
26
- className: N(Y.root, m),
25
+ type: o,
26
+ className: T(G.root, u),
27
27
  "data-variant": e,
28
- "data-size": o,
28
+ "data-size": t,
29
29
  "data-loading": n ? "" : void 0,
30
- disabled: s || n,
30
+ disabled: a || n,
31
31
  "aria-busy": n ? !0 : void 0,
32
32
  children: [
33
- n ? /* @__PURE__ */ l("span", { className: Y.spinner, "aria-hidden": "true" }) : null,
34
- c
33
+ n ? /* @__PURE__ */ l("span", { className: G.spinner, "aria-hidden": "true" }) : null,
34
+ i
35
35
  ]
36
36
  }
37
37
  );
38
- }), he = "maru-Checkbox-module__root__mY3qk", _e = "maru-Checkbox-module__control__PxoNk", be = "maru-Checkbox-module__input__2kt-h", pe = "maru-Checkbox-module__box__OCPee", M = {
39
- root: he,
40
- control: _e,
41
- input: be,
42
- box: pe
43
- }, ct = $(function({ size: e = "md", indeterminate: o = !1, invalid: n = !1, disabled: t, className: s, children: m, ...c }, i) {
44
- const d = L(null), _ = j(
45
- (h) => {
46
- d.current = h, typeof i == "function" ? i(h) : i && (i.current = h);
38
+ }), xe = "maru-Checkbox-module__root__mY3qk", Ee = "maru-Checkbox-module__control__PxoNk", ke = "maru-Checkbox-module__input__2kt-h", Ne = "maru-Checkbox-module__box__OCPee", A = {
39
+ root: xe,
40
+ control: Ee,
41
+ input: ke,
42
+ box: Ne
43
+ }, Ct = E(function({ size: e = "md", indeterminate: t = !1, invalid: n = !1, disabled: o, className: a, children: u, ...i }, c) {
44
+ const d = S(null), _ = Q(
45
+ (f) => {
46
+ d.current = f, typeof c == "function" ? c(f) : c && (c.current = f);
47
47
  },
48
- [i]
48
+ [c]
49
49
  );
50
- return D(() => {
51
- d.current && (d.current.indeterminate = o);
52
- }), /* @__PURE__ */ g(
50
+ return P(() => {
51
+ d.current && (d.current.indeterminate = t);
52
+ }), /* @__PURE__ */ L(
53
53
  "label",
54
54
  {
55
- className: N(M.root, s),
55
+ className: T(A.root, a),
56
56
  "data-size": e,
57
- "data-disabled": t ? "" : void 0,
57
+ "data-disabled": o ? "" : void 0,
58
58
  children: [
59
- /* @__PURE__ */ g("span", { className: M.control, children: [
59
+ /* @__PURE__ */ L("span", { className: A.control, children: [
60
60
  /* @__PURE__ */ l(
61
61
  "input",
62
62
  {
63
- ...c,
63
+ ...i,
64
64
  ref: _,
65
65
  type: "checkbox",
66
- className: M.input,
67
- disabled: t,
66
+ className: A.input,
67
+ disabled: o,
68
68
  "data-invalid": n ? "" : void 0,
69
69
  "aria-invalid": n ? !0 : void 0
70
70
  }
71
71
  ),
72
- /* @__PURE__ */ l("span", { className: M.box, "aria-hidden": "true" })
72
+ /* @__PURE__ */ l("span", { className: A.box, "aria-hidden": "true" })
73
73
  ] }),
74
- m ? /* @__PURE__ */ l("span", { className: M.label, children: m }) : null
74
+ u ? /* @__PURE__ */ l("span", { className: A.label, children: u }) : null
75
75
  ]
76
76
  }
77
77
  );
78
- }), ve = "maru-Heading-module__root__-To4U", ye = {
79
- root: ve
80
- }, we = {
78
+ }), $e = "maru-Heading-module__root__-To4U", ge = {
79
+ root: $e
80
+ }, Le = {
81
81
  1: "4xl",
82
82
  2: "3xl",
83
83
  3: "2xl",
84
84
  4: "xl",
85
85
  5: "lg",
86
86
  6: "md"
87
- }, xe = $(function({ level: e, size: o, tone: n = "default", className: t, ...s }, m) {
88
- const c = `h${e}`;
87
+ }, Ce = E(function({ level: e, size: t, tone: n = "default", className: o, ...a }, u) {
88
+ const i = `h${e}`;
89
89
  return /* @__PURE__ */ l(
90
- c,
90
+ i,
91
91
  {
92
- ...s,
93
- ref: m,
94
- className: N(ye.root, t),
95
- "data-size": o ?? we[e],
92
+ ...a,
93
+ ref: u,
94
+ className: T(ge.root, o),
95
+ "data-size": t ?? Le[e],
96
96
  "data-tone": n
97
97
  }
98
98
  );
99
- }), ke = "maru-Dialog-module__root__tvkOF", Ne = "maru-Dialog-module__panel__b2y0S", $e = "maru-Dialog-module__header__bdJRp", ge = "maru-Dialog-module__title__glVA6", Te = "maru-Dialog-module__description__6Bsa9", Ee = "maru-Dialog-module__body__1ZbVo", Ce = "maru-Dialog-module__actions__JRD2K", Le = "maru-Dialog-module__close__Zz2uv", C = {
100
- root: ke,
101
- panel: Ne,
102
- header: $e,
103
- title: ge,
104
- description: Te,
105
- body: Ee,
106
- actions: Ce,
107
- close: Le
99
+ }), Ie = "maru-Dialog-module__root__tvkOF", Se = "maru-Dialog-module__panel__b2y0S", Pe = "maru-Dialog-module__header__bdJRp", Be = "maru-Dialog-module__title__glVA6", De = "maru-Dialog-module__description__6Bsa9", Re = "maru-Dialog-module__body__1ZbVo", Me = "maru-Dialog-module__actions__JRD2K", ze = "maru-Dialog-module__close__Zz2uv", z = {
100
+ root: Ie,
101
+ panel: Se,
102
+ header: Pe,
103
+ title: Be,
104
+ description: De,
105
+ body: Re,
106
+ actions: Me,
107
+ close: ze
108
108
  };
109
- let q = 0, ee = "";
110
- function Ie() {
111
- q === 0 && (ee = document.body.style.overflow, document.body.style.overflow = "hidden"), q += 1;
109
+ let W = 0, de = "";
110
+ function Oe() {
111
+ W === 0 && (de = document.body.style.overflow, document.body.style.overflow = "hidden"), W += 1;
112
112
  }
113
- function Be() {
114
- q = Math.max(0, q - 1), q === 0 && (document.body.style.overflow = ee);
113
+ function Fe() {
114
+ W = Math.max(0, W - 1), W === 0 && (document.body.style.overflow = de);
115
115
  }
116
- const it = $(function({
116
+ const It = E(function({
117
117
  open: e,
118
- onClose: o,
118
+ onClose: t,
119
119
  title: n,
120
- description: t,
121
- actions: s,
122
- size: m = "md",
123
- closeOnBackdropClick: c = !0,
124
- closeLabel: i = "Close",
120
+ description: o,
121
+ actions: a,
122
+ size: u = "md",
123
+ closeOnBackdropClick: i = !0,
124
+ closeLabel: c = "Close",
125
125
  initialFocusRef: d,
126
126
  keepMounted: _ = !1,
127
- className: h,
128
- children: v,
129
- ...b
130
- }, p) {
131
- const y = A(), x = `${y}-title`, f = `${y}-description`, T = L(null), k = L(o), u = L(e), w = L(c);
132
- D(() => {
133
- k.current = o, u.current = e, w.current = c;
127
+ className: f,
128
+ children: p,
129
+ ...v
130
+ }, w) {
131
+ const y = O(), b = `${y}-title`, m = `${y}-description`, N = S(null), k = S(t), h = S(e), x = S(i);
132
+ P(() => {
133
+ k.current = t, h.current = e, x.current = i;
134
134
  });
135
- const P = j(
136
- (a) => {
137
- T.current = a, typeof p == "function" ? p(a) : p && (p.current = a);
135
+ const R = Q(
136
+ (r) => {
137
+ N.current = r, typeof w == "function" ? w(r) : w && (w.current = r);
138
138
  },
139
- [p]
140
- ), I = e || _;
141
- return D(() => {
142
- const a = T.current;
143
- if (!a || !e) return;
144
- const B = document.activeElement instanceof HTMLElement ? document.activeElement : null;
145
- return a.open || a.showModal(), Ie(), d?.current && d.current.focus(), () => {
146
- Be(), a.open && a.close();
147
- const E = document.activeElement, S = !E || E === document.body || a.contains(E);
148
- B?.isConnected && S && B.focus();
139
+ [w]
140
+ ), D = e || _;
141
+ return P(() => {
142
+ const r = N.current;
143
+ if (!r || !e) return;
144
+ const $ = document.activeElement instanceof HTMLElement ? document.activeElement : null;
145
+ return r.open || r.showModal(), Oe(), d?.current && d.current.focus(), () => {
146
+ Fe(), r.open && r.close();
147
+ const C = document.activeElement, I = !C || C === document.body || r.contains(C);
148
+ $?.isConnected && I && $.focus();
149
149
  };
150
- }, [e]), D(() => {
151
- const a = T.current;
152
- if (!a) return;
153
- const B = (F) => {
154
- F.preventDefault(), k.current();
155
- }, E = () => {
156
- u.current && !a.open && k.current();
150
+ }, [e]), P(() => {
151
+ const r = N.current;
152
+ if (!r) return;
153
+ const $ = (M) => {
154
+ M.preventDefault(), k.current();
155
+ }, C = () => {
156
+ h.current && !r.open && k.current();
157
157
  };
158
- let S = !1;
159
- const H = (F) => {
160
- S = F.target === a;
161
- }, U = (F) => {
162
- const ae = S && F.target === a && w.current;
163
- S = !1, ae && k.current();
158
+ let I = !1;
159
+ const F = (M) => {
160
+ I = M.target === r;
161
+ }, H = (M) => {
162
+ const g = I && M.target === r && x.current;
163
+ I = !1, g && k.current();
164
164
  };
165
- return a.addEventListener("cancel", B), a.addEventListener("close", E), a.addEventListener("mousedown", H), a.addEventListener("click", U), () => {
166
- a.removeEventListener("cancel", B), a.removeEventListener("close", E), a.removeEventListener("mousedown", H), a.removeEventListener("click", U);
165
+ return r.addEventListener("cancel", $), r.addEventListener("close", C), r.addEventListener("mousedown", F), r.addEventListener("click", H), () => {
166
+ r.removeEventListener("cancel", $), r.removeEventListener("close", C), r.removeEventListener("mousedown", F), r.removeEventListener("click", H);
167
167
  };
168
- }, [I]), I ? /* @__PURE__ */ l(
168
+ }, [D]), D ? /* @__PURE__ */ l(
169
169
  "dialog",
170
170
  {
171
- ...b,
172
- ref: P,
173
- className: N(C.root, h),
174
- "data-size": m,
175
- "aria-labelledby": x,
176
- "aria-describedby": t ? f : void 0,
177
- children: /* @__PURE__ */ g("div", { className: C.panel, children: [
178
- /* @__PURE__ */ g("header", { className: C.header, children: [
179
- /* @__PURE__ */ l(xe, { level: 2, size: "lg", id: x, className: C.title, children: n }),
180
- t ? /* @__PURE__ */ l("p", { id: f, className: C.description, children: t }) : null
171
+ ...v,
172
+ ref: R,
173
+ className: T(z.root, f),
174
+ "data-size": u,
175
+ "aria-labelledby": b,
176
+ "aria-describedby": o ? m : void 0,
177
+ children: /* @__PURE__ */ L("div", { className: z.panel, children: [
178
+ /* @__PURE__ */ L("header", { className: z.header, children: [
179
+ /* @__PURE__ */ l(Ce, { level: 2, size: "lg", id: b, className: z.title, children: n }),
180
+ o ? /* @__PURE__ */ l("p", { id: m, className: z.description, children: o }) : null
181
181
  ] }),
182
- /* @__PURE__ */ l("div", { className: C.body, children: v }),
183
- s ? /* @__PURE__ */ l("footer", { className: C.actions, children: s }) : null,
184
- /* @__PURE__ */ l("button", { type: "button", className: C.close, "aria-label": i, onClick: o, children: /* @__PURE__ */ l("svg", { viewBox: "0 0 16 16", width: "16", height: "16", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ l(
182
+ /* @__PURE__ */ l("div", { className: z.body, children: p }),
183
+ a ? /* @__PURE__ */ l("footer", { className: z.actions, children: a }) : null,
184
+ /* @__PURE__ */ l("button", { type: "button", className: z.close, "aria-label": c, onClick: t, children: /* @__PURE__ */ l("svg", { viewBox: "0 0 16 16", width: "16", height: "16", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ l(
185
185
  "path",
186
186
  {
187
187
  d: "M3 3l10 10M13 3L3 13",
@@ -194,116 +194,260 @@ const it = $(function({
194
194
  ] })
195
195
  }
196
196
  ) : null;
197
- }), te = Q(null);
198
- function oe() {
199
- return X(te);
197
+ }), ue = re(null);
198
+ function me() {
199
+ return se(ue);
200
200
  }
201
- const Se = "maru-Field-module__root__OOI9-", De = "maru-Field-module__label__LAQio", Pe = "maru-Field-module__required__8HCWC", Fe = "maru-Field-module__description__yqljW", Me = "maru-Field-module__error__m0uol", R = {
202
- root: Se,
203
- label: De,
204
- required: Pe,
205
- description: Fe,
206
- error: Me
201
+ const He = "maru-Field-module__root__OOI9-", Ae = "maru-Field-module__label__LAQio", qe = "maru-Field-module__required__8HCWC", Ke = "maru-Field-module__description__yqljW", We = "maru-Field-module__error__m0uol", q = {
202
+ root: He,
203
+ label: Ae,
204
+ required: qe,
205
+ description: Ke,
206
+ error: We
207
207
  };
208
- function Z(r) {
209
- return r != null && r !== !1 && r !== "";
208
+ function ee(s) {
209
+ return s != null && s !== !1 && s !== "";
210
210
  }
211
- const lt = $(function({ label: e, description: o, error: n, required: t = !1, disabled: s = !1, className: m, children: c, ...i }, d) {
212
- const _ = A(), h = `${_}-control`, v = `${_}-description`, b = `${_}-error`, p = Z(o), y = Z(n), x = [p ? v : null, y ? b : null].filter(Boolean).join(" ") || void 0;
213
- return /* @__PURE__ */ g(
211
+ const St = E(function({ label: e, description: t, error: n, required: o = !1, disabled: a = !1, className: u, children: i, ...c }, d) {
212
+ const _ = O(), f = `${_}-control`, p = `${_}-description`, v = `${_}-error`, w = ee(t), y = ee(n), b = [w ? p : null, y ? v : null].filter(Boolean).join(" ") || void 0;
213
+ return /* @__PURE__ */ L(
214
214
  "div",
215
215
  {
216
- ...i,
216
+ ...c,
217
217
  ref: d,
218
- className: N(R.root, m),
218
+ className: T(q.root, u),
219
219
  "data-invalid": y ? "" : void 0,
220
220
  children: [
221
- /* @__PURE__ */ g("label", { htmlFor: h, className: R.label, children: [
221
+ /* @__PURE__ */ L("label", { htmlFor: f, className: q.label, children: [
222
222
  e,
223
- t ? /* @__PURE__ */ l("span", { "aria-hidden": "true", className: R.required, children: " *" }) : null
223
+ o ? /* @__PURE__ */ l("span", { "aria-hidden": "true", className: q.required, children: " *" }) : null
224
224
  ] }),
225
- p ? /* @__PURE__ */ l("p", { id: v, className: R.description, children: o }) : null,
225
+ w ? /* @__PURE__ */ l("p", { id: p, className: q.description, children: t }) : null,
226
226
  /* @__PURE__ */ l(
227
- te.Provider,
227
+ ue.Provider,
228
228
  {
229
- value: { controlId: h, describedBy: x, invalid: y, required: t, disabled: s },
230
- children: c
229
+ value: { controlId: f, describedBy: b, invalid: y, required: o, disabled: a },
230
+ children: i
231
231
  }
232
232
  ),
233
- /* @__PURE__ */ l("div", { "aria-live": "polite", children: y ? /* @__PURE__ */ l("p", { id: b, className: R.error, children: n }) : null })
233
+ /* @__PURE__ */ l("div", { "aria-live": "polite", children: y ? /* @__PURE__ */ l("p", { id: v, className: q.error, children: n }) : null })
234
234
  ]
235
235
  }
236
236
  );
237
- }), Re = "maru-Input-module__root__KgYPo", ze = {
238
- root: Re
239
- }, dt = $(function({
237
+ }), Ve = "maru-Input-module__root__KgYPo", je = {
238
+ root: Ve
239
+ }, Pt = E(function({
240
240
  size: e = "md",
241
- type: o = "text",
241
+ type: t = "text",
242
242
  invalid: n,
243
- id: t,
244
- disabled: s,
245
- required: m,
246
- className: c,
247
- "aria-describedby": i,
243
+ id: o,
244
+ disabled: a,
245
+ required: u,
246
+ className: i,
247
+ "aria-describedby": c,
248
248
  ...d
249
249
  }, _) {
250
- const h = oe(), v = n ?? h?.invalid ?? !1, b = [i, h?.describedBy].filter(Boolean).join(" ") || void 0;
250
+ const f = me(), p = n ?? f?.invalid ?? !1, v = [c, f?.describedBy].filter(Boolean).join(" ") || void 0;
251
251
  return /* @__PURE__ */ l(
252
252
  "input",
253
253
  {
254
254
  ...d,
255
255
  ref: _,
256
- id: h?.controlId ?? t,
257
- type: o,
258
- className: N(ze.root, c),
256
+ id: f?.controlId ?? o,
257
+ type: t,
258
+ className: T(je.root, i),
259
259
  "data-size": e,
260
- "data-invalid": v ? "" : void 0,
261
- "aria-invalid": v ? !0 : void 0,
262
- "aria-describedby": b,
263
- disabled: s ?? h?.disabled,
264
- required: m ?? h?.required
260
+ "data-invalid": p ? "" : void 0,
261
+ "aria-invalid": p ? !0 : void 0,
262
+ "aria-describedby": v,
263
+ disabled: a ?? f?.disabled,
264
+ required: u ?? f?.required
265
265
  }
266
266
  );
267
- }), qe = "maru-Select-module__wrapper__KS2K3", Ae = "maru-Select-module__root__y0u6b", Oe = "maru-Select-module__chevron__PLUsh", V = {
268
- wrapper: qe,
269
- root: Ae,
270
- chevron: Oe
271
- }, ut = $(function({
267
+ }), te = {
268
+ top: "bottom",
269
+ bottom: "top",
270
+ left: "right",
271
+ right: "left"
272
+ };
273
+ function fe(s, e, t, n, o = 8, a = 8) {
274
+ const u = {
275
+ top: s.top - o - e.height >= a,
276
+ bottom: s.bottom + o + e.height <= t.height - a,
277
+ left: s.left - o - e.width >= a,
278
+ right: s.right + o + e.width <= t.width - a
279
+ }, i = !u[n] && u[te[n]] ? te[n] : n, c = (f, p, v) => Math.max(a, Math.min(f, v - a - p)), d = (s.left + s.right) / 2 - e.width / 2, _ = (s.top + s.bottom) / 2 - e.height / 2;
280
+ switch (i) {
281
+ case "top":
282
+ return {
283
+ side: i,
284
+ x: c(d, e.width, t.width),
285
+ y: s.top - o - e.height
286
+ };
287
+ case "bottom":
288
+ return {
289
+ side: i,
290
+ x: c(d, e.width, t.width),
291
+ y: s.bottom + o
292
+ };
293
+ case "left":
294
+ return {
295
+ side: i,
296
+ x: s.left - o - e.width,
297
+ y: c(_, e.height, t.height)
298
+ };
299
+ case "right":
300
+ return {
301
+ side: i,
302
+ x: s.right + o,
303
+ y: c(_, e.height, t.height)
304
+ };
305
+ }
306
+ }
307
+ const Ue = "maru-Popover-module__root__vEMon", Ze = "maru-Popover-module__title__hAl5w", Ye = "maru-Popover-module__body__d6SIw", Y = {
308
+ root: Ue,
309
+ title: Ze,
310
+ body: Ye
311
+ }, oe = typeof document > "u" ? P : ce, Je = [
312
+ "a[href]",
313
+ "button:not([disabled])",
314
+ 'input:not([disabled]):not([type="hidden"])',
315
+ "select:not([disabled])",
316
+ "textarea:not([disabled])",
317
+ '[tabindex]:not([tabindex="-1"])'
318
+ ].join(",");
319
+ function Bt({
320
+ content: s,
321
+ children: e,
322
+ title: t,
323
+ "aria-label": n,
324
+ placement: o = "bottom",
325
+ open: a,
326
+ defaultOpen: u = !1,
327
+ onOpenChange: i,
328
+ disabled: c = !1,
329
+ className: d
330
+ }) {
331
+ const _ = O(), f = O(), p = S(null), [v, w] = U(u), y = a !== void 0, b = !c && (y ? a : v), m = S({ open: b, controlled: y, onOpenChange: i });
332
+ oe(() => {
333
+ m.current = { open: b, controlled: y, onOpenChange: i };
334
+ });
335
+ const N = (r) => {
336
+ const { open: $, controlled: C, onOpenChange: I } = m.current;
337
+ r !== $ && (C || w(r), I?.(r));
338
+ }, k = () => p.current?.previousElementSibling ?? null;
339
+ oe(() => {
340
+ const r = p.current;
341
+ if (!r || !b) return;
342
+ const $ = () => {
343
+ const g = k();
344
+ if (!g) return;
345
+ const { x: V, y: pe, side: ve } = fe(
346
+ g.getBoundingClientRect(),
347
+ { width: r.offsetWidth, height: r.offsetHeight },
348
+ {
349
+ width: document.documentElement.clientWidth,
350
+ height: document.documentElement.clientHeight
351
+ },
352
+ o
353
+ );
354
+ r.style.left = `${V}px`, r.style.top = `${pe}px`, r.dataset.placement = ve;
355
+ };
356
+ let C = !1;
357
+ typeof r.showPopover == "function" && (r.showPopover(), C = !0), $();
358
+ const I = (g) => g instanceof Node && !r.contains(g) && !k()?.contains(g), F = (g) => {
359
+ if (g.key !== "Escape") return;
360
+ g.preventDefault(), g.stopPropagation(), N(!1);
361
+ const V = k();
362
+ V instanceof HTMLElement && V.focus();
363
+ }, H = (g) => {
364
+ I(g.target) && N(!1);
365
+ }, M = (g) => {
366
+ I(g.target) && N(!1);
367
+ };
368
+ return window.addEventListener("scroll", $, !0), window.addEventListener("resize", $), document.addEventListener("keydown", F, !0), document.addEventListener("pointerdown", H, !0), document.addEventListener("focusin", M), () => {
369
+ window.removeEventListener("scroll", $, !0), window.removeEventListener("resize", $), document.removeEventListener("keydown", F, !0), document.removeEventListener("pointerdown", H, !0), document.removeEventListener("focusin", M), C && r.hidePopover();
370
+ };
371
+ }, [b, o]);
372
+ const h = S(b);
373
+ P(() => {
374
+ const r = p.current;
375
+ b && !h.current && r && (r.querySelector(Je) ?? r).focus(), h.current = b;
376
+ }, [b]);
377
+ const x = ae.only(e);
378
+ if (!le(x)) return /* @__PURE__ */ l(j, { children: e });
379
+ if (c) return x;
380
+ const R = x.props, D = ie(x, {
381
+ "aria-expanded": b,
382
+ "aria-controls": _,
383
+ "aria-haspopup": "dialog",
384
+ onClick: (r) => {
385
+ R.onClick?.(r), !r.defaultPrevented && N(!m.current.open);
386
+ }
387
+ });
388
+ return /* @__PURE__ */ L(j, { children: [
389
+ D,
390
+ /* @__PURE__ */ L(
391
+ "div",
392
+ {
393
+ ref: p,
394
+ id: _,
395
+ role: "dialog",
396
+ popover: "manual",
397
+ "aria-labelledby": t ? f : void 0,
398
+ "aria-label": t ? void 0 : n,
399
+ tabIndex: -1,
400
+ className: T(Y.root, d),
401
+ "data-open": b ? "" : void 0,
402
+ "data-placement": o,
403
+ children: [
404
+ t ? /* @__PURE__ */ l("div", { id: f, className: Y.title, children: t }) : null,
405
+ b ? /* @__PURE__ */ l("div", { className: Y.body, children: s }) : null
406
+ ]
407
+ }
408
+ )
409
+ ] });
410
+ }
411
+ const Qe = "maru-Select-module__wrapper__KS2K3", Xe = "maru-Select-module__root__y0u6b", Ge = "maru-Select-module__chevron__PLUsh", J = {
412
+ wrapper: Qe,
413
+ root: Xe,
414
+ chevron: Ge
415
+ }, Dt = E(function({
272
416
  size: e = "md",
273
- invalid: o,
417
+ invalid: t,
274
418
  placeholder: n,
275
- id: t,
276
- disabled: s,
277
- required: m,
278
- value: c,
279
- defaultValue: i,
419
+ id: o,
420
+ disabled: a,
421
+ required: u,
422
+ value: i,
423
+ defaultValue: c,
280
424
  className: d,
281
425
  children: _,
282
- "aria-describedby": h,
283
- ...v
284
- }, b) {
285
- const p = oe(), y = o ?? p?.invalid ?? !1, x = s ?? p?.disabled ?? !1, f = [h, p?.describedBy].filter(Boolean).join(" ") || void 0, T = c !== void 0 ? { value: c } : { defaultValue: i ?? (n !== void 0 ? "" : void 0) };
286
- return /* @__PURE__ */ g("span", { className: V.wrapper, "data-size": e, "data-disabled": x ? "" : void 0, children: [
287
- /* @__PURE__ */ g(
426
+ "aria-describedby": f,
427
+ ...p
428
+ }, v) {
429
+ const w = me(), y = t ?? w?.invalid ?? !1, b = a ?? w?.disabled ?? !1, m = [f, w?.describedBy].filter(Boolean).join(" ") || void 0, N = i !== void 0 ? { value: i } : { defaultValue: c ?? (n !== void 0 ? "" : void 0) };
430
+ return /* @__PURE__ */ L("span", { className: J.wrapper, "data-size": e, "data-disabled": b ? "" : void 0, children: [
431
+ /* @__PURE__ */ L(
288
432
  "select",
289
433
  {
290
- ...v,
291
- ...T,
292
- ref: b,
293
- id: p?.controlId ?? t,
294
- className: N(V.root, d),
434
+ ...p,
435
+ ...N,
436
+ ref: v,
437
+ id: w?.controlId ?? o,
438
+ className: T(J.root, d),
295
439
  "data-invalid": y ? "" : void 0,
296
440
  "aria-invalid": y ? !0 : void 0,
297
- "aria-describedby": f,
298
- disabled: x,
299
- required: m ?? p?.required,
441
+ "aria-describedby": m,
442
+ disabled: b,
443
+ required: u ?? w?.required,
300
444
  children: [
301
445
  n !== void 0 ? /* @__PURE__ */ l("option", { value: "", disabled: !0, hidden: !0, children: n }) : null,
302
446
  _
303
447
  ]
304
448
  }
305
449
  ),
306
- /* @__PURE__ */ l("svg", { className: V.chevron, viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ l(
450
+ /* @__PURE__ */ l("svg", { className: J.chevron, viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ l(
307
451
  "path",
308
452
  {
309
453
  d: "M4 6l4 4 4-4",
@@ -315,349 +459,431 @@ const lt = $(function({ label: e, description: o, error: n, required: t = !1, di
315
459
  }
316
460
  ) })
317
461
  ] });
318
- }), Ve = "maru-Stack-module__root__NUN-x", je = {
319
- root: Ve
320
- }, mt = $(function({
462
+ }), et = "maru-Skeleton-module__root__qaX19", tt = {
463
+ root: et
464
+ };
465
+ function ne(s) {
466
+ return typeof s == "number" ? `${s}px` : s;
467
+ }
468
+ const Rt = E(function({ variant: e = "text", width: t, height: n, lines: o = 1, className: a, style: u, ...i }, c) {
469
+ const d = e === "text" ? Math.max(1, Math.floor(o) || 1) : 1, _ = {
470
+ "--maru-skeleton-width": ne(t),
471
+ "--maru-skeleton-height": ne(n),
472
+ ...u
473
+ };
474
+ return /* @__PURE__ */ l(
475
+ "div",
476
+ {
477
+ ...i,
478
+ ref: c,
479
+ "aria-hidden": "true",
480
+ className: T(tt.root, a),
481
+ style: _,
482
+ "data-variant": e,
483
+ "data-lines": d > 1 ? d : void 0,
484
+ children: d > 1 ? Array.from({ length: d }, (f, p) => /* @__PURE__ */ l("span", {}, p)) : null
485
+ }
486
+ );
487
+ }), ot = "maru-Stack-module__root__NUN-x", nt = {
488
+ root: ot
489
+ }, Mt = E(function({
321
490
  as: e = "div",
322
- direction: o = "vertical",
491
+ direction: t = "vertical",
323
492
  gap: n = 4,
324
- align: t,
325
- justify: s,
326
- wrap: m = !1,
327
- className: c,
328
- style: i,
493
+ align: o,
494
+ justify: a,
495
+ wrap: u = !1,
496
+ className: i,
497
+ style: c,
329
498
  ...d
330
499
  }, _) {
331
- const h = e, v = {
500
+ const f = e, p = {
332
501
  "--maru-stack-gap": `var(--maru-space-${n})`,
333
- ...i
502
+ ...c
334
503
  };
335
504
  return /* @__PURE__ */ l(
336
- h,
505
+ f,
337
506
  {
338
507
  ...d,
339
508
  ref: _,
340
- className: N(je.root, c),
341
- style: v,
342
- "data-direction": o,
343
- "data-align": t,
344
- "data-justify": s,
345
- "data-wrap": m ? "" : void 0
509
+ className: T(nt.root, i),
510
+ style: p,
511
+ "data-direction": t,
512
+ "data-align": o,
513
+ "data-justify": a,
514
+ "data-wrap": u ? "" : void 0
346
515
  }
347
516
  );
348
- }), Ke = "maru-Switch-module__root__Y5Ydi", He = "maru-Switch-module__control__HV3vX", Ue = "maru-Switch-module__input__5BPNu", We = "maru-Switch-module__track__7ObdZ", z = {
349
- root: Ke,
350
- control: He,
351
- input: Ue,
352
- track: We
353
- }, ft = $(function({ size: e = "md", disabled: o, className: n, children: t, ...s }, m) {
354
- return /* @__PURE__ */ g(
517
+ }), rt = "maru-Switch-module__root__Y5Ydi", st = "maru-Switch-module__control__HV3vX", at = "maru-Switch-module__input__5BPNu", lt = "maru-Switch-module__track__7ObdZ", K = {
518
+ root: rt,
519
+ control: st,
520
+ input: at,
521
+ track: lt
522
+ }, zt = E(function({ size: e = "md", disabled: t, className: n, children: o, ...a }, u) {
523
+ return /* @__PURE__ */ L(
355
524
  "label",
356
525
  {
357
- className: N(z.root, n),
526
+ className: T(K.root, n),
358
527
  "data-size": e,
359
- "data-disabled": o ? "" : void 0,
528
+ "data-disabled": t ? "" : void 0,
360
529
  children: [
361
- /* @__PURE__ */ g("span", { className: z.control, children: [
530
+ /* @__PURE__ */ L("span", { className: K.control, children: [
362
531
  /* @__PURE__ */ l(
363
532
  "input",
364
533
  {
365
- ...s,
366
- ref: m,
534
+ ...a,
535
+ ref: u,
367
536
  type: "checkbox",
368
537
  role: "switch",
369
- className: z.input,
370
- disabled: o
538
+ className: K.input,
539
+ disabled: t
371
540
  }
372
541
  ),
373
- /* @__PURE__ */ l("span", { className: z.track, "aria-hidden": "true" })
542
+ /* @__PURE__ */ l("span", { className: K.track, "aria-hidden": "true" })
374
543
  ] }),
375
- t ? /* @__PURE__ */ l("span", { className: z.label, children: t }) : null
544
+ o ? /* @__PURE__ */ l("span", { className: K.label, children: o }) : null
376
545
  ]
377
546
  }
378
547
  );
379
- }), ne = Q(null);
380
- function K(r) {
381
- const e = X(ne);
548
+ }), it = "maru-Table-module__wrapper__Qd7Cl", ct = "maru-Table-module__root__aMWWS", dt = "maru-Table-module__caption__9vU1I", ut = "maru-Table-module__header__5ZCAk", mt = "maru-Table-module__cell__nJrDK", ft = "maru-Table-module__body__8JxwZ", ht = "maru-Table-module__row__DD8Km", _t = "maru-Table-module__sort__Oet49", bt = "maru-Table-module__sortIcon__V3-dH", B = {
549
+ wrapper: it,
550
+ root: ct,
551
+ caption: dt,
552
+ header: ut,
553
+ cell: mt,
554
+ body: ft,
555
+ row: ht,
556
+ sort: _t,
557
+ sortIcon: bt
558
+ }, Ot = E(function({ caption: e, hideCaption: t = !1, size: n = "md", striped: o = !1, className: a, children: u, ...i }, c) {
559
+ const d = O(), _ = S(null), [f, p] = U(!1);
560
+ P(() => {
561
+ const y = _.current;
562
+ if (!y) return;
563
+ const b = () => p(y.scrollWidth > y.clientWidth);
564
+ if (b(), typeof ResizeObserver > "u")
565
+ return window.addEventListener("resize", b), () => window.removeEventListener("resize", b);
566
+ const m = new ResizeObserver(b);
567
+ return m.observe(y), y.firstElementChild && m.observe(y.firstElementChild), () => m.disconnect();
568
+ }, []);
569
+ const v = e != null && e !== !1, w = i["aria-label"];
570
+ return /* @__PURE__ */ l(
571
+ "div",
572
+ {
573
+ ref: _,
574
+ className: B.wrapper,
575
+ ...f ? {
576
+ role: "region",
577
+ tabIndex: 0,
578
+ "aria-labelledby": v ? d : void 0,
579
+ "aria-label": v ? void 0 : w
580
+ } : null,
581
+ children: /* @__PURE__ */ L(
582
+ "table",
583
+ {
584
+ ...i,
585
+ ref: c,
586
+ className: T(B.root, a),
587
+ "data-size": n,
588
+ "data-striped": o ? "" : void 0,
589
+ children: [
590
+ v ? /* @__PURE__ */ l(
591
+ "caption",
592
+ {
593
+ id: d,
594
+ className: B.caption,
595
+ "data-hidden": t ? "" : void 0,
596
+ children: e
597
+ }
598
+ ) : null,
599
+ u
600
+ ]
601
+ }
602
+ )
603
+ }
604
+ );
605
+ }), Ft = E(function({ className: e, ...t }, n) {
606
+ return /* @__PURE__ */ l("thead", { ...t, ref: n, className: T(B.head, e) });
607
+ }), Ht = E(function({ className: e, ...t }, n) {
608
+ return /* @__PURE__ */ l("tbody", { ...t, ref: n, className: T(B.body, e) });
609
+ }), At = E(function({ className: e, ...t }, n) {
610
+ return /* @__PURE__ */ l("tr", { ...t, ref: n, className: T(B.row, e) });
611
+ }), qt = E(function({ scope: e = "col", numeric: t = !1, sort: n, onSort: o, className: a, children: u, ...i }, c) {
612
+ return /* @__PURE__ */ l(
613
+ "th",
614
+ {
615
+ ...i,
616
+ ref: c,
617
+ scope: e,
618
+ "aria-sort": n,
619
+ className: T(B.header, a),
620
+ "data-numeric": t ? "" : void 0,
621
+ children: o ? /* @__PURE__ */ L("button", { type: "button", className: B.sort, onClick: o, "data-sort": n, children: [
622
+ u,
623
+ /* @__PURE__ */ l("span", { className: B.sortIcon, "aria-hidden": "true" })
624
+ ] }) : u
625
+ }
626
+ );
627
+ }), Kt = E(function({ numeric: e = !1, className: t, ...n }, o) {
628
+ return /* @__PURE__ */ l(
629
+ "td",
630
+ {
631
+ ...n,
632
+ ref: o,
633
+ className: T(B.cell, t),
634
+ "data-numeric": e ? "" : void 0
635
+ }
636
+ );
637
+ }), he = re(null);
638
+ function X(s) {
639
+ const e = se(he);
382
640
  if (!e)
383
- throw new Error(`<${r}> must be rendered inside <Tabs>.`);
641
+ throw new Error(`<${s}> must be rendered inside <Tabs>.`);
384
642
  return e;
385
643
  }
386
- function re(r, e) {
387
- return `${r}-tab-${encodeURIComponent(e)}`;
644
+ function _e(s, e) {
645
+ return `${s}-tab-${encodeURIComponent(e)}`;
388
646
  }
389
- function se(r, e) {
390
- return `${r}-panel-${encodeURIComponent(e)}`;
647
+ function be(s, e) {
648
+ return `${s}-panel-${encodeURIComponent(e)}`;
391
649
  }
392
- const Ye = "maru-Tabs-module__root__-VKVI", Ze = "maru-Tabs-module__list__qRVME", Je = "maru-Tabs-module__tab__IdDYc", Qe = "maru-Tabs-module__panel__08i9c", O = {
393
- root: Ye,
394
- list: Ze,
395
- tab: Je,
396
- panel: Qe
397
- }, ht = $(function({ value: e, className: o, onClick: n, onFocus: t, onKeyDown: s, ...m }, c) {
398
- const { baseId: i, value: d, select: _, orientation: h, activation: v } = K("Tab"), b = e === d;
399
- function p(f) {
400
- n?.(f), f.defaultPrevented || _(e);
650
+ const pt = "maru-Tabs-module__root__-VKVI", vt = "maru-Tabs-module__list__qRVME", yt = "maru-Tabs-module__tab__IdDYc", wt = "maru-Tabs-module__panel__08i9c", Z = {
651
+ root: pt,
652
+ list: vt,
653
+ tab: yt,
654
+ panel: wt
655
+ }, Wt = E(function({ value: e, className: t, onClick: n, onFocus: o, onKeyDown: a, ...u }, i) {
656
+ const { baseId: c, value: d, select: _, orientation: f, activation: p } = X("Tab"), v = e === d;
657
+ function w(m) {
658
+ n?.(m), m.defaultPrevented || _(e);
401
659
  }
402
- function y(f) {
403
- t?.(f), !f.defaultPrevented && v === "automatic" && _(e);
660
+ function y(m) {
661
+ o?.(m), !m.defaultPrevented && p === "automatic" && _(e);
404
662
  }
405
- function x(f) {
406
- if (s?.(f), f.defaultPrevented) return;
407
- const T = f.currentTarget.closest('[role="tablist"]');
408
- if (!T) return;
409
- const k = Array.from(T.querySelectorAll('[role="tab"]:not(:disabled)')), u = k.indexOf(f.currentTarget);
410
- if (u === -1) return;
411
- const w = getComputedStyle(T).direction === "rtl", P = h === "vertical" ? "ArrowUp" : w ? "ArrowRight" : "ArrowLeft", I = h === "vertical" ? "ArrowDown" : w ? "ArrowLeft" : "ArrowRight";
412
- let a;
413
- if (f.key === I)
414
- a = k[(u + 1) % k.length];
415
- else if (f.key === P)
416
- a = k[(u - 1 + k.length) % k.length];
417
- else if (f.key === "Home")
418
- a = k[0];
419
- else if (f.key === "End")
420
- a = k[k.length - 1];
663
+ function b(m) {
664
+ if (a?.(m), m.defaultPrevented) return;
665
+ const N = m.currentTarget.closest('[role="tablist"]');
666
+ if (!N) return;
667
+ const k = Array.from(N.querySelectorAll('[role="tab"]:not(:disabled)')), h = k.indexOf(m.currentTarget);
668
+ if (h === -1) return;
669
+ const x = getComputedStyle(N).direction === "rtl", R = f === "vertical" ? "ArrowUp" : x ? "ArrowRight" : "ArrowLeft", D = f === "vertical" ? "ArrowDown" : x ? "ArrowLeft" : "ArrowRight";
670
+ let r;
671
+ if (m.key === D)
672
+ r = k[(h + 1) % k.length];
673
+ else if (m.key === R)
674
+ r = k[(h - 1 + k.length) % k.length];
675
+ else if (m.key === "Home")
676
+ r = k[0];
677
+ else if (m.key === "End")
678
+ r = k[k.length - 1];
421
679
  else
422
680
  return;
423
- f.preventDefault(), a?.focus();
681
+ m.preventDefault(), r?.focus();
424
682
  }
425
683
  return /* @__PURE__ */ l(
426
684
  "button",
427
685
  {
428
- ...m,
429
- ref: c,
686
+ ...u,
687
+ ref: i,
430
688
  type: "button",
431
689
  role: "tab",
432
- id: re(i, e),
433
- "aria-selected": b,
434
- "aria-controls": se(i, e),
435
- tabIndex: b ? 0 : -1,
436
- className: N(O.tab, o),
437
- "data-selected": b ? "" : void 0,
438
- "data-orientation": h,
439
- onClick: p,
690
+ id: _e(c, e),
691
+ "aria-selected": v,
692
+ "aria-controls": be(c, e),
693
+ tabIndex: v ? 0 : -1,
694
+ className: T(Z.tab, t),
695
+ "data-selected": v ? "" : void 0,
696
+ "data-orientation": f,
697
+ onClick: w,
440
698
  onFocus: y,
441
- onKeyDown: x
699
+ onKeyDown: b
442
700
  }
443
701
  );
444
- }), _t = $(function({ className: e, ...o }, n) {
445
- const { orientation: t } = K("TabList");
702
+ }), Vt = E(function({ className: e, ...t }, n) {
703
+ const { orientation: o } = X("TabList");
446
704
  return /* @__PURE__ */ l(
447
705
  "div",
448
706
  {
449
- ...o,
707
+ ...t,
450
708
  ref: n,
451
709
  role: "tablist",
452
- "aria-orientation": t,
453
- className: N(O.list, e),
454
- "data-orientation": t
710
+ "aria-orientation": o,
711
+ className: T(Z.list, e),
712
+ "data-orientation": o
455
713
  }
456
714
  );
457
- }), bt = $(function({ value: e, keepMounted: o = !1, className: n, children: t, ...s }, m) {
458
- const { baseId: c, value: i } = K("TabPanel"), d = e === i;
715
+ }), jt = E(function({ value: e, keepMounted: t = !1, className: n, children: o, ...a }, u) {
716
+ const { baseId: i, value: c } = X("TabPanel"), d = e === c;
459
717
  return /* @__PURE__ */ l(
460
718
  "div",
461
719
  {
462
- ...s,
463
- ref: m,
720
+ ...a,
721
+ ref: u,
464
722
  role: "tabpanel",
465
- id: se(c, e),
466
- "aria-labelledby": re(c, e),
723
+ id: be(i, e),
724
+ "aria-labelledby": _e(i, e),
467
725
  tabIndex: 0,
468
726
  hidden: !d,
469
- className: N(O.panel, n),
470
- children: d || o ? t : null
727
+ className: T(Z.panel, n),
728
+ children: d || t ? o : null
471
729
  }
472
730
  );
473
- }), pt = $(function({
731
+ }), Ut = E(function({
474
732
  value: e,
475
- defaultValue: o,
733
+ defaultValue: t,
476
734
  onValueChange: n,
477
- orientation: t = "horizontal",
478
- activation: s = "automatic",
479
- className: m,
480
- children: c,
481
- ...i
735
+ orientation: o = "horizontal",
736
+ activation: a = "automatic",
737
+ className: u,
738
+ children: i,
739
+ ...c
482
740
  }, d) {
483
- const _ = A(), [h, v] = G(o ?? ""), b = e !== void 0, p = b ? e : h, y = j(
484
- (f) => {
485
- f !== p && (b || v(f), n?.(f));
741
+ const _ = O(), [f, p] = U(t ?? ""), v = e !== void 0, w = v ? e : f, y = Q(
742
+ (m) => {
743
+ m !== w && (v || p(m), n?.(m));
486
744
  },
487
- [p, b, n]
488
- ), x = ce(
489
- () => ({ baseId: _, value: p, select: y, orientation: t, activation: s }),
490
- [_, p, y, t, s]
745
+ [w, v, n]
746
+ ), b = ye(
747
+ () => ({ baseId: _, value: w, select: y, orientation: o, activation: a }),
748
+ [_, w, y, o, a]
491
749
  );
492
- return /* @__PURE__ */ l(ne.Provider, { value: x, children: /* @__PURE__ */ l(
750
+ return /* @__PURE__ */ l(he.Provider, { value: b, children: /* @__PURE__ */ l(
493
751
  "div",
494
752
  {
495
- ...i,
753
+ ...c,
496
754
  ref: d,
497
- className: N(O.root, m),
498
- "data-orientation": t,
499
- children: c
755
+ className: T(Z.root, u),
756
+ "data-orientation": o,
757
+ children: i
500
758
  }
501
759
  ) });
502
- }), Xe = "maru-Text-module__root__rsBo7", Ge = {
503
- root: Xe
504
- }, vt = $(function({ as: e = "p", size: o = "md", tone: n = "default", weight: t = "regular", className: s, ...m }, c) {
760
+ }), Tt = "maru-Text-module__root__rsBo7", xt = {
761
+ root: Tt
762
+ }, Zt = E(function({ as: e = "p", size: t = "md", tone: n = "default", weight: o = "regular", className: a, ...u }, i) {
505
763
  return /* @__PURE__ */ l(
506
764
  e,
507
765
  {
508
- ...m,
509
- ref: c,
510
- className: N(Ge.root, s),
511
- "data-size": o,
766
+ ...u,
767
+ ref: i,
768
+ className: T(xt.root, a),
769
+ "data-size": t,
512
770
  "data-tone": n,
513
- "data-weight": t
771
+ "data-weight": o
514
772
  }
515
773
  );
516
- }), J = {
517
- top: "bottom",
518
- bottom: "top",
519
- left: "right",
520
- right: "left"
521
- };
522
- function et(r, e, o, n, t = 8, s = 8) {
523
- const m = {
524
- top: r.top - t - e.height >= s,
525
- bottom: r.bottom + t + e.height <= o.height - s,
526
- left: r.left - t - e.width >= s,
527
- right: r.right + t + e.width <= o.width - s
528
- }, c = !m[n] && m[J[n]] ? J[n] : n, i = (h, v, b) => Math.max(s, Math.min(h, b - s - v)), d = (r.left + r.right) / 2 - e.width / 2, _ = (r.top + r.bottom) / 2 - e.height / 2;
529
- switch (c) {
530
- case "top":
531
- return {
532
- side: c,
533
- x: i(d, e.width, o.width),
534
- y: r.top - t - e.height
535
- };
536
- case "bottom":
537
- return {
538
- side: c,
539
- x: i(d, e.width, o.width),
540
- y: r.bottom + t
541
- };
542
- case "left":
543
- return {
544
- side: c,
545
- x: r.left - t - e.width,
546
- y: i(_, e.height, o.height)
547
- };
548
- case "right":
549
- return {
550
- side: c,
551
- x: r.right + t,
552
- y: i(_, e.height, o.height)
553
- };
554
- }
555
- }
556
- const tt = "maru-Tooltip-module__root__U84l8", ot = {
557
- root: tt
558
- }, nt = typeof document > "u" ? D : ue;
559
- function yt({
560
- content: r,
774
+ }), Et = "maru-Tooltip-module__root__U84l8", kt = {
775
+ root: Et
776
+ }, Nt = typeof document > "u" ? P : ce;
777
+ function Yt({
778
+ content: s,
561
779
  children: e,
562
- placement: o = "top",
780
+ placement: t = "top",
563
781
  openDelay: n = 300,
564
- closeDelay: t = 100,
565
- disabled: s = !1,
566
- className: m
782
+ closeDelay: o = 100,
783
+ disabled: a = !1,
784
+ className: u
567
785
  }) {
568
- const c = A(), [i, d] = G(!1), _ = L(null), h = L(null), v = L(void 0), b = () => {
569
- clearTimeout(v.current), v.current = void 0;
570
- }, p = (u, w) => {
571
- _.current = u, b(), w > 0 ? v.current = setTimeout(() => d(!0), w) : d(!0);
572
- }, y = (u) => {
573
- b(), u > 0 ? v.current = setTimeout(() => d(!1), u) : d(!1);
786
+ const i = O(), [c, d] = U(!1), _ = S(null), f = S(null), p = S(void 0), v = () => {
787
+ clearTimeout(p.current), p.current = void 0;
788
+ }, w = (h, x) => {
789
+ _.current = h, v(), x > 0 ? p.current = setTimeout(() => d(!0), x) : d(!0);
790
+ }, y = (h) => {
791
+ v(), h > 0 ? p.current = setTimeout(() => d(!1), h) : d(!1);
574
792
  };
575
- D(() => b, []), D(() => {
576
- s && (b(), d(!1));
577
- }, [s]), nt(() => {
578
- const u = h.current;
579
- if (!u || !i) return;
580
- const w = () => {
581
- const a = _.current;
582
- if (!a) return;
583
- const { x: B, y: E, side: S } = et(
584
- a.getBoundingClientRect(),
585
- { width: u.offsetWidth, height: u.offsetHeight },
793
+ P(() => v, []), P(() => {
794
+ a && (v(), d(!1));
795
+ }, [a]), Nt(() => {
796
+ const h = f.current;
797
+ if (!h || !c) return;
798
+ const x = () => {
799
+ const r = _.current;
800
+ if (!r) return;
801
+ const { x: $, y: C, side: I } = fe(
802
+ r.getBoundingClientRect(),
803
+ { width: h.offsetWidth, height: h.offsetHeight },
586
804
  {
587
805
  width: document.documentElement.clientWidth,
588
806
  height: document.documentElement.clientHeight
589
807
  },
590
- o
808
+ t
591
809
  );
592
- u.style.left = `${B}px`, u.style.top = `${E}px`, u.dataset.placement = S;
810
+ h.style.left = `${$}px`, h.style.top = `${C}px`, h.dataset.placement = I;
593
811
  };
594
- let P = !1;
595
- typeof u.showPopover == "function" && (u.showPopover(), P = !0), w();
596
- const I = (a) => {
597
- a.key === "Escape" && (a.preventDefault(), a.stopPropagation(), d(!1));
812
+ let R = !1;
813
+ typeof h.showPopover == "function" && (h.showPopover(), R = !0), x();
814
+ const D = (r) => {
815
+ r.key === "Escape" && (r.preventDefault(), r.stopPropagation(), d(!1));
598
816
  };
599
- return window.addEventListener("scroll", w, !0), window.addEventListener("resize", w), document.addEventListener("keydown", I, !0), () => {
600
- window.removeEventListener("scroll", w, !0), window.removeEventListener("resize", w), document.removeEventListener("keydown", I, !0), P && u.hidePopover();
817
+ return window.addEventListener("scroll", x, !0), window.addEventListener("resize", x), document.addEventListener("keydown", D, !0), () => {
818
+ window.removeEventListener("scroll", x, !0), window.removeEventListener("resize", x), document.removeEventListener("keydown", D, !0), R && h.hidePopover();
601
819
  };
602
- }, [i, o]);
603
- const x = ie.only(e);
604
- if (!le(x)) return /* @__PURE__ */ l(W, { children: e });
605
- if (s) return x;
606
- const f = x.props, T = [f["aria-describedby"], c].filter(Boolean).join(" "), k = de(x, {
607
- "aria-describedby": T,
608
- onMouseEnter: (u) => {
609
- f.onMouseEnter?.(u), p(u.currentTarget, n);
820
+ }, [c, t]);
821
+ const b = ae.only(e);
822
+ if (!le(b)) return /* @__PURE__ */ l(j, { children: e });
823
+ if (a) return b;
824
+ const m = b.props, N = [m["aria-describedby"], i].filter(Boolean).join(" "), k = ie(b, {
825
+ "aria-describedby": N,
826
+ onMouseEnter: (h) => {
827
+ m.onMouseEnter?.(h), w(h.currentTarget, n);
610
828
  },
611
- onMouseLeave: (u) => {
612
- f.onMouseLeave?.(u), y(t);
829
+ onMouseLeave: (h) => {
830
+ m.onMouseLeave?.(h), y(o);
613
831
  },
614
- onFocus: (u) => {
615
- f.onFocus?.(u);
616
- let w = !0;
832
+ onFocus: (h) => {
833
+ m.onFocus?.(h);
834
+ let x = !0;
617
835
  try {
618
- w = u.currentTarget.matches(":focus-visible");
836
+ x = h.currentTarget.matches(":focus-visible");
619
837
  } catch {
620
838
  }
621
- w && p(u.currentTarget, 0);
839
+ x && w(h.currentTarget, 0);
622
840
  },
623
- onBlur: (u) => {
624
- f.onBlur?.(u), y(0);
841
+ onBlur: (h) => {
842
+ m.onBlur?.(h), y(0);
625
843
  }
626
844
  });
627
- return /* @__PURE__ */ g(W, { children: [
845
+ return /* @__PURE__ */ L(j, { children: [
628
846
  k,
629
847
  /* @__PURE__ */ l(
630
848
  "span",
631
849
  {
632
- ref: h,
633
- id: c,
850
+ ref: f,
851
+ id: i,
634
852
  role: "tooltip",
635
853
  popover: "manual",
636
- className: N(ot.root, m),
637
- "data-open": i ? "" : void 0,
638
- "data-placement": o,
639
- onMouseEnter: b,
640
- onMouseLeave: () => y(t),
641
- children: r
854
+ className: T(kt.root, u),
855
+ "data-open": c ? "" : void 0,
856
+ "data-placement": t,
857
+ onMouseEnter: v,
858
+ onMouseLeave: () => y(o),
859
+ children: s
642
860
  }
643
861
  )
644
862
  ] });
645
863
  }
646
864
  export {
647
- at as Button,
648
- ct as Checkbox,
649
- it as Dialog,
650
- lt as Field,
651
- xe as Heading,
652
- dt as Input,
653
- ut as Select,
654
- mt as Stack,
655
- ft as Switch,
656
- ht as Tab,
657
- _t as TabList,
658
- bt as TabPanel,
659
- pt as Tabs,
660
- vt as Text,
661
- yt as Tooltip
865
+ Lt as Button,
866
+ Ct as Checkbox,
867
+ It as Dialog,
868
+ St as Field,
869
+ Ce as Heading,
870
+ Pt as Input,
871
+ Bt as Popover,
872
+ Dt as Select,
873
+ Rt as Skeleton,
874
+ Mt as Stack,
875
+ zt as Switch,
876
+ Wt as Tab,
877
+ Vt as TabList,
878
+ jt as TabPanel,
879
+ Ot as Table,
880
+ Ht as TableBody,
881
+ Kt as TableCell,
882
+ Ft as TableHead,
883
+ qt as TableHeader,
884
+ At as TableRow,
885
+ Ut as Tabs,
886
+ Zt as Text,
887
+ Yt as Tooltip
662
888
  };
663
889
  //# sourceMappingURL=index.js.map