@vhyxui/react 0.1.0-alpha.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/dist/Alert-BJ1O0bnK.cjs +1 -0
- package/dist/Alert-am3ANPTH.js +99 -0
- package/dist/Badge-Fuc7l-1E.js +38 -0
- package/dist/Badge-RM7n86Rq.cjs +1 -0
- package/dist/Breadcrumb-Db7ASomJ.js +90 -0
- package/dist/Breadcrumb-StitgXXx.cjs +1 -0
- package/dist/Button-B32xz0b5.js +58 -0
- package/dist/Button-CfYG4zkG.cjs +1 -0
- package/dist/Card-D7ZNeWtE.js +75 -0
- package/dist/Card-d5xrWgQS.cjs +1 -0
- package/dist/Checkbox-DWl91ci_.js +92 -0
- package/dist/Checkbox-DvkT6QP9.cjs +1 -0
- package/dist/Dialog-CtYu14zl.js +245 -0
- package/dist/Dialog-gPT4noD8.cjs +1 -0
- package/dist/Drawer-BFJxsPG1.js +246 -0
- package/dist/Drawer-BygSIQQn.cjs +1 -0
- package/dist/Field-Bv07PL2M.js +120 -0
- package/dist/Field-D6FSsUGj.cjs +1 -0
- package/dist/Input-Dqt5q33I.js +151 -0
- package/dist/Input-OFmZxiHe.cjs +1 -0
- package/dist/Pagination-C1h7OTgM.js +128 -0
- package/dist/Pagination-CmmcBPNz.cjs +1 -0
- package/dist/Popover-BPFkS4xn.cjs +1 -0
- package/dist/Popover-MxUovsIt.js +194 -0
- package/dist/Progress-DWLr6Bq2.js +75 -0
- package/dist/Progress-FO-4WX0i.cjs +1 -0
- package/dist/RadioItem-BfkTHBxQ.cjs +1 -0
- package/dist/RadioItem-CzHSS_qK.js +141 -0
- package/dist/Select-C9yB2B8M.cjs +1 -0
- package/dist/Select-DjeJOdb7.js +327 -0
- package/dist/Separator-C5lPGzes.cjs +1 -0
- package/dist/Separator-DQT58t90.js +52 -0
- package/dist/Spinner-Cd5tcOLS.js +61 -0
- package/dist/Spinner-DSHhLV-r.cjs +1 -0
- package/dist/Switch-BU_Tcttb.cjs +1 -0
- package/dist/Switch-DOAZfSV0.js +64 -0
- package/dist/Tabs-BTfm4LbV.js +220 -0
- package/dist/Tabs-DuU02-UD.cjs +1 -0
- package/dist/Textarea-CLrctxHU.js +104 -0
- package/dist/Textarea-H6evM8L4.cjs +1 -0
- package/dist/Toast-0acAjZTB.js +167 -0
- package/dist/Toast-ndaxbpcV.cjs +1 -0
- package/dist/Tooltip-BAmErB_g.js +107 -0
- package/dist/Tooltip-CCd6VRvZ.cjs +1 -0
- package/dist/VhyxUIProvider-C9NxI-tU.cjs +1 -0
- package/dist/VhyxUIProvider-D1vNoiIk.js +34 -0
- package/dist/alert.cjs +1 -0
- package/dist/alert.d.ts +25 -0
- package/dist/alert.js +4 -0
- package/dist/badge.cjs +1 -0
- package/dist/badge.d.ts +31 -0
- package/dist/badge.js +4 -0
- package/dist/breadcrumb.cjs +1 -0
- package/dist/breadcrumb.d.ts +81 -0
- package/dist/breadcrumb.js +4 -0
- package/dist/button.cjs +1 -0
- package/dist/button.d.ts +36 -0
- package/dist/button.js +4 -0
- package/dist/card.cjs +1 -0
- package/dist/card.d.ts +72 -0
- package/dist/card.js +4 -0
- package/dist/checkbox.cjs +1 -0
- package/dist/checkbox.d.ts +33 -0
- package/dist/checkbox.js +4 -0
- package/dist/dialog.cjs +1 -0
- package/dist/dialog.d.ts +112 -0
- package/dist/dialog.js +4 -0
- package/dist/drawer.cjs +1 -0
- package/dist/drawer.d.ts +110 -0
- package/dist/drawer.js +4 -0
- package/dist/form.cjs +1 -0
- package/dist/form.d.ts +116 -0
- package/dist/form.js +6 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +1184 -0
- package/dist/index.js +83 -0
- package/dist/input.cjs +1 -0
- package/dist/input.d.ts +31 -0
- package/dist/input.js +4 -0
- package/dist/jsx-runtime-BRMkMA8J.cjs +22 -0
- package/dist/jsx-runtime-CL69jGNW.js +279 -0
- package/dist/pagination.cjs +1 -0
- package/dist/pagination.d.ts +32 -0
- package/dist/pagination.js +4 -0
- package/dist/popover.cjs +1 -0
- package/dist/popover.d.ts +72 -0
- package/dist/popover.js +4 -0
- package/dist/progress.cjs +1 -0
- package/dist/progress.d.ts +35 -0
- package/dist/progress.js +4 -0
- package/dist/radio.cjs +1 -0
- package/dist/radio.d.ts +47 -0
- package/dist/radio.js +5 -0
- package/dist/select.cjs +1 -0
- package/dist/select.d.ts +97 -0
- package/dist/select.js +4 -0
- package/dist/separator.cjs +1 -0
- package/dist/separator.d.ts +21 -0
- package/dist/separator.js +4 -0
- package/dist/spinner.cjs +1 -0
- package/dist/spinner.d.ts +24 -0
- package/dist/spinner.js +4 -0
- package/dist/style.css +1 -0
- package/dist/switch.cjs +1 -0
- package/dist/switch.d.ts +28 -0
- package/dist/switch.js +4 -0
- package/dist/tabs.cjs +1 -0
- package/dist/tabs.d.ts +59 -0
- package/dist/tabs.js +4 -0
- package/dist/test-utils.cjs +1 -0
- package/dist/test-utils.d.ts +5 -0
- package/dist/test-utils.js +12 -0
- package/dist/textarea.cjs +1 -0
- package/dist/textarea.d.ts +34 -0
- package/dist/textarea.js +4 -0
- package/dist/toast.cjs +1 -0
- package/dist/toast.d.ts +28 -0
- package/dist/toast.js +5 -0
- package/dist/tooltip.cjs +1 -0
- package/dist/tooltip.d.ts +32 -0
- package/dist/tooltip.js +4 -0
- package/dist/useId-BGRmH6iF.js +8 -0
- package/dist/useId-D2AEOm2G.cjs +1 -0
- package/package.json +170 -0
- package/style.css +1 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { j as t } from "./jsx-runtime-CL69jGNW.js";
|
|
2
|
+
import H, { useState as J, useCallback as y } from "react";
|
|
3
|
+
import { inputContract as m } from "@vhyxui/core";
|
|
4
|
+
import { withAgentContract as O } from "@vhyxseal/react";
|
|
5
|
+
import { u as T } from "./useId-BGRmH6iF.js";
|
|
6
|
+
const q = "_wrapper_16ky4_1", D = "_input_16ky4_60", G = "_icon_16ky4_90", K = "_prefix_16ky4_102", Q = "_suffix_16ky4_103", e = {
|
|
7
|
+
wrapper: q,
|
|
8
|
+
"wrapper--error": "_wrapper--error_16ky4_29",
|
|
9
|
+
input: D,
|
|
10
|
+
icon: G,
|
|
11
|
+
prefix: K,
|
|
12
|
+
suffix: Q,
|
|
13
|
+
"clear-button": "_clear-button_16ky4_113",
|
|
14
|
+
"toggle-button": "_toggle-button_16ky4_114"
|
|
15
|
+
};
|
|
16
|
+
function U({ crossed: a }) {
|
|
17
|
+
return /* @__PURE__ */ t.jsx(
|
|
18
|
+
"svg",
|
|
19
|
+
{
|
|
20
|
+
"aria-hidden": "true",
|
|
21
|
+
viewBox: "0 0 24 24",
|
|
22
|
+
fill: "none",
|
|
23
|
+
stroke: "currentColor",
|
|
24
|
+
strokeWidth: 2,
|
|
25
|
+
strokeLinecap: "round",
|
|
26
|
+
strokeLinejoin: "round",
|
|
27
|
+
style: { width: "1em", height: "1em" },
|
|
28
|
+
children: a ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
29
|
+
/* @__PURE__ */ t.jsx("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94" }),
|
|
30
|
+
/* @__PURE__ */ t.jsx("path", { d: "M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19" }),
|
|
31
|
+
/* @__PURE__ */ t.jsx("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
32
|
+
] }) : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
33
|
+
/* @__PURE__ */ t.jsx("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
34
|
+
/* @__PURE__ */ t.jsx("circle", { cx: 12, cy: 12, r: 3 })
|
|
35
|
+
] })
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function X() {
|
|
40
|
+
return /* @__PURE__ */ t.jsxs(
|
|
41
|
+
"svg",
|
|
42
|
+
{
|
|
43
|
+
"aria-hidden": "true",
|
|
44
|
+
viewBox: "0 0 24 24",
|
|
45
|
+
fill: "none",
|
|
46
|
+
stroke: "currentColor",
|
|
47
|
+
strokeWidth: 2.5,
|
|
48
|
+
strokeLinecap: "round",
|
|
49
|
+
style: { width: "0.75em", height: "0.75em" },
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ t.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
52
|
+
/* @__PURE__ */ t.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
const w = H.forwardRef(
|
|
58
|
+
({
|
|
59
|
+
size: a = "md",
|
|
60
|
+
icon: n,
|
|
61
|
+
iconPosition: i = "left",
|
|
62
|
+
suffix: o,
|
|
63
|
+
prefix: h,
|
|
64
|
+
clearable: j = !1,
|
|
65
|
+
onClear: s,
|
|
66
|
+
error: c = !1,
|
|
67
|
+
contract: _,
|
|
68
|
+
className: b,
|
|
69
|
+
id: g,
|
|
70
|
+
type: d,
|
|
71
|
+
value: l,
|
|
72
|
+
onChange: k,
|
|
73
|
+
"aria-label": v,
|
|
74
|
+
"aria-describedby": I,
|
|
75
|
+
...N
|
|
76
|
+
}, C) => {
|
|
77
|
+
const S = T("vhyx-input"), x = g ?? S, [p, B] = J(!1), A = y(() => {
|
|
78
|
+
B((W) => !W);
|
|
79
|
+
}, []), u = d === "password", L = d === "search", M = u ? p ? "text" : "password" : d, P = l !== void 0 ? String(l).length > 0 : !1, f = j || L && P, R = y(() => {
|
|
80
|
+
s == null || s();
|
|
81
|
+
}, [s]), r = !!n, V = !!h, z = !!o || u || f, E = {
|
|
82
|
+
...m,
|
|
83
|
+
id: x,
|
|
84
|
+
..._
|
|
85
|
+
}, F = [
|
|
86
|
+
e.wrapper,
|
|
87
|
+
c ? e["wrapper--error"] : "",
|
|
88
|
+
b
|
|
89
|
+
].filter(Boolean).join(" ");
|
|
90
|
+
return /* @__PURE__ */ t.jsxs(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
className: F,
|
|
94
|
+
"data-size": a,
|
|
95
|
+
"data-error": c ? !0 : void 0,
|
|
96
|
+
"data-has-icon": r ? !0 : void 0,
|
|
97
|
+
"data-icon-position": r ? i : void 0,
|
|
98
|
+
children: [
|
|
99
|
+
V && /* @__PURE__ */ t.jsx("span", { className: e.prefix, "aria-hidden": "true", children: h }),
|
|
100
|
+
r && i === "left" && /* @__PURE__ */ t.jsx("span", { className: e.icon, "aria-hidden": "true", children: n }),
|
|
101
|
+
/* @__PURE__ */ t.jsx(
|
|
102
|
+
"input",
|
|
103
|
+
{
|
|
104
|
+
ref: C,
|
|
105
|
+
id: x,
|
|
106
|
+
type: M,
|
|
107
|
+
value: l,
|
|
108
|
+
onChange: k,
|
|
109
|
+
"aria-invalid": c ? !0 : void 0,
|
|
110
|
+
"aria-label": v,
|
|
111
|
+
"aria-describedby": I,
|
|
112
|
+
className: e.input,
|
|
113
|
+
"data-vhyx-contract": JSON.stringify(E),
|
|
114
|
+
...N
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
r && i === "right" && /* @__PURE__ */ t.jsx("span", { className: e.icon, "aria-hidden": "true", children: n }),
|
|
118
|
+
f && /* @__PURE__ */ t.jsx(
|
|
119
|
+
"button",
|
|
120
|
+
{
|
|
121
|
+
type: "button",
|
|
122
|
+
className: e["clear-button"],
|
|
123
|
+
onClick: R,
|
|
124
|
+
"aria-label": "Clear",
|
|
125
|
+
tabIndex: 0,
|
|
126
|
+
children: /* @__PURE__ */ t.jsx(X, {})
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
u && /* @__PURE__ */ t.jsx(
|
|
130
|
+
"button",
|
|
131
|
+
{
|
|
132
|
+
type: "button",
|
|
133
|
+
className: e["toggle-button"],
|
|
134
|
+
onClick: A,
|
|
135
|
+
"aria-label": p ? "Hide password" : "Show password",
|
|
136
|
+
tabIndex: 0,
|
|
137
|
+
children: /* @__PURE__ */ t.jsx(U, { crossed: p })
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
z && o && /* @__PURE__ */ t.jsx("span", { className: e.suffix, "aria-hidden": "true", children: o })
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
w.displayName = "VhyxInput";
|
|
147
|
+
const Y = { ...m, id: "vhyxui-input" }, Z = O(w, Y);
|
|
148
|
+
Z.displayName = "VhyxInput";
|
|
149
|
+
export {
|
|
150
|
+
Z as I
|
|
151
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("./jsx-runtime-BRMkMA8J.cjs"),n=require("react"),y=require("@vhyxui/core"),H=require("@vhyxseal/react"),J=require("./useId-D2AEOm2G.cjs"),O="_wrapper_16ky4_1",T="_input_16ky4_60",D="_icon_16ky4_90",G="_prefix_16ky4_102",K="_suffix_16ky4_103",s={wrapper:O,"wrapper--error":"_wrapper--error_16ky4_29",input:T,icon:D,prefix:G,suffix:K,"clear-button":"_clear-button_16ky4_113","toggle-button":"_toggle-button_16ky4_114"};function Q({crossed:i}){return t.jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{width:"1em",height:"1em"},children:i?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"}),t.jsxRuntimeExports.jsx("path",{d:"M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"}),t.jsxRuntimeExports.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),t.jsxRuntimeExports.jsx("circle",{cx:12,cy:12,r:3})]})})}function U(){return t.jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",style:{width:"0.75em",height:"0.75em"},children:[t.jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}const f=n.forwardRef(({size:i="md",icon:a,iconPosition:o="left",suffix:x,prefix:h,clearable:R=!1,onClear:e,error:c=!1,contract:E,className:_,id:b,type:u,value:p,onChange:g,"aria-label":k,"aria-describedby":v,...I},C)=>{const N=J.useId("vhyx-input"),j=b??N,[d,S]=n.useState(!1),q=n.useCallback(()=>{S(W=>!W)},[]),l=u==="password",B=u==="search",A=l?d?"text":"password":u,L=p!==void 0?String(p).length>0:!1,m=R||B&&L,M=n.useCallback(()=>{e==null||e()},[e]),r=!!a,P=!!h,V=!!x||l||m,z={...y.inputContract,id:j,...E},F=[s.wrapper,c?s["wrapper--error"]:"",_].filter(Boolean).join(" ");return t.jsxRuntimeExports.jsxs("div",{className:F,"data-size":i,"data-error":c?!0:void 0,"data-has-icon":r?!0:void 0,"data-icon-position":r?o:void 0,children:[P&&t.jsxRuntimeExports.jsx("span",{className:s.prefix,"aria-hidden":"true",children:h}),r&&o==="left"&&t.jsxRuntimeExports.jsx("span",{className:s.icon,"aria-hidden":"true",children:a}),t.jsxRuntimeExports.jsx("input",{ref:C,id:j,type:A,value:p,onChange:g,"aria-invalid":c?!0:void 0,"aria-label":k,"aria-describedby":v,className:s.input,"data-vhyx-contract":JSON.stringify(z),...I}),r&&o==="right"&&t.jsxRuntimeExports.jsx("span",{className:s.icon,"aria-hidden":"true",children:a}),m&&t.jsxRuntimeExports.jsx("button",{type:"button",className:s["clear-button"],onClick:M,"aria-label":"Clear",tabIndex:0,children:t.jsxRuntimeExports.jsx(U,{})}),l&&t.jsxRuntimeExports.jsx("button",{type:"button",className:s["toggle-button"],onClick:q,"aria-label":d?"Hide password":"Show password",tabIndex:0,children:t.jsxRuntimeExports.jsx(Q,{crossed:d})}),V&&x&&t.jsxRuntimeExports.jsx("span",{className:s.suffix,"aria-hidden":"true",children:x})]})});f.displayName="VhyxInput";const X={...y.inputContract,id:"vhyxui-input"},w=H.withAgentContract(f,X);w.displayName="VhyxInput";exports.Input=w;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { j as t } from "./jsx-runtime-CL69jGNW.js";
|
|
2
|
+
import E, { useMemo as v } from "react";
|
|
3
|
+
import { paginationContract as _ } from "@vhyxui/core";
|
|
4
|
+
import { withAgentContract as I } from "@vhyxseal/react";
|
|
5
|
+
import { u as L } from "./useId-BGRmH6iF.js";
|
|
6
|
+
const P = "_nav_1kxmq_1", M = "_list_1kxmq_5", g = "_button_1kxmq_15", w = "_ellipsis_1kxmq_75", l = {
|
|
7
|
+
nav: P,
|
|
8
|
+
list: M,
|
|
9
|
+
button: g,
|
|
10
|
+
ellipsis: w
|
|
11
|
+
}, h = "ellipsis";
|
|
12
|
+
function A(i, s, a) {
|
|
13
|
+
const m = a * 2 + 5;
|
|
14
|
+
if (s <= m)
|
|
15
|
+
return Array.from({ length: s }, (e, x) => x + 1);
|
|
16
|
+
const r = Math.max(i - a, 2), c = Math.min(i + a, s - 1), n = r > 2, u = c < s - 1, o = [1];
|
|
17
|
+
n && o.push(h);
|
|
18
|
+
for (let e = r; e <= c; e++)
|
|
19
|
+
o.push(e);
|
|
20
|
+
return u && o.push(h), o.push(s), o;
|
|
21
|
+
}
|
|
22
|
+
const N = E.forwardRef(
|
|
23
|
+
({
|
|
24
|
+
page: i,
|
|
25
|
+
pageCount: s,
|
|
26
|
+
onPageChange: a,
|
|
27
|
+
siblingCount: m = 1,
|
|
28
|
+
showFirstLast: r = !1,
|
|
29
|
+
showPrevNext: c = !0,
|
|
30
|
+
size: n = "md",
|
|
31
|
+
contract: u,
|
|
32
|
+
className: o,
|
|
33
|
+
...e
|
|
34
|
+
}, x) => {
|
|
35
|
+
const p = L("vhyx-pagination"), k = v(
|
|
36
|
+
() => ({ ..._, id: p, ...u }),
|
|
37
|
+
[p, u]
|
|
38
|
+
), S = v(
|
|
39
|
+
() => A(i, s, m),
|
|
40
|
+
[i, s, m]
|
|
41
|
+
), f = i <= 1, j = i >= s, R = [l.nav, o].filter(Boolean).join(" ");
|
|
42
|
+
return /* @__PURE__ */ t.jsx(
|
|
43
|
+
"nav",
|
|
44
|
+
{
|
|
45
|
+
ref: x,
|
|
46
|
+
"aria-label": "Pagination",
|
|
47
|
+
className: R,
|
|
48
|
+
"data-size": n,
|
|
49
|
+
"data-vhyx-contract": JSON.stringify(k),
|
|
50
|
+
...e,
|
|
51
|
+
children: /* @__PURE__ */ t.jsxs("ul", { className: l.list, children: [
|
|
52
|
+
r && /* @__PURE__ */ t.jsx("li", { children: /* @__PURE__ */ t.jsx(
|
|
53
|
+
"button",
|
|
54
|
+
{
|
|
55
|
+
type: "button",
|
|
56
|
+
className: l.button,
|
|
57
|
+
onClick: () => a(1),
|
|
58
|
+
disabled: f,
|
|
59
|
+
"aria-label": "First page",
|
|
60
|
+
"data-size": n,
|
|
61
|
+
children: "«"
|
|
62
|
+
}
|
|
63
|
+
) }),
|
|
64
|
+
c && /* @__PURE__ */ t.jsx("li", { children: /* @__PURE__ */ t.jsx(
|
|
65
|
+
"button",
|
|
66
|
+
{
|
|
67
|
+
type: "button",
|
|
68
|
+
className: l.button,
|
|
69
|
+
onClick: () => a(i - 1),
|
|
70
|
+
disabled: f,
|
|
71
|
+
"aria-label": "Previous page",
|
|
72
|
+
"data-size": n,
|
|
73
|
+
children: "‹"
|
|
74
|
+
}
|
|
75
|
+
) }),
|
|
76
|
+
S.map((y, q) => {
|
|
77
|
+
if (y === h)
|
|
78
|
+
return /* @__PURE__ */ t.jsx("li", { children: /* @__PURE__ */ t.jsx("span", { className: l.ellipsis, "aria-hidden": "true", children: "…" }) }, `ellipsis-${q}`);
|
|
79
|
+
const d = y, b = d === i;
|
|
80
|
+
return /* @__PURE__ */ t.jsx("li", { children: /* @__PURE__ */ t.jsx(
|
|
81
|
+
"button",
|
|
82
|
+
{
|
|
83
|
+
type: "button",
|
|
84
|
+
className: l.button,
|
|
85
|
+
onClick: () => !b && a(d),
|
|
86
|
+
"aria-current": b ? "page" : void 0,
|
|
87
|
+
"aria-label": b ? void 0 : `Page ${d}`,
|
|
88
|
+
"data-state": b ? "active" : "inactive",
|
|
89
|
+
"data-size": n,
|
|
90
|
+
children: d
|
|
91
|
+
}
|
|
92
|
+
) }, d);
|
|
93
|
+
}),
|
|
94
|
+
c && /* @__PURE__ */ t.jsx("li", { children: /* @__PURE__ */ t.jsx(
|
|
95
|
+
"button",
|
|
96
|
+
{
|
|
97
|
+
type: "button",
|
|
98
|
+
className: l.button,
|
|
99
|
+
onClick: () => a(i + 1),
|
|
100
|
+
disabled: j,
|
|
101
|
+
"aria-label": "Next page",
|
|
102
|
+
"data-size": n,
|
|
103
|
+
children: "›"
|
|
104
|
+
}
|
|
105
|
+
) }),
|
|
106
|
+
r && /* @__PURE__ */ t.jsx("li", { children: /* @__PURE__ */ t.jsx(
|
|
107
|
+
"button",
|
|
108
|
+
{
|
|
109
|
+
type: "button",
|
|
110
|
+
className: l.button,
|
|
111
|
+
onClick: () => a(s),
|
|
112
|
+
disabled: j,
|
|
113
|
+
"aria-label": "Last page",
|
|
114
|
+
"data-size": n,
|
|
115
|
+
children: "»"
|
|
116
|
+
}
|
|
117
|
+
) })
|
|
118
|
+
] })
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
N.displayName = "VhyxPagination";
|
|
124
|
+
const B = { ..._, id: "vhyxui-pagination" }, V = I(N, B);
|
|
125
|
+
V.displayName = "VhyxPagination";
|
|
126
|
+
export {
|
|
127
|
+
V as P
|
|
128
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("./jsx-runtime-BRMkMA8J.cjs"),j=require("react"),y=require("@vhyxui/core"),I=require("@vhyxseal/react"),g=require("./useId-D2AEOm2G.cjs"),L="_nav_1kxmq_1",M="_list_1kxmq_5",P="_button_1kxmq_15",w="_ellipsis_1kxmq_75",e={nav:L,list:M,button:P,ellipsis:w},b="ellipsis";function A(s,i,n){const u=n*2+5;if(i<=u)return Array.from({length:i},(o,p)=>p+1);const r=Math.max(s-n,2),c=Math.min(s+n,i-1),a=r>2,d=c<i-1,l=[1];a&&l.push(b);for(let o=r;o<=c;o++)l.push(o);return d&&l.push(b),l.push(i),l}const v=j.forwardRef(({page:s,pageCount:i,onPageChange:n,siblingCount:u=1,showFirstLast:r=!1,showPrevNext:c=!0,size:a="md",contract:d,className:l,...o},p)=>{const h=g.useId("vhyx-pagination"),N=j.useMemo(()=>({...y.paginationContract,id:h,...d}),[h,d]),k=j.useMemo(()=>A(s,i,u),[s,i,u]),R=s<=1,E=s>=i,q=[e.nav,l].filter(Boolean).join(" ");return t.jsxRuntimeExports.jsx("nav",{ref:p,"aria-label":"Pagination",className:q,"data-size":a,"data-vhyx-contract":JSON.stringify(N),...o,children:t.jsxRuntimeExports.jsxs("ul",{className:e.list,children:[r&&t.jsxRuntimeExports.jsx("li",{children:t.jsxRuntimeExports.jsx("button",{type:"button",className:e.button,onClick:()=>n(1),disabled:R,"aria-label":"First page","data-size":a,children:"«"})}),c&&t.jsxRuntimeExports.jsx("li",{children:t.jsxRuntimeExports.jsx("button",{type:"button",className:e.button,onClick:()=>n(s-1),disabled:R,"aria-label":"Previous page","data-size":a,children:"‹"})}),k.map((f,S)=>{if(f===b)return t.jsxRuntimeExports.jsx("li",{children:t.jsxRuntimeExports.jsx("span",{className:e.ellipsis,"aria-hidden":"true",children:"…"})},`ellipsis-${S}`);const x=f,m=x===s;return t.jsxRuntimeExports.jsx("li",{children:t.jsxRuntimeExports.jsx("button",{type:"button",className:e.button,onClick:()=>!m&&n(x),"aria-current":m?"page":void 0,"aria-label":m?void 0:`Page ${x}`,"data-state":m?"active":"inactive","data-size":a,children:x})},x)}),c&&t.jsxRuntimeExports.jsx("li",{children:t.jsxRuntimeExports.jsx("button",{type:"button",className:e.button,onClick:()=>n(s+1),disabled:E,"aria-label":"Next page","data-size":a,children:"›"})}),r&&t.jsxRuntimeExports.jsx("li",{children:t.jsxRuntimeExports.jsx("button",{type:"button",className:e.button,onClick:()=>n(i),disabled:E,"aria-label":"Last page","data-size":a,children:"»"})})]})})});v.displayName="VhyxPagination";const B={...y.paginationContract,id:"vhyxui-pagination"},_=I.withAgentContract(v,B);_.displayName="VhyxPagination";exports.Pagination=_;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const p=require("./jsx-runtime-BRMkMA8J.cjs"),n=require("react"),M=require("react-dom"),R=require("@vhyxui/core"),T=require("@vhyxseal/react"),A=require("./useId-D2AEOm2G.cjs"),O="_trigger_5e049_1",U="_content_5e049_7",X="_arrow_5e049_21",$="_close_5e049_29",P={trigger:O,content:U,arrow:X,close:$},b=n.createContext(null);function j(s){const c=n.useContext(b);if(!c)throw new R.VhyxUIError({code:R.VhyxUIErrorCode.VHYXUI_MISSING_CONTEXT,message:`${s} must be used within <Popover>`,suggestion:"Wrap your component tree with <Popover>"});return c}const I=n.forwardRef(({open:s,defaultOpen:c=!1,onOpenChange:e,contract:f,children:m},o)=>{const r=A.useId("vhyx-popover"),l=`${r}-trigger`,d=`${r}-content`,a=s!==void 0,[g,t]=n.useState(c),i=a?s:g,u=n.useRef(null),x=n.useRef(null),y=n.useCallback(v=>{a||t(v),e==null||e(v)},[a,e]);n.useEffect(()=>{if(!i)return;function v(C){var h;C.key==="Escape"&&(y(!1),(h=u.current)==null||h.focus())}return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[i,y]),n.useEffect(()=>{if(!i)return;function v(C){var w,E;const h=C.target;(w=u.current)!=null&&w.contains(h)||(E=x.current)!=null&&E.contains(h)||y(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i,y]);const B=n.useMemo(()=>({...R.popoverContract,id:r,...f}),[r,f]),L=n.useMemo(()=>({open:i,onOpenChange:y,triggerId:l,contentId:d,triggerRef:u,contentRef:x}),[i,y,l,d]);return p.jsxRuntimeExports.jsx(b.Provider,{value:L,children:p.jsxRuntimeExports.jsx("div",{ref:o,"data-state":i?"open":"closed","data-vhyx-contract":JSON.stringify(B),children:m})})});I.displayName="VhyxPopover";const _=n.forwardRef(({children:s,className:c,onClick:e,asChild:f=!1,...m},o)=>{const r=j("Popover.Trigger"),l=n.useCallback(t=>{r.triggerRef.current=t,typeof o=="function"?o(t):o&&(o.current=t)},[o,r.triggerRef]),d=n.useCallback(t=>{e==null||e(t),r.onOpenChange(!r.open)},[e,r]),a=[P.trigger,c].filter(Boolean).join(" "),g={id:r.triggerId,"aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,onClick:d,className:a,...m};return f?p.jsxRuntimeExports.jsx(R.Slot,{ref:l,...g,children:s}):p.jsxRuntimeExports.jsx("button",{ref:l,type:"button",...g,children:s})});_.displayName="VhyxPopoverTrigger";function N({children:s,className:c,side:e="bottom",align:f="center",...m}){const o=j("Popover.Content"),[r,l]=n.useState({top:0,left:0});n.useEffect(()=>{if(!o.open||!o.triggerRef.current)return;const t=o.triggerRef.current.getBoundingClientRect(),i=8;let u=0,x=0;e==="bottom"?(u=t.bottom+i,x=t.left+t.width/2):e==="top"?(u=t.top-i,x=t.left+t.width/2):e==="right"?(u=t.top+t.height/2,x=t.right+i):(u=t.top+t.height/2,x=t.left-i),l({top:u,left:x})},[o.open,o.triggerRef,e]);const d=n.useCallback(t=>{o.contentRef.current=t},[o.contentRef]);if(!o.open)return null;const a=[P.content,c].filter(Boolean).join(" "),g=p.jsxRuntimeExports.jsx("div",{ref:d,id:o.contentId,role:"dialog","aria-modal":"false","aria-labelledby":o.triggerId,className:a,"data-state":"open","data-side":e,"data-align":f,style:{position:"fixed",top:r.top,left:r.left,zIndex:450,transform:"translateX(-50%)"},...m,children:s});return M.createPortal(g,document.body)}N.displayName="VhyxPopoverContent";function V({className:s,...c}){const e=[P.arrow,s].filter(Boolean).join(" ");return p.jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",className:e,viewBox:"0 0 10 5",...c,children:p.jsxRuntimeExports.jsx("path",{d:"M0 5L5 0L10 5",fill:"currentColor"})})}V.displayName="VhyxPopoverArrow";const S=n.forwardRef(({children:s,className:c,onClick:e,asChild:f=!1,...m},o)=>{const r=j("Popover.Close"),l=n.useCallback(g=>{e==null||e(g),r.onOpenChange(!1)},[e,r]),d=[P.close,c].filter(Boolean).join(" "),a={onClick:l,className:d,...m};return f?p.jsxRuntimeExports.jsx(R.Slot,{ref:o,...a,children:s}):p.jsxRuntimeExports.jsx("button",{ref:o,type:"button",...a,children:s??"Close"})});S.displayName="VhyxPopoverClose";const k={...R.popoverContract,id:"vhyxui-popover"},q=Object.assign(T.withAgentContract(I,k),{Trigger:_,Content:N,Arrow:V,Close:S});q.displayName="VhyxPopover";exports.Popover=q;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { j as p } from "./jsx-runtime-CL69jGNW.js";
|
|
2
|
+
import R, { useState as E, useRef as b, useCallback as h, useEffect as C, useMemo as N, createContext as $, useContext as D } from "react";
|
|
3
|
+
import G from "react-dom";
|
|
4
|
+
import { popoverContract as V, Slot as B, VhyxUIError as z, VhyxUIErrorCode as H } from "@vhyxui/core";
|
|
5
|
+
import { withAgentContract as J } from "@vhyxseal/react";
|
|
6
|
+
import { u as K } from "./useId-BGRmH6iF.js";
|
|
7
|
+
const W = "_trigger_5e049_1", Y = "_content_5e049_7", q = "_arrow_5e049_21", F = "_close_5e049_29", P = {
|
|
8
|
+
trigger: W,
|
|
9
|
+
content: Y,
|
|
10
|
+
arrow: q,
|
|
11
|
+
close: F
|
|
12
|
+
}, L = $(null);
|
|
13
|
+
function j(n) {
|
|
14
|
+
const s = D(L);
|
|
15
|
+
if (!s)
|
|
16
|
+
throw new z({
|
|
17
|
+
code: H.VHYXUI_MISSING_CONTEXT,
|
|
18
|
+
message: `${n} must be used within <Popover>`,
|
|
19
|
+
suggestion: "Wrap your component tree with <Popover>"
|
|
20
|
+
});
|
|
21
|
+
return s;
|
|
22
|
+
}
|
|
23
|
+
const S = R.forwardRef(
|
|
24
|
+
({
|
|
25
|
+
open: n,
|
|
26
|
+
defaultOpen: s = !1,
|
|
27
|
+
onOpenChange: e,
|
|
28
|
+
contract: f,
|
|
29
|
+
children: v
|
|
30
|
+
}, o) => {
|
|
31
|
+
const r = K("vhyx-popover"), c = `${r}-trigger`, u = `${r}-content`, a = n !== void 0, [d, t] = E(s), i = a ? n : d, l = b(null), g = b(null), x = h(
|
|
32
|
+
(m) => {
|
|
33
|
+
a || t(m), e == null || e(m);
|
|
34
|
+
},
|
|
35
|
+
[a, e]
|
|
36
|
+
);
|
|
37
|
+
C(() => {
|
|
38
|
+
if (!i) return;
|
|
39
|
+
function m(w) {
|
|
40
|
+
var y;
|
|
41
|
+
w.key === "Escape" && (x(!1), (y = l.current) == null || y.focus());
|
|
42
|
+
}
|
|
43
|
+
return document.addEventListener("keydown", m), () => document.removeEventListener("keydown", m);
|
|
44
|
+
}, [i, x]), C(() => {
|
|
45
|
+
if (!i) return;
|
|
46
|
+
function m(w) {
|
|
47
|
+
var I, _;
|
|
48
|
+
const y = w.target;
|
|
49
|
+
(I = l.current) != null && I.contains(y) || (_ = g.current) != null && _.contains(y) || x(!1);
|
|
50
|
+
}
|
|
51
|
+
return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
|
|
52
|
+
}, [i, x]);
|
|
53
|
+
const U = N(
|
|
54
|
+
() => ({ ...V, id: r, ...f }),
|
|
55
|
+
[r, f]
|
|
56
|
+
), X = N(
|
|
57
|
+
() => ({
|
|
58
|
+
open: i,
|
|
59
|
+
onOpenChange: x,
|
|
60
|
+
triggerId: c,
|
|
61
|
+
contentId: u,
|
|
62
|
+
triggerRef: l,
|
|
63
|
+
contentRef: g
|
|
64
|
+
}),
|
|
65
|
+
[i, x, c, u]
|
|
66
|
+
);
|
|
67
|
+
return /* @__PURE__ */ p.jsx(L.Provider, { value: X, children: /* @__PURE__ */ p.jsx(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
ref: o,
|
|
71
|
+
"data-state": i ? "open" : "closed",
|
|
72
|
+
"data-vhyx-contract": JSON.stringify(U),
|
|
73
|
+
children: v
|
|
74
|
+
}
|
|
75
|
+
) });
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
S.displayName = "VhyxPopover";
|
|
79
|
+
const T = R.forwardRef(
|
|
80
|
+
({ children: n, className: s, onClick: e, asChild: f = !1, ...v }, o) => {
|
|
81
|
+
const r = j("Popover.Trigger"), c = h(
|
|
82
|
+
(t) => {
|
|
83
|
+
r.triggerRef.current = t, typeof o == "function" ? o(t) : o && (o.current = t);
|
|
84
|
+
},
|
|
85
|
+
[o, r.triggerRef]
|
|
86
|
+
), u = h(
|
|
87
|
+
(t) => {
|
|
88
|
+
e == null || e(t), r.onOpenChange(!r.open);
|
|
89
|
+
},
|
|
90
|
+
[e, r]
|
|
91
|
+
), a = [P.trigger, s].filter(Boolean).join(" "), d = {
|
|
92
|
+
id: r.triggerId,
|
|
93
|
+
"aria-haspopup": "dialog",
|
|
94
|
+
"aria-expanded": r.open,
|
|
95
|
+
"aria-controls": r.open ? r.contentId : void 0,
|
|
96
|
+
onClick: u,
|
|
97
|
+
className: a,
|
|
98
|
+
...v
|
|
99
|
+
};
|
|
100
|
+
return f ? /* @__PURE__ */ p.jsx(B, { ref: c, ...d, children: n }) : /* @__PURE__ */ p.jsx("button", { ref: c, type: "button", ...d, children: n });
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
T.displayName = "VhyxPopoverTrigger";
|
|
104
|
+
function A({
|
|
105
|
+
children: n,
|
|
106
|
+
className: s,
|
|
107
|
+
side: e = "bottom",
|
|
108
|
+
align: f = "center",
|
|
109
|
+
...v
|
|
110
|
+
}) {
|
|
111
|
+
const o = j("Popover.Content"), [r, c] = E({ top: 0, left: 0 });
|
|
112
|
+
C(() => {
|
|
113
|
+
if (!o.open || !o.triggerRef.current) return;
|
|
114
|
+
const t = o.triggerRef.current.getBoundingClientRect(), i = 8;
|
|
115
|
+
let l = 0, g = 0;
|
|
116
|
+
e === "bottom" ? (l = t.bottom + i, g = t.left + t.width / 2) : e === "top" ? (l = t.top - i, g = t.left + t.width / 2) : e === "right" ? (l = t.top + t.height / 2, g = t.right + i) : (l = t.top + t.height / 2, g = t.left - i), c({ top: l, left: g });
|
|
117
|
+
}, [o.open, o.triggerRef, e]);
|
|
118
|
+
const u = h(
|
|
119
|
+
(t) => {
|
|
120
|
+
o.contentRef.current = t;
|
|
121
|
+
},
|
|
122
|
+
[o.contentRef]
|
|
123
|
+
);
|
|
124
|
+
if (!o.open) return null;
|
|
125
|
+
const a = [P.content, s].filter(Boolean).join(" "), d = /* @__PURE__ */ p.jsx(
|
|
126
|
+
"div",
|
|
127
|
+
{
|
|
128
|
+
ref: u,
|
|
129
|
+
id: o.contentId,
|
|
130
|
+
role: "dialog",
|
|
131
|
+
"aria-modal": "false",
|
|
132
|
+
"aria-labelledby": o.triggerId,
|
|
133
|
+
className: a,
|
|
134
|
+
"data-state": "open",
|
|
135
|
+
"data-side": e,
|
|
136
|
+
"data-align": f,
|
|
137
|
+
style: {
|
|
138
|
+
position: "fixed",
|
|
139
|
+
top: r.top,
|
|
140
|
+
left: r.left,
|
|
141
|
+
zIndex: 450,
|
|
142
|
+
// --vhyx-z-popover
|
|
143
|
+
transform: "translateX(-50%)"
|
|
144
|
+
},
|
|
145
|
+
...v,
|
|
146
|
+
children: n
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
return G.createPortal(d, document.body);
|
|
150
|
+
}
|
|
151
|
+
A.displayName = "VhyxPopoverContent";
|
|
152
|
+
function M({ className: n, ...s }) {
|
|
153
|
+
const e = [P.arrow, n].filter(Boolean).join(" ");
|
|
154
|
+
return /* @__PURE__ */ p.jsx(
|
|
155
|
+
"svg",
|
|
156
|
+
{
|
|
157
|
+
"aria-hidden": "true",
|
|
158
|
+
className: e,
|
|
159
|
+
viewBox: "0 0 10 5",
|
|
160
|
+
...s,
|
|
161
|
+
children: /* @__PURE__ */ p.jsx("path", { d: "M0 5L5 0L10 5", fill: "currentColor" })
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
M.displayName = "VhyxPopoverArrow";
|
|
166
|
+
const O = R.forwardRef(
|
|
167
|
+
({ children: n, className: s, onClick: e, asChild: f = !1, ...v }, o) => {
|
|
168
|
+
const r = j("Popover.Close"), c = h(
|
|
169
|
+
(d) => {
|
|
170
|
+
e == null || e(d), r.onOpenChange(!1);
|
|
171
|
+
},
|
|
172
|
+
[e, r]
|
|
173
|
+
), u = [P.close, s].filter(Boolean).join(" "), a = {
|
|
174
|
+
onClick: c,
|
|
175
|
+
className: u,
|
|
176
|
+
...v
|
|
177
|
+
};
|
|
178
|
+
return f ? /* @__PURE__ */ p.jsx(B, { ref: o, ...a, children: n }) : /* @__PURE__ */ p.jsx("button", { ref: o, type: "button", ...a, children: n ?? "Close" });
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
O.displayName = "VhyxPopoverClose";
|
|
182
|
+
const Q = { ...V, id: "vhyxui-popover" }, Z = Object.assign(
|
|
183
|
+
J(S, Q),
|
|
184
|
+
{
|
|
185
|
+
Trigger: T,
|
|
186
|
+
Content: A,
|
|
187
|
+
Arrow: M,
|
|
188
|
+
Close: O
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
Z.displayName = "VhyxPopover";
|
|
192
|
+
export {
|
|
193
|
+
Z as P
|
|
194
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { j as o } from "./jsx-runtime-CL69jGNW.js";
|
|
2
|
+
import k, { useMemo as b } from "react";
|
|
3
|
+
import { progressContract as c } from "@vhyxui/core";
|
|
4
|
+
import { withAgentContract as N } from "@vhyxseal/react";
|
|
5
|
+
import { u as C } from "./useId-BGRmH6iF.js";
|
|
6
|
+
const P = "_wrapper_ko60j_1", M = "_label_ko60j_10", I = "_track_ko60j_21", R = "_fill_ko60j_52", t = {
|
|
7
|
+
wrapper: P,
|
|
8
|
+
label: M,
|
|
9
|
+
track: I,
|
|
10
|
+
fill: R
|
|
11
|
+
}, n = k.forwardRef(
|
|
12
|
+
({
|
|
13
|
+
value: a,
|
|
14
|
+
max: s = 100,
|
|
15
|
+
indeterminate: r = !1,
|
|
16
|
+
size: p = "md",
|
|
17
|
+
variant: d = "default",
|
|
18
|
+
showLabel: f = !1,
|
|
19
|
+
label: m,
|
|
20
|
+
contract: h,
|
|
21
|
+
className: g,
|
|
22
|
+
id: u,
|
|
23
|
+
...v
|
|
24
|
+
}, _) => {
|
|
25
|
+
const j = C("vhyx-progress"), e = u ?? j, l = b(() => {
|
|
26
|
+
if (a === void 0 || r) return 0;
|
|
27
|
+
const w = Math.max(0, Math.min(a, s));
|
|
28
|
+
return Math.round(w / s * 100);
|
|
29
|
+
}, [a, s, r]), i = m ?? `${l}%`, x = {
|
|
30
|
+
...c,
|
|
31
|
+
id: e,
|
|
32
|
+
...h
|
|
33
|
+
}, y = [t.wrapper, g].filter(Boolean).join(" ");
|
|
34
|
+
return /* @__PURE__ */ o.jsxs(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
ref: _,
|
|
38
|
+
id: e,
|
|
39
|
+
className: y,
|
|
40
|
+
"data-size": p,
|
|
41
|
+
"data-variant": d,
|
|
42
|
+
"data-vhyx-contract": JSON.stringify(x),
|
|
43
|
+
...v,
|
|
44
|
+
children: [
|
|
45
|
+
f && /* @__PURE__ */ o.jsx("span", { className: t.label, "aria-hidden": "true", children: i }),
|
|
46
|
+
/* @__PURE__ */ o.jsx(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
role: "progressbar",
|
|
50
|
+
"aria-valuemin": 0,
|
|
51
|
+
"aria-valuemax": s,
|
|
52
|
+
"aria-valuenow": r ? void 0 : a ?? 0,
|
|
53
|
+
"aria-label": i,
|
|
54
|
+
className: t.track,
|
|
55
|
+
children: /* @__PURE__ */ o.jsx(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
className: t.fill,
|
|
59
|
+
"data-indeterminate": r ? !0 : void 0,
|
|
60
|
+
style: r ? void 0 : { width: `${l}%` }
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
n.displayName = "VhyxProgress";
|
|
71
|
+
const B = { ...c, id: "vhyxui-progress" }, S = N(n, B);
|
|
72
|
+
S.displayName = "VhyxProgress";
|
|
73
|
+
export {
|
|
74
|
+
S as P
|
|
75
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a=require("./jsx-runtime-BRMkMA8J.cjs"),n=require("react"),l=require("@vhyxui/core"),N=require("@vhyxseal/react"),R=require("./useId-D2AEOm2G.cjs"),C="_wrapper_ko60j_1",q="_label_ko60j_10",P="_track_ko60j_21",E="_fill_ko60j_52",t={wrapper:C,label:q,track:P,fill:E},d=n.forwardRef(({value:r,max:e=100,indeterminate:s=!1,size:u="md",variant:x="default",showLabel:g=!1,label:f,contract:h,className:j,id:m,...v},_)=>{const y=R.useId("vhyx-progress"),o=m??y,c=n.useMemo(()=>{if(r===void 0||s)return 0;const b=Math.max(0,Math.min(r,e));return Math.round(b/e*100)},[r,e,s]),i=f??`${c}%`,w={...l.progressContract,id:o,...h},k=[t.wrapper,j].filter(Boolean).join(" ");return a.jsxRuntimeExports.jsxs("div",{ref:_,id:o,className:k,"data-size":u,"data-variant":x,"data-vhyx-contract":JSON.stringify(w),...v,children:[g&&a.jsxRuntimeExports.jsx("span",{className:t.label,"aria-hidden":"true",children:i}),a.jsxRuntimeExports.jsx("div",{role:"progressbar","aria-valuemin":0,"aria-valuemax":e,"aria-valuenow":s?void 0:r??0,"aria-label":i,className:t.track,children:a.jsxRuntimeExports.jsx("div",{className:t.fill,"data-indeterminate":s?!0:void 0,style:s?void 0:{width:`${c}%`}})})]})});d.displayName="VhyxProgress";const I={...l.progressContract,id:"vhyxui-progress"},p=N.withAgentContract(d,I);p.displayName="VhyxProgress";exports.Progress=p;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const m=require("./jsx-runtime-BRMkMA8J.cjs"),e=require("react"),B=require("@vhyxui/core"),P=require("@vhyxseal/react"),W=require("./useId-D2AEOm2G.cjs"),H="_group_16juf_3",Q="_item_16juf_17",R={group:H,item:Q,"radio-indicator":"_radio-indicator_16juf_40","radio-dot":"_radio-dot_16juf_98","radio-label":"_radio-label_16juf_109"},M=e.createContext(null);function T(){const r=e.useContext(M);if(!r)throw new Error("[VhyxUI] <RadioItem> must be used within <RadioGroup>. Wrap your RadioItem components with <RadioGroup>.");return r}const O=e.forwardRef(({value:r,defaultValue:v,onValueChange:o,disabled:j=!1,orientation:c="vertical",size:n="md",contract:I,className:d,id:s,children:f,...p},h)=>{const w=W.useId("vhyx-radiogroup"),u=s??w,l=r!==void 0,[N,b]=e.useState(v),y=l?r:N,t=e.useRef(new Map),x=e.useRef([]),[E,C]=e.useState(void 0),q=e.useCallback((i,g)=>{g?(!t.current.has(i)&&(x.current.push(i),x.current.length===1&&C(i)),t.current.set(i,g)):(t.current.delete(i),x.current=x.current.filter(a=>a!==i),C(x.current[0]))},[]),A=e.useCallback((i,g)=>{const a=x.current,k=a.indexOf(i);if(k===-1)return;const L=g==="next"?(k+1)%a.length:(k-1+a.length)%a.length,_=a[L];if(_===void 0)return;const G=t.current.get(_);!G||G.disabled||(G.focus(),l||b(_),o==null||o(_))},[l,o]),S=e.useCallback(i=>{l||b(i),o==null||o(i)},[l,o]),z=e.useMemo(()=>({...B.radioContract,id:u,...I}),[u,I]),D=e.useMemo(()=>({value:y,onValueChange:S,disabled:j,size:n,groupId:u,registerItem:q,navigateItem:A,firstValue:E}),[y,S,j,n,u,q,A,E]),J=[R.group,d].filter(Boolean).join(" ");return m.jsxRuntimeExports.jsx(M.Provider,{value:D,children:m.jsxRuntimeExports.jsx("div",{ref:h,id:u,role:"radiogroup","aria-orientation":c,className:J,"data-orientation":c,"data-size":n,"data-vhyx-contract":JSON.stringify(z),...p,children:f})})});O.displayName="VhyxRadioGroup";const X={...B.radioContract,id:"vhyxui-radio-group"},F=P.withAgentContract(O,X);F.displayName="VhyxRadioGroup";const U=e.forwardRef(({value:r,disabled:v,children:o,className:j,onClick:c,onKeyDown:n,...I},d)=>{const s=T(),f=s.value===r,p=v??s.disabled,h=e.useRef(null),w=e.useCallback(t=>{h.current=t,typeof d=="function"?d(t):d&&(d.current=t)},[d]);e.useEffect(()=>(s.registerItem(r,h.current),()=>{s.registerItem(r,null)}),[s,r]);const u=e.useCallback(t=>{c==null||c(t),p||s.onValueChange(r)},[c,p,s,r]),l=e.useCallback(t=>{n==null||n(t),t.key==="ArrowDown"||t.key==="ArrowRight"?(t.preventDefault(),s.navigateItem(r,"next")):(t.key==="ArrowUp"||t.key==="ArrowLeft")&&(t.preventDefault(),s.navigateItem(r,"prev"))},[n,s,r]),N=!s.value&&s.firstValue===r,b=f||N?0:-1,y=[R.item,j].filter(Boolean).join(" ");return m.jsxRuntimeExports.jsxs("button",{ref:w,type:"button",role:"radio","aria-checked":f,disabled:p,tabIndex:b,onClick:u,onKeyDown:l,className:y,"data-state":f?"checked":"unchecked","data-size":s.size,"data-disabled":p?!0:void 0,...I,children:[m.jsxRuntimeExports.jsx("span",{className:R["radio-indicator"],children:f&&m.jsxRuntimeExports.jsx("span",{className:R["radio-dot"]})}),o&&m.jsxRuntimeExports.jsx("span",{className:R["radio-label"],children:o})]})});U.displayName="VhyxRadioItem";exports.RadioGroup=F;exports.RadioItem=U;
|