@cfx-dev/ui-components 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
 
3
+ export declare const BACKDROP_OUTLET_ID = "backdrop-outlet";
3
4
  export interface BackdropPortalProps {
4
5
  children?: React.ReactNode;
5
6
  }
@@ -1,11 +1,13 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { useOutlet as p } from "../../utils/hooks.js";
3
- function u({
4
- children: o
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { useOutlet as c } from "../../utils/hooks.js";
3
+ const e = "backdrop-outlet";
4
+ function n({
5
+ children: t
5
6
  }) {
6
- const r = p("backdrop");
7
- return /* @__PURE__ */ t(r, { children: o });
7
+ const o = c(e);
8
+ return /* @__PURE__ */ r(o, { children: t });
8
9
  }
9
10
  export {
10
- u as BackdropPortal
11
+ e as BACKDROP_OUTLET_ID,
12
+ n as BackdropPortal
11
13
  };
@@ -1,5 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
 
3
+ export declare const FLYOUT_OUTLET_ID = "flyout-outlet";
3
4
  export interface FlyoutProps {
4
5
  disabled?: boolean;
5
6
  size?: 'normal' | 'small' | 'xsmall';
@@ -1,59 +1,60 @@
1
1
  import { jsxs as i, jsx as s } from "react/jsx-runtime";
2
- import d from "react";
2
+ import _ from "react";
3
3
  import { F as p } from "../../Combination-Dp_plIQU.js";
4
4
  import { Button as h } from "../Button/Button.js";
5
5
  import { Interactive as f } from "../Interactive/Interactive.js";
6
6
  import { I as u } from "../../Icons-BlBKvJD8.js";
7
- import { clsx as c } from "../../utils/clsx.js";
7
+ import { clsx as l } from "../../utils/clsx.js";
8
8
  import { noop as v } from "../../utils/functional.js";
9
9
  import { useOutlet as b, useKeyboardClose as z } from "../../utils/hooks.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 = {
10
+ import '../../assets/Flyout.css';const N = "_root_11ks7_1", C = "_holder_11ks7_6", y = "_active_11ks7_15", F = "_backdrop_11ks7_15", x = "_mask_11ks7_28", I = "_content_11ks7_90", L = "_header_11ks7_95", O = "_title_11ks7_101", e = {
11
11
  root: N,
12
12
  "size-normal": "_size-normal_11ks7_6",
13
13
  holder: C,
14
14
  "size-small": "_size-small_11ks7_9",
15
15
  "size-xsmall": "_size-xsmall_11ks7_12",
16
16
  active: y,
17
- backdrop: x,
17
+ backdrop: F,
18
18
  "backdrop-appearance": "_backdrop-appearance_11ks7_1",
19
- mask: F,
19
+ mask: x,
20
20
  "holder-appearance": "_holder-appearance_11ks7_1",
21
21
  content: I,
22
22
  header: L,
23
- title: g
24
- };
25
- function j(n) {
23
+ title: O
24
+ }, E = "flyout-outlet";
25
+ function T(c) {
26
26
  const {
27
27
  disabled: o = !1,
28
28
  size: a = "normal",
29
29
  onClose: r = v,
30
- children: l,
31
- holderClassName: m
32
- } = n, _ = b("flyout-outlet");
33
- d.useEffect(() => {
30
+ children: n,
31
+ holderClassName: d
32
+ } = c, m = b(E);
33
+ _.useEffect(() => {
34
34
  if (o)
35
35
  return;
36
36
  const t = document.getElementById("cfxui-root");
37
37
  return t == null || t.classList.add("shrink"), () => t == null ? void 0 : t.classList.remove("shrink");
38
38
  }, [o]), z(r);
39
- const k = c(e.root, e[`size-${a}`], {
39
+ const k = l(e.root, e[`size-${a}`], {
40
40
  [e.active]: !o
41
41
  });
42
- return /* @__PURE__ */ s(_, { children: /* @__PURE__ */ i("div", { className: k, children: [
42
+ return /* @__PURE__ */ s(m, { children: /* @__PURE__ */ i("div", { className: k, children: [
43
43
  /* @__PURE__ */ s(f, { showPointer: !1, className: e.backdrop, onClick: r }),
44
- /* @__PURE__ */ s("div", { className: e.mask, children: /* @__PURE__ */ s("div", { className: c(e.holder, m), children: /* @__PURE__ */ s(p, { disabled: !!o, className: e.content, children: l }) }) })
44
+ /* @__PURE__ */ s("div", { className: e.mask, children: /* @__PURE__ */ s("div", { className: l(e.holder, d), children: /* @__PURE__ */ s(p, { disabled: !!o, className: e.content, children: n }) }) })
45
45
  ] }) });
46
46
  }
47
- j.Header = d.forwardRef(function(o, a) {
47
+ T.Header = _.forwardRef(function(o, a) {
48
48
  const {
49
49
  onClose: r,
50
- children: l
50
+ children: n
51
51
  } = o;
52
52
  return /* @__PURE__ */ i("div", { ref: a, className: e.header, children: [
53
- /* @__PURE__ */ s("div", { className: e.title, children: l }),
53
+ /* @__PURE__ */ s("div", { className: e.title, children: n }),
54
54
  !!r && /* @__PURE__ */ s(h, { size: "large", icon: u.exit, onClick: r })
55
55
  ] });
56
56
  });
57
57
  export {
58
- j as Flyout
58
+ E as FLYOUT_OUTLET_ID,
59
+ T as Flyout
59
60
  };
@@ -1,5 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
 
3
+ export declare const OVERLAY_OUTLET_ID = "overlay-outlet";
3
4
  export interface OverlayProps {
4
5
  children: React.ReactNode;
5
6
  className?: string;
@@ -1,28 +1,29 @@
1
- import { jsx as t } from "react/jsx-runtime";
1
+ import { jsx as r } from "react/jsx-runtime";
2
2
  import a from "react";
3
3
  import { F as i } from "../../Combination-Dp_plIQU.js";
4
4
  import { Interactive as m } from "../Interactive/Interactive.js";
5
5
  import { clsx as e } from "../../utils/clsx.js";
6
6
  import { useOutlet as u } from "../../utils/hooks.js";
7
- import '../../assets/Overlay.css';const f = "_root_15udb_1", _ = "_backdrop_15udb_9", p = "_content_15udb_27", n = {
8
- root: f,
9
- backdrop: _,
7
+ import '../../assets/Overlay.css';const _ = "_root_15udb_1", f = "_backdrop_15udb_9", p = "_content_15udb_27", n = {
8
+ root: _,
9
+ backdrop: f,
10
10
  "backdrop-appearance": "_backdrop-appearance_15udb_1",
11
11
  content: p
12
- };
12
+ }, b = "overlay-outlet";
13
13
  function l(c) {
14
14
  const {
15
15
  className: o,
16
- children: r
17
- } = c, d = e(n.root, o), s = u("overlay-outlet");
18
- return /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t("div", { className: d, children: r }) });
16
+ children: t
17
+ } = c, s = e(n.root, o), d = u(b);
18
+ return /* @__PURE__ */ r(d, { children: /* @__PURE__ */ r("div", { className: s, children: t }) });
19
19
  }
20
- l.Backdrop = a.forwardRef(function(o, r) {
21
- return /* @__PURE__ */ t(m, { ref: r, onClick: o.onClick, className: e(n.backdrop, o.className), children: o.children });
20
+ l.Backdrop = a.forwardRef(function(o, t) {
21
+ return /* @__PURE__ */ r(m, { ref: t, onClick: o.onClick, className: e(n.backdrop, o.className), children: o.children });
22
22
  });
23
- l.Content = a.forwardRef(function(o, r) {
24
- return /* @__PURE__ */ t("div", { ref: r, className: e(n.content, o.className), children: /* @__PURE__ */ t(i, { children: o.children }) });
23
+ l.Content = a.forwardRef(function(o, t) {
24
+ return /* @__PURE__ */ r("div", { ref: t, className: e(n.content, o.className), children: /* @__PURE__ */ r(i, { children: o.children }) });
25
25
  });
26
26
  export {
27
+ b as OVERLAY_OUTLET_ID,
27
28
  l as Overlay
28
29
  };
@@ -1,17 +1,18 @@
1
- import { jsx as t, jsxs as m } from "react/jsx-runtime";
2
- import s from "react";
3
- import { ui as p } from "../ui.js";
4
- import { useOutletBefore as v, useWindowResize as x } from "../../utils/hooks.js";
5
- import '../../assets/Shroud.css';const _ = "_root_7v6x1_1", g = "_tile_7v6x1_6", e = {
6
- root: _,
1
+ import { jsx as t, jsxs as h } from "react/jsx-runtime";
2
+ import r from "react";
3
+ import { TITLE_OUTLET_ID as p } from "../Title/Title.js";
4
+ import { ui as _ } from "../ui.js";
5
+ import { useOutlet as v, useWindowResize as x } from "../../utils/hooks.js";
6
+ import '../../assets/Shroud.css';const b = "_root_7v6x1_1", g = "_tile_7v6x1_6", e = {
7
+ root: b,
7
8
  tile: g
8
- }, S = s.forwardRef(function(c, n) {
9
+ }, S = r.forwardRef(function(c, n) {
9
10
  const {
10
- forRef: r
11
- } = c, [u, d] = s.useState({}), f = v("title"), i = s.useCallback(() => {
12
- if (!r.current)
11
+ forRef: s
12
+ } = c, [u, d] = r.useState({}), f = v(p, "before"), i = r.useCallback(() => {
13
+ if (!s.current)
13
14
  return;
14
- const o = r.current.getBoundingClientRect(), h = {
15
+ const o = s.current.getBoundingClientRect(), m = {
15
16
  x: o.x,
16
17
  y: o.y,
17
18
  w: o.width,
@@ -21,14 +22,14 @@ import '../../assets/Shroud.css';const _ = "_root_7v6x1_1", g = "_tile_7v6x1_6",
21
22
  };
22
23
  d(
23
24
  Object.fromEntries(
24
- Object.entries(h).flatMap(([l, a]) => [
25
- [`--${l}`, p.px(a)],
26
- [`--${l}-raw`, a]
25
+ Object.entries(m).flatMap(([a, l]) => [
26
+ [`--${a}`, _.px(l)],
27
+ [`--${a}-raw`, l]
27
28
  ])
28
29
  )
29
30
  );
30
31
  }, []);
31
- return s.useEffect(i, []), x(i), /* @__PURE__ */ t(f, { children: /* @__PURE__ */ m("div", { ref: n, className: e.root, style: u, children: [
32
+ return r.useEffect(i, []), x(i), /* @__PURE__ */ t(f, { children: /* @__PURE__ */ h("div", { ref: n, className: e.root, style: u, children: [
32
33
  /* @__PURE__ */ t("div", { className: e.tile, "data-top": !0 }),
33
34
  /* @__PURE__ */ t("div", { className: e.tile, "data-left": !0 }),
34
35
  /* @__PURE__ */ t("div", { className: e.tile, "data-right": !0 }),
@@ -1,5 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
 
3
+ export declare const TITLE_OUTLET_ID = "title-outlet";
3
4
  type FixedOn = 'top' | 'top-left' | 'right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left';
4
5
  type TitleChildren = ((ref: React.RefObject<any>) => React.ReactNode) | React.ReactElement;
5
6
  export interface TitleProps {
@@ -1,11 +1,11 @@
1
- import { jsxs as L, Fragment as k, jsx as p } from "react/jsx-runtime";
1
+ import { jsxs as T, Fragment as w, jsx as p } from "react/jsx-runtime";
2
2
  import f from "react";
3
3
  import { clsx as O } from "../../utils/clsx.js";
4
- import { useOutlet as y } from "../../utils/hooks.js";
5
- import { mergeRefs as C } from "../../utils/mergeRefs.js";
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,
4
+ import { useOutlet as k } from "../../utils/hooks.js";
5
+ import { mergeRefs as y } from "../../utils/mergeRefs.js";
6
+ import '../../assets/Title.css';const C = "_wrapper_1l1sn_1", R = "_appearance_1l1sn_1", $ = "_animated_1l1sn_26", M = "_root_1l1sn_71", N = "_shortcut_1l1sn_84", m = {
7
+ wrapper: C,
8
+ appearance: R,
9
9
  animated: $,
10
10
  "fixed-on-top": "_fixed-on-top_1l1sn_29",
11
11
  "fixed-on-top-left": "_fixed-on-top-left_1l1sn_35",
@@ -16,9 +16,9 @@ import '../../assets/Title.css';const R = "_wrapper_1l1sn_1", T = "_appearance_1
16
16
  "fixed-on-right": "_fixed-on-right_1l1sn_65",
17
17
  root: M,
18
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;
19
+ }, i = 10, S = "title-outlet";
20
+ function F(l, a, [e, n]) {
21
+ const r = l ? n : n - 20, s = l ? 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,18 +26,18 @@ function S(a, l, [e, n]) {
26
26
  left: `${s}px`,
27
27
  // transform: `translate(${left}px, ${top}px)`,
28
28
  maxWidth: `calc(100vw - ${s}px - 10px)`,
29
- animationDelay: `${l}ms`
29
+ animationDelay: `${a}ms`
30
30
  };
31
31
  }
32
- function F(a, l) {
32
+ function I(l, a) {
33
33
  const {
34
34
  x: e,
35
35
  y: n,
36
36
  width: r,
37
37
  height: s
38
- } = a.getBoundingClientRect();
38
+ } = l.getBoundingClientRect();
39
39
  let t = 0, c = 0;
40
- switch (l) {
40
+ switch (a) {
41
41
  case "top": {
42
42
  t = e + r / 2, c = n - i;
43
43
  break;
@@ -69,21 +69,21 @@ function F(a, l) {
69
69
  }
70
70
  return [t, c];
71
71
  }
72
- function D(a) {
72
+ function B(l) {
73
73
  const {
74
- title: l,
74
+ title: a,
75
75
  children: e,
76
76
  animated: n = !0,
77
77
  fixedOn: r = "bottom",
78
78
  delay: s = 0
79
- } = a, t = f.useRef(r);
79
+ } = l, t = f.useRef(r);
80
80
  t.current = r;
81
- const c = y("title"), o = f.useRef(null), [g, x] = f.useState(!1), [E, _] = f.useState([0, 0]);
81
+ const c = k(S), o = f.useRef(null), [g, x] = f.useState(!1), [E, _] = f.useState([0, 0]);
82
82
  f.useEffect(() => {
83
83
  if (!o.current)
84
84
  return;
85
85
  const d = (u) => {
86
- t.current && o.current ? _(F(o.current, t.current)) : _([u.clientX, u.clientY]), x(!0);
86
+ t.current && o.current ? _(I(o.current, t.current)) : _([u.clientX, u.clientY]), x(!0);
87
87
  }, v = () => {
88
88
  x(!1);
89
89
  }, b = (u) => {
@@ -94,20 +94,21 @@ function D(a) {
94
94
  };
95
95
  }, []);
96
96
  let h = null;
97
- if (g && l) {
97
+ if (g && a) {
98
98
  const d = O(m.wrapper, m[`fixed-on-${r}`], {
99
99
  [m.animated]: n
100
100
  });
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 }) }) });
101
+ h = /* @__PURE__ */ p(c, { children: /* @__PURE__ */ p("div", { className: d, style: F(!!r, s, E), children: /* @__PURE__ */ p("div", { className: m.root, children: a }) }) });
102
102
  }
103
- const w = typeof e == "function" ? e(o) : f.cloneElement(e, {
104
- ref: C(o, e.props.ref)
103
+ const L = typeof e == "function" ? e(o) : f.cloneElement(e, {
104
+ ref: y(o, e.props.ref)
105
105
  });
106
- return /* @__PURE__ */ L(k, { children: [
107
- w,
106
+ return /* @__PURE__ */ T(w, { children: [
107
+ L,
108
108
  h
109
109
  ] });
110
110
  }
111
111
  export {
112
- D as Title
112
+ S as TITLE_OUTLET_ID,
113
+ B as Title
113
114
  };
package/dist/main.d.ts CHANGED
@@ -1,25 +1,26 @@
1
1
  export { mergeRefs } from './utils/mergeRefs';
2
2
  export { clsx } from './utils/clsx';
3
3
  export { getValue } from './utils/getValue';
4
- export { useInstance, useDynamicRef, useGlobalKeyboardEvent, useKeyboardClose, useWindowResize, useOutlet, useOutletAfter, useOutletBefore, } from './utils/hooks';
4
+ export { useInstance, useDynamicRef, useGlobalKeyboardEvent, useKeyboardClose, useWindowResize, useOutlet, } from './utils/hooks';
5
5
  export { noop, returnTrue, returnFalse, identity, invoke, } from './utils/functional';
6
6
  export { isExternalUrl, matchLinks, matchLinkNodes, defaultLinkReplacerx, defaultLinkReplacer, linkifyx, linkify, Linkify, } from './utils/links';
7
7
  export { clamp01, clamp, } from './utils/math';
8
8
  export { unicodeCharAt, splitByIndices, replaceRange, normalizeSlashes, isTrueString, isFalseString, } from './utils/string';
9
9
  export type { ValueOrGetter } from './utils/getValue';
10
10
  export type { ILinkSubstitute, ILinkMatch, LinkifyProps, } from './utils/links';
11
+ export type { OutletPosition } from './utils/hooks';
11
12
  export { Checkbox } from './components/Checkbox/Checkbox';
12
13
  export { Button } from './components/Button/Button';
13
14
  export { LinkButton } from './components/Button/LinkButton';
14
15
  export { ButtonBar } from './components/Button/ButtonBar';
15
16
  export { Avatar } from './components/Avatar/Avatar';
16
- export { BackdropPortal } from './components/BackdropPortal/BackdropPortal';
17
+ export { BackdropPortal, BACKDROP_OUTLET_ID } from './components/BackdropPortal/BackdropPortal';
17
18
  export { Badge } from './components/Badge/Badge';
18
19
  export { ControlBox } from './components/ControlBox/ControlBox';
19
20
  export { CountryFlag } from './components/CountryFlag/CountryFlag';
20
21
  export { Decorate } from './components/Decorate/Decorate';
21
22
  export { Dot } from './components/Dot/Dot';
22
- export { Flyout } from './components/Flyout/Flyout';
23
+ export { Flyout, FLYOUT_OUTLET_ID } from './components/Flyout/Flyout';
23
24
  export { Icon } from './components/Icon/Icon';
24
25
  export { Indicator } from './components/Indicator/Indicator';
25
26
  export { InfoPanel } from './components/InfoPanel/InfoPanel';
@@ -38,7 +39,7 @@ export { VirtualScrollable } from './components/Layout/Scrollable/VirtualScrolla
38
39
  export { Loaf } from './components/Loaf/Loaf';
39
40
  export { Modal } from './components/Modal/Modal';
40
41
  export { NavList } from './components/NavList/NavList';
41
- export { Overlay } from './components/Overlay/Overlay';
42
+ export { Overlay, OVERLAY_OUTLET_ID } from './components/Overlay/Overlay';
42
43
  export { Popover } from './components/Popover/Popover';
43
44
  export { PremiumBadge } from './components/PremiumBadge/PremiumBadge';
44
45
  export { Prose } from './components/Prose/Prose';
@@ -52,7 +53,7 @@ export { Switch } from './components/Switch/Switch';
52
53
  export { Tabular } from './components/Tabular/Tabular';
53
54
  export { Text, TextBlock } from './components/Text/Text';
54
55
  export { Textarea } from './components/Textarea/Textarea';
55
- export { Title } from './components/Title/Title';
56
+ export { Title, TITLE_OUTLET_ID } from './components/Title/Title';
56
57
  export { InputDropzone } from './components/InputDropzone/InputDropzone';
57
58
  export type { InputDropzoneProps, FileWithPath } from './components/InputDropzone/InputDropzone';
58
59
  export { Icons, BrandIcon } from './style-guide/Icons/Icons';
package/dist/main.js CHANGED
@@ -1,145 +1,147 @@
1
1
  import { mergeRefs as e } from "./utils/mergeRefs.js";
2
2
  import { clsx as p } from "./utils/clsx.js";
3
- import { getValue as f } from "./utils/getValue.js";
4
- import { useDynamicRef as a, useGlobalKeyboardEvent as l, useInstance as n, useKeyboardClose as i, useOutlet as s, useOutletAfter as u, useOutletBefore as c, useWindowResize as d } from "./utils/hooks.js";
5
- import { identity as y, invoke as B, noop as I, returnFalse as k, returnTrue as g } from "./utils/functional.js";
6
- import { Linkify as b, defaultLinkReplacer as h, defaultLinkReplacerx as L, isExternalUrl as v, linkify as C, linkifyx as P, matchLinkNodes as T, matchLinks as F } from "./utils/links.js";
7
- import { clamp as D, clamp01 as z } from "./utils/math.js";
8
- import { isFalseString as w, isTrueString as E, normalizeSlashes as K, replaceRange as N, splitByIndices as V, unicodeCharAt as G } from "./utils/string.js";
9
- import { Checkbox as U } from "./components/Checkbox/Checkbox.js";
10
- import { Button as j } from "./components/Button/Button.js";
11
- import { LinkButton as H } from "./components/Button/LinkButton.js";
12
- import { ButtonBar as Q } from "./components/Button/ButtonBar.js";
13
- import { Avatar as Y } from "./components/Avatar/Avatar.js";
14
- import { BackdropPortal as _ } from "./components/BackdropPortal/BackdropPortal.js";
15
- import { Badge as rr } from "./components/Badge/Badge.js";
16
- import { ControlBox as er } from "./components/ControlBox/ControlBox.js";
17
- import { CountryFlag as pr } from "./components/CountryFlag/CountryFlag.js";
18
- import { Decorate as fr } from "./components/Decorate/Decorate.js";
19
- import { Dot as ar } from "./components/Dot/Dot.js";
20
- import { Flyout as nr } from "./components/Flyout/Flyout.js";
3
+ import { getValue as m } from "./utils/getValue.js";
4
+ import { useDynamicRef as a, useGlobalKeyboardEvent as n, useInstance as l, useKeyboardClose as i, useOutlet as s, useWindowResize as u } from "./utils/hooks.js";
5
+ import { identity as d, invoke as I, noop as T, returnFalse as L, returnTrue as S } from "./utils/functional.js";
6
+ import { Linkify as B, defaultLinkReplacer as k, defaultLinkReplacerx as R, isExternalUrl as O, linkify as g, linkifyx as D, matchLinkNodes as b, matchLinks as h } from "./utils/links.js";
7
+ import { clamp as E, clamp01 as P } from "./utils/math.js";
8
+ import { isFalseString as v, isTrueString as F, normalizeSlashes as U, replaceRange as A, splitByIndices as z, unicodeCharAt as K } from "./utils/string.js";
9
+ import { Checkbox as w } from "./components/Checkbox/Checkbox.js";
10
+ import { Button as Y } from "./components/Button/Button.js";
11
+ import { LinkButton as M } from "./components/Button/LinkButton.js";
12
+ import { ButtonBar as j } from "./components/Button/ButtonBar.js";
13
+ import { Avatar as H } from "./components/Avatar/Avatar.js";
14
+ import { BACKDROP_OUTLET_ID as Q, BackdropPortal as X } from "./components/BackdropPortal/BackdropPortal.js";
15
+ import { Badge as $ } from "./components/Badge/Badge.js";
16
+ import { ControlBox as or } from "./components/ControlBox/ControlBox.js";
17
+ import { CountryFlag as tr } from "./components/CountryFlag/CountryFlag.js";
18
+ import { Decorate as xr } from "./components/Decorate/Decorate.js";
19
+ import { Dot as fr } from "./components/Dot/Dot.js";
20
+ import { FLYOUT_OUTLET_ID as nr, Flyout as lr } from "./components/Flyout/Flyout.js";
21
21
  import { Icon as sr } from "./components/Icon/Icon.js";
22
22
  import { Indicator as cr } from "./components/Indicator/Indicator.js";
23
- import { InfoPanel as Sr } from "./components/InfoPanel/InfoPanel.js";
24
- import { Input as Br } from "./components/Input/Input.js";
25
- import { RichInput as kr } from "./components/Input/RichInput.js";
26
- import { Interactive as Rr } from "./components/Interactive/Interactive.js";
27
- import { Island as hr } from "./components/Island/Island.js";
28
- import { Box as vr } from "./components/Layout/Box/Box.js";
29
- import { Center as Pr } from "./components/Layout/Center/Center.js";
30
- import { Flex as Fr } from "./components/Layout/Flex/Flex.js";
31
- import { FlexRestricter as Dr } from "./components/Layout/Flex/FlexRestricter.js";
32
- import { Pad as Ar } from "./components/Layout/Pad/Pad.js";
33
- import { Page as Er } from "./components/Layout/Page/Page.js";
34
- import { Scrollable as Nr } from "./components/Layout/Scrollable/Scrollable.js";
35
- import { VirtualScrollable as Gr } from "./components/Layout/Scrollable/VirtualScrollable.js";
36
- import { Loaf as Ur } from "./components/Loaf/Loaf.js";
37
- import { Modal as jr } from "./components/Modal/Modal.js";
38
- import { NavList as Hr } from "./components/NavList/NavList.js";
39
- import { Overlay as Qr } from "./components/Overlay/Overlay.js";
40
- import { Popover as Yr } from "./components/Popover/Popover.js";
41
- import { PremiumBadge as _r } from "./components/PremiumBadge/PremiumBadge.js";
42
- import { Prose as ro } from "./components/Prose/Prose.js";
43
- import { Radio as eo } from "./components/Radio/Radio.js";
44
- import { Select as po } from "./components/Select/Select.js";
23
+ import { InfoPanel as Ir } from "./components/InfoPanel/InfoPanel.js";
24
+ import { Input as Lr } from "./components/Input/Input.js";
25
+ import { RichInput as yr } from "./components/Input/RichInput.js";
26
+ import { Interactive as kr } from "./components/Interactive/Interactive.js";
27
+ import { Island as Or } from "./components/Island/Island.js";
28
+ import { Box as Dr } from "./components/Layout/Box/Box.js";
29
+ import { Center as hr } from "./components/Layout/Center/Center.js";
30
+ import { Flex as Er } from "./components/Layout/Flex/Flex.js";
31
+ import { FlexRestricter as _r } from "./components/Layout/Flex/FlexRestricter.js";
32
+ import { Pad as Fr } from "./components/Layout/Pad/Pad.js";
33
+ import { Page as Ar } from "./components/Layout/Page/Page.js";
34
+ import { Scrollable as Kr } from "./components/Layout/Scrollable/Scrollable.js";
35
+ import { VirtualScrollable as wr } from "./components/Layout/Scrollable/VirtualScrollable.js";
36
+ import { Loaf as Yr } from "./components/Loaf/Loaf.js";
37
+ import { Modal as Mr } from "./components/Modal/Modal.js";
38
+ import { NavList as jr } from "./components/NavList/NavList.js";
39
+ import { OVERLAY_OUTLET_ID as Hr, Overlay as Jr } from "./components/Overlay/Overlay.js";
40
+ import { Popover as Xr } from "./components/Popover/Popover.js";
41
+ import { PremiumBadge as $r } from "./components/PremiumBadge/PremiumBadge.js";
42
+ import { Prose as oo } from "./components/Prose/Prose.js";
43
+ import { Radio as to } from "./components/Radio/Radio.js";
44
+ import { Select as xo } from "./components/Select/Select.js";
45
45
  import { Separator as fo } from "./components/Separator/Separator.js";
46
- import { Shroud as ao } from "./components/Shroud/Shroud.js";
47
- import { Spacer as no } from "./components/Spacer/Spacer.js";
48
- import { Style as so, useContextualStyle as uo } from "./components/Style/Style.js";
49
- import { Switch as So } from "./components/Switch/Switch.js";
50
- import { Tabular as Bo } from "./components/Tabular/Tabular.js";
51
- import { Text as ko, TextBlock as go } from "./components/Text/Text.js";
52
- import { Textarea as bo } from "./components/Textarea/Textarea.js";
53
- import { Title as Lo } from "./components/Title/Title.js";
46
+ import { Shroud as no } from "./components/Shroud/Shroud.js";
47
+ import { Spacer as io } from "./components/Spacer/Spacer.js";
48
+ import { Style as uo, useContextualStyle as co } from "./components/Style/Style.js";
49
+ import { Switch as To } from "./components/Switch/Switch.js";
50
+ import { Tabular as So } from "./components/Tabular/Tabular.js";
51
+ import { Text as Bo, TextBlock as ko } from "./components/Text/Text.js";
52
+ import { Textarea as Oo } from "./components/Textarea/Textarea.js";
53
+ import { TITLE_OUTLET_ID as Do, Title as bo } from "./components/Title/Title.js";
54
54
  import { InputDropzone as Co } from "./components/InputDropzone/InputDropzone.js";
55
- import { B as To, I as Fo } from "./Icons-BlBKvJD8.js";
56
- import { OnScreenSensor as Do } from "./components/OnScreenSensor.js";
55
+ import { B as Po, I as _o } from "./Icons-BlBKvJD8.js";
56
+ import { OnScreenSensor as Fo } from "./components/OnScreenSensor.js";
57
57
  import { ui as Ao } from "./components/ui.js";
58
- import { Symbols as Eo } from "./components/Symbols.js";
58
+ import { Symbols as Ko } from "./components/Symbols.js";
59
59
  export {
60
- Y as Avatar,
61
- _ as BackdropPortal,
62
- rr as Badge,
63
- vr as Box,
64
- To as BrandIcon,
65
- j as Button,
66
- Q as ButtonBar,
67
- Pr as Center,
68
- U as Checkbox,
69
- er as ControlBox,
70
- pr as CountryFlag,
71
- fr as Decorate,
72
- ar as Dot,
73
- Fr as Flex,
74
- Dr as FlexRestricter,
75
- nr as Flyout,
60
+ H as Avatar,
61
+ Q as BACKDROP_OUTLET_ID,
62
+ X as BackdropPortal,
63
+ $ as Badge,
64
+ Dr as Box,
65
+ Po as BrandIcon,
66
+ Y as Button,
67
+ j as ButtonBar,
68
+ hr as Center,
69
+ w as Checkbox,
70
+ or as ControlBox,
71
+ tr as CountryFlag,
72
+ xr as Decorate,
73
+ fr as Dot,
74
+ nr as FLYOUT_OUTLET_ID,
75
+ Er as Flex,
76
+ _r as FlexRestricter,
77
+ lr as Flyout,
76
78
  sr as Icon,
77
- Fo as Icons,
79
+ _o as Icons,
78
80
  cr as Indicator,
79
- Sr as InfoPanel,
80
- Br as Input,
81
+ Ir as InfoPanel,
82
+ Lr as Input,
81
83
  Co as InputDropzone,
82
- Rr as Interactive,
83
- hr as Island,
84
- H as LinkButton,
85
- b as Linkify,
86
- Ur as Loaf,
87
- jr as Modal,
88
- Hr as NavList,
89
- Do as OnScreenSensor,
90
- Qr as Overlay,
91
- Ar as Pad,
92
- Er as Page,
93
- Yr as Popover,
94
- _r as PremiumBadge,
95
- ro as Prose,
96
- eo as Radio,
97
- kr as RichInput,
98
- Nr as Scrollable,
99
- po as Select,
84
+ kr as Interactive,
85
+ Or as Island,
86
+ M as LinkButton,
87
+ B as Linkify,
88
+ Yr as Loaf,
89
+ Mr as Modal,
90
+ jr as NavList,
91
+ Hr as OVERLAY_OUTLET_ID,
92
+ Fo as OnScreenSensor,
93
+ Jr as Overlay,
94
+ Fr as Pad,
95
+ Ar as Page,
96
+ Xr as Popover,
97
+ $r as PremiumBadge,
98
+ oo as Prose,
99
+ to as Radio,
100
+ yr as RichInput,
101
+ Kr as Scrollable,
102
+ xo as Select,
100
103
  fo as Separator,
101
- ao as Shroud,
102
- no as Spacer,
103
- so as Style,
104
- So as Switch,
105
- Eo as Symbols,
106
- Bo as Tabular,
107
- ko as Text,
108
- go as TextBlock,
109
- bo as Textarea,
110
- Lo as Title,
111
- Gr as VirtualScrollable,
112
- D as clamp,
113
- z as clamp01,
104
+ no as Shroud,
105
+ io as Spacer,
106
+ uo as Style,
107
+ To as Switch,
108
+ Ko as Symbols,
109
+ Do as TITLE_OUTLET_ID,
110
+ So as Tabular,
111
+ Bo as Text,
112
+ ko as TextBlock,
113
+ Oo as Textarea,
114
+ bo as Title,
115
+ wr as VirtualScrollable,
116
+ E as clamp,
117
+ P as clamp01,
114
118
  p as clsx,
115
- h as defaultLinkReplacer,
116
- L as defaultLinkReplacerx,
117
- f as getValue,
118
- y as identity,
119
- B as invoke,
120
- v as isExternalUrl,
121
- w as isFalseString,
122
- E as isTrueString,
123
- C as linkify,
124
- P as linkifyx,
125
- T as matchLinkNodes,
126
- F as matchLinks,
119
+ k as defaultLinkReplacer,
120
+ R as defaultLinkReplacerx,
121
+ m as getValue,
122
+ d as identity,
123
+ I as invoke,
124
+ O as isExternalUrl,
125
+ v as isFalseString,
126
+ F as isTrueString,
127
+ g as linkify,
128
+ D as linkifyx,
129
+ b as matchLinkNodes,
130
+ h as matchLinks,
127
131
  e as mergeRefs,
128
- I as noop,
129
- K as normalizeSlashes,
130
- N as replaceRange,
131
- k as returnFalse,
132
- g as returnTrue,
133
- V as splitByIndices,
132
+ T as noop,
133
+ U as normalizeSlashes,
134
+ A as replaceRange,
135
+ L as returnFalse,
136
+ S as returnTrue,
137
+ z as splitByIndices,
134
138
  Ao as ui,
135
- G as unicodeCharAt,
136
- uo as useContextualStyle,
139
+ K as unicodeCharAt,
140
+ co as useContextualStyle,
137
141
  a as useDynamicRef,
138
- l as useGlobalKeyboardEvent,
139
- n as useInstance,
142
+ n as useGlobalKeyboardEvent,
143
+ l as useInstance,
140
144
  i as useKeyboardClose,
141
145
  s as useOutlet,
142
- u as useOutletAfter,
143
- c as useOutletBefore,
144
- d as useWindowResize
146
+ u as useWindowResize
145
147
  };
@@ -11,6 +11,5 @@ 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 useOutletAfter(id: string): React.FC<React.PropsWithChildren>;
15
- export declare function useOutletBefore(id: string): React.FC<React.PropsWithChildren>;
16
- export declare function useOutlet(id: string): React.FC<React.PropsWithChildren>;
14
+ export type OutletPosition = 'original' | 'before' | 'after';
15
+ export declare function useOutlet(id: string, position?: OutletPosition): React.FC<React.PropsWithChildren>;
@@ -1,24 +1,24 @@
1
- import { jsx as y } from "react/jsx-runtime";
2
- import u from "react";
3
- import { R as d } from "../index-2hJuj4UN.js";
4
- const f = Symbol("Uninitialized");
5
- function P(e, ...t) {
6
- const n = u.useRef(f);
7
- return n.current === f && (n.current = e(...t)), n.current;
1
+ import { jsx as E } from "react/jsx-runtime";
2
+ import o from "react";
3
+ import { R as m } from "../index-2hJuj4UN.js";
4
+ const a = Symbol("Uninitialized");
5
+ function h(e, ...t) {
6
+ const r = o.useRef(a);
7
+ return r.current === a && (r.current = e(...t)), r.current;
8
8
  }
9
- function m(e) {
10
- const t = u.useRef(e);
9
+ function l(e) {
10
+ const t = o.useRef(e);
11
11
  return t.current = e, t;
12
12
  }
13
- function i(e, t = "keydown", n) {
14
- u.useEffect(() => {
15
- const o = (r) => {
16
- i.shouldProcessEvent(r) && e.current(r);
13
+ function i(e, t = "keydown", r) {
14
+ o.useEffect(() => {
15
+ const s = (n) => {
16
+ i.shouldProcessEvent(n) && e.current(n);
17
17
  };
18
- return window.addEventListener(t, o, n), () => {
19
- window.removeEventListener(t, o, n);
18
+ return window.addEventListener(t, s, r), () => {
19
+ window.removeEventListener(t, s, r);
20
20
  };
21
- }, [t, n]);
21
+ }, [t, r]);
22
22
  }
23
23
  i.shouldProcessEvent = (e) => {
24
24
  if (e.target instanceof Element) {
@@ -35,68 +35,45 @@ i.shouldProcessEvent = (e) => {
35
35
  }
36
36
  return !0;
37
37
  };
38
- function E(e) {
39
- const t = m((n) => {
40
- E.isCloseEvent(n) && e();
38
+ function d(e) {
39
+ const t = l((r) => {
40
+ d.isCloseEvent(r) && e();
41
41
  });
42
42
  i(t);
43
43
  }
44
- E.isCloseEvent = (e) => e.key === "Escape";
44
+ d.isCloseEvent = (e) => e.key === "Escape";
45
45
  function v(e) {
46
- const t = m(e);
47
- u.useEffect(() => {
48
- const n = () => t.current();
49
- return window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
46
+ const t = l(e);
47
+ o.useEffect(() => {
48
+ const r = () => t.current();
49
+ return window.addEventListener("resize", r), () => window.removeEventListener("resize", r);
50
50
  }, []);
51
51
  }
52
- function a(e) {
52
+ function b(e) {
53
53
  const {
54
54
  children: t
55
55
  } = e;
56
- return /* @__PURE__ */ y("div", { style: { display: "none" }, children: t });
56
+ return /* @__PURE__ */ E("div", { style: { display: "none" }, children: t });
57
57
  }
58
- function h(e) {
59
- const [t, n] = u.useState(() => a);
60
- return u.useEffect(() => {
61
- const o = `${e}_after`;
62
- let r = document.getElementById(o), c = document.getElementById(e);
63
- c || (c = document.createElement("div"), c.id = e, document.body.appendChild(c)), r || (r = document.createElement("div"), r.id = o, c.after(r));
64
- const s = ({
65
- children: l
66
- }) => d.createPortal(l, r);
67
- n(() => s);
68
- }, [e]), t;
69
- }
70
- function R(e) {
71
- const [t, n] = u.useState(() => a);
72
- return u.useEffect(() => {
73
- const o = `${e}_before`;
74
- let r = document.getElementById(o), c = document.getElementById(e);
75
- c || (c = document.createElement("div"), c.id = e, document.body.appendChild(c)), r || (r = document.createElement("div"), r.id = o, document.body.insertBefore(r, c));
76
- const s = ({
77
- children: l
78
- }) => d.createPortal(l, r);
79
- n(() => s);
80
- }, [e]), t;
81
- }
82
- function B(e) {
83
- const [t, n] = u.useState(() => a);
84
- return u.useEffect(() => {
85
- let o = document.getElementById(e);
86
- o || (o = document.createElement("div"), o.id = e, document.body.appendChild(o));
87
- const r = ({
58
+ function g(e, t = "original") {
59
+ const [r, s] = o.useState(() => b);
60
+ return o.useEffect(() => {
61
+ let n = document.getElementById(e);
62
+ if (n || (n = document.createElement("div"), n.id = e, document.body.appendChild(n)), t !== "original") {
63
+ const c = n, u = `${e}_${t}`;
64
+ n = document.getElementById(u), n || (n = document.createElement("div"), n.id = u, t === "before" ? document.body.insertBefore(n, c) : c.after(n));
65
+ }
66
+ const f = ({
88
67
  children: c
89
- }) => d.createPortal(c, o);
90
- n(() => r);
91
- }, [e]), t;
68
+ }) => m.createPortal(c, n);
69
+ s(() => f);
70
+ }, [e, t]), r;
92
71
  }
93
72
  export {
94
- m as useDynamicRef,
73
+ l as useDynamicRef,
95
74
  i as useGlobalKeyboardEvent,
96
- P as useInstance,
97
- E as useKeyboardClose,
98
- B as useOutlet,
99
- h as useOutletAfter,
100
- R as useOutletBefore,
75
+ h as useInstance,
76
+ d as useKeyboardClose,
77
+ g as useOutlet,
101
78
  v as useWindowResize
102
79
  };
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.20",
4
+ "version": "0.0.21",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "dist/main.js",