@cfx-dev/ui-components 0.0.11 → 0.0.13

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.
@@ -2,7 +2,7 @@ import { jsx as _ } from "react/jsx-runtime";
2
2
  import r from "react";
3
3
  import { Interactive as w } from "./components/Interactive/Interactive.js";
4
4
  import { clsx as A } from "./utils/clsx.js";
5
- import { c as C } from "./hooks-Bv1kQUpO.js";
5
+ import { d as C } from "./hooks-GAujvL7d.js";
6
6
  import { c as b } from "./math-i2ceybzU.js";
7
7
  import './assets/Rail.css';const P = "_virtual_sn3qq_1", T = "_root_sn3qq_5", y = "_active_sn3qq_13", z = "_scroller_sn3qq_17", M = "_content_sn3qq_27", R = "_thumb_sn3qq_42", a = {
8
8
  virtual: P,
@@ -1,10 +1,10 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { a as r } from "../../outlet-C4wpavcH.js";
3
- const a = r("backdrop");
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { a } from "../../hooks-GAujvL7d.js";
4
3
  function e({
5
- children: t
4
+ children: o
6
5
  }) {
7
- return /* @__PURE__ */ o(a, { children: t });
6
+ const r = a("backdrop");
7
+ return /* @__PURE__ */ t(r, { children: o });
8
8
  }
9
9
  export {
10
10
  e as BackdropPortal
@@ -1,58 +1,57 @@
1
1
  import { jsxs as i, jsx as s } from "react/jsx-runtime";
2
- import m from "react";
3
- import { F as k } from "../../Combination-Dj-a6dCZ.js";
4
- import { Button as p } from "../Button/Button.js";
5
- import { I as h } from "../../Icons-B26SczGZ.js";
6
- import { Interactive as f } from "../Interactive/Interactive.js";
2
+ import d from "react";
3
+ import { F as p } from "../../Combination-Dj-a6dCZ.js";
4
+ import { Button as h } from "../Button/Button.js";
5
+ import { I as f } from "../../Icons-B26SczGZ.js";
6
+ import { Interactive as u } from "../Interactive/Interactive.js";
7
7
  import { clsx as l } from "../../utils/clsx.js";
8
- import { n as u } from "../../functional-C0pE183N.js";
9
- import { b as v } from "../../hooks-Bv1kQUpO.js";
10
- import { a as b } from "../../outlet-C4wpavcH.js";
11
- import '../../assets/Flyout.css';const z = "_root_11ks7_1", N = "_holder_11ks7_6", C = "_active_11ks7_15", y = "_backdrop_11ks7_15", x = "_mask_11ks7_28", F = "_content_11ks7_90", I = "_header_11ks7_95", L = "_title_11ks7_101", e = {
12
- root: z,
8
+ import { n as v } from "../../functional-C0pE183N.js";
9
+ import { a as b, c as z } from "../../hooks-GAujvL7d.js";
10
+ import '../../assets/Flyout.css';const N = "_root_11ks7_1", C = "_holder_11ks7_6", y = "_active_11ks7_15", x = "_backdrop_11ks7_15", F = "_mask_11ks7_28", I = "_content_11ks7_90", L = "_header_11ks7_95", g = "_title_11ks7_101", e = {
11
+ root: N,
13
12
  "size-normal": "_size-normal_11ks7_6",
14
- holder: N,
13
+ holder: C,
15
14
  "size-small": "_size-small_11ks7_9",
16
15
  "size-xsmall": "_size-xsmall_11ks7_12",
17
- active: C,
18
- backdrop: y,
16
+ active: y,
17
+ backdrop: x,
19
18
  "backdrop-appearance": "_backdrop-appearance_11ks7_1",
20
- mask: x,
19
+ mask: F,
21
20
  "holder-appearance": "_holder-appearance_11ks7_1",
22
- content: F,
23
- header: I,
24
- title: L
25
- }, g = b("overlay-outlet");
21
+ content: I,
22
+ header: L,
23
+ title: g
24
+ };
26
25
  function j(c) {
27
26
  const {
28
27
  disabled: o = !1,
29
28
  size: r = "normal",
30
- onClose: t = u,
29
+ onClose: a = v,
31
30
  children: n,
32
- holderClassName: d
33
- } = c;
34
- m.useEffect(() => {
31
+ holderClassName: m
32
+ } = c, _ = b("flyout-outlet");
33
+ d.useEffect(() => {
35
34
  if (o)
36
35
  return;
37
- const a = document.getElementById("cfxui-root");
38
- return a == null || a.classList.add("shrink"), () => a == null ? void 0 : a.classList.remove("shrink");
39
- }, [o]), v(t);
40
- const _ = l(e.root, e[`size-${r}`], {
36
+ const t = document.getElementById("cfxui-root");
37
+ return t == null || t.classList.add("shrink"), () => t == null ? void 0 : t.classList.remove("shrink");
38
+ }, [o]), z(a);
39
+ const k = l(e.root, e[`size-${r}`], {
41
40
  [e.active]: !o
42
41
  });
43
- return /* @__PURE__ */ s(g, { children: /* @__PURE__ */ i("div", { className: _, children: [
44
- /* @__PURE__ */ s(f, { showPointer: !1, className: e.backdrop, onClick: t }),
45
- /* @__PURE__ */ s("div", { className: e.mask, children: /* @__PURE__ */ s("div", { className: l(e.holder, d), children: /* @__PURE__ */ s(k, { disabled: !!o, className: e.content, children: n }) }) })
42
+ return /* @__PURE__ */ s(_, { children: /* @__PURE__ */ i("div", { className: k, children: [
43
+ /* @__PURE__ */ s(u, { showPointer: !1, className: e.backdrop, onClick: a }),
44
+ /* @__PURE__ */ s("div", { className: e.mask, children: /* @__PURE__ */ s("div", { className: l(e.holder, m), children: /* @__PURE__ */ s(p, { disabled: !!o, className: e.content, children: n }) }) })
46
45
  ] }) });
47
46
  }
48
- j.Header = m.forwardRef(function(o, r) {
47
+ j.Header = d.forwardRef(function(o, r) {
49
48
  const {
50
- onClose: t,
49
+ onClose: a,
51
50
  children: n
52
51
  } = o;
53
52
  return /* @__PURE__ */ i("div", { ref: r, className: e.header, children: [
54
53
  /* @__PURE__ */ s("div", { className: e.title, children: n }),
55
- !!t && /* @__PURE__ */ s(p, { size: "large", icon: h.exit, onClick: t })
54
+ !!a && /* @__PURE__ */ s(h, { size: "large", icon: f.exit, onClick: a })
56
55
  ] });
57
56
  });
58
57
  export {
@@ -3,7 +3,7 @@ import n from "react";
3
3
  import { Indicator as q } from "../Indicator/Indicator.js";
4
4
  import { clsx as H } from "../../utils/clsx.js";
5
5
  import { getValue as J } from "../../utils/getValue.js";
6
- import { u as i } from "../../hooks-Bv1kQUpO.js";
6
+ import { u as i } from "../../hooks-GAujvL7d.js";
7
7
  import '../../assets/Input.css';const O = "_root_gmtev_1", P = "_input_gmtev_1", Q = "_small_gmtev_8", U = "_large_gmtev_12", Y = "_decorator_gmtev_60", Z = "_error_gmtev_68", $ = "_disabled_gmtev_72", ee = "_description_gmtev_106", e = {
8
8
  root: O,
9
9
  input: P,
@@ -3,7 +3,7 @@ import r from "react";
3
3
  import { Button as D } from "../Button/Button.js";
4
4
  import { I as F } from "../../Icons-B26SczGZ.js";
5
5
  import { clsx as L } from "../../utils/clsx.js";
6
- import { u as i } from "../../hooks-Bv1kQUpO.js";
6
+ import { u as i } from "../../hooks-GAujvL7d.js";
7
7
  import '../../assets/RichInput.css';const T = "_root_16on4_1", j = "_renderer_16on4_1", z = "_small_16on4_8", E = "_large_16on4_13", H = "_clear_16on4_95", t = {
8
8
  root: T,
9
9
  renderer: j,
@@ -2,9 +2,9 @@ import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "../../Interactive/Interactive.js";
4
4
  import "../../../utils/clsx.js";
5
- import "../../../hooks-Bv1kQUpO.js";
5
+ import "../../../hooks-GAujvL7d.js";
6
6
  import "../../../math-i2ceybzU.js";
7
- import { R as e } from "../../../Rail-DoYzqKk4.js";
7
+ import { R as e } from "../../../Rail-BCY3h7eP.js";
8
8
  export {
9
9
  e as Rail
10
10
  };
@@ -3,7 +3,7 @@ import r from "react";
3
3
  import { useContextualStyle as W } from "../../Style/Style.js";
4
4
  import { clsx as b } from "../../../utils/clsx.js";
5
5
  import k from "../../../utils/mergeRefs.js";
6
- import { s as o, R as w } from "../../../Rail-DoYzqKk4.js";
6
+ import { s as o, R as w } from "../../../Rail-BCY3h7eP.js";
7
7
  const N = {
8
8
  size: 0,
9
9
  scrollPos: 0,
@@ -4,7 +4,7 @@ import { _ as ie } from "../../../extends-Dk_bSU3E.js";
4
4
  import { _ as ne } from "../../../inheritsLoose-A8WKSWDx.js";
5
5
  import { clsx as oe } from "../../../utils/clsx.js";
6
6
  import { Scrollable as le } from "./Scrollable.js";
7
- import { s as se } from "../../../Rail-DoYzqKk4.js";
7
+ import { s as se } from "../../../Rail-BCY3h7eP.js";
8
8
  function $(r) {
9
9
  if (r === void 0)
10
10
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -1,9 +1,9 @@
1
- import { jsxs as n, jsx as o } from "react/jsx-runtime";
1
+ import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
2
  import { Button as _ } from "../Button/Button.js";
3
3
  import { I as f } from "../../Icons-B26SczGZ.js";
4
4
  import { Overlay as s } from "../Overlay/Overlay.js";
5
- import { n as c } from "../../functional-C0pE183N.js";
6
- import { b as h } from "../../hooks-Bv1kQUpO.js";
5
+ import { n } from "../../functional-C0pE183N.js";
6
+ import { c as h } from "../../hooks-GAujvL7d.js";
7
7
  import '../../assets/Modal.css';const v = "_root_1v8ee_1", C = "_close_1v8ee_27", u = "_header_1v8ee_37", N = "_footer_1v8ee_47", r = {
8
8
  root: v,
9
9
  "modal-appearance": "_modal-appearance_1v8ee_1",
@@ -13,15 +13,15 @@ import '../../assets/Modal.css';const v = "_root_1v8ee_1", C = "_close_1v8ee_27"
13
13
  };
14
14
  function l(a) {
15
15
  const {
16
- onClose: e = c,
16
+ onClose: e = n,
17
17
  children: d,
18
18
  backdropClassName: i,
19
19
  contentClassName: m,
20
20
  disableBackdropClose: p = !1
21
- } = a, t = p ? c : e;
22
- return h(t), /* @__PURE__ */ n(s, { children: [
21
+ } = a, t = p ? n : e;
22
+ return h(t), /* @__PURE__ */ c(s, { children: [
23
23
  /* @__PURE__ */ o(s.Backdrop, { onClick: t, className: i }),
24
- /* @__PURE__ */ o(s.Content, { className: m, children: /* @__PURE__ */ n("div", { className: r.root, children: [
24
+ /* @__PURE__ */ o(s.Content, { className: m, children: /* @__PURE__ */ c("div", { className: r.root, children: [
25
25
  !!e && /* @__PURE__ */ o("div", { className: r.close, children: /* @__PURE__ */ o(_, { size: "large", theme: "transparent", icon: f.exit, onClick: e }) }),
26
26
  d
27
27
  ] }) })
@@ -1,7 +1,7 @@
1
1
  import { jsx as p } from "react/jsx-runtime";
2
2
  import t from "react";
3
3
  import { n as o } from "../functional-C0pE183N.js";
4
- import { u as s } from "../hooks-Bv1kQUpO.js";
4
+ import { u as s } from "../hooks-GAujvL7d.js";
5
5
  const l = {
6
6
  width: "0",
7
7
  height: "0"
@@ -1,27 +1,27 @@
1
- import { jsx as r } from "react/jsx-runtime";
1
+ import { jsx as t } from "react/jsx-runtime";
2
2
  import n from "react";
3
- import { F as s } from "../../Combination-Dj-a6dCZ.js";
4
- import { Interactive as i } from "../Interactive/Interactive.js";
5
- import { clsx as a } from "../../utils/clsx.js";
6
- import { a as m } from "../../outlet-C4wpavcH.js";
7
- import '../../assets/Overlay.css';const u = "_root_15udb_1", f = "_backdrop_15udb_9", _ = "_content_15udb_27", e = {
8
- root: u,
9
- backdrop: f,
3
+ import { F as i } from "../../Combination-Dj-a6dCZ.js";
4
+ import { Interactive as m } from "../Interactive/Interactive.js";
5
+ import { clsx as e } from "../../utils/clsx.js";
6
+ import { a as u } from "../../hooks-GAujvL7d.js";
7
+ import '../../assets/Overlay.css';const f = "_root_15udb_1", _ = "_backdrop_15udb_9", p = "_content_15udb_27", a = {
8
+ root: f,
9
+ backdrop: _,
10
10
  "backdrop-appearance": "_backdrop-appearance_15udb_1",
11
- content: _
12
- }, p = m("overlay-outlet");
11
+ content: p
12
+ };
13
13
  function l(c) {
14
14
  const {
15
15
  className: o,
16
- children: t
17
- } = c, d = a(e.root, o);
18
- return /* @__PURE__ */ r(p, { children: /* @__PURE__ */ r("div", { className: d, children: t }) });
16
+ children: r
17
+ } = c, s = e(a.root, o), d = u("overlay-outlet");
18
+ return /* @__PURE__ */ t(d, { children: /* @__PURE__ */ t("div", { className: s, children: r }) });
19
19
  }
20
- l.Backdrop = n.forwardRef(function(o, t) {
21
- return /* @__PURE__ */ r(i, { ref: t, onClick: o.onClick, className: a(e.backdrop, o.className), children: o.children });
20
+ l.Backdrop = n.forwardRef(function(o, r) {
21
+ return /* @__PURE__ */ t(m, { ref: r, onClick: o.onClick, className: e(a.backdrop, o.className), children: o.children });
22
22
  });
23
- l.Content = n.forwardRef(function(o, t) {
24
- return /* @__PURE__ */ r("div", { ref: t, className: a(e.content, o.className), children: /* @__PURE__ */ r(s, { children: o.children }) });
23
+ l.Content = n.forwardRef(function(o, r) {
24
+ return /* @__PURE__ */ t("div", { ref: r, className: e(a.content, o.className), children: /* @__PURE__ */ t(i, { children: o.children }) });
25
25
  });
26
26
  export {
27
27
  l as Overlay
@@ -1,35 +1,34 @@
1
1
  import { jsx as t, jsxs as m } from "react/jsx-runtime";
2
- import s from "react";
3
- import { a as h } from "../../hooks-Bv1kQUpO.js";
4
- import { P as p } from "../../outlets-BsMV5obW.js";
5
- import { ui as v } from "../ui.js";
6
- import '../../assets/Shroud.css';const x = "_root_7v6x1_1", _ = "_tile_7v6x1_6", e = {
7
- root: x,
8
- tile: _
9
- }, S = s.forwardRef(function(c, n) {
2
+ import o from "react";
3
+ import { a as p, b as v } from "../../hooks-GAujvL7d.js";
4
+ import { ui as x } from "../ui.js";
5
+ import '../../assets/Shroud.css';const _ = "_root_7v6x1_1", b = "_tile_7v6x1_6", e = {
6
+ root: _,
7
+ tile: b
8
+ }, S = o.forwardRef(function(c, n) {
10
9
  const {
11
10
  forRef: r
12
- } = c, [d, u] = s.useState({}), i = s.useCallback(() => {
11
+ } = c, [u, d] = o.useState({}), f = p("pre-title"), i = o.useCallback(() => {
13
12
  if (!r.current)
14
13
  return;
15
- const o = r.current.getBoundingClientRect(), f = {
16
- x: o.x,
17
- y: o.y,
18
- w: o.width,
19
- h: o.height,
14
+ const s = r.current.getBoundingClientRect(), h = {
15
+ x: s.x,
16
+ y: s.y,
17
+ w: s.width,
18
+ h: s.height,
20
19
  sw: globalThis.screen.availWidth,
21
20
  sh: globalThis.screen.availHeight
22
21
  };
23
- u(
22
+ d(
24
23
  Object.fromEntries(
25
- Object.entries(f).flatMap(([a, l]) => [
26
- [`--${a}`, v.px(l)],
24
+ Object.entries(h).flatMap(([a, l]) => [
25
+ [`--${a}`, x.px(l)],
27
26
  [`--${a}-raw`, l]
28
27
  ])
29
28
  )
30
29
  );
31
30
  }, []);
32
- return s.useEffect(i, []), h(i), /* @__PURE__ */ t(p, { children: /* @__PURE__ */ m("div", { ref: n, className: e.root, style: d, children: [
31
+ return o.useEffect(i, []), v(i), /* @__PURE__ */ t(f, { children: /* @__PURE__ */ m("div", { ref: n, className: e.root, style: u, children: [
33
32
  /* @__PURE__ */ t("div", { className: e.tile, "data-top": !0 }),
34
33
  /* @__PURE__ */ t("div", { className: e.tile, "data-left": !0 }),
35
34
  /* @__PURE__ */ t("div", { className: e.tile, "data-right": !0 }),
@@ -1,12 +1,12 @@
1
- import { jsxs as w, Fragment as L, jsx as _ } from "react/jsx-runtime";
2
- import l from "react";
3
- import { T as k } from "../../outlets-BsMV5obW.js";
4
- import { clsx as y } from "../../utils/clsx.js";
1
+ import { jsxs as L, Fragment as k, jsx as p } from "react/jsx-runtime";
2
+ import f from "react";
3
+ import { clsx as O } from "../../utils/clsx.js";
4
+ import { a as y } from "../../hooks-GAujvL7d.js";
5
5
  import C from "../../utils/mergeRefs.js";
6
- import '../../assets/Title.css';const O = "_wrapper_1l1sn_1", R = "_appearance_1l1sn_1", T = "_animated_1l1sn_26", $ = "_root_1l1sn_71", M = "_shortcut_1l1sn_84", d = {
7
- wrapper: O,
8
- appearance: R,
9
- animated: T,
6
+ import '../../assets/Title.css';const R = "_wrapper_1l1sn_1", T = "_appearance_1l1sn_1", $ = "_animated_1l1sn_26", M = "_root_1l1sn_71", N = "_shortcut_1l1sn_84", m = {
7
+ wrapper: R,
8
+ appearance: T,
9
+ animated: $,
10
10
  "fixed-on-top": "_fixed-on-top_1l1sn_29",
11
11
  "fixed-on-top-left": "_fixed-on-top-left_1l1sn_35",
12
12
  "fixed-on-bottom": "_fixed-on-bottom_1l1sn_41",
@@ -14,11 +14,11 @@ import '../../assets/Title.css';const O = "_wrapper_1l1sn_1", R = "_appearance_1
14
14
  "fixed-on-bottom-right": "_fixed-on-bottom-right_1l1sn_53",
15
15
  "fixed-on-left": "_fixed-on-left_1l1sn_59",
16
16
  "fixed-on-right": "_fixed-on-right_1l1sn_65",
17
- root: $,
18
- shortcut: M
19
- }, c = 10;
20
- function N(i, a, [t, o]) {
21
- const r = i ? o : o - 20, s = i ? t : t + 16;
17
+ root: M,
18
+ shortcut: N
19
+ }, i = 10;
20
+ function S(a, l, [e, n]) {
21
+ const r = a ? n : n - 20, s = a ? e : e + 16;
22
22
  return {
23
23
  // Prefer top and left for element to snap to the pixel grid
24
24
  // as when using transform it will become blurry in most of the cases as top and left values are floats
@@ -26,88 +26,88 @@ function N(i, a, [t, o]) {
26
26
  left: `${s}px`,
27
27
  // transform: `translate(${left}px, ${top}px)`,
28
28
  maxWidth: `calc(100vw - ${s}px - 10px)`,
29
- animationDelay: `${a}ms`
29
+ animationDelay: `${l}ms`
30
30
  };
31
31
  }
32
- function S(i, a) {
32
+ function F(a, l) {
33
33
  const {
34
- x: t,
35
- y: o,
34
+ x: e,
35
+ y: n,
36
36
  width: r,
37
37
  height: s
38
- } = i.getBoundingClientRect();
39
- let n = 0, e = 0;
40
- switch (a) {
38
+ } = a.getBoundingClientRect();
39
+ let t = 0, c = 0;
40
+ switch (l) {
41
41
  case "top": {
42
- n = t + r / 2, e = o - c;
42
+ t = e + r / 2, c = n - i;
43
43
  break;
44
44
  }
45
45
  case "top-left": {
46
- n = t, e = o - c;
46
+ t = e, c = n - i;
47
47
  break;
48
48
  }
49
49
  case "bottom": {
50
- n = t + r / 2, e = o + s + c;
50
+ t = e + r / 2, c = n + s + i;
51
51
  break;
52
52
  }
53
53
  case "bottom-left": {
54
- n = t, e = o + s + c;
54
+ t = e, c = n + s + i;
55
55
  break;
56
56
  }
57
57
  case "bottom-right": {
58
- n = t + r, e = o + s + c;
58
+ t = e + r, c = n + s + i;
59
59
  break;
60
60
  }
61
61
  case "left": {
62
- n = t - c, e = o + s / 2;
62
+ t = e - i, c = n + s / 2;
63
63
  break;
64
64
  }
65
65
  case "right": {
66
- n = t + r + c, e = o + s / 2;
66
+ t = e + r + i, c = n + s / 2;
67
67
  break;
68
68
  }
69
69
  }
70
- return [n, e];
70
+ return [t, c];
71
71
  }
72
- function B(i) {
72
+ function D(a) {
73
73
  const {
74
- title: a,
75
- children: t,
76
- animated: o = !0,
74
+ title: l,
75
+ children: e,
76
+ animated: n = !0,
77
77
  fixedOn: r = "bottom",
78
78
  delay: s = 0
79
- } = i, n = l.useRef(r);
80
- n.current = r;
81
- const e = l.useRef(null), [b, p] = l.useState(!1), [g, m] = l.useState([0, 0]);
82
- l.useEffect(() => {
83
- if (!e.current)
79
+ } = a, t = f.useRef(r);
80
+ t.current = r;
81
+ const c = y("title"), o = f.useRef(null), [g, x] = f.useState(!1), [E, _] = f.useState([0, 0]);
82
+ f.useEffect(() => {
83
+ if (!o.current)
84
84
  return;
85
- const u = (f) => {
86
- n.current && e.current ? m(S(e.current, n.current)) : m([f.clientX, f.clientY]), p(!0);
87
- }, h = () => {
88
- p(!1);
89
- }, v = (f) => {
90
- n.current || m([f.clientX, f.clientY]);
85
+ const d = (u) => {
86
+ t.current && o.current ? _(F(o.current, t.current)) : _([u.clientX, u.clientY]), x(!0);
87
+ }, v = () => {
88
+ x(!1);
89
+ }, b = (u) => {
90
+ t.current || _([u.clientX, u.clientY]);
91
91
  };
92
- return e.current.addEventListener("mouseenter", u), e.current.addEventListener("mouseleave", h), e.current.addEventListener("mousemove", v), () => {
93
- e.current && (e.current.removeEventListener("mouseenter", u), e.current.removeEventListener("mouseleave", h), e.current.removeEventListener("mousemove", v));
92
+ return o.current.addEventListener("mouseenter", d), o.current.addEventListener("mouseleave", v), o.current.addEventListener("mousemove", b), () => {
93
+ o.current && (o.current.removeEventListener("mouseenter", d), o.current.removeEventListener("mouseleave", v), o.current.removeEventListener("mousemove", b));
94
94
  };
95
95
  }, []);
96
- let x = null;
97
- if (b && a) {
98
- const u = y(d.wrapper, d[`fixed-on-${r}`], {
99
- [d.animated]: o
96
+ let h = null;
97
+ if (g && l) {
98
+ const d = O(m.wrapper, m[`fixed-on-${r}`], {
99
+ [m.animated]: n
100
100
  });
101
- x = /* @__PURE__ */ _(k, { children: /* @__PURE__ */ _("div", { className: u, style: N(!!r, s, g), children: /* @__PURE__ */ _("div", { className: d.root, children: a }) }) });
101
+ h = /* @__PURE__ */ p(c, { children: /* @__PURE__ */ p("div", { className: d, style: S(!!r, s, E), children: /* @__PURE__ */ p("div", { className: m.root, children: l }) }) });
102
102
  }
103
- const E = typeof t == "function" ? t(e) : l.cloneElement(t, {
104
- ref: C(e, t.props.ref)
103
+ const w = typeof e == "function" ? e(o) : f.cloneElement(e, {
104
+ ref: C(o, e.props.ref)
105
105
  });
106
- return /* @__PURE__ */ w(L, { children: [
107
- E,
108
- x
106
+ return /* @__PURE__ */ L(k, { children: [
107
+ w,
108
+ h
109
109
  ] });
110
110
  }
111
111
  export {
112
- B as Title
112
+ D as Title
113
113
  };
@@ -0,0 +1,86 @@
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import o from "react";
3
+ import { $ as f } from "./index-C75OpfGQ.js";
4
+ const i = Symbol("Uninitialized");
5
+ function E(e, ...t) {
6
+ const n = o.useRef(i);
7
+ return n.current === i && (n.current = e(...t)), n.current;
8
+ }
9
+ function u(e) {
10
+ const t = o.useRef(e);
11
+ return t.current = e, t;
12
+ }
13
+ function c(e, t = "keydown", n) {
14
+ o.useEffect(() => {
15
+ const r = (s) => {
16
+ c.shouldProcessEvent(s) && e.current(s);
17
+ };
18
+ return window.addEventListener(t, r, n), () => {
19
+ window.removeEventListener(t, r, n);
20
+ };
21
+ }, [t, n]);
22
+ }
23
+ c.shouldProcessEvent = (e) => {
24
+ if (e.target instanceof Element) {
25
+ if (e.target.hasAttribute("contenteditable"))
26
+ return !1;
27
+ switch (e.target.tagName) {
28
+ case "INPUT":
29
+ case "SELECT":
30
+ case "TEXTAREA":
31
+ return !1;
32
+ default:
33
+ return !0;
34
+ }
35
+ }
36
+ return !0;
37
+ };
38
+ function a(e) {
39
+ const t = u((n) => {
40
+ a.isCloseEvent(n) && e();
41
+ });
42
+ c(t);
43
+ }
44
+ a.isCloseEvent = (e) => e.key === "Escape";
45
+ function m(e) {
46
+ const t = u(e);
47
+ o.useEffect(() => {
48
+ const n = () => t.current();
49
+ return window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
50
+ }, []);
51
+ }
52
+ function b(e) {
53
+ const {
54
+ children: t
55
+ } = e;
56
+ return /* @__PURE__ */ d("div", { style: { display: "none" }, children: t });
57
+ }
58
+ function w(e) {
59
+ const [t, n] = o.useState(() => b);
60
+ return o.useEffect(() => {
61
+ let r = document.getElementById(e);
62
+ r || (r = document.createElement("div"), r.id = e, document.body.appendChild(r));
63
+ const s = ({
64
+ children: l
65
+ }) => f.createPortal(l, r);
66
+ n(() => s);
67
+ }, [e]), t;
68
+ }
69
+ const v = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
70
+ __proto__: null,
71
+ useDynamicRef: u,
72
+ useGlobalKeyboardEvent: c,
73
+ useInstance: E,
74
+ useKeyboardClose: a,
75
+ useOutlet: w,
76
+ useWindowResize: m
77
+ }, Symbol.toStringTag, { value: "Module" }));
78
+ export {
79
+ w as a,
80
+ m as b,
81
+ a as c,
82
+ E as d,
83
+ c as e,
84
+ v as h,
85
+ u
86
+ };
package/dist/main.d.ts CHANGED
@@ -62,7 +62,6 @@ export { Text } from './components/Text/Text';
62
62
  export { Textarea } from './components/Textarea/Textarea';
63
63
  export { Title } from './components/Title/Title';
64
64
  export { Icons, BrandIcon } from './components/Icons';
65
- export * as outlets from './components/outlets';
66
65
  export { OnScreenSensor } from './components/OnScreenSensor';
67
66
  export { ui } from './components/ui';
68
67
  export { Symbols } from './components/Symbols';
package/dist/main.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { clsx as o } from "./utils/clsx.js";
2
2
  import { f as r } from "./functional-C0pE183N.js";
3
3
  import { getValue as t } from "./utils/getValue.js";
4
- import { h as e } from "./hooks-Bv1kQUpO.js";
4
+ import { h as e } from "./hooks-GAujvL7d.js";
5
5
  import { l as m } from "./links-CgOD-Vfj.js";
6
6
  import { m as p } from "./math-i2ceybzU.js";
7
7
  import f from "./utils/mergeRefs.js";
8
- import { o as x } from "./outlet-C4wpavcH.js";
8
+ import { o as x } from "./outlet-B11a3Kgw.js";
9
9
  import { s as a } from "./string-NVxCUbqk.js";
10
10
  import { Checkbox as P } from "./components/Checkbox/Checkbox.js";
11
11
  import { Button as y } from "./components/Button/Button.js";
@@ -29,7 +29,7 @@ import { Box as eo } from "./components/Layout/Box/Box.js";
29
29
  import { Center as po } from "./components/Layout/Center/Center.js";
30
30
  import { Flex as xo } from "./components/Layout/Flex/Flex.js";
31
31
  import { Pad as lo } from "./components/Layout/Pad/Pad.js";
32
- import { Page as so } from "./components/Layout/Page/Page.js";
32
+ import { Page as io } from "./components/Layout/Page/Page.js";
33
33
  import { Scrollable as co } from "./components/Layout/Scrollable/Scrollable.js";
34
34
  import { Loaf as Bo } from "./components/Loaf/Loaf.js";
35
35
  import { Modal as So } from "./components/Modal/Modal.js";
@@ -50,10 +50,9 @@ import { Text as Qo } from "./components/Text/Text.js";
50
50
  import { Textarea as Wo } from "./components/Textarea/Textarea.js";
51
51
  import { Title as Yo } from "./components/Title/Title.js";
52
52
  import { B as _o, I as $o } from "./Icons-B26SczGZ.js";
53
- import { o as rr } from "./outlets-BsMV5obW.js";
54
- import { OnScreenSensor as er } from "./components/OnScreenSensor.js";
55
- import { ui as pr } from "./components/ui.js";
56
- import { Symbols as xr } from "./components/Symbols.js";
53
+ import { OnScreenSensor as rr } from "./components/OnScreenSensor.js";
54
+ import { ui as er } from "./components/ui.js";
55
+ import { Symbols as pr } from "./components/Symbols.js";
57
56
  const S = {
58
57
  clsx: o,
59
58
  getValue: t,
@@ -91,10 +90,10 @@ export {
91
90
  Bo as Loaf,
92
91
  So as Modal,
93
92
  ho as NavList,
94
- er as OnScreenSensor,
93
+ rr as OnScreenSensor,
95
94
  vo as Overlay,
96
95
  lo as Pad,
97
- so as Page,
96
+ io as Page,
98
97
  bo as Popover,
99
98
  Co as PremiumBadge,
100
99
  Fo as Prose,
@@ -107,12 +106,11 @@ export {
107
106
  jo as Spacer,
108
107
  zo as Style,
109
108
  Go as Switch,
110
- xr as Symbols,
109
+ pr as Symbols,
111
110
  Jo as Tabular,
112
111
  Qo as Text,
113
112
  Wo as Textarea,
114
113
  Yo as Title,
115
- rr as outlets,
116
- pr as ui,
114
+ er as ui,
117
115
  S as utils
118
116
  };
@@ -0,0 +1,27 @@
1
+ import { $ as o } from "./index-C75OpfGQ.js";
2
+ function r(t) {
3
+ let e = null;
4
+ if (typeof window < "u" && (e = document.getElementById(t)), !e)
5
+ throw new Error(`Attempted to connect the outlet to the DOM node with ID #${t}, but no such node exists.`);
6
+ return ({
7
+ children: n
8
+ }) => o.createPortal(n, e);
9
+ }
10
+ function u() {
11
+ let t = null;
12
+ if (typeof window < "u" && (t = document.createElement("div"), document.body.appendChild(t)), !t)
13
+ throw new Error("Attempted to create an outlet, but no such outlet exists.");
14
+ return ({
15
+ children: e
16
+ }) => o.createPortal(e, t);
17
+ }
18
+ const c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
19
+ __proto__: null,
20
+ attachOutlet: r,
21
+ createOutlet: u
22
+ }, Symbol.toStringTag, { value: "Module" }));
23
+ export {
24
+ r as a,
25
+ u as c,
26
+ c as o
27
+ };
@@ -1,14 +1,22 @@
1
- function o(r) {
2
- if (!r)
3
- return "";
4
- if (typeof r == "string" || typeof r == "number")
5
- return r.toString();
6
- const t = [];
7
- return typeof r == "object" && (Array.isArray(r) ? r.forEach((e) => t.push(o(e))) : Object.values(r).forEach((e) => t.push(o(e)))), t.filter(Boolean).join(" ");
1
+ function n(t) {
2
+ let l, e = "";
3
+ if (typeof t == "string" || typeof t == "number")
4
+ e += t;
5
+ else if (typeof t == "object")
6
+ if (Array.isArray(t))
7
+ for (let f = 0; f < t.length; f++)
8
+ t[f] && (l = n(t[f])) && (e && (e += " "), e += l);
9
+ else
10
+ for (const f in t)
11
+ t[f] && (e && (e += " "), e += f);
12
+ return e;
8
13
  }
9
- function n(...r) {
10
- return [...r].map((t) => o(t)).filter(Boolean).join(" ");
14
+ function o(...t) {
15
+ let l = 0, e, f, r = "";
16
+ for (; l < t.length; )
17
+ (f = t[l++]) && (e = n(f)) && (r && (r += " "), r += e);
18
+ return r;
11
19
  }
12
20
  export {
13
- n as clsx
21
+ o as clsx
14
22
  };
@@ -11,3 +11,4 @@ export declare namespace useKeyboardClose {
11
11
  var isCloseEvent: (event: KeyboardEvent) => boolean;
12
12
  }
13
13
  export declare function useWindowResize<T extends () => void>(callback: T): void;
14
+ export declare function useOutlet(id: string): React.FC<React.PropsWithChildren>;
@@ -1,9 +1,12 @@
1
+ import "react/jsx-runtime";
1
2
  import "react";
2
- import { u as o, d as u, c as n, b as r, a as b } from "../hooks-Bv1kQUpO.js";
3
+ import "../index-C75OpfGQ.js";
4
+ import { u, e as r, d as i, c as m, a as n, b } from "../hooks-GAujvL7d.js";
3
5
  export {
4
- o as useDynamicRef,
5
- u as useGlobalKeyboardEvent,
6
- n as useInstance,
7
- r as useKeyboardClose,
6
+ u as useDynamicRef,
7
+ r as useGlobalKeyboardEvent,
8
+ i as useInstance,
9
+ m as useKeyboardClose,
10
+ n as useOutlet,
8
11
  b as useWindowResize
9
12
  };
@@ -1,5 +1,5 @@
1
1
  import "../index-C75OpfGQ.js";
2
- import { a as r, c } from "../outlet-C4wpavcH.js";
2
+ import { a as r, c } from "../outlet-B11a3Kgw.js";
3
3
  export {
4
4
  r as attachOutlet,
5
5
  c as createOutlet
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cfx-dev/ui-components",
3
3
  "private": false,
4
- "version": "0.0.11",
4
+ "version": "0.0.13",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "dist/main.js",
@@ -17,6 +17,7 @@
17
17
  "build": "tsc --p ./tsconfig-build.json && vite build",
18
18
  "lint": "eslint --quiet \"src/**/*{ts,tsx}\" \"lib/**/*{ts,tsx}\"",
19
19
  "lint:fix": "eslint --fix --quiet \"src/**/*{ts,tsx}\" \"lib/**/*{ts,tsx}\"",
20
+ "test": "vitest run",
20
21
  "preview": "vite preview",
21
22
  "prepublishOnly": "yarn build",
22
23
  "storybook": "storybook dev -p 6006",
@@ -71,6 +72,7 @@
71
72
  "vite": "^5.2.0",
72
73
  "vite-plugin-dts": "^3.9.1",
73
74
  "vite-plugin-lib-inject-css": "^2.1.1",
74
- "vite-plugin-static-copy": "^1.0.5"
75
+ "vite-plugin-static-copy": "^1.0.5",
76
+ "vitest": "^1.6.0"
75
77
  }
76
78
  }
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const PreTitleOutlet: import('react').FC<{
3
- children?: import('react').ReactNode;
4
- }>;
5
- export declare const TitleOutlet: import('react').FC<{
6
- children?: import('react').ReactNode;
7
- }>;
8
- export declare const AfterTitleOutlet: import('react').FC<{
9
- children?: import('react').ReactNode;
10
- }>;
@@ -1,7 +0,0 @@
1
- import "../outlet-C4wpavcH.js";
2
- import { A as r, P as i, T } from "../outlets-BsMV5obW.js";
3
- export {
4
- r as AfterTitleOutlet,
5
- i as PreTitleOutlet,
6
- T as TitleOutlet
7
- };
@@ -1,65 +0,0 @@
1
- import r from "react";
2
- const a = Symbol("Uninitialized");
3
- function f(e, ...t) {
4
- const n = r.useRef(a);
5
- return n.current === a && (n.current = e(...t)), n.current;
6
- }
7
- function o(e) {
8
- const t = r.useRef(e);
9
- return t.current = e, t;
10
- }
11
- function s(e, t = "keydown", n) {
12
- r.useEffect(() => {
13
- const i = (u) => {
14
- s.shouldProcessEvent(u) && e.current(u);
15
- };
16
- return window.addEventListener(t, i, n), () => {
17
- window.removeEventListener(t, i, n);
18
- };
19
- }, [t, n]);
20
- }
21
- s.shouldProcessEvent = (e) => {
22
- if (e.target instanceof Element) {
23
- if (e.target.hasAttribute("contenteditable"))
24
- return !1;
25
- switch (e.target.tagName) {
26
- case "INPUT":
27
- case "SELECT":
28
- case "TEXTAREA":
29
- return !1;
30
- default:
31
- return !0;
32
- }
33
- }
34
- return !0;
35
- };
36
- function c(e) {
37
- const t = o((n) => {
38
- c.isCloseEvent(n) && e();
39
- });
40
- s(t);
41
- }
42
- c.isCloseEvent = (e) => e.key === "Escape";
43
- function l(e) {
44
- const t = o(e);
45
- r.useEffect(() => {
46
- const n = () => t.current();
47
- return window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
48
- }, []);
49
- }
50
- const E = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
51
- __proto__: null,
52
- useDynamicRef: o,
53
- useGlobalKeyboardEvent: s,
54
- useInstance: f,
55
- useKeyboardClose: c,
56
- useWindowResize: l
57
- }, Symbol.toStringTag, { value: "Module" }));
58
- export {
59
- l as a,
60
- c as b,
61
- f as c,
62
- s as d,
63
- E as h,
64
- o as u
65
- };
@@ -1,25 +0,0 @@
1
- import { $ as o } from "./index-C75OpfGQ.js";
2
- function n(t) {
3
- const e = document.getElementById(t);
4
- if (!e)
5
- throw new Error(`Tried to attach outlet to the DOM node #${t}, but there is no such`);
6
- return ({
7
- children: r
8
- }) => o.createPortal(r, e);
9
- }
10
- function a() {
11
- const t = document.createElement("div");
12
- return document.body.appendChild(t), ({
13
- children: e
14
- }) => o.createPortal(e, t);
15
- }
16
- const u = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
17
- __proto__: null,
18
- attachOutlet: n,
19
- createOutlet: a
20
- }, Symbol.toStringTag, { value: "Module" }));
21
- export {
22
- n as a,
23
- a as c,
24
- u as o
25
- };
@@ -1,13 +0,0 @@
1
- import { c as t } from "./outlet-C4wpavcH.js";
2
- const e = t(), o = t(), l = t(), s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3
- __proto__: null,
4
- AfterTitleOutlet: l,
5
- PreTitleOutlet: e,
6
- TitleOutlet: o
7
- }, Symbol.toStringTag, { value: "Module" }));
8
- export {
9
- l as A,
10
- e as P,
11
- o as T,
12
- s as o
13
- };