fina-react-ds 0.0.0
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/README.md +17 -0
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/_virtual/use-sync-external-store-shim.development.js +4 -0
- package/dist/_virtual/use-sync-external-store-shim.production.js +4 -0
- package/dist/components/alert-dialog.d.ts +16 -0
- package/dist/components/alert.d.ts +8 -0
- package/dist/components/alert.js +70 -0
- package/dist/components/avatar.d.ts +5 -0
- package/dist/components/avatar.js +58 -0
- package/dist/components/badge.d.ts +8 -0
- package/dist/components/badge.js +43 -0
- package/dist/components/button.d.ts +10 -0
- package/dist/components/button.js +152 -0
- package/dist/components/card.d.ts +8 -0
- package/dist/components/card.js +99 -0
- package/dist/components/checkbox.d.ts +4 -0
- package/dist/components/checkbox.js +34 -0
- package/dist/components/dialog.d.ts +15 -0
- package/dist/components/dialog.js +148 -0
- package/dist/components/dropdown-menu.d.ts +25 -0
- package/dist/components/dropdown-menu.js +248 -0
- package/dist/components/input.d.ts +3 -0
- package/dist/components/input.js +24 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.js +32 -0
- package/dist/components/pagination.d.ts +13 -0
- package/dist/components/pagination.js +128 -0
- package/dist/components/popover.d.ts +7 -0
- package/dist/components/popover.js +50 -0
- package/dist/components/select.d.ts +11 -0
- package/dist/components/select.js +48 -0
- package/dist/components/separator.d.ts +4 -0
- package/dist/components/simple-pagination.d.ts +6 -0
- package/dist/components/simple-pagination.js +34 -0
- package/dist/components/tabs.d.ts +7 -0
- package/dist/components/tabs.js +73 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/index.js +80 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +11 -0
- package/dist/lib.d.ts +16 -0
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +534 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +430 -0
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +215 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +159 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +149 -0
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +24 -0
- package/dist/node_modules/@radix-ui/react-avatar/dist/index.js +80 -0
- package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +258 -0
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +51 -0
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +34 -0
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +76 -0
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +265 -0
- package/dist/node_modules/@radix-ui/react-direction/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +133 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +230 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +21 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +149 -0
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +16 -0
- package/dist/node_modules/@radix-ui/react-label/dist/index.js +22 -0
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js +663 -0
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +247 -0
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +224 -0
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +16 -0
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +77 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +189 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +60 -0
- package/dist/node_modules/@radix-ui/react-tabs/dist/index.js +168 -0
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +16 -0
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +59 -0
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +19 -0
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +6 -0
- package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +30 -0
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +54 -0
- package/dist/node_modules/get-nonce/dist/es2015/index.js +9 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +11 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +116 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +33 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +18 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +70 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +73 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +7 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +27 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +13 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +17 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +35 -0
- package/dist/node_modules/tslib/tslib.es6.js +31 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +9 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +29 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +28 -0
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +21 -0
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +72 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +73 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +62 -0
- package/dist/node_modules/use-sync-external-store/shim/index.js +13 -0
- package/dist/themes/base.css +1982 -0
- package/dist/themes/pro.css +188 -0
- package/dist/themes/puulse-colors.css +388 -0
- package/package.json +114 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
var U = Object.defineProperty;
|
|
2
|
+
var m = (o, e) => U(o, "name", { value: e, configurable: !0 });
|
|
3
|
+
import * as u from "react";
|
|
4
|
+
import { composeEventHandlers as f } from "../../primitive/dist/index.js";
|
|
5
|
+
import { composeRefs as B } from "../../react-compose-refs/dist/index.js";
|
|
6
|
+
import { createContextScope as F } from "../../react-context/dist/index.js";
|
|
7
|
+
import { useControllableState as D } from "../../react-use-controllable-state/dist/index.js";
|
|
8
|
+
import { Primitive as H } from "../../react-primitive/dist/index.js";
|
|
9
|
+
import { createMenuScope as _, Root as W, Portal as $, Anchor as j, Content as X, Group as q, Label as z, Item as J, CheckboxItem as Q, ItemIndicator as V, RadioGroup as Y, RadioItem as Z, Separator as oo, Sub as eo, SubTrigger as ro, SubContent as no, Arrow as ao } from "../../react-menu/dist/index.js";
|
|
10
|
+
import { useId as g } from "../../react-id/dist/index.js";
|
|
11
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
12
|
+
var M = "DropdownMenu", [to, Eo] = F(
|
|
13
|
+
M,
|
|
14
|
+
[_]
|
|
15
|
+
), i = _(), [po, h] = to(M), R = /* @__PURE__ */ m((o) => {
|
|
16
|
+
const {
|
|
17
|
+
__scopeDropdownMenu: e,
|
|
18
|
+
children: n,
|
|
19
|
+
dir: r,
|
|
20
|
+
open: a,
|
|
21
|
+
defaultOpen: d,
|
|
22
|
+
onOpenChange: c,
|
|
23
|
+
modal: p = !0
|
|
24
|
+
} = o, s = i(e), v = u.useRef(null), [l, w] = D({
|
|
25
|
+
prop: a,
|
|
26
|
+
defaultProp: d ?? !1,
|
|
27
|
+
onChange: c,
|
|
28
|
+
caller: M
|
|
29
|
+
});
|
|
30
|
+
return /* @__PURE__ */ t(
|
|
31
|
+
po,
|
|
32
|
+
{
|
|
33
|
+
scope: e,
|
|
34
|
+
triggerId: g(),
|
|
35
|
+
triggerRef: v,
|
|
36
|
+
contentId: g(),
|
|
37
|
+
open: l,
|
|
38
|
+
onOpenChange: w,
|
|
39
|
+
onOpenToggle: u.useCallback(() => w((K) => !K), [w]),
|
|
40
|
+
modal: p,
|
|
41
|
+
children: /* @__PURE__ */ t(W, { ...s, open: l, onOpenChange: w, dir: r, modal: p, children: n })
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}, "DropdownMenu");
|
|
45
|
+
R.displayName = M;
|
|
46
|
+
var b = "DropdownMenuTrigger", I = u.forwardRef(
|
|
47
|
+
(o, e) => {
|
|
48
|
+
const { __scopeDropdownMenu: n, disabled: r = !1, ...a } = o, d = h(b, n), c = i(n);
|
|
49
|
+
return /* @__PURE__ */ t(j, { asChild: !0, ...c, children: /* @__PURE__ */ t(
|
|
50
|
+
H.button,
|
|
51
|
+
{
|
|
52
|
+
type: "button",
|
|
53
|
+
id: d.triggerId,
|
|
54
|
+
"aria-haspopup": "menu",
|
|
55
|
+
"aria-expanded": d.open,
|
|
56
|
+
"aria-controls": d.open ? d.contentId : void 0,
|
|
57
|
+
"data-state": d.open ? "open" : "closed",
|
|
58
|
+
"data-disabled": r ? "" : void 0,
|
|
59
|
+
disabled: r,
|
|
60
|
+
...a,
|
|
61
|
+
ref: B(e, d.triggerRef),
|
|
62
|
+
onPointerDown: f(o.onPointerDown, (p) => {
|
|
63
|
+
!r && p.button === 0 && p.ctrlKey === !1 && (d.onOpenToggle(), d.open || p.preventDefault());
|
|
64
|
+
}),
|
|
65
|
+
onKeyDown: f(o.onKeyDown, (p) => {
|
|
66
|
+
r || (["Enter", " "].includes(p.key) && d.onOpenToggle(), p.key === "ArrowDown" && d.onOpenChange(!0), ["Enter", " ", "ArrowDown"].includes(p.key) && p.preventDefault());
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
) });
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
I.displayName = b;
|
|
73
|
+
var uo = "DropdownMenuPortal", S = /* @__PURE__ */ m((o) => {
|
|
74
|
+
const { __scopeDropdownMenu: e, ...n } = o, r = i(e);
|
|
75
|
+
return /* @__PURE__ */ t($, { ...r, ...n });
|
|
76
|
+
}, "DropdownMenuPortal");
|
|
77
|
+
S.displayName = uo;
|
|
78
|
+
var C = "DropdownMenuContent", N = u.forwardRef(
|
|
79
|
+
(o, e) => {
|
|
80
|
+
const { __scopeDropdownMenu: n, ...r } = o, a = h(C, n), d = i(n), c = u.useRef(!1);
|
|
81
|
+
return /* @__PURE__ */ t(
|
|
82
|
+
X,
|
|
83
|
+
{
|
|
84
|
+
id: a.contentId,
|
|
85
|
+
"aria-labelledby": a.triggerId,
|
|
86
|
+
...d,
|
|
87
|
+
...r,
|
|
88
|
+
ref: e,
|
|
89
|
+
onCloseAutoFocus: f(o.onCloseAutoFocus, (p) => {
|
|
90
|
+
var s;
|
|
91
|
+
c.current || (s = a.triggerRef.current) == null || s.focus(), c.current = !1, p.preventDefault();
|
|
92
|
+
}),
|
|
93
|
+
onInteractOutside: f(o.onInteractOutside, (p) => {
|
|
94
|
+
const s = p.detail.originalEvent, v = s.button === 0 && s.ctrlKey === !0, l = s.button === 2 || v;
|
|
95
|
+
(!a.modal || l) && (c.current = !0);
|
|
96
|
+
}),
|
|
97
|
+
style: {
|
|
98
|
+
...o.style,
|
|
99
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
100
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
101
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
102
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
103
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
N.displayName = C;
|
|
110
|
+
var io = "DropdownMenuGroup", x = u.forwardRef(
|
|
111
|
+
(o, e) => {
|
|
112
|
+
const { __scopeDropdownMenu: n, ...r } = o, a = i(n);
|
|
113
|
+
return /* @__PURE__ */ t(q, { ...a, ...r, ref: e });
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
x.displayName = io;
|
|
117
|
+
var so = "DropdownMenuLabel", A = u.forwardRef(
|
|
118
|
+
(o, e) => {
|
|
119
|
+
const { __scopeDropdownMenu: n, ...r } = o, a = i(n);
|
|
120
|
+
return /* @__PURE__ */ t(z, { ...a, ...r, ref: e });
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
A.displayName = so;
|
|
124
|
+
var co = "DropdownMenuItem", P = u.forwardRef(
|
|
125
|
+
(o, e) => {
|
|
126
|
+
const { __scopeDropdownMenu: n, ...r } = o, a = i(n);
|
|
127
|
+
return /* @__PURE__ */ t(J, { ...a, ...r, ref: e });
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
P.displayName = co;
|
|
131
|
+
var lo = "DropdownMenuCheckboxItem", E = u.forwardRef((o, e) => {
|
|
132
|
+
const { __scopeDropdownMenu: n, ...r } = o, a = i(n);
|
|
133
|
+
return /* @__PURE__ */ t(Q, { ...a, ...r, ref: e });
|
|
134
|
+
});
|
|
135
|
+
E.displayName = lo;
|
|
136
|
+
var wo = "DropdownMenuRadioGroup", O = u.forwardRef((o, e) => {
|
|
137
|
+
const { __scopeDropdownMenu: n, ...r } = o, a = i(n);
|
|
138
|
+
return /* @__PURE__ */ t(Y, { ...a, ...r, ref: e });
|
|
139
|
+
});
|
|
140
|
+
O.displayName = wo;
|
|
141
|
+
var mo = "DropdownMenuRadioItem", y = u.forwardRef((o, e) => {
|
|
142
|
+
const { __scopeDropdownMenu: n, ...r } = o, a = i(n);
|
|
143
|
+
return /* @__PURE__ */ t(Z, { ...a, ...r, ref: e });
|
|
144
|
+
});
|
|
145
|
+
y.displayName = mo;
|
|
146
|
+
var fo = "DropdownMenuItemIndicator", T = u.forwardRef((o, e) => {
|
|
147
|
+
const { __scopeDropdownMenu: n, ...r } = o, a = i(n);
|
|
148
|
+
return /* @__PURE__ */ t(V, { ...a, ...r, ref: e });
|
|
149
|
+
});
|
|
150
|
+
T.displayName = fo;
|
|
151
|
+
var Mo = "DropdownMenuSeparator", G = u.forwardRef((o, e) => {
|
|
152
|
+
const { __scopeDropdownMenu: n, ...r } = o, a = i(n);
|
|
153
|
+
return /* @__PURE__ */ t(oo, { ...a, ...r, ref: e });
|
|
154
|
+
});
|
|
155
|
+
G.displayName = Mo;
|
|
156
|
+
var vo = "DropdownMenuArrow", go = u.forwardRef(
|
|
157
|
+
(o, e) => {
|
|
158
|
+
const { __scopeDropdownMenu: n, ...r } = o, a = i(n);
|
|
159
|
+
return /* @__PURE__ */ t(ao, { ...a, ...r, ref: e });
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
go.displayName = vo;
|
|
163
|
+
var Do = /* @__PURE__ */ m((o) => {
|
|
164
|
+
const { __scopeDropdownMenu: e, children: n, open: r, onOpenChange: a, defaultOpen: d } = o, c = i(e), [p, s] = D({
|
|
165
|
+
prop: r,
|
|
166
|
+
defaultProp: d ?? !1,
|
|
167
|
+
onChange: a,
|
|
168
|
+
caller: "DropdownMenuSub"
|
|
169
|
+
});
|
|
170
|
+
return /* @__PURE__ */ t(eo, { ...c, open: p, onOpenChange: s, children: n });
|
|
171
|
+
}, "DropdownMenuSub"), _o = "DropdownMenuSubTrigger", k = u.forwardRef((o, e) => {
|
|
172
|
+
const { __scopeDropdownMenu: n, ...r } = o, a = i(n);
|
|
173
|
+
return /* @__PURE__ */ t(ro, { ...a, ...r, ref: e });
|
|
174
|
+
});
|
|
175
|
+
k.displayName = _o;
|
|
176
|
+
var ho = "DropdownMenuSubContent", L = u.forwardRef((o, e) => {
|
|
177
|
+
const { __scopeDropdownMenu: n, ...r } = o, a = i(n);
|
|
178
|
+
return /* @__PURE__ */ t(
|
|
179
|
+
no,
|
|
180
|
+
{
|
|
181
|
+
...a,
|
|
182
|
+
...r,
|
|
183
|
+
ref: e,
|
|
184
|
+
style: {
|
|
185
|
+
...o.style,
|
|
186
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
187
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
188
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
189
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
190
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
});
|
|
195
|
+
L.displayName = ho;
|
|
196
|
+
var Oo = R, yo = I, To = S, Go = N, ko = x, Lo = A, Ko = P, Uo = E, Bo = O, Fo = y, Ho = T, Wo = G, $o = Do, jo = k, Xo = L;
|
|
197
|
+
export {
|
|
198
|
+
Uo as CheckboxItem,
|
|
199
|
+
Go as Content,
|
|
200
|
+
R as DropdownMenu,
|
|
201
|
+
go as DropdownMenuArrow,
|
|
202
|
+
E as DropdownMenuCheckboxItem,
|
|
203
|
+
N as DropdownMenuContent,
|
|
204
|
+
x as DropdownMenuGroup,
|
|
205
|
+
P as DropdownMenuItem,
|
|
206
|
+
T as DropdownMenuItemIndicator,
|
|
207
|
+
A as DropdownMenuLabel,
|
|
208
|
+
S as DropdownMenuPortal,
|
|
209
|
+
O as DropdownMenuRadioGroup,
|
|
210
|
+
y as DropdownMenuRadioItem,
|
|
211
|
+
G as DropdownMenuSeparator,
|
|
212
|
+
Do as DropdownMenuSub,
|
|
213
|
+
L as DropdownMenuSubContent,
|
|
214
|
+
k as DropdownMenuSubTrigger,
|
|
215
|
+
I as DropdownMenuTrigger,
|
|
216
|
+
ko as Group,
|
|
217
|
+
Ko as Item,
|
|
218
|
+
Ho as ItemIndicator,
|
|
219
|
+
Lo as Label,
|
|
220
|
+
To as Portal,
|
|
221
|
+
Bo as RadioGroup,
|
|
222
|
+
Fo as RadioItem,
|
|
223
|
+
Oo as Root,
|
|
224
|
+
Wo as Separator,
|
|
225
|
+
$o as Sub,
|
|
226
|
+
Xo as SubContent,
|
|
227
|
+
jo as SubTrigger,
|
|
228
|
+
yo as Trigger,
|
|
229
|
+
Eo as createDropdownMenuScope
|
|
230
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var a = Object.defineProperty;
|
|
2
|
+
var n = (e, t) => a(e, "name", { value: t, configurable: !0 });
|
|
3
|
+
import * as u from "react";
|
|
4
|
+
var o = 0;
|
|
5
|
+
function d() {
|
|
6
|
+
u.useEffect(() => {
|
|
7
|
+
const e = document.querySelectorAll("[data-radix-focus-guard]");
|
|
8
|
+
return document.body.insertAdjacentElement("afterbegin", e[0] ?? r()), document.body.insertAdjacentElement("beforeend", e[1] ?? r()), o++, () => {
|
|
9
|
+
o === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), o--;
|
|
10
|
+
};
|
|
11
|
+
}, []);
|
|
12
|
+
}
|
|
13
|
+
n(d, "useFocusGuards");
|
|
14
|
+
function r() {
|
|
15
|
+
const e = document.createElement("span");
|
|
16
|
+
return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
|
|
17
|
+
}
|
|
18
|
+
n(r, "createFocusGuard");
|
|
19
|
+
export {
|
|
20
|
+
d as useFocusGuards
|
|
21
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
var M = Object.defineProperty;
|
|
2
|
+
var r = (e, t) => M(e, "name", { value: t, configurable: !0 });
|
|
3
|
+
import * as l from "react";
|
|
4
|
+
import { useComposedRefs as _ } from "../../react-compose-refs/dist/index.js";
|
|
5
|
+
import { Primitive as K } from "../../react-primitive/dist/index.js";
|
|
6
|
+
import { useCallbackRef as N } from "../../react-use-callback-ref/dist/index.js";
|
|
7
|
+
import { jsx as k } from "react/jsx-runtime";
|
|
8
|
+
var T = "focusScope.autoFocusOnMount", h = "focusScope.autoFocusOnUnmount", O = { bubbles: !1, cancelable: !0 }, w = "FocusScope", x = l.forwardRef((e, t) => {
|
|
9
|
+
const {
|
|
10
|
+
loop: n = !1,
|
|
11
|
+
trapped: u = !1,
|
|
12
|
+
onMountAutoFocus: E,
|
|
13
|
+
onUnmountAutoFocus: g,
|
|
14
|
+
...U
|
|
15
|
+
} = e, [o, A] = l.useState(null), v = N(E), b = N(g), F = l.useRef(null), P = _(t, (s) => A(s)), f = l.useRef({
|
|
16
|
+
paused: !1,
|
|
17
|
+
pause() {
|
|
18
|
+
this.paused = !0;
|
|
19
|
+
},
|
|
20
|
+
resume() {
|
|
21
|
+
this.paused = !1;
|
|
22
|
+
}
|
|
23
|
+
}).current;
|
|
24
|
+
l.useEffect(() => {
|
|
25
|
+
if (u) {
|
|
26
|
+
let s = /* @__PURE__ */ r(function(a) {
|
|
27
|
+
if (f.paused || !o) return;
|
|
28
|
+
const i = a.target;
|
|
29
|
+
o.contains(i) ? F.current = i : d(F.current, { select: !0 });
|
|
30
|
+
}, "handleFocusIn2"), m = /* @__PURE__ */ r(function(a) {
|
|
31
|
+
if (f.paused || !o) return;
|
|
32
|
+
const i = a.relatedTarget;
|
|
33
|
+
i !== null && (o.contains(i) || d(F.current, { select: !0 }));
|
|
34
|
+
}, "handleFocusOut2"), c = /* @__PURE__ */ r(function(a) {
|
|
35
|
+
if (document.activeElement === document.body)
|
|
36
|
+
for (const y of a)
|
|
37
|
+
y.removedNodes.length > 0 && d(o);
|
|
38
|
+
}, "handleMutations2");
|
|
39
|
+
document.addEventListener("focusin", s), document.addEventListener("focusout", m);
|
|
40
|
+
const p = new MutationObserver(c);
|
|
41
|
+
return o && p.observe(o, { childList: !0, subtree: !0 }), () => {
|
|
42
|
+
document.removeEventListener("focusin", s), document.removeEventListener("focusout", m), p.disconnect();
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}, [u, o, f.paused]), l.useEffect(() => {
|
|
46
|
+
if (o) {
|
|
47
|
+
C.add(f);
|
|
48
|
+
const s = document.activeElement;
|
|
49
|
+
if (!o.contains(s)) {
|
|
50
|
+
const c = new CustomEvent(T, O);
|
|
51
|
+
o.addEventListener(T, v), o.dispatchEvent(c), c.defaultPrevented || (D(q(L(o)), { select: !0 }), document.activeElement === s && d(o));
|
|
52
|
+
}
|
|
53
|
+
return () => {
|
|
54
|
+
o.removeEventListener(T, v), setTimeout(() => {
|
|
55
|
+
const c = new CustomEvent(h, O);
|
|
56
|
+
o.addEventListener(h, b), o.dispatchEvent(c), c.defaultPrevented || d(s ?? document.body, { select: !0 }), o.removeEventListener(h, b), C.remove(f);
|
|
57
|
+
}, 0);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}, [o, v, b, f]);
|
|
61
|
+
const R = l.useCallback(
|
|
62
|
+
(s) => {
|
|
63
|
+
if (!n && !u || f.paused) return;
|
|
64
|
+
const m = s.key === "Tab" && !s.altKey && !s.ctrlKey && !s.metaKey, c = document.activeElement;
|
|
65
|
+
if (m && c) {
|
|
66
|
+
const p = s.currentTarget, [a, i] = H(p);
|
|
67
|
+
a && i ? !s.shiftKey && c === i ? (s.preventDefault(), n && d(a, { select: !0 })) : s.shiftKey && c === a && (s.preventDefault(), n && d(i, { select: !0 })) : c === p && s.preventDefault();
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
[n, u, f.paused]
|
|
71
|
+
);
|
|
72
|
+
return /* @__PURE__ */ k(K.div, { tabIndex: -1, ...U, ref: P, onKeyDown: R });
|
|
73
|
+
});
|
|
74
|
+
x.displayName = w;
|
|
75
|
+
function D(e, { select: t = !1 } = {}) {
|
|
76
|
+
const n = document.activeElement;
|
|
77
|
+
for (const u of e)
|
|
78
|
+
if (d(u, { select: t }), document.activeElement !== n) return;
|
|
79
|
+
}
|
|
80
|
+
r(D, "focusFirst");
|
|
81
|
+
function H(e) {
|
|
82
|
+
const t = L(e), n = S(t, e), u = S(t.reverse(), e);
|
|
83
|
+
return [n, u];
|
|
84
|
+
}
|
|
85
|
+
r(H, "getTabbableEdges");
|
|
86
|
+
function L(e) {
|
|
87
|
+
const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
88
|
+
acceptNode: /* @__PURE__ */ r((u) => {
|
|
89
|
+
const E = u.tagName === "INPUT" && u.type === "hidden";
|
|
90
|
+
return u.disabled || u.hidden || E ? NodeFilter.FILTER_SKIP : u.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
91
|
+
}, "acceptNode")
|
|
92
|
+
});
|
|
93
|
+
for (; n.nextNode(); ) t.push(n.currentNode);
|
|
94
|
+
return t;
|
|
95
|
+
}
|
|
96
|
+
r(L, "getTabbableCandidates");
|
|
97
|
+
function S(e, t) {
|
|
98
|
+
for (const n of e)
|
|
99
|
+
if (!V(n, { upTo: t })) return n;
|
|
100
|
+
}
|
|
101
|
+
r(S, "findVisible");
|
|
102
|
+
function V(e, { upTo: t }) {
|
|
103
|
+
if (getComputedStyle(e).visibility === "hidden") return !0;
|
|
104
|
+
for (; e; ) {
|
|
105
|
+
if (t !== void 0 && e === t) return !1;
|
|
106
|
+
if (getComputedStyle(e).display === "none") return !0;
|
|
107
|
+
e = e.parentElement;
|
|
108
|
+
}
|
|
109
|
+
return !1;
|
|
110
|
+
}
|
|
111
|
+
r(V, "isHidden");
|
|
112
|
+
function W(e) {
|
|
113
|
+
return e instanceof HTMLInputElement && "select" in e;
|
|
114
|
+
}
|
|
115
|
+
r(W, "isSelectableInput");
|
|
116
|
+
function d(e, { select: t = !1 } = {}) {
|
|
117
|
+
if (e && e.focus) {
|
|
118
|
+
const n = document.activeElement;
|
|
119
|
+
e.focus({ preventScroll: !0 }), e !== n && W(e) && t && e.select();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
r(d, "focus");
|
|
123
|
+
var C = j();
|
|
124
|
+
function j() {
|
|
125
|
+
let e = [];
|
|
126
|
+
return {
|
|
127
|
+
add(t) {
|
|
128
|
+
const n = e[0];
|
|
129
|
+
t !== n && (n == null || n.pause()), e = I(e, t), e.unshift(t);
|
|
130
|
+
},
|
|
131
|
+
remove(t) {
|
|
132
|
+
var n;
|
|
133
|
+
e = I(e, t), (n = e[0]) == null || n.resume();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
r(j, "createFocusScopesStack");
|
|
138
|
+
function I(e, t) {
|
|
139
|
+
const n = [...e], u = n.indexOf(t);
|
|
140
|
+
return u !== -1 && n.splice(u, 1), n;
|
|
141
|
+
}
|
|
142
|
+
r(I, "arrayRemove");
|
|
143
|
+
function q(e) {
|
|
144
|
+
return e.filter((t) => t.tagName !== "A");
|
|
145
|
+
}
|
|
146
|
+
r(q, "removeLinks");
|
|
147
|
+
export {
|
|
148
|
+
x as FocusScope
|
|
149
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var s = Object.defineProperty;
|
|
2
|
+
var o = (t, e) => s(t, "name", { value: e, configurable: !0 });
|
|
3
|
+
import * as r from "react";
|
|
4
|
+
import { useLayoutEffect as f } from "../../react-use-layout-effect/dist/index.js";
|
|
5
|
+
var c = r[" useId ".trim().toString()] || (() => {
|
|
6
|
+
}), i = 0;
|
|
7
|
+
function m(t) {
|
|
8
|
+
const [e, u] = r.useState(c());
|
|
9
|
+
return f(() => {
|
|
10
|
+
u((a) => a ?? String(i++));
|
|
11
|
+
}, [t]), t || (e ? `radix-${e}` : "");
|
|
12
|
+
}
|
|
13
|
+
o(m, "useId");
|
|
14
|
+
export {
|
|
15
|
+
m as useId
|
|
16
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var f = Object.defineProperty;
|
|
2
|
+
var o = (t, a) => f(t, "name", { value: a, configurable: !0 });
|
|
3
|
+
import * as l from "react";
|
|
4
|
+
import { Primitive as m } from "../../react-primitive/dist/index.js";
|
|
5
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
6
|
+
var n = "Label", i = l.forwardRef((t, a) => /* @__PURE__ */ u(
|
|
7
|
+
m.label,
|
|
8
|
+
{
|
|
9
|
+
...t,
|
|
10
|
+
ref: a,
|
|
11
|
+
onMouseDown: /* @__PURE__ */ o((e) => {
|
|
12
|
+
var r;
|
|
13
|
+
e.target.closest("button, input, select, textarea") || ((r = t.onMouseDown) == null || r.call(t, e), !e.defaultPrevented && e.detail > 1 && e.preventDefault());
|
|
14
|
+
}, "onMouseDown")
|
|
15
|
+
}
|
|
16
|
+
));
|
|
17
|
+
i.displayName = n;
|
|
18
|
+
var g = i;
|
|
19
|
+
export {
|
|
20
|
+
i as Label,
|
|
21
|
+
g as Root
|
|
22
|
+
};
|