@pravalabs/ui 0.0.0-stage → 1.0.0-rc.1
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/LICENSE +21 -0
- package/README.md +142 -2
- package/dist/Accordion-CVRdRha1.js +107 -0
- package/dist/Alert-Bxv6CGPj.js +54 -0
- package/dist/Avatar-DUw9xBQ-.js +49 -0
- package/dist/Badge-cupXlWce.js +37 -0
- package/dist/Button-vjrnnaM_.js +65 -0
- package/dist/Card-BJNdpGjM.js +44 -0
- package/dist/Checkbox-BQtcnwwC.js +60 -0
- package/dist/Container-DO8bd1tv.js +19 -0
- package/dist/Dialog-D3-sT_1Z.js +147 -0
- package/dist/Drawer-BRzJmvQx.js +21 -0
- package/dist/DropdownMenu-CFa2vgXi.js +137 -0
- package/dist/FormField-CoC946w9.js +61 -0
- package/dist/Grid-vTrChm2w.js +31 -0
- package/dist/Input-B97l8Dj0.js +82 -0
- package/dist/Label-DYOFzyEM.js +25 -0
- package/dist/Popover-C9Vgtm3q.js +81 -0
- package/dist/PravaProvider-0znpKV4G.js +59 -0
- package/dist/Progress-_Hz8dxM4.js +51 -0
- package/dist/RadioGroup-CvdV80Pg.js +90 -0
- package/dist/Select-_urp2aA_.js +451 -0
- package/dist/Separator-MnFbL0eH.js +23 -0
- package/dist/Skeleton-CyjiU8o1.js +25 -0
- package/dist/Spinner-Da7h4BDn.js +77 -0
- package/dist/Stack-DNtmh6BN.js +30 -0
- package/dist/Switch-Cp-wriw6.js +50 -0
- package/dist/Tabs-C0SRJSv1.js +158 -0
- package/dist/Textarea-D0fNA7sQ.js +69 -0
- package/dist/Toast-7qJXHzEb.js +110 -0
- package/dist/Tooltip-CyW8YfU9.js +57 -0
- package/dist/accordion.js +8 -0
- package/dist/alert.js +7 -0
- package/dist/avatar.js +7 -0
- package/dist/badge.js +7 -0
- package/dist/button.js +7 -0
- package/dist/card.js +10 -0
- package/dist/checkbox.js +8 -0
- package/dist/components/accordion/Accordion.d.ts +42 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/alert/Alert.d.ts +35 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/avatar/Avatar.d.ts +16 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/badge/Badge.d.ts +22 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/button/Button.d.ts +50 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/card/Card.d.ts +49 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/checkbox/Checkbox.d.ts +23 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/container/Container.d.ts +22 -0
- package/dist/components/container/index.d.ts +2 -0
- package/dist/components/dialog/Dialog.d.ts +89 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/drawer/Drawer.d.ts +46 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/dropdown-menu/DropdownMenu.d.ts +59 -0
- package/dist/components/dropdown-menu/index.d.ts +2 -0
- package/dist/components/field/field.d.ts +87 -0
- package/dist/components/form-field/FormField.d.ts +41 -0
- package/dist/components/form-field/index.d.ts +2 -0
- package/dist/components/grid/Grid.d.ts +36 -0
- package/dist/components/grid/index.d.ts +2 -0
- package/dist/components/input/Input.d.ts +35 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/label/Label.d.ts +15 -0
- package/dist/components/label/index.d.ts +2 -0
- package/dist/components/popover/Popover.d.ts +35 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/progress/Progress.d.ts +15 -0
- package/dist/components/progress/index.d.ts +2 -0
- package/dist/components/provider/PravaProvider.d.ts +69 -0
- package/dist/components/provider/index.d.ts +2 -0
- package/dist/components/radio-group/RadioGroup.d.ts +58 -0
- package/dist/components/radio-group/index.d.ts +2 -0
- package/dist/components/select/Select.d.ts +76 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/separator/Separator.d.ts +9 -0
- package/dist/components/separator/index.d.ts +2 -0
- package/dist/components/skeleton/Skeleton.d.ts +7 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/spinner/Spinner.d.ts +15 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/stack/Stack.d.ts +38 -0
- package/dist/components/stack/index.d.ts +2 -0
- package/dist/components/switch/Switch.d.ts +19 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/tabs/Tabs.d.ts +69 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/textarea/Textarea.d.ts +26 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/toast/Toast.d.ts +55 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/tooltip/Tooltip.d.ts +22 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/container.js +7 -0
- package/dist/dialog.js +8 -0
- package/dist/drawer.js +8 -0
- package/dist/dropdown-menu.js +8 -0
- package/dist/field-U1YinldE.js +152 -0
- package/dist/form-field.js +8 -0
- package/dist/grid.js +7 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +29 -0
- package/dist/input.js +8 -0
- package/dist/internal/overlay.d.ts +39 -0
- package/dist/internal/useControllable.d.ts +2 -0
- package/dist/label.js +8 -0
- package/dist/overlay-9zlvgpUZ.js +121 -0
- package/dist/popover.js +8 -0
- package/dist/progress.js +7 -0
- package/dist/provider.js +7 -0
- package/dist/radio-group.js +8 -0
- package/dist/select.js +8 -0
- package/dist/separator.js +7 -0
- package/dist/skeleton.js +7 -0
- package/dist/spinner.js +7 -0
- package/dist/stack.js +7 -0
- package/dist/styles/components/accordion.css +1 -0
- package/dist/styles/components/alert.css +1 -0
- package/dist/styles/components/avatar.css +1 -0
- package/dist/styles/components/badge.css +1 -0
- package/dist/styles/components/button.css +1 -0
- package/dist/styles/components/card.css +1 -0
- package/dist/styles/components/checkbox.css +1 -0
- package/dist/styles/components/container.css +1 -0
- package/dist/styles/components/dialog.css +1 -0
- package/dist/styles/components/drawer.css +1 -0
- package/dist/styles/components/dropdown-menu.css +1 -0
- package/dist/styles/components/field.css +1 -0
- package/dist/styles/components/floating.css +1 -0
- package/dist/styles/components/form-field.css +1 -0
- package/dist/styles/components/grid.css +1 -0
- package/dist/styles/components/input.css +1 -0
- package/dist/styles/components/label.css +1 -0
- package/dist/styles/components/popover.css +1 -0
- package/dist/styles/components/progress.css +1 -0
- package/dist/styles/components/provider.css +1 -0
- package/dist/styles/components/radio-group.css +1 -0
- package/dist/styles/components/select.css +1 -0
- package/dist/styles/components/separator.css +1 -0
- package/dist/styles/components/skeleton.css +1 -0
- package/dist/styles/components/spinner.css +1 -0
- package/dist/styles/components/stack.css +1 -0
- package/dist/styles/components/switch.css +1 -0
- package/dist/styles/components/tabs.css +1 -0
- package/dist/styles/components/textarea.css +1 -0
- package/dist/styles/components/toast.css +1 -0
- package/dist/styles/components/tooltip.css +1 -0
- package/dist/styles.css +1 -0
- package/dist/switch.js +8 -0
- package/dist/tabs.js +10 -0
- package/dist/textarea.js +8 -0
- package/dist/toast.js +9 -0
- package/dist/tokens.css +192 -0
- package/dist/tooltip.js +8 -0
- package/dist/useControllable-C2Te1pSd.js +14 -0
- package/package.json +223 -4
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as u, Fragment as E, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as H, useRef as _, useImperativeHandle as R, useId as S, useEffect as C, useContext as q, createContext as z } from "react";
|
|
4
|
+
import { u as F, l as K, m as O, c as b } from "./overlay-9zlvgpUZ.js";
|
|
5
|
+
import { u as A } from "./useControllable-C2Te1pSd.js";
|
|
6
|
+
import { u as G } from "./PravaProvider-0znpKV4G.js";
|
|
7
|
+
const y = z(() => {
|
|
8
|
+
});
|
|
9
|
+
function W({ children: p }) {
|
|
10
|
+
const c = q(y);
|
|
11
|
+
return b(p, { onClick: c });
|
|
12
|
+
}
|
|
13
|
+
const X = H(
|
|
14
|
+
function({
|
|
15
|
+
title: c,
|
|
16
|
+
description: d,
|
|
17
|
+
footer: g,
|
|
18
|
+
trigger: h,
|
|
19
|
+
open: j,
|
|
20
|
+
defaultOpen: B = !1,
|
|
21
|
+
onOpenChange: x,
|
|
22
|
+
modal: l = !0,
|
|
23
|
+
dismissible: f = !0,
|
|
24
|
+
hideClose: D,
|
|
25
|
+
size: k = "md",
|
|
26
|
+
classNames: n,
|
|
27
|
+
className: w,
|
|
28
|
+
children: v,
|
|
29
|
+
id: P,
|
|
30
|
+
...i
|
|
31
|
+
}, T) {
|
|
32
|
+
const { messages: $ } = G(), [o, r] = A(
|
|
33
|
+
j,
|
|
34
|
+
B,
|
|
35
|
+
x
|
|
36
|
+
), s = _(null);
|
|
37
|
+
R(T, () => s.current);
|
|
38
|
+
const I = S(), t = P ?? I, m = _(!1);
|
|
39
|
+
C(() => {
|
|
40
|
+
const e = s.current;
|
|
41
|
+
e && (o && !e.open ? (l ? e.showModal() : e.show(), e.querySelector("[data-autofocus]")?.focus()) : !o && e.open && e.close());
|
|
42
|
+
}, [o, l]);
|
|
43
|
+
const M = F(o, s);
|
|
44
|
+
C(() => o && l ? K() : void 0, [o, l]);
|
|
45
|
+
const N = O(i, {
|
|
46
|
+
// The browser's own Escape path, which also covers focus sitting outside the dialog.
|
|
47
|
+
onCancel: (e) => {
|
|
48
|
+
e.preventDefault(), f && r(!1);
|
|
49
|
+
},
|
|
50
|
+
// Keeps state in sync when something inside closes it, such as `<form method="dialog">`.
|
|
51
|
+
onClose: () => {
|
|
52
|
+
o && r(!1);
|
|
53
|
+
},
|
|
54
|
+
onKeyDown: (e) => {
|
|
55
|
+
e.key !== "Escape" || e.defaultPrevented || (e.preventDefault(), e.stopPropagation(), f && r(!1));
|
|
56
|
+
},
|
|
57
|
+
// ::backdrop presses target the dialog itself; the panel covers everything else.
|
|
58
|
+
onPointerDown: (e) => {
|
|
59
|
+
m.current = e.target === e.currentTarget;
|
|
60
|
+
},
|
|
61
|
+
onClick: (e) => {
|
|
62
|
+
l && f && m.current && e.target === e.currentTarget && r(!1);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return /* @__PURE__ */ u(E, { children: [
|
|
66
|
+
h && b(h, {
|
|
67
|
+
"aria-haspopup": "dialog",
|
|
68
|
+
"aria-expanded": o,
|
|
69
|
+
"aria-controls": t,
|
|
70
|
+
onClick: (e) => {
|
|
71
|
+
e.currentTarget.focus(), r(!0);
|
|
72
|
+
}
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ a(
|
|
75
|
+
"dialog",
|
|
76
|
+
{
|
|
77
|
+
...i,
|
|
78
|
+
...N,
|
|
79
|
+
ref: s,
|
|
80
|
+
id: t,
|
|
81
|
+
className: ["prava-dialog", w].filter(Boolean).join(" "),
|
|
82
|
+
"data-size": k,
|
|
83
|
+
"data-modal": l ? "" : void 0,
|
|
84
|
+
"aria-labelledby": i["aria-labelledby"] ?? `${t}-title`,
|
|
85
|
+
"aria-describedby": i["aria-describedby"] ?? (d != null ? `${t}-description` : void 0),
|
|
86
|
+
children: M && /* @__PURE__ */ a(y.Provider, { value: () => r(!1), children: /* @__PURE__ */ u("div", { className: "prava-dialog__panel", children: [
|
|
87
|
+
/* @__PURE__ */ u(
|
|
88
|
+
"header",
|
|
89
|
+
{
|
|
90
|
+
className: ["prava-dialog__header", n?.header].filter(Boolean).join(" "),
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ a(
|
|
93
|
+
"h2",
|
|
94
|
+
{
|
|
95
|
+
id: `${t}-title`,
|
|
96
|
+
className: ["prava-dialog__title", n?.title].filter(Boolean).join(" "),
|
|
97
|
+
children: c
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
d != null && /* @__PURE__ */ a(
|
|
101
|
+
"p",
|
|
102
|
+
{
|
|
103
|
+
id: `${t}-description`,
|
|
104
|
+
className: [
|
|
105
|
+
"prava-dialog__description",
|
|
106
|
+
n?.description
|
|
107
|
+
].filter(Boolean).join(" "),
|
|
108
|
+
children: d
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
v != null && /* @__PURE__ */ a(
|
|
115
|
+
"div",
|
|
116
|
+
{
|
|
117
|
+
className: ["prava-dialog__body", n?.body].filter(Boolean).join(" "),
|
|
118
|
+
children: v
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
g != null && /* @__PURE__ */ a(
|
|
122
|
+
"footer",
|
|
123
|
+
{
|
|
124
|
+
className: ["prava-dialog__footer", n?.footer].filter(Boolean).join(" "),
|
|
125
|
+
children: g
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
!D && /* @__PURE__ */ a(
|
|
129
|
+
"button",
|
|
130
|
+
{
|
|
131
|
+
type: "button",
|
|
132
|
+
className: ["prava-dialog__close", n?.close].filter(Boolean).join(" "),
|
|
133
|
+
"aria-label": $.close,
|
|
134
|
+
onClick: () => r(!1),
|
|
135
|
+
children: /* @__PURE__ */ a("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ a("path", { d: "M4 4l8 8M12 4l-8 8" }) })
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
] }) })
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
] });
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
export {
|
|
145
|
+
X as D,
|
|
146
|
+
W as a
|
|
147
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as t } from "react";
|
|
4
|
+
import { a as n, D as i } from "./Dialog-D3-sT_1Z.js";
|
|
5
|
+
const p = n, c = t(
|
|
6
|
+
function({ placement: a = "end", className: r, ...o }, e) {
|
|
7
|
+
return /* @__PURE__ */ s(
|
|
8
|
+
i,
|
|
9
|
+
{
|
|
10
|
+
...o,
|
|
11
|
+
ref: e,
|
|
12
|
+
className: ["prava-drawer", r].filter(Boolean).join(" "),
|
|
13
|
+
"data-placement": a
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
export {
|
|
19
|
+
c as D,
|
|
20
|
+
p as a
|
|
21
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as g, jsx as s, Fragment as S } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as y, useId as j, useCallback as L } from "react";
|
|
4
|
+
import { a as M, b as q, c as B } from "./overlay-9zlvgpUZ.js";
|
|
5
|
+
import { u as H } from "./useControllable-C2Te1pSd.js";
|
|
6
|
+
const R = 500;
|
|
7
|
+
function Q({
|
|
8
|
+
trigger: w,
|
|
9
|
+
items: x,
|
|
10
|
+
placement: A = "bottom",
|
|
11
|
+
align: _ = "start",
|
|
12
|
+
open: E,
|
|
13
|
+
defaultOpen: C = !1,
|
|
14
|
+
onOpenChange: N,
|
|
15
|
+
className: P,
|
|
16
|
+
id: T,
|
|
17
|
+
...$
|
|
18
|
+
}) {
|
|
19
|
+
const [l, a] = H(E, C, N), u = y(null), c = y(null), I = j(), i = T ?? I, b = w.props.id ?? `${i}-trigger`, K = y({ text: "", at: 0 });
|
|
20
|
+
M(l, u, c, A, _), q(
|
|
21
|
+
l,
|
|
22
|
+
u,
|
|
23
|
+
L(() => a(!1), [a])
|
|
24
|
+
);
|
|
25
|
+
const f = () => Array.from(
|
|
26
|
+
c.current?.querySelectorAll('[role="menuitem"]') ?? []
|
|
27
|
+
), h = () => u.current?.firstElementChild, v = (e) => {
|
|
28
|
+
a(!0), requestAnimationFrame(() => {
|
|
29
|
+
const o = f();
|
|
30
|
+
(e === "menu" ? c.current : e === "first" ? o[0] : o[o.length - 1])?.focus();
|
|
31
|
+
});
|
|
32
|
+
}, D = () => {
|
|
33
|
+
a(!1), h()?.focus();
|
|
34
|
+
}, F = (e) => {
|
|
35
|
+
const o = Date.now(), r = K.current;
|
|
36
|
+
r.text = o - r.at > R ? e : r.text + e, r.at = o;
|
|
37
|
+
const n = f(), t = n.indexOf(document.activeElement), d = r.text.split("").every((m) => m === e) ? e : r.text, p = d.length > 1 ? 0 : 1;
|
|
38
|
+
[
|
|
39
|
+
...n.slice(t + p),
|
|
40
|
+
...n.slice(0, t + p)
|
|
41
|
+
].find((m) => m.textContent?.trim().toLowerCase().startsWith(d))?.focus();
|
|
42
|
+
}, O = (e) => {
|
|
43
|
+
const o = f(), r = o.indexOf(document.activeElement), n = (p) => o[(p + o.length) % o.length]?.focus(), d = {
|
|
44
|
+
ArrowDown: () => n(r + 1),
|
|
45
|
+
ArrowUp: () => n(r < 0 ? -1 : r - 1),
|
|
46
|
+
Home: () => n(0),
|
|
47
|
+
End: () => n(-1),
|
|
48
|
+
Escape: D
|
|
49
|
+
}[e.key];
|
|
50
|
+
d ? (e.preventDefault(), e.stopPropagation(), d()) : e.key === "Tab" ? (a(!1), h()?.focus()) : e.key.length === 1 && e.key !== " " && !e.ctrlKey && !e.metaKey && !e.altKey && F(e.key.toLowerCase());
|
|
51
|
+
}, k = (e, o) => {
|
|
52
|
+
const r = {
|
|
53
|
+
role: "menuitem",
|
|
54
|
+
tabIndex: -1,
|
|
55
|
+
className: "prava-dropdown-menu__item",
|
|
56
|
+
"data-tone": e.tone === "danger" ? "danger" : void 0,
|
|
57
|
+
"aria-disabled": e.disabled || void 0,
|
|
58
|
+
onClick: (t) => {
|
|
59
|
+
if (e.disabled) {
|
|
60
|
+
t.preventDefault();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
D(), e.onSelect?.();
|
|
64
|
+
},
|
|
65
|
+
// Hover and keyboard share one highlight, so only one row ever looks active.
|
|
66
|
+
onPointerMove: (t) => {
|
|
67
|
+
t.pointerType === "mouse" && t.currentTarget.focus();
|
|
68
|
+
}
|
|
69
|
+
}, n = /* @__PURE__ */ g(S, { children: [
|
|
70
|
+
e.icon != null && /* @__PURE__ */ s("span", { className: "prava-dropdown-menu__icon", "aria-hidden": "true", children: e.icon }),
|
|
71
|
+
/* @__PURE__ */ s("span", { className: "prava-dropdown-menu__label", children: e.label })
|
|
72
|
+
] });
|
|
73
|
+
return e.href ? /* @__PURE__ */ s("a", { ...r, href: e.disabled ? void 0 : e.href, children: n }, o) : /* @__PURE__ */ s("button", { type: "button", ...r, children: n }, o);
|
|
74
|
+
};
|
|
75
|
+
return /* @__PURE__ */ g("span", { ref: u, className: "prava-floating-root", children: [
|
|
76
|
+
B(w, {
|
|
77
|
+
id: b,
|
|
78
|
+
"aria-haspopup": "menu",
|
|
79
|
+
"aria-expanded": l,
|
|
80
|
+
"aria-controls": i,
|
|
81
|
+
// detail is 0 for Enter and Space, which land on the first item; a pointer lands on the menu.
|
|
82
|
+
onClick: (e) => {
|
|
83
|
+
l ? a(!1) : v(e.detail === 0 ? "first" : "menu");
|
|
84
|
+
},
|
|
85
|
+
onKeyDown: (e) => {
|
|
86
|
+
e.key !== "ArrowDown" && e.key !== "ArrowUp" || (e.preventDefault(), v(e.key === "ArrowDown" ? "first" : "last"));
|
|
87
|
+
}
|
|
88
|
+
}),
|
|
89
|
+
/* @__PURE__ */ s(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
"aria-labelledby": b,
|
|
93
|
+
...$,
|
|
94
|
+
ref: c,
|
|
95
|
+
id: i,
|
|
96
|
+
role: "menu",
|
|
97
|
+
tabIndex: -1,
|
|
98
|
+
popover: "manual",
|
|
99
|
+
className: ["prava-floating prava-dropdown-menu", P].filter(Boolean).join(" "),
|
|
100
|
+
"data-open": l ? "" : void 0,
|
|
101
|
+
onKeyDown: O,
|
|
102
|
+
onPointerLeave: () => c.current?.focus(),
|
|
103
|
+
children: x.map((e, o) => "separator" in e ? /* @__PURE__ */ s(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
role: "separator",
|
|
107
|
+
className: "prava-dropdown-menu__separator"
|
|
108
|
+
},
|
|
109
|
+
o
|
|
110
|
+
) : "items" in e ? /* @__PURE__ */ g(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
role: "group",
|
|
114
|
+
"aria-labelledby": `${i}-group-${o}`,
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ s(
|
|
117
|
+
"div",
|
|
118
|
+
{
|
|
119
|
+
id: `${i}-group-${o}`,
|
|
120
|
+
className: "prava-dropdown-menu__group-label",
|
|
121
|
+
children: e.label
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
e.items.map(
|
|
125
|
+
(r, n) => k(r, `${o}-${n}`)
|
|
126
|
+
)
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
o
|
|
130
|
+
) : k(e, String(o)))
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
] });
|
|
134
|
+
}
|
|
135
|
+
export {
|
|
136
|
+
Q as D
|
|
137
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as p, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { cloneElement as u } from "react";
|
|
4
|
+
import { u as f, F as v } from "./field-U1YinldE.js";
|
|
5
|
+
import { L as h } from "./Label-DYOFzyEM.js";
|
|
6
|
+
const x = /* @__PURE__ */ new Set([
|
|
7
|
+
"checkbox",
|
|
8
|
+
"radio",
|
|
9
|
+
"range",
|
|
10
|
+
"file",
|
|
11
|
+
"color",
|
|
12
|
+
"hidden",
|
|
13
|
+
"submit",
|
|
14
|
+
"reset",
|
|
15
|
+
"button",
|
|
16
|
+
"image"
|
|
17
|
+
]);
|
|
18
|
+
function j({
|
|
19
|
+
label: n,
|
|
20
|
+
control: a,
|
|
21
|
+
description: o,
|
|
22
|
+
error: s,
|
|
23
|
+
required: i = !1,
|
|
24
|
+
id: d,
|
|
25
|
+
className: l,
|
|
26
|
+
...m
|
|
27
|
+
}) {
|
|
28
|
+
const e = a.props, c = a.type === "textarea" || a.type === "select" || a.type === "input" && !x.has(e.type ?? "text"), r = f({
|
|
29
|
+
id: d ?? e.id,
|
|
30
|
+
description: o,
|
|
31
|
+
error: s,
|
|
32
|
+
onBlur: e.onBlur,
|
|
33
|
+
onChange: e.onChange,
|
|
34
|
+
onInvalid: e.onInvalid,
|
|
35
|
+
"aria-describedby": e["aria-describedby"],
|
|
36
|
+
"aria-invalid": e["aria-invalid"]
|
|
37
|
+
});
|
|
38
|
+
return /* @__PURE__ */ p(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
...m,
|
|
42
|
+
className: ["prava-field prava-form-field", l].filter(Boolean).join(" "),
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ t(h, { htmlFor: r.id, required: i, children: n }),
|
|
45
|
+
/* @__PURE__ */ t(v.Provider, { value: !0, children: u(a, {
|
|
46
|
+
...r.controlProps,
|
|
47
|
+
required: i || e.required,
|
|
48
|
+
"aria-required": i || e["aria-required"],
|
|
49
|
+
...c && {
|
|
50
|
+
className: ["prava-control", e.className].filter(Boolean).join(" "),
|
|
51
|
+
"data-size": e["data-size"] ?? "md"
|
|
52
|
+
}
|
|
53
|
+
}) }),
|
|
54
|
+
r.messages
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
j as F
|
|
61
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as m } from "react";
|
|
4
|
+
const c = m(function({
|
|
5
|
+
columns: r,
|
|
6
|
+
minColumnWidth: a,
|
|
7
|
+
gap: i = 4,
|
|
8
|
+
as: o = "div",
|
|
9
|
+
className: t,
|
|
10
|
+
style: d,
|
|
11
|
+
...n
|
|
12
|
+
}, s) {
|
|
13
|
+
return /* @__PURE__ */ e(
|
|
14
|
+
o,
|
|
15
|
+
{
|
|
16
|
+
...n,
|
|
17
|
+
ref: s,
|
|
18
|
+
className: ["prava-grid", t].filter(Boolean).join(" "),
|
|
19
|
+
"data-gap": i,
|
|
20
|
+
"data-columns": r,
|
|
21
|
+
style: {
|
|
22
|
+
"--prava-grid-columns": r,
|
|
23
|
+
"--prava-grid-min": a,
|
|
24
|
+
...d
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
export {
|
|
30
|
+
c as G
|
|
31
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as p, jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as j } from "react";
|
|
4
|
+
import { b as x, u as z } from "./field-U1YinldE.js";
|
|
5
|
+
const w = j(
|
|
6
|
+
function(c, u) {
|
|
7
|
+
const {
|
|
8
|
+
size: a = "md",
|
|
9
|
+
invalid: m,
|
|
10
|
+
label: o,
|
|
11
|
+
startIcon: e,
|
|
12
|
+
endIcon: r,
|
|
13
|
+
disabledReason: d,
|
|
14
|
+
description: v,
|
|
15
|
+
error: b,
|
|
16
|
+
id: h,
|
|
17
|
+
placeholder: t,
|
|
18
|
+
className: f,
|
|
19
|
+
onBlur: _,
|
|
20
|
+
onChange: N,
|
|
21
|
+
onInvalid: I,
|
|
22
|
+
ref: y,
|
|
23
|
+
...i
|
|
24
|
+
} = x(c, u), l = !!o, s = z({
|
|
25
|
+
id: h,
|
|
26
|
+
description: i.disabled && d ? d : v,
|
|
27
|
+
error: b,
|
|
28
|
+
invalid: m,
|
|
29
|
+
onBlur: _,
|
|
30
|
+
onChange: N,
|
|
31
|
+
onInvalid: I,
|
|
32
|
+
"aria-describedby": i["aria-describedby"],
|
|
33
|
+
"aria-invalid": i["aria-invalid"]
|
|
34
|
+
});
|
|
35
|
+
return /* @__PURE__ */ p("span", { className: "prava-field prava-input-field", children: [
|
|
36
|
+
/* @__PURE__ */ p(
|
|
37
|
+
"span",
|
|
38
|
+
{
|
|
39
|
+
className: "prava-input__control",
|
|
40
|
+
"data-has-start-icon": e != null || void 0,
|
|
41
|
+
"data-has-end-icon": r != null || void 0,
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ n(
|
|
44
|
+
"input",
|
|
45
|
+
{
|
|
46
|
+
...i,
|
|
47
|
+
...s.controlProps,
|
|
48
|
+
ref: y,
|
|
49
|
+
placeholder: l ? t ?? " " : t,
|
|
50
|
+
size: typeof a == "number" ? a : void 0,
|
|
51
|
+
className: ["prava-control prava-input", f].filter(Boolean).join(" "),
|
|
52
|
+
"data-size": typeof a == "number" ? "md" : a,
|
|
53
|
+
"data-has-label": l || void 0
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
e != null && /* @__PURE__ */ n(
|
|
57
|
+
"span",
|
|
58
|
+
{
|
|
59
|
+
className: "prava-input__icon prava-input__icon--start",
|
|
60
|
+
"aria-hidden": "true",
|
|
61
|
+
children: e
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
r != null && /* @__PURE__ */ n(
|
|
65
|
+
"span",
|
|
66
|
+
{
|
|
67
|
+
className: "prava-input__icon prava-input__icon--end",
|
|
68
|
+
"aria-hidden": "true",
|
|
69
|
+
children: r
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
l && /* @__PURE__ */ n("label", { className: "prava-input__label", htmlFor: s.id, children: o })
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
s.messages
|
|
77
|
+
] });
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
export {
|
|
81
|
+
w as I
|
|
82
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as o, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { u as i } from "./PravaProvider-0znpKV4G.js";
|
|
4
|
+
function t({
|
|
5
|
+
required: e = !1,
|
|
6
|
+
className: r,
|
|
7
|
+
children: s,
|
|
8
|
+
...l
|
|
9
|
+
}) {
|
|
10
|
+
const { messages: n } = i();
|
|
11
|
+
return /* @__PURE__ */ o(
|
|
12
|
+
"label",
|
|
13
|
+
{
|
|
14
|
+
...l,
|
|
15
|
+
className: ["prava-label", r].filter(Boolean).join(" "),
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ a("span", { children: s }),
|
|
18
|
+
e && /* @__PURE__ */ a("span", { className: "prava-label__required", children: n.required })
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
t as L
|
|
25
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as i, jsx as d, Fragment as C } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as c, useId as k, useCallback as D, useEffect as E } from "react";
|
|
4
|
+
import { u as I, a as N, b as w, c as F } from "./overlay-9zlvgpUZ.js";
|
|
5
|
+
import { u as K } from "./useControllable-C2Te1pSd.js";
|
|
6
|
+
function S({
|
|
7
|
+
trigger: u,
|
|
8
|
+
title: s,
|
|
9
|
+
placement: p = "bottom",
|
|
10
|
+
align: f = "start",
|
|
11
|
+
open: m,
|
|
12
|
+
defaultOpen: b = !1,
|
|
13
|
+
onOpenChange: g,
|
|
14
|
+
classNames: v,
|
|
15
|
+
className: x,
|
|
16
|
+
children: h,
|
|
17
|
+
id: P,
|
|
18
|
+
...y
|
|
19
|
+
}) {
|
|
20
|
+
const [e, t] = K(m, b, g), a = c(null), n = c(null), j = k(), r = P ?? j, B = I(e, n);
|
|
21
|
+
return N(e, a, n, p, f), w(
|
|
22
|
+
e,
|
|
23
|
+
a,
|
|
24
|
+
D(() => t(!1), [t])
|
|
25
|
+
), E(() => {
|
|
26
|
+
if (!e) return;
|
|
27
|
+
const o = n.current;
|
|
28
|
+
(o?.querySelector(
|
|
29
|
+
"a[href],button:not(:disabled),input:not(:disabled),select:not(:disabled),textarea:not(:disabled),[tabindex]:not([tabindex='-1'])"
|
|
30
|
+
) ?? o)?.focus();
|
|
31
|
+
}, [e]), /* @__PURE__ */ i(
|
|
32
|
+
"span",
|
|
33
|
+
{
|
|
34
|
+
ref: a,
|
|
35
|
+
className: "prava-floating-root",
|
|
36
|
+
onKeyDown: (o) => {
|
|
37
|
+
o.key !== "Escape" || !e || o.defaultPrevented || (o.preventDefault(), o.stopPropagation(), t(!1), a.current?.firstElementChild?.focus());
|
|
38
|
+
},
|
|
39
|
+
onBlur: (o) => {
|
|
40
|
+
const l = o.relatedTarget;
|
|
41
|
+
e && l && !a.current?.contains(l) && t(!1);
|
|
42
|
+
},
|
|
43
|
+
children: [
|
|
44
|
+
F(u, {
|
|
45
|
+
"aria-haspopup": "dialog",
|
|
46
|
+
"aria-expanded": e,
|
|
47
|
+
"aria-controls": r,
|
|
48
|
+
onClick: () => t(!e)
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ d(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
role: "dialog",
|
|
54
|
+
tabIndex: -1,
|
|
55
|
+
"aria-labelledby": s != null ? `${r}-title` : void 0,
|
|
56
|
+
...y,
|
|
57
|
+
ref: n,
|
|
58
|
+
id: r,
|
|
59
|
+
popover: "manual",
|
|
60
|
+
className: ["prava-floating prava-popover", x].filter(Boolean).join(" "),
|
|
61
|
+
"data-open": e ? "" : void 0,
|
|
62
|
+
children: B && /* @__PURE__ */ i(C, { children: [
|
|
63
|
+
s != null && /* @__PURE__ */ d(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
id: `${r}-title`,
|
|
67
|
+
className: ["prava-popover__title", v?.title].filter(Boolean).join(" "),
|
|
68
|
+
children: s
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
h
|
|
72
|
+
] })
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
S as P
|
|
81
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { useContext as n, useMemo as m, createContext as d } from "react";
|
|
4
|
+
const v = {
|
|
5
|
+
required: "Required",
|
|
6
|
+
loading: "Loading",
|
|
7
|
+
close: "Close",
|
|
8
|
+
dismiss: "Dismiss",
|
|
9
|
+
notifications: "Notifications",
|
|
10
|
+
search: "Search",
|
|
11
|
+
noResults: "No results",
|
|
12
|
+
removeOption: "Remove {label}",
|
|
13
|
+
selectedCount: "{count} selected",
|
|
14
|
+
valueMissing: "Fill in this field.",
|
|
15
|
+
valueMissingChoice: "Select an option.",
|
|
16
|
+
typeMismatchEmail: "Enter a valid email address.",
|
|
17
|
+
typeMismatchUrl: "Enter a valid URL.",
|
|
18
|
+
badInput: "Enter a valid value.",
|
|
19
|
+
patternMismatch: "Match the requested format.",
|
|
20
|
+
tooShort: "Use at least {minLength} characters.",
|
|
21
|
+
tooLong: "Use no more than {maxLength} characters.",
|
|
22
|
+
rangeUnderflow: "Enter {min} or more.",
|
|
23
|
+
rangeOverflow: "Enter {max} or less.",
|
|
24
|
+
stepMismatch: "Enter a valid value."
|
|
25
|
+
}, s = d({
|
|
26
|
+
direction: "ltr",
|
|
27
|
+
locale: "en",
|
|
28
|
+
messages: v
|
|
29
|
+
}), g = () => n(s);
|
|
30
|
+
function p({
|
|
31
|
+
direction: e = "ltr",
|
|
32
|
+
locale: a,
|
|
33
|
+
messages: r,
|
|
34
|
+
theme: i,
|
|
35
|
+
children: l
|
|
36
|
+
}) {
|
|
37
|
+
const t = n(s), c = m(
|
|
38
|
+
() => ({
|
|
39
|
+
direction: e,
|
|
40
|
+
locale: a ?? t.locale,
|
|
41
|
+
messages: { ...t.messages, ...r }
|
|
42
|
+
}),
|
|
43
|
+
[e, a, r, t]
|
|
44
|
+
);
|
|
45
|
+
return /* @__PURE__ */ o(s.Provider, { value: c, children: /* @__PURE__ */ o(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: "prava-provider",
|
|
49
|
+
dir: e,
|
|
50
|
+
lang: a,
|
|
51
|
+
"data-prava-theme": i,
|
|
52
|
+
children: l
|
|
53
|
+
}
|
|
54
|
+
) });
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
p as P,
|
|
58
|
+
g as u
|
|
59
|
+
};
|