welcome-ui 10.0.0-alpha.14 → 10.0.0-alpha.15

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,187 +0,0 @@
1
- "use client";
2
- import { c as te, g as v, s as re, i as x, a as z, d as oe, e as se, C as ne } from "./SBSPVDDI-CmtnvvUX.js";
3
- import { c as ie, _ as L, i as ae, am as ue, an as ce, m as M, ao as C, t as le, ah as fe, u as I, j as P, p as de, h as U, k as pe, d as me, v as ve, a as R, Z as ge, ap as ye, f as Ce, b as Pe, e as Ee } from "./OE2EFRVA-Dg1R6gaC.js";
4
- import { f as Ie, r as Se } from "./B7UTNDHN-BghjolIs.js";
5
- import { useRef as H, useEffect as V, useState as Fe, useCallback as we, createContext as b } from "react";
6
- import { jsx as xe } from "react/jsx-runtime";
7
- import { P as be, b as Ke } from "./Y67KZUMI-BwLWwpNF.js";
8
- var he = "div";
9
- function ke(r) {
10
- return r.some((i) => !!i.rowId);
11
- }
12
- function Ae(r) {
13
- const i = r.target;
14
- return i && !U(i) ? !1 : r.key.length === 1 && !r.ctrlKey && !r.metaKey;
15
- }
16
- function _e(r) {
17
- return r.key === "Shift" || r.key === "Control" || r.key === "Alt" || r.key === "Meta";
18
- }
19
- function O(r, i, l) {
20
- return I((e) => {
21
- var s;
22
- if (i == null || i(e), e.defaultPrevented || e.isPropagationStopped() || !P(e) || _e(e) || Ae(e)) return;
23
- const f = r.getState(), p = (s = v(r, f.activeId)) == null ? void 0 : s.element;
24
- if (!p) return;
25
- const n = e, { view: K } = n, w = L(n, ["view"]), c = l == null ? void 0 : l.current;
26
- p !== c && p.focus(), ye(p, e.type, w) || e.preventDefault(), e.currentTarget.contains(p) && e.stopPropagation();
27
- });
28
- }
29
- function Te(r) {
30
- return oe(
31
- Ie(Se(se(r)))
32
- );
33
- }
34
- function De(r) {
35
- const [i, l] = Fe(!1), e = we(() => l(!0), []), s = r.useState(
36
- (f) => v(r, f.activeId)
37
- );
38
- return V(() => {
39
- const f = s == null ? void 0 : s.element;
40
- i && f && (l(!1), f.focus({ preventScroll: !0 }));
41
- }, [s, i]), e;
42
- }
43
- var Be = ie(
44
- function(i) {
45
- var l = i, {
46
- store: e,
47
- composite: s = !0,
48
- focusOnMove: f = s,
49
- moveOnKeyPress: p = !0
50
- } = l, n = L(l, [
51
- "store",
52
- "composite",
53
- "focusOnMove",
54
- "moveOnKeyPress"
55
- ]);
56
- const K = te();
57
- e = e || K, ae(
58
- e,
59
- process.env.NODE_ENV !== "production" && "Composite must receive a `store` prop or be wrapped in a CompositeProvider component."
60
- );
61
- const w = H(null), c = H(null), N = De(e), S = e.useState("moves"), [, q] = ue(
62
- s ? e.setBaseElement : null
63
- );
64
- V(() => {
65
- var t;
66
- if (!e || !S || !s || !f) return;
67
- const { activeId: o } = e.getState(), a = (t = v(e, o)) == null ? void 0 : t.element;
68
- a && ce(a);
69
- }, [e, S, s, f]), M(() => {
70
- if (!e || !S || !s) return;
71
- const { baseElement: t, activeId: o } = e.getState();
72
- if (!(o === null) || !t) return;
73
- const u = c.current;
74
- c.current = null, u && C(u, { relatedTarget: t }), le(t) || t.focus();
75
- }, [e, S, s]);
76
- const h = e.useState("activeId"), k = e.useState("virtualFocus");
77
- M(() => {
78
- var t;
79
- if (!e || !s || !k) return;
80
- const o = c.current;
81
- if (c.current = null, !o) return;
82
- const u = ((t = v(e, h)) == null ? void 0 : t.element) || fe(o);
83
- u !== o && C(o, { relatedTarget: u });
84
- }, [e, h, k, s]);
85
- const G = O(
86
- e,
87
- n.onKeyDownCapture,
88
- c
89
- ), W = O(
90
- e,
91
- n.onKeyUpCapture,
92
- c
93
- ), A = n.onFocusCapture, Z = I((t) => {
94
- if (A == null || A(t), t.defaultPrevented || !e) return;
95
- const { virtualFocus: o } = e.getState();
96
- if (!o) return;
97
- const a = t.relatedTarget, u = re(t.currentTarget);
98
- P(t) && u && (t.stopPropagation(), c.current = a);
99
- }), _ = n.onFocus, J = I((t) => {
100
- if (_ == null || _(t), t.defaultPrevented || !s || !e) return;
101
- const { relatedTarget: o } = t, { virtualFocus: a } = e.getState();
102
- a ? P(t) && !x(e, o) && queueMicrotask(N) : P(t) && e.setActiveId(null);
103
- }), T = n.onBlurCapture, Q = I((t) => {
104
- var o;
105
- if (T == null || T(t), t.defaultPrevented || !e) return;
106
- const { virtualFocus: a, activeId: u } = e.getState();
107
- if (!a) return;
108
- const m = (o = v(e, u)) == null ? void 0 : o.element, g = t.relatedTarget, F = x(e, g), d = c.current;
109
- c.current = null, P(t) && F ? (g === m ? d && d !== g && C(d, t) : m ? C(m, t) : d && C(d, t), t.stopPropagation()) : !x(e, t.target) && m && C(m, t);
110
- }), D = n.onKeyDown, X = de(p), Y = I((t) => {
111
- var o;
112
- if (D == null || D(t), t.nativeEvent.isComposing || t.defaultPrevented || !e || !P(t)) return;
113
- const { orientation: a, renderedItems: u, activeId: m } = e.getState(), g = v(e, m);
114
- if ((o = g == null ? void 0 : g.element) != null && o.isConnected) return;
115
- const F = a !== "horizontal", d = a !== "vertical", y = ke(u);
116
- if ((t.key === "ArrowLeft" || t.key === "ArrowRight" || t.key === "Home" || t.key === "End") && U(t.currentTarget)) return;
117
- const B = {
118
- ArrowUp: (y || F) && (() => {
119
- if (y) {
120
- const E = Te(u);
121
- return E == null ? void 0 : E.id;
122
- }
123
- return e == null ? void 0 : e.last();
124
- }),
125
- ArrowRight: (y || d) && e.first,
126
- ArrowDown: (y || F) && e.first,
127
- ArrowLeft: (y || d) && e.last,
128
- Home: e.first,
129
- End: e.last,
130
- PageUp: e.first,
131
- PageDown: e.last
132
- }[t.key];
133
- if (B) {
134
- const E = B();
135
- if (E !== void 0) {
136
- if (!X(t)) return;
137
- t.preventDefault(), e.move(E);
138
- }
139
- }
140
- });
141
- n = pe(
142
- n,
143
- (t) => /* @__PURE__ */ xe(z, { value: e, children: t }),
144
- [e]
145
- );
146
- const $ = e.useState((t) => {
147
- var o;
148
- if (e && s && t.virtualFocus)
149
- return (o = v(e, t.activeId)) == null ? void 0 : o.id;
150
- });
151
- n = me(R({
152
- "aria-activedescendant": $
153
- }, n), {
154
- ref: ve(w, q, n.ref),
155
- onKeyDownCapture: G,
156
- onKeyUpCapture: W,
157
- onFocusCapture: Z,
158
- onFocus: J,
159
- onBlurCapture: Q,
160
- onKeyDown: Y
161
- });
162
- const ee = e.useState(
163
- (t) => s && (t.virtualFocus || t.activeId === null)
164
- );
165
- return n = ge(R({ focusable: ee }, n)), n;
166
- }
167
- );
168
- Ce(function(i) {
169
- const l = Be(i);
170
- return Pe(he, l);
171
- });
172
- b(
173
- void 0
174
- );
175
- var j = Ee(
176
- [Ke, z],
177
- [be, ne]
178
- ), Ne = j.useContext, qe = j.useProviderContext;
179
- b(
180
- void 0
181
- );
182
- b(!1);
183
- export {
184
- qe as a,
185
- Ne as b,
186
- Be as u
187
- };