@facto-to/design-system 0.1.0-beta.3 → 0.1.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,66 +1,89 @@
1
1
  "use client";
2
- import { jsxs as d, jsx as a } from "react/jsx-runtime";
3
- import * as P from "@radix-ui/react-tooltip";
4
- import * as p from "@radix-ui/react-toast";
5
- import { createPortal as G } from "react-dom";
6
- import * as A from "@radix-ui/react-checkbox";
7
- import * as u from "@radix-ui/react-dialog";
8
- import * as g from "@radix-ui/react-select";
9
- import * as E from "@radix-ui/react-switch";
10
- import * as R from "@radix-ui/react-tabs";
11
- import { createContext as K, forwardRef as M, useId as I, useContext as _, useState as O, useRef as V, useEffect as W, useCallback as L } from "react";
12
- const x = /* @__PURE__ */ new WeakMap();
13
- function z(t) {
2
+ import { jsxs as d, jsx as a, Fragment as H } from "react/jsx-runtime";
3
+ import * as x from "@radix-ui/react-tooltip";
4
+ import * as y from "@radix-ui/react-toast";
5
+ import { createPortal as K } from "react-dom";
6
+ import * as z from "@radix-ui/react-checkbox";
7
+ import * as m from "@radix-ui/react-dialog";
8
+ import * as v from "@radix-ui/react-select";
9
+ import * as V from "@radix-ui/react-switch";
10
+ import * as M from "@radix-ui/react-tabs";
11
+ import { createContext as Z, forwardRef as L, useRef as j, useState as A, useCallback as O, useEffect as W, useId as S, useContext as T } from "react";
12
+ const F = /* @__PURE__ */ new WeakMap();
13
+ function J(t) {
14
14
  const e = Array.from(t.ownerDocument.body.children).filter(
15
- (n) => n instanceof HTMLElement && !n.hasAttribute("data-radix-focus-guard") && !n.contains(t)
15
+ (o) => o instanceof HTMLElement && !o.hasAttribute("data-radix-focus-guard") && !o.contains(t)
16
16
  );
17
- for (const n of e) {
18
- const c = x.get(n);
19
- c ? c.count += 1 : (x.set(n, { count: 1, wasInert: n.inert }), n.inert = !0);
17
+ for (const o of e) {
18
+ const c = F.get(o);
19
+ c ? c.count += 1 : (F.set(o, { count: 1, wasInert: o.inert }), o.inert = !0);
20
20
  }
21
- let o = !0;
21
+ let n = !0;
22
22
  return () => {
23
- if (o) {
24
- o = !1;
25
- for (const n of e) {
26
- const c = x.get(n);
27
- c && (c.count -= 1, c.count === 0 && (c.wasInert || (n.inert = !1), x.delete(n)));
23
+ if (n) {
24
+ n = !1;
25
+ for (const o of e) {
26
+ const c = F.get(o);
27
+ c && (c.count -= 1, c.count === 0 && (c.wasInert || (o.inert = !1), F.delete(o)));
28
28
  }
29
29
  }
30
30
  };
31
31
  }
32
- const s = (...t) => t.filter(Boolean).join(" "), w = (...t) => t.filter(Boolean).join(" ") || void 0, v = K({}), J = (t) => Object.fromEntries(
33
- Object.entries(t ?? {}).filter(([e, o]) => e.startsWith("--facto-") && o !== void 0 && o !== null)
32
+ const s = (...t) => t.filter(Boolean).join(" "), D = (...t) => t.filter(Boolean).join(" ") || void 0, k = Z({}), Q = (t) => Object.fromEntries(
33
+ Object.entries(t ?? {}).filter(([e, n]) => e.startsWith("--facto-") && n !== void 0 && n !== null)
34
34
  );
35
- function Z({ className: t, tokens: e, style: o, ...n }) {
36
- const c = _(v), i = { ...e, ...o }, r = { ...c, ...J(i) };
37
- return /* @__PURE__ */ a(v.Provider, { value: r, children: /* @__PURE__ */ a("div", { ...n, style: i, className: s("facto-theme", t) }) });
35
+ function nt({ className: t, tokens: e, style: n, ...o }) {
36
+ const c = T(k), i = { ...e, ...n }, r = { ...c, ...Q(i) };
37
+ return /* @__PURE__ */ a(k.Provider, { value: r, children: /* @__PURE__ */ a("div", { ...o, style: i, className: s("facto-theme", t) }) });
38
+ }
39
+ function B({ name: t, size: e = 20, ...n }) {
40
+ return /* @__PURE__ */ a("svg", { width: e, height: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", focusable: "false", ...n, children: {
41
+ close: /* @__PURE__ */ a("path", { d: "m6 6 12 12M18 6 6 18" }),
42
+ arrowLeft: /* @__PURE__ */ a("path", { d: "m12 5-7 7 7 7M5 12h14" }),
43
+ check: /* @__PURE__ */ a("path", { d: "m5 12 4 4L19 6" }),
44
+ chevronDown: /* @__PURE__ */ a("path", { d: "m6 9 6 6 6-6" }),
45
+ chevronRight: /* @__PURE__ */ a("path", { d: "m9 6 6 6-6 6" }),
46
+ info: /* @__PURE__ */ d(H, { children: [
47
+ /* @__PURE__ */ a("circle", { cx: "12", cy: "12", r: "9" }),
48
+ /* @__PURE__ */ a("path", { d: "M12 11v6M12 7v1" })
49
+ ] }),
50
+ warning: /* @__PURE__ */ d(H, { children: [
51
+ /* @__PURE__ */ a("path", { d: "m12 3 10 18H2L12 3Z" }),
52
+ /* @__PURE__ */ a("path", { d: "M12 9v5M12 17v1" })
53
+ ] })
54
+ }[t] });
55
+ }
56
+ function ot({ className: t, ...e }) {
57
+ return /* @__PURE__ */ a("div", { ...e, className: s("facto-modal-header", t) });
58
+ }
59
+ function ct({ className: t, ...e }) {
60
+ return /* @__PURE__ */ a("div", { ...e, className: s("facto-modal-footer", t) });
38
61
  }
39
- const tt = M(
62
+ const it = L(
40
63
  function({
41
64
  variant: e = "primary",
42
- size: o = "md",
43
- fullWidth: n,
65
+ size: n = "md",
66
+ fullWidth: o,
44
67
  loading: c,
45
68
  className: i,
46
69
  children: r,
47
70
  disabled: f,
48
71
  type: l = "button",
49
- ...m
50
- }, y) {
72
+ ...h
73
+ }, u) {
51
74
  return /* @__PURE__ */ d(
52
75
  "button",
53
76
  {
54
- ...m,
55
- ref: y,
77
+ ...h,
78
+ ref: u,
56
79
  type: l,
57
80
  disabled: f || c,
58
81
  "aria-busy": c || void 0,
59
82
  className: s(
60
83
  "facto-button",
61
84
  `facto-button--${e}`,
62
- `facto-button--${o}`,
63
- n && "facto-button--full",
85
+ `facto-button--${n}`,
86
+ o && "facto-button--full",
64
87
  i
65
88
  ),
66
89
  children: [
@@ -70,30 +93,31 @@ const tt = M(
70
93
  }
71
94
  );
72
95
  }
73
- ), et = M(
74
- function({ ariaLabel: e, size: o = "md", className: n, title: c, type: i = "button", ...r }, f) {
96
+ ), st = L(
97
+ function({ ariaLabel: e, size: n = "md", className: o, title: c, type: i = "button", children: r, ...f }, l) {
75
98
  return /* @__PURE__ */ a(
76
99
  "button",
77
100
  {
78
- ...r,
79
- ref: f,
101
+ ...f,
102
+ ref: l,
80
103
  type: i,
81
104
  "aria-label": e,
82
105
  title: c ?? e,
83
106
  className: s(
84
107
  "facto-icon-button",
85
- `facto-icon-button--${o}`,
86
- n
87
- )
108
+ `facto-icon-button--${n}`,
109
+ o
110
+ ),
111
+ children: /* @__PURE__ */ a("span", { className: "facto-icon-button__visual", children: r })
88
112
  }
89
113
  );
90
114
  }
91
115
  );
92
- function H({ padding: t = "lg", className: e, ...o }) {
116
+ function q({ padding: t = "lg", className: e, ...n }) {
93
117
  return /* @__PURE__ */ a(
94
118
  "div",
95
119
  {
96
- ...o,
120
+ ...n,
97
121
  className: s(
98
122
  "facto-surface",
99
123
  `facto-surface--padding-${t}`,
@@ -102,14 +126,14 @@ function H({ padding: t = "lg", className: e, ...o }) {
102
126
  }
103
127
  );
104
128
  }
105
- function at(t) {
106
- return /* @__PURE__ */ a(H, { ...t });
129
+ function rt(t) {
130
+ return /* @__PURE__ */ a(q, { ...t });
107
131
  }
108
- function ot({ span: t = 1, className: e, ...o }) {
132
+ function lt({ span: t = 1, className: e, ...n }) {
109
133
  return /* @__PURE__ */ a(
110
- H,
134
+ q,
111
135
  {
112
- ...o,
136
+ ...n,
113
137
  padding: "md",
114
138
  className: s(
115
139
  "facto-widget",
@@ -119,60 +143,60 @@ function ot({ span: t = 1, className: e, ...o }) {
119
143
  }
120
144
  );
121
145
  }
122
- function nt({ className: t, children: e, ...o }) {
123
- return /* @__PURE__ */ a("div", { ...o, className: s("facto-dashboard-container", t), children: /* @__PURE__ */ a("div", { className: "facto-dashboard-grid", children: e }) });
146
+ function dt({ className: t, children: e, ...n }) {
147
+ return /* @__PURE__ */ a("div", { ...n, className: s("facto-dashboard-container", t), children: /* @__PURE__ */ a("div", { className: "facto-dashboard-grid", children: e }) });
124
148
  }
125
- function ct({ withAction: t, className: e, ...o }) {
149
+ function ft({ withAction: t, className: e, ...n }) {
126
150
  return /* @__PURE__ */ a(
127
151
  "div",
128
152
  {
129
- ...o,
153
+ ...n,
130
154
  className: s("facto-widget-head", t && "facto-widget-head--with-action", e)
131
155
  }
132
156
  );
133
157
  }
134
- function it({ className: t, ...e }) {
158
+ function ut({ className: t, ...e }) {
135
159
  return /* @__PURE__ */ a("div", { ...e, className: s("facto-widget-list", t) });
136
160
  }
137
- function st({ className: t, ...e }) {
161
+ function mt({ className: t, ...e }) {
138
162
  return /* @__PURE__ */ a("div", { ...e, className: s("facto-widget-kv", t) });
139
163
  }
140
- function rt({ className: t, ...e }) {
164
+ function ht({ className: t, ...e }) {
141
165
  return /* @__PURE__ */ a("div", { ...e, className: s("facto-widget-amount", t) });
142
166
  }
143
- function lt(t) {
167
+ function gt(t) {
144
168
  const e = s("facto-widget-action", t.dark && "facto-widget-action--dark", t.className);
145
169
  if (typeof t.href == "string") {
146
170
  const { dark: r, className: f, ...l } = t;
147
171
  return /* @__PURE__ */ a("a", { ...l, className: e });
148
172
  }
149
- const { dark: o, className: n, type: c = "button", ...i } = t;
173
+ const { dark: n, className: o, type: c = "button", ...i } = t;
150
174
  return /* @__PURE__ */ a("button", { ...i, type: c, className: e });
151
175
  }
152
- function dt({
176
+ function bt({
153
177
  className: t,
154
178
  type: e = "button",
155
- ...o
179
+ ...n
156
180
  }) {
157
181
  return /* @__PURE__ */ a(
158
182
  "button",
159
183
  {
160
- ...o,
184
+ ...n,
161
185
  type: e,
162
186
  className: s("facto-widget-row", t)
163
187
  }
164
188
  );
165
189
  }
166
- function Q({
190
+ function U({
167
191
  label: t,
168
192
  helperText: e,
169
- error: o,
170
- id: n,
193
+ error: n,
194
+ id: o,
171
195
  containerClassName: c,
172
196
  className: i,
173
197
  ...r
174
198
  }) {
175
- const f = I(), l = n ?? f, m = o || e ? `${l}-description` : void 0;
199
+ const f = S(), l = o ?? f, h = n || e ? `${l}-description` : void 0;
176
200
  return /* @__PURE__ */ d("div", { className: s("facto-field", c), children: [
177
201
  t && /* @__PURE__ */ a("label", { className: "facto-field__label", htmlFor: l, children: t }),
178
202
  /* @__PURE__ */ a(
@@ -180,38 +204,38 @@ function Q({
180
204
  {
181
205
  ...r,
182
206
  id: l,
183
- "aria-invalid": !!o || r["aria-invalid"],
184
- "aria-describedby": w(r["aria-describedby"], m),
207
+ "aria-invalid": !!n || r["aria-invalid"],
208
+ "aria-describedby": D(r["aria-describedby"], h),
185
209
  className: s(
186
210
  "facto-input",
187
- !!o && "facto-input--error",
211
+ !!n && "facto-input--error",
188
212
  i
189
213
  )
190
214
  }
191
215
  ),
192
- (o || e) && /* @__PURE__ */ a(
216
+ (n || e) && /* @__PURE__ */ a(
193
217
  "span",
194
218
  {
195
- id: m,
219
+ id: h,
196
220
  className: s(
197
221
  "facto-field__message",
198
- !!o && "facto-field__message--error"
222
+ !!n && "facto-field__message--error"
199
223
  ),
200
- children: o ?? e
224
+ children: n ?? e
201
225
  }
202
226
  )
203
227
  ] });
204
228
  }
205
- function ft({
229
+ function vt({
206
230
  label: t,
207
231
  helperText: e,
208
- error: o,
209
- id: n,
232
+ error: n,
233
+ id: o,
210
234
  containerClassName: c,
211
235
  className: i,
212
236
  ...r
213
237
  }) {
214
- const f = I(), l = n ?? f, m = o || e ? `${l}-description` : void 0;
238
+ const f = S(), l = o ?? f, h = n || e ? `${l}-description` : void 0;
215
239
  return /* @__PURE__ */ d("div", { className: s("facto-field", c), children: [
216
240
  t && /* @__PURE__ */ a("label", { className: "facto-field__label", htmlFor: l, children: t }),
217
241
  /* @__PURE__ */ a(
@@ -219,105 +243,109 @@ function ft({
219
243
  {
220
244
  ...r,
221
245
  id: l,
222
- "aria-invalid": !!o || r["aria-invalid"],
223
- "aria-describedby": w(r["aria-describedby"], m),
246
+ "aria-invalid": !!n || r["aria-invalid"],
247
+ "aria-describedby": D(r["aria-describedby"], h),
224
248
  className: s(
225
249
  "facto-textarea",
226
- !!o && "facto-input--error",
250
+ !!n && "facto-input--error",
227
251
  i
228
252
  )
229
253
  }
230
254
  ),
231
- (o || e) && /* @__PURE__ */ a(
255
+ (n || e) && /* @__PURE__ */ a(
232
256
  "span",
233
257
  {
234
- id: m,
258
+ id: h,
235
259
  className: s(
236
260
  "facto-field__message",
237
- !!o && "facto-field__message--error"
261
+ !!n && "facto-field__message--error"
238
262
  ),
239
- children: o ?? e
263
+ children: n ?? e
240
264
  }
241
265
  )
242
266
  ] });
243
267
  }
244
- function ut({ tone: t = "neutral", className: e, ...o }) {
268
+ function Nt({ tone: t = "neutral", className: e, ...n }) {
245
269
  return /* @__PURE__ */ a(
246
270
  "span",
247
271
  {
248
- ...o,
272
+ ...n,
249
273
  className: s("facto-badge", `facto-badge--${t}`, e)
250
274
  }
251
275
  );
252
276
  }
253
- function mt({
277
+ function pt({
254
278
  options: t,
255
279
  value: e,
256
- defaultValue: o,
257
- onValueChange: n,
280
+ defaultValue: n,
281
+ onValueChange: o,
258
282
  placeholder: c = "Select an option",
259
283
  label: i,
260
284
  error: r,
261
285
  disabled: f,
262
286
  name: l,
263
- id: m,
264
- ariaLabel: y,
265
- "aria-describedby": $,
266
- className: C
287
+ id: h,
288
+ ariaLabel: u,
289
+ "aria-describedby": g,
290
+ className: N
267
291
  }) {
268
- const F = _(v), B = I(), k = m ?? B, D = r ? `${k}-description` : void 0, T = V(null), b = L(() => {
269
- T.current?.(), T.current = null;
270
- }, []), S = L(
271
- (h) => {
272
- b(), h && (T.current = z(h));
292
+ const w = T(k), P = S(), I = h ?? P, R = r ? `${I}-description` : void 0, C = j(null), p = O(() => {
293
+ C.current?.(), C.current = null;
294
+ }, []), $ = O(
295
+ (b) => {
296
+ p(), b && (C.current = J(b));
273
297
  },
274
- [b]
298
+ [p]
275
299
  );
276
- return W(() => b, [b]), /* @__PURE__ */ d("div", { className: s("facto-field", C), children: [
277
- i && /* @__PURE__ */ a("label", { className: "facto-field__label", htmlFor: k, children: i }),
300
+ return W(() => p, [p]), /* @__PURE__ */ d("div", { className: s("facto-field", N), children: [
301
+ i && /* @__PURE__ */ a("label", { className: "facto-field__label", htmlFor: I, children: i }),
278
302
  /* @__PURE__ */ d(
279
- g.Root,
303
+ v.Root,
280
304
  {
281
305
  value: e,
282
- defaultValue: o,
283
- onValueChange: n,
306
+ defaultValue: n,
307
+ onValueChange: o,
284
308
  disabled: f,
285
309
  name: l,
286
310
  children: [
287
311
  /* @__PURE__ */ d(
288
- g.Trigger,
312
+ v.Trigger,
289
313
  {
290
- id: k,
314
+ id: I,
291
315
  className: s("facto-select", !!r && "facto-input--error"),
292
- "aria-label": y,
293
- "aria-describedby": w($, D),
316
+ "aria-label": u,
317
+ "aria-describedby": D(g, R),
294
318
  "aria-invalid": !!r,
295
319
  children: [
296
- /* @__PURE__ */ a(g.Value, { placeholder: c }),
297
- /* @__PURE__ */ a(g.Icon, { className: "facto-select__chevron", children: "⌄" })
320
+ /* @__PURE__ */ a(v.Value, { placeholder: c }),
321
+ /* @__PURE__ */ a(v.Icon, { className: "facto-select__chevron", children: /* @__PURE__ */ a(B, { name: "chevronDown", size: 16 }) })
298
322
  ]
299
323
  }
300
324
  ),
301
- /* @__PURE__ */ a(g.Portal, { children: /* @__PURE__ */ a(
302
- g.Content,
325
+ /* @__PURE__ */ a(v.Portal, { children: /* @__PURE__ */ a(
326
+ v.Content,
303
327
  {
304
- ref: S,
328
+ ref: $,
305
329
  className: "facto-theme facto-select-content",
306
- style: F,
330
+ style: w,
307
331
  position: "popper",
308
- onCloseAutoFocus: b,
309
- children: /* @__PURE__ */ a(g.Viewport, { children: t.map((h) => /* @__PURE__ */ d(
310
- g.Item,
332
+ side: "bottom",
333
+ align: "start",
334
+ sideOffset: 8,
335
+ collisionPadding: 16,
336
+ onCloseAutoFocus: p,
337
+ children: /* @__PURE__ */ a(v.Viewport, { children: t.map((b) => /* @__PURE__ */ d(
338
+ v.Item,
311
339
  {
312
- value: h.value,
313
- disabled: h.disabled,
340
+ value: b.value,
341
+ disabled: b.disabled,
314
342
  className: "facto-select-item",
315
343
  children: [
316
- /* @__PURE__ */ a(g.ItemText, { children: h.label }),
317
- /* @__PURE__ */ a(g.ItemIndicator, { children: "✓" })
344
+ /* @__PURE__ */ a(v.ItemText, { children: b.label }),
345
+ /* @__PURE__ */ a(v.ItemIndicator, { children: /* @__PURE__ */ a(B, { name: "check", size: 16 }) })
318
346
  ]
319
347
  },
320
- h.value
348
+ b.value
321
349
  )) })
322
350
  }
323
351
  ) })
@@ -327,28 +355,28 @@ function mt({
327
355
  r && /* @__PURE__ */ a(
328
356
  "span",
329
357
  {
330
- id: D,
358
+ id: R,
331
359
  className: "facto-field__message facto-field__message--error",
332
360
  children: r
333
361
  }
334
362
  )
335
363
  ] });
336
364
  }
337
- function ht({
365
+ function _t({
338
366
  label: t,
339
367
  description: e,
340
- className: o,
341
- id: n,
368
+ className: n,
369
+ id: o,
342
370
  ...c
343
371
  }) {
344
- const i = I(), r = n ?? i, f = e ? `${r}-description` : void 0, l = /* @__PURE__ */ a(
345
- E.Root,
372
+ const i = S(), r = o ?? i, f = e ? `${r}-description` : void 0, l = /* @__PURE__ */ a(
373
+ V.Root,
346
374
  {
347
375
  ...c,
348
376
  id: r,
349
- "aria-describedby": w(c["aria-describedby"], f),
350
- className: s("facto-switch", o),
351
- children: /* @__PURE__ */ a(E.Thumb, { className: "facto-switch__thumb" })
377
+ "aria-describedby": D(c["aria-describedby"], f),
378
+ className: s("facto-switch", n),
379
+ children: /* @__PURE__ */ a("span", { className: "facto-switch__track", "aria-hidden": "true", children: /* @__PURE__ */ a(V.Thumb, { className: "facto-switch__thumb" }) })
352
380
  }
353
381
  );
354
382
  return t ? /* @__PURE__ */ d("div", { className: "facto-check-field", children: [
@@ -359,21 +387,21 @@ function ht({
359
387
  ] })
360
388
  ] }) : l;
361
389
  }
362
- function gt({
390
+ function kt({
363
391
  label: t,
364
392
  description: e,
365
- className: o,
366
- id: n,
393
+ className: n,
394
+ id: o,
367
395
  ...c
368
396
  }) {
369
- const i = I(), r = n ?? i, f = e ? `${r}-description` : void 0, l = /* @__PURE__ */ a(
370
- A.Root,
397
+ const i = S(), r = o ?? i, f = e ? `${r}-description` : void 0, l = /* @__PURE__ */ a(
398
+ z.Root,
371
399
  {
372
400
  ...c,
373
401
  id: r,
374
- "aria-describedby": w(c["aria-describedby"], f),
375
- className: s("facto-checkbox", o),
376
- children: /* @__PURE__ */ a(A.Indicator, { className: "facto-checkbox__indicator", children: "✓" })
402
+ "aria-describedby": D(c["aria-describedby"], f),
403
+ className: s("facto-checkbox", n),
404
+ children: /* @__PURE__ */ a("span", { className: "facto-checkbox__visual", "aria-hidden": "true", children: /* @__PURE__ */ a(z.Indicator, { className: "facto-checkbox__indicator", children: /* @__PURE__ */ a(B, { name: "check", size: 16 }) }) })
377
405
  }
378
406
  );
379
407
  return t ? /* @__PURE__ */ d("div", { className: "facto-check-field", children: [
@@ -384,102 +412,126 @@ function gt({
384
412
  ] })
385
413
  ] }) : l;
386
414
  }
387
- const bt = R.Root;
388
- function Nt({
415
+ const yt = M.Root;
416
+ function Tt({
389
417
  className: t,
390
418
  ...e
391
419
  }) {
392
420
  return /* @__PURE__ */ a(
393
- R.List,
421
+ M.List,
394
422
  {
395
423
  ...e,
396
424
  className: s("facto-tabs-list", t)
397
425
  }
398
426
  );
399
427
  }
400
- function vt({
428
+ function wt({
401
429
  className: t,
402
430
  ...e
403
431
  }) {
404
432
  return /* @__PURE__ */ a(
405
- R.Trigger,
433
+ M.Trigger,
406
434
  {
407
435
  ...e,
408
436
  className: s("facto-tabs-trigger", t)
409
437
  }
410
438
  );
411
439
  }
412
- function pt({
440
+ function It({
413
441
  className: t,
414
442
  ...e
415
443
  }) {
416
444
  return /* @__PURE__ */ a(
417
- R.Content,
445
+ M.Content,
418
446
  {
419
447
  ...e,
420
448
  className: s("facto-tabs-content", t)
421
449
  }
422
450
  );
423
451
  }
424
- const _t = u.Root, yt = u.Trigger, kt = u.Close, Tt = u.Title, It = u.Description;
425
- function wt({
426
- size: t = "md",
452
+ const Ct = m.Root, Bt = m.Trigger, St = m.Close, X = L(
453
+ function({ className: e, children: n, tabIndex: o, ...c }, i) {
454
+ const r = j(null), [f, l] = A(!1), h = O((u) => {
455
+ if (r.current = u, typeof i == "function") {
456
+ const g = i(u);
457
+ if (typeof g == "function")
458
+ return () => {
459
+ r.current === u && (r.current = null), g();
460
+ };
461
+ } else i && (i.current = u);
462
+ }, [i]);
463
+ return W(() => {
464
+ const u = r.current;
465
+ if (!u) return;
466
+ const g = () => l(u.scrollHeight > u.clientHeight + 1);
467
+ g();
468
+ const N = new ResizeObserver(g), w = new MutationObserver(g);
469
+ return N.observe(u), w.observe(u, { childList: !0, characterData: !0, subtree: !0 }), () => {
470
+ N.disconnect(), w.disconnect();
471
+ };
472
+ }, [n]), /* @__PURE__ */ a(m.Title, { ...c, ref: h, tabIndex: f ? o ?? 0 : o, className: s("facto-modal-title", e), children: n });
473
+ }
474
+ ), Y = L(function({ className: e, ...n }, o) {
475
+ return /* @__PURE__ */ a(m.Description, { ...n, ref: o, className: s("facto-modal-description", e) });
476
+ });
477
+ function Dt({
478
+ size: t = "sm",
427
479
  className: e,
428
- style: o,
429
- children: n,
480
+ style: n,
481
+ children: o,
430
482
  ...c
431
483
  }) {
432
- const i = _(v);
433
- return /* @__PURE__ */ d(u.Portal, { children: [
434
- /* @__PURE__ */ a(u.Overlay, { className: "facto-dialog-overlay", style: i }),
484
+ const i = T(k);
485
+ return /* @__PURE__ */ d(m.Portal, { children: [
486
+ /* @__PURE__ */ a(m.Overlay, { className: "facto-dialog-overlay", style: i }),
435
487
  /* @__PURE__ */ a(
436
- u.Content,
488
+ m.Content,
437
489
  {
438
490
  ...c,
439
- style: { ...i, ...o },
491
+ style: { ...i, ...n },
440
492
  className: s(
441
493
  "facto-theme",
442
494
  "facto-dialog",
443
495
  `facto-dialog--${t}`,
444
496
  e
445
497
  ),
446
- children: n
498
+ children: o
447
499
  }
448
500
  )
449
501
  ] });
450
502
  }
451
- const Ct = u.Root, Bt = u.Trigger, St = u.Close, Pt = u.Title, $t = u.Description;
452
- function Dt({
503
+ const Pt = m.Root, $t = m.Trigger, xt = m.Close, Rt = X, Ft = Y;
504
+ function Mt({
453
505
  side: t = "center",
454
506
  className: e,
455
- style: o,
456
- children: n,
507
+ style: n,
508
+ children: o,
457
509
  ...c
458
510
  }) {
459
- const i = _(v);
460
- return /* @__PURE__ */ d(u.Portal, { children: [
461
- /* @__PURE__ */ a(u.Overlay, { className: "facto-dialog-overlay", style: i }),
511
+ const i = T(k);
512
+ return /* @__PURE__ */ d(m.Portal, { children: [
513
+ /* @__PURE__ */ a(m.Overlay, { className: "facto-dialog-overlay", style: i }),
462
514
  /* @__PURE__ */ a(
463
- u.Content,
515
+ m.Content,
464
516
  {
465
517
  ...c,
466
- style: { ...i, ...o },
518
+ style: { ...i, ...n },
467
519
  className: s(
468
520
  "facto-theme",
469
521
  "facto-sheet",
470
522
  `facto-sheet--${t}`,
471
523
  e
472
524
  ),
473
- children: n
525
+ children: o
474
526
  }
475
527
  )
476
528
  ] });
477
529
  }
478
- function xt({
530
+ function Lt({
479
531
  width: t,
480
532
  height: e,
481
- circle: o,
482
- className: n,
533
+ circle: n,
534
+ className: o,
483
535
  style: c,
484
536
  ...i
485
537
  }) {
@@ -490,33 +542,33 @@ function xt({
490
542
  "aria-hidden": "true",
491
543
  className: s(
492
544
  "facto-skeleton",
493
- o && "facto-skeleton--circle",
494
- n
545
+ n && "facto-skeleton--circle",
546
+ o
495
547
  ),
496
548
  style: { ...c, width: t, height: e }
497
549
  }
498
550
  );
499
551
  }
500
- function Rt({
552
+ function Wt({
501
553
  title: t,
502
554
  description: e,
503
- action: o,
504
- icon: n,
555
+ action: n,
556
+ icon: o,
505
557
  className: c,
506
558
  ...i
507
559
  }) {
508
560
  return /* @__PURE__ */ d("div", { ...i, className: s("facto-empty-state", c), children: [
509
- n && /* @__PURE__ */ a("div", { className: "facto-empty-state__icon", "aria-hidden": "true", children: n }),
561
+ o && /* @__PURE__ */ a("div", { className: "facto-empty-state__icon", "aria-hidden": "true", children: o }),
510
562
  /* @__PURE__ */ a("strong", { children: t }),
511
563
  e && /* @__PURE__ */ a("p", { children: e }),
512
- o && /* @__PURE__ */ a("div", { children: o })
564
+ n && /* @__PURE__ */ a("div", { children: n })
513
565
  ] });
514
566
  }
515
- function Ft({
567
+ function Ot({
516
568
  tone: t = "info",
517
569
  title: e,
518
- description: o,
519
- action: n,
570
+ description: n,
571
+ action: o,
520
572
  className: c,
521
573
  ...i
522
574
  }) {
@@ -529,18 +581,18 @@ function Ft({
529
581
  children: [
530
582
  /* @__PURE__ */ d("div", { children: [
531
583
  /* @__PURE__ */ a("strong", { children: e }),
532
- o && /* @__PURE__ */ a("span", { children: o })
584
+ n && /* @__PURE__ */ a("span", { children: n })
533
585
  ] }),
534
- n
586
+ o
535
587
  ]
536
588
  }
537
589
  );
538
590
  }
539
- function Wt({
591
+ function jt({
540
592
  gap: t = 3,
541
593
  direction: e = "vertical",
542
- align: o = "stretch",
543
- justify: n = "start",
594
+ align: n = "stretch",
595
+ justify: o = "start",
544
596
  className: c,
545
597
  ...i
546
598
  }) {
@@ -552,73 +604,73 @@ function Wt({
552
604
  "facto-stack",
553
605
  `facto-stack--${e}`,
554
606
  `facto-stack--gap-${t}`,
555
- `facto-stack--align-${o}`,
556
- `facto-stack--justify-${n}`,
607
+ `facto-stack--align-${n}`,
608
+ `facto-stack--justify-${o}`,
557
609
  c
558
610
  )
559
611
  }
560
612
  );
561
613
  }
562
- function jt({ delayDuration: t = 300, ...e }) {
563
- return /* @__PURE__ */ a(P.Provider, { ...e, delayDuration: t });
614
+ function At({ delayDuration: t = 300, ...e }) {
615
+ return /* @__PURE__ */ a(x.Provider, { ...e, delayDuration: t });
564
616
  }
565
- const At = P.Root, Et = P.Trigger;
566
- function Lt({ variant: t = "default", className: e, style: o, sideOffset: n = 6, children: c, ...i }) {
567
- const r = _(v);
568
- return /* @__PURE__ */ a(P.Portal, { children: /* @__PURE__ */ a(
569
- P.Content,
617
+ const Et = x.Root, Ht = x.Trigger;
618
+ function zt({ variant: t = "default", className: e, style: n, sideOffset: o = 6, children: c, ...i }) {
619
+ const r = T(k);
620
+ return /* @__PURE__ */ a(x.Portal, { children: /* @__PURE__ */ a(
621
+ x.Content,
570
622
  {
571
623
  ...i,
572
- sideOffset: n,
624
+ sideOffset: o,
573
625
  className: s("facto-theme", "facto-tooltip", t === "content" && "facto-tooltip--content", e),
574
- style: { ...r, ...o },
626
+ style: { ...r, ...n },
575
627
  children: c
576
628
  }
577
629
  ) });
578
630
  }
579
- function Mt({ duration: t = 2600, ...e }) {
580
- return /* @__PURE__ */ a(p.Provider, { ...e, duration: t });
631
+ function Vt({ duration: t = 2600, ...e }) {
632
+ return /* @__PURE__ */ a(y.Provider, { ...e, duration: t });
581
633
  }
582
- function Ot({ tone: t = "success", className: e, style: o, children: n, ...c }) {
583
- const i = _(v);
584
- return /* @__PURE__ */ d(p.Root, { ...c, className: s("facto-theme", "facto-toast", `facto-toast--${t}`, e), style: { ...i, ...o }, children: [
585
- /* @__PURE__ */ a("span", { className: "facto-toast__icon", "aria-hidden": "true", children: t === "danger" ? "×" : "✓" }),
586
- /* @__PURE__ */ a("div", { className: "facto-toast__copy", children: n })
634
+ function qt({ tone: t = "success", className: e, style: n, children: o, ...c }) {
635
+ const i = T(k);
636
+ return /* @__PURE__ */ d(y.Root, { ...c, className: s("facto-theme", "facto-toast", `facto-toast--${t}`, e), style: { ...i, ...n }, children: [
637
+ /* @__PURE__ */ a("span", { className: "facto-toast__icon", "aria-hidden": "true", children: /* @__PURE__ */ a(B, { name: t === "danger" ? "close" : t === "warning" ? "warning" : t === "info" ? "info" : "check" }) }),
638
+ /* @__PURE__ */ a("div", { className: "facto-toast__copy", children: o })
587
639
  ] });
588
640
  }
589
- function Vt({ className: t, ...e }) {
590
- return /* @__PURE__ */ a(p.Title, { ...e, className: s("facto-toast__title", t) });
641
+ function Gt({ className: t, ...e }) {
642
+ return /* @__PURE__ */ a(y.Title, { ...e, className: s("facto-toast__title", t) });
591
643
  }
592
- function Ht({ className: t, ...e }) {
593
- return /* @__PURE__ */ a(p.Description, { ...e, className: s("facto-toast__description", t) });
644
+ function Kt({ className: t, ...e }) {
645
+ return /* @__PURE__ */ a(y.Description, { ...e, className: s("facto-toast__description", t) });
594
646
  }
595
- function qt({ className: t, ...e }) {
596
- return /* @__PURE__ */ a(p.Action, { ...e, className: s("facto-button", "facto-button--secondary", "facto-button--sm", t) });
647
+ function Zt({ className: t, ...e }) {
648
+ return /* @__PURE__ */ a(y.Action, { ...e, className: s("facto-button", "facto-button--secondary", "facto-button--sm", t) });
597
649
  }
598
- function Gt({ className: t, children: e = "×", "aria-label": o = "Dismiss notification", ...n }) {
599
- return /* @__PURE__ */ a(p.Close, { ...n, "aria-label": o, className: s("facto-toast__close", t), children: e });
650
+ function Jt({ className: t, children: e = /* @__PURE__ */ a(B, { name: "close" }), "aria-label": n = "Dismiss notification", ...o }) {
651
+ return /* @__PURE__ */ a(y.Close, { ...o, "aria-label": n, className: s("facto-toast__close", t), children: e });
600
652
  }
601
- function Kt({ className: t, style: e, ...o }) {
602
- const n = _(v), [c, i] = O(!1);
603
- return W(() => i(!0), []), c ? G(/* @__PURE__ */ a(p.Viewport, { ...o, className: s("facto-toast-viewport", t), style: { ...n, ...e } }), document.body) : null;
653
+ function Qt({ className: t, style: e, ...n }) {
654
+ const o = T(k), [c, i] = A(!1);
655
+ return W(() => i(!0), []), c ? K(/* @__PURE__ */ a(y.Viewport, { ...n, className: s("facto-toast-viewport", t), style: { ...o, ...e } }), document.body) : null;
604
656
  }
605
- function zt({ value: t, defaultValue: e = "", onValueChange: o, clearLabel: n = "Clear search", label: c = "Search", helperText: i, error: r, id: f, containerClassName: l, className: m, disabled: y, readOnly: $, ...C }) {
606
- const F = I(), B = f ?? F, k = r || i ? `${B}-description` : void 0, [D, T] = O(e), b = t ?? D, S = V(null);
657
+ function Ut({ value: t, defaultValue: e = "", onValueChange: n, clearLabel: o = "Clear search", label: c = "Search", helperText: i, error: r, id: f, containerClassName: l, className: h, disabled: u, readOnly: g, ...N }) {
658
+ const w = S(), P = f ?? w, I = r || i ? `${P}-description` : void 0, [R, C] = A(e), p = t ?? R, $ = j(null);
607
659
  W(() => {
608
- const N = S.current?.form;
609
- if (!N || t !== void 0) return;
610
- const j = (q) => {
660
+ const _ = $.current?.form;
661
+ if (!_ || t !== void 0) return;
662
+ const E = (G) => {
611
663
  queueMicrotask(() => {
612
- q.defaultPrevented || (T(e), o?.(e));
664
+ G.defaultPrevented || (C(e), n?.(e));
613
665
  });
614
666
  };
615
- return N.addEventListener("reset", j), () => N.removeEventListener("reset", j);
616
- }, [e, t, o]);
617
- const h = (N) => {
618
- t === void 0 && T(N), o?.(N);
667
+ return _.addEventListener("reset", E), () => _.removeEventListener("reset", E);
668
+ }, [e, t, n]);
669
+ const b = (_) => {
670
+ t === void 0 && C(_), n?.(_);
619
671
  };
620
672
  return /* @__PURE__ */ d("div", { className: s("facto-field", l), children: [
621
- c && /* @__PURE__ */ a("label", { className: "facto-field__label", htmlFor: B, children: c }),
673
+ c && /* @__PURE__ */ a("label", { className: "facto-field__label", htmlFor: P, children: c }),
622
674
  /* @__PURE__ */ d("div", { className: "facto-search", children: [
623
675
  /* @__PURE__ */ d("svg", { className: "facto-search__icon", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: [
624
676
  /* @__PURE__ */ a("circle", { cx: "10.5", cy: "10.5", r: "6.5" }),
@@ -627,90 +679,93 @@ function zt({ value: t, defaultValue: e = "", onValueChange: o, clearLabel: n =
627
679
  /* @__PURE__ */ a(
628
680
  "input",
629
681
  {
630
- ...C,
631
- ref: S,
632
- id: B,
682
+ ...N,
683
+ ref: $,
684
+ id: P,
633
685
  type: "search",
634
- disabled: y,
635
- readOnly: $,
636
- value: b,
637
- onChange: (N) => h(N.target.value),
638
- "aria-invalid": !!r || C["aria-invalid"],
639
- "aria-describedby": w(C["aria-describedby"], k),
640
- className: s("facto-input", "facto-search__input", !!r && "facto-input--error", m)
686
+ disabled: u,
687
+ readOnly: g,
688
+ value: p,
689
+ onChange: (_) => b(_.target.value),
690
+ "aria-invalid": !!r || N["aria-invalid"],
691
+ "aria-describedby": D(N["aria-describedby"], I),
692
+ className: s("facto-input", "facto-search__input", !!r && "facto-input--error", h)
641
693
  }
642
694
  ),
643
- b && !$ && /* @__PURE__ */ a(
695
+ p && !g && /* @__PURE__ */ a(
644
696
  "button",
645
697
  {
646
698
  type: "button",
647
699
  className: "facto-search__clear",
648
- disabled: y,
649
- "aria-label": n,
700
+ disabled: u,
701
+ "aria-label": o,
650
702
  onClick: () => {
651
- h(""), S.current?.focus();
703
+ b(""), $.current?.focus();
652
704
  },
653
- children: "×"
705
+ children: /* @__PURE__ */ a(B, { name: "close", size: 16 })
654
706
  }
655
707
  )
656
708
  ] }),
657
- (r || i) && /* @__PURE__ */ a("span", { id: k, className: s("facto-field__message", !!r && "facto-field__message--error"), children: r ?? i })
709
+ (r || i) && /* @__PURE__ */ a("span", { id: I, className: s("facto-field__message", !!r && "facto-field__message--error"), children: r ?? i })
658
710
  ] });
659
711
  }
660
- function Jt({ className: t, ...e }) {
661
- return /* @__PURE__ */ a(Q, { ...e, type: "search", className: s("facto-search-field", t) });
712
+ function Xt({ className: t, ...e }) {
713
+ return /* @__PURE__ */ a(U, { ...e, type: "search", className: s("facto-search-field", t) });
662
714
  }
663
715
  export {
664
- ut as Badge,
665
- tt as Button,
666
- at as Card,
667
- gt as Checkbox,
668
- nt as DashboardGrid,
669
- _t as Dialog,
670
- kt as DialogClose,
671
- wt as DialogContent,
672
- It as DialogDescription,
673
- Tt as DialogTitle,
674
- yt as DialogTrigger,
675
- Rt as EmptyState,
676
- zt as EnhancedSearchField,
677
- Z as FactoTheme,
678
- et as IconButton,
679
- Ft as Notice,
680
- Jt as SearchField,
681
- mt as Select,
682
- Ct as Sheet,
683
- St as SheetClose,
684
- Dt as SheetContent,
685
- $t as SheetDescription,
686
- Pt as SheetTitle,
687
- Bt as SheetTrigger,
688
- xt as Skeleton,
689
- Wt as Stack,
690
- H as Surface,
691
- ht as Switch,
692
- bt as Tabs,
693
- pt as TabsContent,
694
- Nt as TabsList,
695
- vt as TabsTrigger,
696
- Q as TextField,
697
- ft as Textarea,
698
- Ot as Toast,
699
- qt as ToastAction,
700
- Gt as ToastClose,
701
- Ht as ToastDescription,
702
- Mt as ToastProvider,
703
- Vt as ToastTitle,
704
- Kt as ToastViewport,
705
- At as Tooltip,
706
- Lt as TooltipContent,
707
- jt as TooltipProvider,
708
- Et as TooltipTrigger,
709
- ot as Widget,
710
- lt as WidgetAction,
711
- rt as WidgetAmount,
712
- ct as WidgetHeader,
713
- st as WidgetKeyValue,
714
- it as WidgetList,
715
- dt as WidgetRow
716
+ Nt as Badge,
717
+ it as Button,
718
+ rt as Card,
719
+ kt as Checkbox,
720
+ dt as DashboardGrid,
721
+ Ct as Dialog,
722
+ St as DialogClose,
723
+ Dt as DialogContent,
724
+ Y as DialogDescription,
725
+ X as DialogTitle,
726
+ Bt as DialogTrigger,
727
+ Wt as EmptyState,
728
+ Ut as EnhancedSearchField,
729
+ nt as FactoTheme,
730
+ B as Icon,
731
+ st as IconButton,
732
+ ct as ModalFooter,
733
+ ot as ModalHeader,
734
+ Ot as Notice,
735
+ Xt as SearchField,
736
+ pt as Select,
737
+ Pt as Sheet,
738
+ xt as SheetClose,
739
+ Mt as SheetContent,
740
+ Ft as SheetDescription,
741
+ Rt as SheetTitle,
742
+ $t as SheetTrigger,
743
+ Lt as Skeleton,
744
+ jt as Stack,
745
+ q as Surface,
746
+ _t as Switch,
747
+ yt as Tabs,
748
+ It as TabsContent,
749
+ Tt as TabsList,
750
+ wt as TabsTrigger,
751
+ U as TextField,
752
+ vt as Textarea,
753
+ qt as Toast,
754
+ Zt as ToastAction,
755
+ Jt as ToastClose,
756
+ Kt as ToastDescription,
757
+ Vt as ToastProvider,
758
+ Gt as ToastTitle,
759
+ Qt as ToastViewport,
760
+ Et as Tooltip,
761
+ zt as TooltipContent,
762
+ At as TooltipProvider,
763
+ Ht as TooltipTrigger,
764
+ lt as Widget,
765
+ gt as WidgetAction,
766
+ ht as WidgetAmount,
767
+ ft as WidgetHeader,
768
+ mt as WidgetKeyValue,
769
+ ut as WidgetList,
770
+ bt as WidgetRow
716
771
  };