@spear-ai/spectral 1.3.56 → 1.3.58
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/Drawer.js +41 -39
- package/dist/Popover.js +14 -12
- package/dist/RadioGroup.d.ts +34 -9
- package/dist/RadioGroup.js +504 -33
- package/dist/Select.js +588 -635
- package/dist/Tooltip.js +12 -10
- package/dist/components/RadioGroup/RadioGroup.d.ts +34 -9
- package/dist/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/index-CA7haECj.js +248 -0
- package/dist/index-CBwRmAsQ.js +69 -0
- package/dist/index-Cb7rjMhE.js +27 -0
- package/dist/index-CbXx14YO.js +59 -0
- package/dist/{index-CFeaEsew.js → index-Cfyte2YO.js} +1 -1
- package/dist/{index-BDYruyoU.js → index-DUK1rxhf.js} +1 -1
- package/dist/{index-C18a1qz_.js → index-FeGk8zep.js} +316 -338
- package/dist/index-VXXKXen4.js +15 -0
- package/dist/index-cCg4yNa8.js +132 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/styles/main.css +1 -1
- package/package.json +2 -1
- package/dist/RadioGroup/RadioGroupBase.d.ts +0 -52
- package/dist/RadioGroup/RadioGroupBase.js +0 -249
- package/dist/components/RadioGroup/RadioGroupBase.d.ts +0 -52
- package/dist/components/RadioGroup/RadioGroupBase.d.ts.map +0 -1
- package/dist/index-Ddc_4vXe.js +0 -80
- package/dist/index-DfFzqLW6.js +0 -373
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../styles/main.css";
|
|
3
|
-
import { jsx as A, jsxs as T } from "react/jsx-runtime";
|
|
4
|
-
import { useControllableState as z } from "../hooks/useControllableState.js";
|
|
5
|
-
import { Slot as L } from "../primitives/slot.js";
|
|
6
|
-
import { createContext as J, forwardRef as P, useId as U, useState as $, useRef as V, useEffect as E, useCallback as G, useContext as B, useImperativeHandle as K } from "react";
|
|
7
|
-
function q(...u) {
|
|
8
|
-
return u.filter(Boolean).join(" ");
|
|
9
|
-
}
|
|
10
|
-
const H = J(null);
|
|
11
|
-
function Q(u, a, t, o) {
|
|
12
|
-
const l = u.length;
|
|
13
|
-
let n = a;
|
|
14
|
-
for (let f = 0; f < l; f += 1) {
|
|
15
|
-
if (n = t === "next" ? n + 1 : n - 1, o && (n < 0 && (n = l - 1), n >= l && (n = 0)), n < 0 || n >= l) return a;
|
|
16
|
-
if (!u[n].disabled) return n;
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
}
|
|
20
|
-
function W(u, a, t) {
|
|
21
|
-
const { key: o } = u;
|
|
22
|
-
return o === "Home" ? "first" : o === "End" ? "last" : a === "vertical" ? o === "ArrowDown" ? "next" : o === "ArrowUp" ? "prev" : null : o === "ArrowRight" ? t === "rtl" ? "prev" : "next" : o === "ArrowLeft" ? t === "rtl" ? "next" : "prev" : null;
|
|
23
|
-
}
|
|
24
|
-
const X = P(
|
|
25
|
-
({
|
|
26
|
-
asChild: u,
|
|
27
|
-
className: a,
|
|
28
|
-
value: t,
|
|
29
|
-
defaultValue: o,
|
|
30
|
-
onValueChange: l,
|
|
31
|
-
name: n,
|
|
32
|
-
required: f = !1,
|
|
33
|
-
form: y,
|
|
34
|
-
disabled: b = !1,
|
|
35
|
-
orientation: e = "vertical",
|
|
36
|
-
dir: N = "ltr",
|
|
37
|
-
loop: p = !0,
|
|
38
|
-
variant: v = "default",
|
|
39
|
-
id: c,
|
|
40
|
-
...d
|
|
41
|
-
}, m) => {
|
|
42
|
-
const O = U(), F = c ?? `rg-${O}`, [g, k] = z({
|
|
43
|
-
value: t,
|
|
44
|
-
defaultValue: o ?? void 0,
|
|
45
|
-
onChange: l
|
|
46
|
-
}), [w, C] = $(g), R = V([]), I = V(null);
|
|
47
|
-
E(() => {
|
|
48
|
-
g !== void 0 && C(g);
|
|
49
|
-
}, [g]), E(() => {
|
|
50
|
-
const s = I.current;
|
|
51
|
-
if (!s) return;
|
|
52
|
-
const i = () => {
|
|
53
|
-
k(o ?? void 0);
|
|
54
|
-
};
|
|
55
|
-
return s.addEventListener("reset", i), () => s.removeEventListener("reset", i);
|
|
56
|
-
}, [o, k]);
|
|
57
|
-
const r = G((s) => (R.current.push(s), () => {
|
|
58
|
-
R.current = R.current.filter((i) => i.value !== s.value);
|
|
59
|
-
}), []), h = G(
|
|
60
|
-
(s, i) => {
|
|
61
|
-
b || (k(s), i?.focus && (C(s), R.current.find((M) => M.value === s)?.ref.current?.focus()));
|
|
62
|
-
},
|
|
63
|
-
[b, k]
|
|
64
|
-
), x = {
|
|
65
|
-
value: g,
|
|
66
|
-
setValue: h,
|
|
67
|
-
name: n,
|
|
68
|
-
required: f,
|
|
69
|
-
form: y,
|
|
70
|
-
disabled: b,
|
|
71
|
-
orientation: e,
|
|
72
|
-
dir: N,
|
|
73
|
-
loop: p,
|
|
74
|
-
registerItem: r,
|
|
75
|
-
focusableValue: w,
|
|
76
|
-
setFocusableValue: C,
|
|
77
|
-
formElRef: I,
|
|
78
|
-
itemsRef: R,
|
|
79
|
-
variant: v
|
|
80
|
-
}, D = u ? L : "div", S = m;
|
|
81
|
-
return /* @__PURE__ */ A(H.Provider, { value: x, children: /* @__PURE__ */ A(
|
|
82
|
-
D,
|
|
83
|
-
{
|
|
84
|
-
id: F,
|
|
85
|
-
ref: S,
|
|
86
|
-
role: "radiogroup",
|
|
87
|
-
"aria-orientation": e,
|
|
88
|
-
"data-disabled": b ? "" : void 0,
|
|
89
|
-
className: q(a),
|
|
90
|
-
...d
|
|
91
|
-
}
|
|
92
|
-
) });
|
|
93
|
-
}
|
|
94
|
-
);
|
|
95
|
-
X.displayName = "RadioGroup";
|
|
96
|
-
const Y = P(
|
|
97
|
-
({ asChild: u, className: a, value: t, disabled: o, id: l, onKeyDown: n, onClick: f, ...y }, b) => {
|
|
98
|
-
const e = B(H);
|
|
99
|
-
if (!e) throw new Error("RadioGroupItem must be used within RadioGroup");
|
|
100
|
-
const N = U(), p = l ?? `rgi-${N}`, v = V(null), c = V(null);
|
|
101
|
-
K(
|
|
102
|
-
b,
|
|
103
|
-
() => v.current,
|
|
104
|
-
[]
|
|
105
|
-
);
|
|
106
|
-
const d = e.value === t, m = !!o || e.disabled;
|
|
107
|
-
E(() => {
|
|
108
|
-
const r = { value: t, ref: v, disabled: !!m, id: p };
|
|
109
|
-
return e.registerItem(r);
|
|
110
|
-
}, [t, m, p]), E(() => {
|
|
111
|
-
!e.formElRef.current && c.current?.form && (e.formElRef.current = c.current.form);
|
|
112
|
-
}, [e.formElRef]), E(() => {
|
|
113
|
-
c.current && (c.current.checked = d);
|
|
114
|
-
}, [d]);
|
|
115
|
-
const F = (e.focusableValue ? e.focusableValue === t : d) && !m ? 0 : -1, g = u ? L : "button", k = (r) => {
|
|
116
|
-
v.current = r;
|
|
117
|
-
}, w = G(
|
|
118
|
-
(r) => {
|
|
119
|
-
if (!m && (e.setValue(t, { focus: !0, user: r }), c.current)) {
|
|
120
|
-
const h = new Event("change", { bubbles: !0 });
|
|
121
|
-
c.current.dispatchEvent(h);
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
[e, m, t]
|
|
125
|
-
), C = G(
|
|
126
|
-
(r) => {
|
|
127
|
-
f?.(r), !r.defaultPrevented && w(!0);
|
|
128
|
-
},
|
|
129
|
-
[f, w]
|
|
130
|
-
), R = G(
|
|
131
|
-
(r) => {
|
|
132
|
-
if (n?.(r), r.defaultPrevented) return;
|
|
133
|
-
if (r.key === " " || r.key === "Enter") {
|
|
134
|
-
r.preventDefault(), w(!0);
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
const h = W(r, e.orientation, e.dir);
|
|
138
|
-
if (h) {
|
|
139
|
-
r.preventDefault();
|
|
140
|
-
const x = [...e.itemsRef.current], D = x.findIndex((i) => i.value === t);
|
|
141
|
-
if (D === -1) return;
|
|
142
|
-
if (h === "first") {
|
|
143
|
-
const i = x.find((j) => !j.disabled);
|
|
144
|
-
i && e.setValue(i.value, { focus: !0, user: !0 });
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
if (h === "last") {
|
|
148
|
-
const i = [...x].reverse().find((j) => !j.disabled);
|
|
149
|
-
i && e.setValue(i.value, { focus: !0, user: !0 });
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
const S = Q(x, D, h, e.loop), s = x[S];
|
|
153
|
-
s && !s.disabled && e.setValue(s.value, { focus: !0, user: !0 });
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
[e, n, w, t]
|
|
157
|
-
), I = e.variant === "unstyled";
|
|
158
|
-
return /* @__PURE__ */ T(
|
|
159
|
-
g,
|
|
160
|
-
{
|
|
161
|
-
id: p,
|
|
162
|
-
ref: k,
|
|
163
|
-
type: "button",
|
|
164
|
-
role: "radio",
|
|
165
|
-
"aria-checked": d,
|
|
166
|
-
"aria-disabled": m || void 0,
|
|
167
|
-
"data-state": d ? "checked" : "unchecked",
|
|
168
|
-
"data-disabled": m ? "" : void 0,
|
|
169
|
-
tabIndex: F,
|
|
170
|
-
onClick: C,
|
|
171
|
-
onKeyDown: R,
|
|
172
|
-
className: q(
|
|
173
|
-
// Only apply default styles when not unstyled
|
|
174
|
-
!I && "border-input bg-background focus-visible:ring-ring inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
175
|
-
!I && "data-[state=checked]:border-primary data-[state=checked]:bg-primary/10 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
176
|
-
// Always preserve basic accessibility for unstyled variant
|
|
177
|
-
I && "border-sm focus-visible:ring-ring data-[state=checked]:border-selected-primary cursor-pointer rounded-sm border-2 border-transparent transition-opacity hover:opacity-70 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",
|
|
178
|
-
a
|
|
179
|
-
),
|
|
180
|
-
...y,
|
|
181
|
-
children: [
|
|
182
|
-
/* @__PURE__ */ A(
|
|
183
|
-
"input",
|
|
184
|
-
{
|
|
185
|
-
ref: c,
|
|
186
|
-
type: "radio",
|
|
187
|
-
name: e.name,
|
|
188
|
-
value: t,
|
|
189
|
-
required: e.required,
|
|
190
|
-
disabled: m,
|
|
191
|
-
form: e.form,
|
|
192
|
-
checked: d,
|
|
193
|
-
readOnly: !0,
|
|
194
|
-
tabIndex: -1,
|
|
195
|
-
"aria-hidden": "true",
|
|
196
|
-
style: {
|
|
197
|
-
position: "absolute",
|
|
198
|
-
opacity: 0,
|
|
199
|
-
width: 0,
|
|
200
|
-
height: 0,
|
|
201
|
-
pointerEvents: "none"
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
),
|
|
205
|
-
y.children
|
|
206
|
-
]
|
|
207
|
-
}
|
|
208
|
-
);
|
|
209
|
-
}
|
|
210
|
-
);
|
|
211
|
-
Y.displayName = "RadioGroupItem";
|
|
212
|
-
const Z = P(
|
|
213
|
-
({ asChild: u, className: a, forceMount: t, ...o }, l) => {
|
|
214
|
-
if (!B(H)) return null;
|
|
215
|
-
const [f, y] = $(!1), b = V(null);
|
|
216
|
-
return K(
|
|
217
|
-
l,
|
|
218
|
-
() => b.current,
|
|
219
|
-
[]
|
|
220
|
-
), E(() => {
|
|
221
|
-
const p = b.current;
|
|
222
|
-
if (!p) return;
|
|
223
|
-
const v = p.closest('[role="radio"]');
|
|
224
|
-
if (!v) return;
|
|
225
|
-
const c = () => {
|
|
226
|
-
y(v.getAttribute("aria-checked") === "true");
|
|
227
|
-
};
|
|
228
|
-
c();
|
|
229
|
-
const d = new MutationObserver(c);
|
|
230
|
-
return d.observe(v, { attributes: !0, attributeFilter: ["aria-checked"] }), () => d.disconnect();
|
|
231
|
-
}, []), !f && !t ? null : /* @__PURE__ */ A(
|
|
232
|
-
u ? L : "span",
|
|
233
|
-
{
|
|
234
|
-
ref: (p) => {
|
|
235
|
-
b.current = p;
|
|
236
|
-
},
|
|
237
|
-
"data-state": f ? "checked" : "unchecked",
|
|
238
|
-
className: q("flex items-center justify-center text-current", a),
|
|
239
|
-
...o
|
|
240
|
-
}
|
|
241
|
-
);
|
|
242
|
-
}
|
|
243
|
-
);
|
|
244
|
-
Z.displayName = "RadioGroupIndicator";
|
|
245
|
-
export {
|
|
246
|
-
X as RadioGroup,
|
|
247
|
-
Z as RadioGroupIndicator,
|
|
248
|
-
Y as RadioGroupItem
|
|
249
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { AsChildProp } from '../../primitives/slot';
|
|
2
|
-
import { ButtonHTMLAttributes, HTMLAttributes } from 'react';
|
|
3
|
-
type Orientation = 'horizontal' | 'vertical';
|
|
4
|
-
type Dir = 'ltr' | 'rtl';
|
|
5
|
-
type GroupBaseProps = Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'role'>;
|
|
6
|
-
export type RadioGroupProps = GroupBaseProps & AsChildProp & {
|
|
7
|
-
value?: string;
|
|
8
|
-
defaultValue?: string;
|
|
9
|
-
onValueChange?: (value: string | undefined) => void;
|
|
10
|
-
name?: string;
|
|
11
|
-
required?: boolean;
|
|
12
|
-
form?: string;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
orientation?: Orientation;
|
|
15
|
-
dir?: Dir;
|
|
16
|
-
loop?: boolean;
|
|
17
|
-
variant?: 'default' | 'unstyled';
|
|
18
|
-
};
|
|
19
|
-
type ItemBaseProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'role' | 'value'>;
|
|
20
|
-
export type RadioGroupItemProps = ItemBaseProps & AsChildProp & {
|
|
21
|
-
value: string;
|
|
22
|
-
disabled?: boolean;
|
|
23
|
-
id?: string;
|
|
24
|
-
'aria-label'?: string;
|
|
25
|
-
};
|
|
26
|
-
export type RadioGroupIndicatorProps = HTMLAttributes<HTMLSpanElement> & AsChildProp & {
|
|
27
|
-
forceMount?: boolean;
|
|
28
|
-
};
|
|
29
|
-
export declare const RadioGroup: import('react').ForwardRefExoticComponent<GroupBaseProps & AsChildProp & {
|
|
30
|
-
value?: string;
|
|
31
|
-
defaultValue?: string;
|
|
32
|
-
onValueChange?: (value: string | undefined) => void;
|
|
33
|
-
name?: string;
|
|
34
|
-
required?: boolean;
|
|
35
|
-
form?: string;
|
|
36
|
-
disabled?: boolean;
|
|
37
|
-
orientation?: Orientation;
|
|
38
|
-
dir?: Dir;
|
|
39
|
-
loop?: boolean;
|
|
40
|
-
variant?: "default" | "unstyled";
|
|
41
|
-
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
42
|
-
export declare const RadioGroupItem: import('react').ForwardRefExoticComponent<ItemBaseProps & AsChildProp & {
|
|
43
|
-
value: string;
|
|
44
|
-
disabled?: boolean;
|
|
45
|
-
id?: string;
|
|
46
|
-
'aria-label'?: string;
|
|
47
|
-
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
48
|
-
export declare const RadioGroupIndicator: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & AsChildProp & {
|
|
49
|
-
forceMount?: boolean;
|
|
50
|
-
} & import('react').RefAttributes<HTMLSpanElement>>;
|
|
51
|
-
export {};
|
|
52
|
-
//# sourceMappingURL=RadioGroupBase.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroupBase.d.ts","sourceRoot":"","sources":["../../../src/components/RadioGroup/RadioGroupBase.tsx"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAUL,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAA;AAMd,KAAK,WAAW,GAAG,YAAY,GAAG,UAAU,CAAA;AAC5C,KAAK,GAAG,GAAG,KAAK,GAAG,KAAK,CAAA;AAExB,KAAK,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC,CAAA;AAE/E,MAAM,MAAM,eAAe,GAAG,cAAc,GAC1C,WAAW,GAAG;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAA;IACnD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,GAAG,CAAC,EAAE,GAAG,CAAA;IACT,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;CACjC,CAAA;AAEH,KAAK,aAAa,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC,CAAA;AAEjG,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAC7C,WAAW,GAAG;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAEH,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,eAAe,CAAC,GACpE,WAAW,GAAG;IACZ,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAiEH,eAAO,MAAM,UAAU;YA3FX,MAAM;mBACC,MAAM;oBACL,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI;WAC5C,MAAM;eACF,OAAO;WACX,MAAM;eACF,OAAO;kBACJ,WAAW;UACnB,GAAG;WACF,OAAO;cACJ,SAAS,GAAG,UAAU;kDAyLnC,CAAA;AAGD,eAAO,MAAM,cAAc;WArLhB,MAAM;eACF,OAAO;SACb,MAAM;mBACI,MAAM;qDAgVxB,CAAA;AAGD,eAAO,MAAM,mBAAmB;iBA9Uf,OAAO;mDA2XvB,CAAA"}
|
package/dist/index-Ddc_4vXe.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import "./styles/main.css";
|
|
2
|
-
import * as i from "react";
|
|
3
|
-
import O from "react-dom";
|
|
4
|
-
import { g as A, P as y, b as R } from "./index-DfFzqLW6.js";
|
|
5
|
-
import { jsx as T } from "react/jsx-runtime";
|
|
6
|
-
var v = "Portal", E = i.forwardRef((n, e) => {
|
|
7
|
-
const { container: t, ...r } = n, [a, u] = i.useState(!1);
|
|
8
|
-
A(() => u(!0), []);
|
|
9
|
-
const m = t || a && globalThis?.document?.body;
|
|
10
|
-
return m ? O.createPortal(/* @__PURE__ */ T(y.div, { ...r, ref: e }), m) : null;
|
|
11
|
-
});
|
|
12
|
-
E.displayName = v;
|
|
13
|
-
function S(n, e) {
|
|
14
|
-
return i.useReducer((t, r) => e[t][r] ?? t, n);
|
|
15
|
-
}
|
|
16
|
-
var w = (n) => {
|
|
17
|
-
const { present: e, children: t } = n, r = h(e), a = typeof t == "function" ? t({ present: r.isPresent }) : i.Children.only(t), u = R(r.ref, I(a));
|
|
18
|
-
return typeof t == "function" || r.isPresent ? i.cloneElement(a, { ref: u }) : null;
|
|
19
|
-
};
|
|
20
|
-
w.displayName = "Presence";
|
|
21
|
-
function h(n) {
|
|
22
|
-
const [e, t] = i.useState(), r = i.useRef(null), a = i.useRef(n), u = i.useRef("none"), m = n ? "mounted" : "unmounted", [p, s] = S(m, {
|
|
23
|
-
mounted: {
|
|
24
|
-
UNMOUNT: "unmounted",
|
|
25
|
-
ANIMATION_OUT: "unmountSuspended"
|
|
26
|
-
},
|
|
27
|
-
unmountSuspended: {
|
|
28
|
-
MOUNT: "mounted",
|
|
29
|
-
ANIMATION_END: "unmounted"
|
|
30
|
-
},
|
|
31
|
-
unmounted: {
|
|
32
|
-
MOUNT: "mounted"
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
return i.useEffect(() => {
|
|
36
|
-
const o = N(r.current);
|
|
37
|
-
u.current = p === "mounted" ? o : "none";
|
|
38
|
-
}, [p]), A(() => {
|
|
39
|
-
const o = r.current, d = a.current;
|
|
40
|
-
if (d !== n) {
|
|
41
|
-
const f = u.current, c = N(o);
|
|
42
|
-
n ? s("MOUNT") : c === "none" || o?.display === "none" ? s("UNMOUNT") : s(d && f !== c ? "ANIMATION_OUT" : "UNMOUNT"), a.current = n;
|
|
43
|
-
}
|
|
44
|
-
}, [n, s]), A(() => {
|
|
45
|
-
if (e) {
|
|
46
|
-
let o;
|
|
47
|
-
const d = e.ownerDocument.defaultView ?? window, l = (c) => {
|
|
48
|
-
const P = N(r.current).includes(CSS.escape(c.animationName));
|
|
49
|
-
if (c.target === e && P && (s("ANIMATION_END"), !a.current)) {
|
|
50
|
-
const g = e.style.animationFillMode;
|
|
51
|
-
e.style.animationFillMode = "forwards", o = d.setTimeout(() => {
|
|
52
|
-
e.style.animationFillMode === "forwards" && (e.style.animationFillMode = g);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}, f = (c) => {
|
|
56
|
-
c.target === e && (u.current = N(r.current));
|
|
57
|
-
};
|
|
58
|
-
return e.addEventListener("animationstart", f), e.addEventListener("animationcancel", l), e.addEventListener("animationend", l), () => {
|
|
59
|
-
d.clearTimeout(o), e.removeEventListener("animationstart", f), e.removeEventListener("animationcancel", l), e.removeEventListener("animationend", l);
|
|
60
|
-
};
|
|
61
|
-
} else
|
|
62
|
-
s("ANIMATION_END");
|
|
63
|
-
}, [e, s]), {
|
|
64
|
-
isPresent: ["mounted", "unmountSuspended"].includes(p),
|
|
65
|
-
ref: i.useCallback((o) => {
|
|
66
|
-
r.current = o ? getComputedStyle(o) : null, t(o);
|
|
67
|
-
}, [])
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
function N(n) {
|
|
71
|
-
return n?.animationName || "none";
|
|
72
|
-
}
|
|
73
|
-
function I(n) {
|
|
74
|
-
let e = Object.getOwnPropertyDescriptor(n.props, "ref")?.get, t = e && "isReactWarning" in e && e.isReactWarning;
|
|
75
|
-
return t ? n.ref : (e = Object.getOwnPropertyDescriptor(n, "ref")?.get, t = e && "isReactWarning" in e && e.isReactWarning, t ? n.props.ref : n.props.ref || n.ref);
|
|
76
|
-
}
|
|
77
|
-
export {
|
|
78
|
-
w as P,
|
|
79
|
-
E as a
|
|
80
|
-
};
|