@cfx-dev/ui-components 4.2.7 → 4.2.9

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,171 +0,0 @@
1
- import * as l from "react";
2
- import h from "react";
3
- import { jsx as y, Fragment as w } from "react/jsx-runtime";
4
- function L(e, t, { checkForDefaultPrevented: o = !0 } = {}) {
5
- return function(n) {
6
- if (e == null || e(n), o === !1 || !n.defaultPrevented)
7
- return t == null ? void 0 : t(n);
8
- };
9
- }
10
- function A(e, t) {
11
- if (typeof e == "function")
12
- return e(t);
13
- e != null && (e.current = t);
14
- }
15
- function O(...e) {
16
- return (t) => {
17
- let o = !1;
18
- const r = e.map((n) => {
19
- const c = A(n, t);
20
- return !o && typeof c == "function" && (o = !0), c;
21
- });
22
- if (o)
23
- return () => {
24
- for (let n = 0; n < r.length; n++) {
25
- const c = r[n];
26
- typeof c == "function" ? c() : A(e[n], null);
27
- }
28
- };
29
- };
30
- }
31
- function I(...e) {
32
- return l.useCallback(O(...e), e);
33
- }
34
- function E(e, t = []) {
35
- let o = [];
36
- function r(c, s) {
37
- const i = l.createContext(s), f = o.length;
38
- o = [...o, s];
39
- const S = (R) => {
40
- var d;
41
- const { scope: C, children: a, ...u } = R, p = ((d = C == null ? void 0 : C[e]) == null ? void 0 : d[f]) || i, m = l.useMemo(() => u, Object.values(u));
42
- return /* @__PURE__ */ y(p.Provider, { value: m, children: a });
43
- };
44
- S.displayName = c + "Provider";
45
- function M(R, C) {
46
- var p;
47
- const a = ((p = C == null ? void 0 : C[e]) == null ? void 0 : p[f]) || i, u = l.useContext(a);
48
- if (u) return u;
49
- if (s !== void 0) return s;
50
- throw new Error(`\`${R}\` must be used within \`${c}\``);
51
- }
52
- return [S, M];
53
- }
54
- const n = () => {
55
- const c = o.map((s) => l.createContext(s));
56
- return function(i) {
57
- const f = (i == null ? void 0 : i[e]) || c;
58
- return l.useMemo(
59
- () => ({ [`__scope${e}`]: { ...i, [e]: f } }),
60
- [i, f]
61
- );
62
- };
63
- };
64
- return n.scopeName = e, [r, v(n, ...t)];
65
- }
66
- function v(...e) {
67
- const t = e[0];
68
- if (e.length === 1) return t;
69
- const o = () => {
70
- const r = e.map((n) => ({
71
- useScope: n(),
72
- scopeName: n.scopeName
73
- }));
74
- return function(c) {
75
- const s = r.reduce((i, { useScope: f, scopeName: S }) => {
76
- const R = f(c)[`__scope${S}`];
77
- return { ...i, ...R };
78
- }, {});
79
- return l.useMemo(() => ({ [`__scope${t.scopeName}`]: s }), [s]);
80
- };
81
- };
82
- return o.scopeName = t.scopeName, o;
83
- }
84
- var _ = l.forwardRef((e, t) => {
85
- const { children: o, ...r } = e, n = l.Children.toArray(o), c = n.find(V);
86
- if (c) {
87
- const s = c.props.children, i = n.map((f) => f === c ? l.Children.count(s) > 1 ? l.Children.only(null) : l.isValidElement(s) ? s.props.children : null : f);
88
- return /* @__PURE__ */ y(N, { ...r, ref: t, children: l.isValidElement(s) ? l.cloneElement(s, void 0, i) : null });
89
- }
90
- return /* @__PURE__ */ y(N, { ...r, ref: t, children: o });
91
- });
92
- _.displayName = "Slot";
93
- var N = l.forwardRef((e, t) => {
94
- const { children: o, ...r } = e;
95
- if (l.isValidElement(o)) {
96
- const n = j(o);
97
- return l.cloneElement(o, {
98
- ...$(r, o.props),
99
- // @ts-ignore
100
- ref: t ? O(t, n) : n
101
- });
102
- }
103
- return l.Children.count(o) > 1 ? l.Children.only(null) : null;
104
- });
105
- N.displayName = "SlotClone";
106
- var T = ({ children: e }) => /* @__PURE__ */ y(w, { children: e });
107
- function V(e) {
108
- return l.isValidElement(e) && e.type === T;
109
- }
110
- function $(e, t) {
111
- const o = { ...t };
112
- for (const r in t) {
113
- const n = e[r], c = t[r];
114
- /^on[A-Z]/.test(r) ? n && c ? o[r] = (...i) => {
115
- c(...i), n(...i);
116
- } : n && (o[r] = n) : r === "style" ? o[r] = { ...n, ...c } : r === "className" && (o[r] = [n, c].filter(Boolean).join(" "));
117
- }
118
- return { ...e, ...o };
119
- }
120
- function j(e) {
121
- var r, n;
122
- let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, o = t && "isReactWarning" in t && t.isReactWarning;
123
- return o ? e.ref : (t = (n = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : n.get, o = t && "isReactWarning" in t && t.isReactWarning, o ? e.props.ref : e.props.ref || e.ref);
124
- }
125
- function k(e) {
126
- const t = e + "CollectionProvider", [o, r] = E(t), [n, c] = o(
127
- t,
128
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
129
- ), s = (a) => {
130
- const { scope: u, children: p } = a, m = h.useRef(null), d = h.useRef(/* @__PURE__ */ new Map()).current;
131
- return /* @__PURE__ */ y(n, { scope: u, itemMap: d, collectionRef: m, children: p });
132
- };
133
- s.displayName = t;
134
- const i = e + "CollectionSlot", f = h.forwardRef(
135
- (a, u) => {
136
- const { scope: p, children: m } = a, d = c(i, p), x = I(u, d.collectionRef);
137
- return /* @__PURE__ */ y(_, { ref: x, children: m });
138
- }
139
- );
140
- f.displayName = i;
141
- const S = e + "CollectionItemSlot", M = "data-radix-collection-item", R = h.forwardRef(
142
- (a, u) => {
143
- const { scope: p, children: m, ...d } = a, x = h.useRef(null), g = I(u, x), P = c(S, p);
144
- return h.useEffect(() => (P.itemMap.set(x, { ref: x, ...d }), () => void P.itemMap.delete(x))), /* @__PURE__ */ y(_, { [M]: "", ref: g, children: m });
145
- }
146
- );
147
- R.displayName = S;
148
- function C(a) {
149
- const u = c(e + "CollectionConsumer", a);
150
- return h.useCallback(() => {
151
- const m = u.collectionRef.current;
152
- if (!m) return [];
153
- const d = Array.from(m.querySelectorAll(`[${M}]`));
154
- return Array.from(u.itemMap.values()).sort(
155
- (P, b) => d.indexOf(P.ref.current) - d.indexOf(b.ref.current)
156
- );
157
- }, [u.collectionRef, u.itemMap]);
158
- }
159
- return [
160
- { Provider: s, Slot: f, ItemSlot: R },
161
- C,
162
- r
163
- ];
164
- }
165
- export {
166
- k as a,
167
- E as b,
168
- O as c,
169
- L as d,
170
- I as u
171
- };