@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.
Files changed (125) hide show
  1. package/dist/Alert-BJ1O0bnK.cjs +1 -0
  2. package/dist/Alert-am3ANPTH.js +99 -0
  3. package/dist/Badge-Fuc7l-1E.js +38 -0
  4. package/dist/Badge-RM7n86Rq.cjs +1 -0
  5. package/dist/Breadcrumb-Db7ASomJ.js +90 -0
  6. package/dist/Breadcrumb-StitgXXx.cjs +1 -0
  7. package/dist/Button-B32xz0b5.js +58 -0
  8. package/dist/Button-CfYG4zkG.cjs +1 -0
  9. package/dist/Card-D7ZNeWtE.js +75 -0
  10. package/dist/Card-d5xrWgQS.cjs +1 -0
  11. package/dist/Checkbox-DWl91ci_.js +92 -0
  12. package/dist/Checkbox-DvkT6QP9.cjs +1 -0
  13. package/dist/Dialog-CtYu14zl.js +245 -0
  14. package/dist/Dialog-gPT4noD8.cjs +1 -0
  15. package/dist/Drawer-BFJxsPG1.js +246 -0
  16. package/dist/Drawer-BygSIQQn.cjs +1 -0
  17. package/dist/Field-Bv07PL2M.js +120 -0
  18. package/dist/Field-D6FSsUGj.cjs +1 -0
  19. package/dist/Input-Dqt5q33I.js +151 -0
  20. package/dist/Input-OFmZxiHe.cjs +1 -0
  21. package/dist/Pagination-C1h7OTgM.js +128 -0
  22. package/dist/Pagination-CmmcBPNz.cjs +1 -0
  23. package/dist/Popover-BPFkS4xn.cjs +1 -0
  24. package/dist/Popover-MxUovsIt.js +194 -0
  25. package/dist/Progress-DWLr6Bq2.js +75 -0
  26. package/dist/Progress-FO-4WX0i.cjs +1 -0
  27. package/dist/RadioItem-BfkTHBxQ.cjs +1 -0
  28. package/dist/RadioItem-CzHSS_qK.js +141 -0
  29. package/dist/Select-C9yB2B8M.cjs +1 -0
  30. package/dist/Select-DjeJOdb7.js +327 -0
  31. package/dist/Separator-C5lPGzes.cjs +1 -0
  32. package/dist/Separator-DQT58t90.js +52 -0
  33. package/dist/Spinner-Cd5tcOLS.js +61 -0
  34. package/dist/Spinner-DSHhLV-r.cjs +1 -0
  35. package/dist/Switch-BU_Tcttb.cjs +1 -0
  36. package/dist/Switch-DOAZfSV0.js +64 -0
  37. package/dist/Tabs-BTfm4LbV.js +220 -0
  38. package/dist/Tabs-DuU02-UD.cjs +1 -0
  39. package/dist/Textarea-CLrctxHU.js +104 -0
  40. package/dist/Textarea-H6evM8L4.cjs +1 -0
  41. package/dist/Toast-0acAjZTB.js +167 -0
  42. package/dist/Toast-ndaxbpcV.cjs +1 -0
  43. package/dist/Tooltip-BAmErB_g.js +107 -0
  44. package/dist/Tooltip-CCd6VRvZ.cjs +1 -0
  45. package/dist/VhyxUIProvider-C9NxI-tU.cjs +1 -0
  46. package/dist/VhyxUIProvider-D1vNoiIk.js +34 -0
  47. package/dist/alert.cjs +1 -0
  48. package/dist/alert.d.ts +25 -0
  49. package/dist/alert.js +4 -0
  50. package/dist/badge.cjs +1 -0
  51. package/dist/badge.d.ts +31 -0
  52. package/dist/badge.js +4 -0
  53. package/dist/breadcrumb.cjs +1 -0
  54. package/dist/breadcrumb.d.ts +81 -0
  55. package/dist/breadcrumb.js +4 -0
  56. package/dist/button.cjs +1 -0
  57. package/dist/button.d.ts +36 -0
  58. package/dist/button.js +4 -0
  59. package/dist/card.cjs +1 -0
  60. package/dist/card.d.ts +72 -0
  61. package/dist/card.js +4 -0
  62. package/dist/checkbox.cjs +1 -0
  63. package/dist/checkbox.d.ts +33 -0
  64. package/dist/checkbox.js +4 -0
  65. package/dist/dialog.cjs +1 -0
  66. package/dist/dialog.d.ts +112 -0
  67. package/dist/dialog.js +4 -0
  68. package/dist/drawer.cjs +1 -0
  69. package/dist/drawer.d.ts +110 -0
  70. package/dist/drawer.js +4 -0
  71. package/dist/form.cjs +1 -0
  72. package/dist/form.d.ts +116 -0
  73. package/dist/form.js +6 -0
  74. package/dist/index.cjs +1 -0
  75. package/dist/index.d.ts +1184 -0
  76. package/dist/index.js +83 -0
  77. package/dist/input.cjs +1 -0
  78. package/dist/input.d.ts +31 -0
  79. package/dist/input.js +4 -0
  80. package/dist/jsx-runtime-BRMkMA8J.cjs +22 -0
  81. package/dist/jsx-runtime-CL69jGNW.js +279 -0
  82. package/dist/pagination.cjs +1 -0
  83. package/dist/pagination.d.ts +32 -0
  84. package/dist/pagination.js +4 -0
  85. package/dist/popover.cjs +1 -0
  86. package/dist/popover.d.ts +72 -0
  87. package/dist/popover.js +4 -0
  88. package/dist/progress.cjs +1 -0
  89. package/dist/progress.d.ts +35 -0
  90. package/dist/progress.js +4 -0
  91. package/dist/radio.cjs +1 -0
  92. package/dist/radio.d.ts +47 -0
  93. package/dist/radio.js +5 -0
  94. package/dist/select.cjs +1 -0
  95. package/dist/select.d.ts +97 -0
  96. package/dist/select.js +4 -0
  97. package/dist/separator.cjs +1 -0
  98. package/dist/separator.d.ts +21 -0
  99. package/dist/separator.js +4 -0
  100. package/dist/spinner.cjs +1 -0
  101. package/dist/spinner.d.ts +24 -0
  102. package/dist/spinner.js +4 -0
  103. package/dist/style.css +1 -0
  104. package/dist/switch.cjs +1 -0
  105. package/dist/switch.d.ts +28 -0
  106. package/dist/switch.js +4 -0
  107. package/dist/tabs.cjs +1 -0
  108. package/dist/tabs.d.ts +59 -0
  109. package/dist/tabs.js +4 -0
  110. package/dist/test-utils.cjs +1 -0
  111. package/dist/test-utils.d.ts +5 -0
  112. package/dist/test-utils.js +12 -0
  113. package/dist/textarea.cjs +1 -0
  114. package/dist/textarea.d.ts +34 -0
  115. package/dist/textarea.js +4 -0
  116. package/dist/toast.cjs +1 -0
  117. package/dist/toast.d.ts +28 -0
  118. package/dist/toast.js +5 -0
  119. package/dist/tooltip.cjs +1 -0
  120. package/dist/tooltip.d.ts +32 -0
  121. package/dist/tooltip.js +4 -0
  122. package/dist/useId-BGRmH6iF.js +8 -0
  123. package/dist/useId-D2AEOm2G.cjs +1 -0
  124. package/package.json +170 -0
  125. package/style.css +1 -0
@@ -0,0 +1,220 @@
1
+ import { j as h } from "./jsx-runtime-CL69jGNW.js";
2
+ import w, { useState as q, useRef as N, useCallback as T, useMemo as L, useEffect as D, createContext as P, useContext as W } from "react";
3
+ import { tabsContract as z, Slot as Y, VhyxUIError as G, VhyxUIErrorCode as J } from "@vhyxui/core";
4
+ import { withAgentContract as F } from "@vhyxseal/react";
5
+ import { u as Q } from "./useId-BGRmH6iF.js";
6
+ const Z = "_root_11mqx_3", K = "_list_11mqx_16", tt = "_trigger_11mqx_49", et = "_indicator_11mqx_114", st = "_panel_11mqx_149", _ = {
7
+ root: Z,
8
+ list: K,
9
+ trigger: tt,
10
+ indicator: et,
11
+ panel: st
12
+ }, O = P(null);
13
+ function $(e) {
14
+ const c = W(O);
15
+ if (!c)
16
+ throw new G({
17
+ code: J.VHYXUI_MISSING_CONTEXT,
18
+ message: `${e} must be used within <Tabs>`,
19
+ suggestion: "Wrap your component tree with <Tabs>"
20
+ });
21
+ return c;
22
+ }
23
+ const V = w.forwardRef(
24
+ ({
25
+ value: e,
26
+ defaultValue: c,
27
+ onValueChange: f,
28
+ orientation: n = "horizontal",
29
+ variant: t = "default",
30
+ size: i = "md",
31
+ contract: u,
32
+ className: x,
33
+ children: l,
34
+ ...r
35
+ }, a) => {
36
+ const y = Q("vhyx-tabs"), I = e !== void 0, [C, j] = q(c), R = I ? e : C, b = N([]), p = N(/* @__PURE__ */ new Map()), s = T(
37
+ (d, v) => {
38
+ v ? (b.current.includes(d) || b.current.push(d), p.current.set(d, v)) : (p.current.delete(d), b.current = b.current.filter((o) => o !== d));
39
+ },
40
+ []
41
+ ), g = T(
42
+ (d) => {
43
+ I || j(d), f == null || f(d);
44
+ },
45
+ [I, f]
46
+ ), E = T(
47
+ (d, v) => {
48
+ var S;
49
+ const o = b.current;
50
+ if (o.length === 0) return;
51
+ let m;
52
+ if (v === "first")
53
+ m = o[0];
54
+ else if (v === "last")
55
+ m = o[o.length - 1];
56
+ else {
57
+ const A = o.indexOf(d);
58
+ v === "next" ? m = o[(A + 1) % o.length] : m = o[(A - 1 + o.length) % o.length];
59
+ }
60
+ m !== void 0 && (g(m), (S = p.current.get(m)) == null || S.focus());
61
+ },
62
+ [g]
63
+ ), U = L(
64
+ () => ({ ...z, id: y, ...u }),
65
+ [y, u]
66
+ ), M = L(
67
+ () => ({
68
+ value: R,
69
+ onValueChange: g,
70
+ orientation: n,
71
+ variant: t,
72
+ size: i,
73
+ tabsId: y,
74
+ triggerOrderRef: b,
75
+ triggerElementsRef: p,
76
+ registerTrigger: s,
77
+ navigateTab: E
78
+ }),
79
+ [
80
+ R,
81
+ g,
82
+ n,
83
+ t,
84
+ i,
85
+ y,
86
+ s,
87
+ E
88
+ ]
89
+ ), X = [_.root, x].filter(Boolean).join(" ");
90
+ return /* @__PURE__ */ h.jsx(O.Provider, { value: M, children: /* @__PURE__ */ h.jsx(
91
+ "div",
92
+ {
93
+ ref: a,
94
+ className: X,
95
+ "data-orientation": n,
96
+ "data-variant": t,
97
+ "data-size": i,
98
+ "data-vhyx-contract": JSON.stringify(U),
99
+ ...r,
100
+ children: l
101
+ }
102
+ ) });
103
+ }
104
+ );
105
+ V.displayName = "VhyxTabs";
106
+ const k = w.forwardRef(
107
+ ({ children: e, className: c, ...f }, n) => {
108
+ const t = $("Tabs.List"), i = N(null), [u, x] = q({}), l = T(
109
+ (a) => {
110
+ i.current = a, typeof n == "function" ? n(a) : n && (n.current = a);
111
+ },
112
+ [n]
113
+ );
114
+ D(() => {
115
+ if (!t.value || !i.current) return;
116
+ const a = t.triggerElementsRef.current.get(t.value);
117
+ a && (t.orientation === "horizontal" ? x({
118
+ width: a.offsetWidth,
119
+ transform: `translateX(${a.offsetLeft}px)`
120
+ }) : x({
121
+ height: a.offsetHeight,
122
+ transform: `translateY(${a.offsetTop}px)`
123
+ }));
124
+ }, [t.value, t.orientation, t.triggerElementsRef]);
125
+ const r = [_.list, c].filter(Boolean).join(" ");
126
+ return /* @__PURE__ */ h.jsxs(
127
+ "div",
128
+ {
129
+ ref: l,
130
+ role: "tablist",
131
+ "aria-orientation": t.orientation,
132
+ className: r,
133
+ "data-variant": t.variant,
134
+ "data-orientation": t.orientation,
135
+ ...f,
136
+ children: [
137
+ e,
138
+ /* @__PURE__ */ h.jsx(
139
+ "span",
140
+ {
141
+ className: _.indicator,
142
+ "data-orientation": t.orientation,
143
+ "aria-hidden": "true",
144
+ style: u
145
+ }
146
+ )
147
+ ]
148
+ }
149
+ );
150
+ }
151
+ );
152
+ k.displayName = "VhyxTabsList";
153
+ const B = w.forwardRef(
154
+ ({ value: e, children: c, className: f, onClick: n, onKeyDown: t, disabled: i, asChild: u = !1, ...x }, l) => {
155
+ const r = $("Tabs.Trigger"), a = r.value === e, y = `${r.tabsId}-panel-${e}`, I = `${r.tabsId}-trigger-${e}`, C = T(
156
+ (s) => {
157
+ r.registerTrigger(e, s), typeof l == "function" ? l(s) : l && (l.current = s);
158
+ },
159
+ [l, r, e]
160
+ ), j = T(
161
+ (s) => {
162
+ n == null || n(s), i || r.onValueChange(e);
163
+ },
164
+ [n, i, r, e]
165
+ ), R = T(
166
+ (s) => {
167
+ t == null || t(s);
168
+ const g = r.orientation === "horizontal";
169
+ g && s.key === "ArrowRight" || !g && s.key === "ArrowDown" ? (s.preventDefault(), r.navigateTab(e, "next")) : g && s.key === "ArrowLeft" || !g && s.key === "ArrowUp" ? (s.preventDefault(), r.navigateTab(e, "prev")) : s.key === "Home" ? (s.preventDefault(), r.navigateTab(e, "first")) : s.key === "End" && (s.preventDefault(), r.navigateTab(e, "last"));
170
+ },
171
+ [t, r, e]
172
+ ), b = [_.trigger, f].filter(Boolean).join(" "), p = {
173
+ id: I,
174
+ role: "tab",
175
+ "aria-selected": a,
176
+ "aria-controls": y,
177
+ disabled: i,
178
+ tabIndex: a ? 0 : -1,
179
+ onClick: j,
180
+ onKeyDown: R,
181
+ className: b,
182
+ "data-state": a ? "active" : "inactive",
183
+ "data-size": r.size,
184
+ ...x
185
+ };
186
+ return u ? /* @__PURE__ */ h.jsx(Y, { ref: C, ...p, children: c }) : /* @__PURE__ */ h.jsx("button", { ref: C, type: "button", ...p, children: c });
187
+ }
188
+ );
189
+ B.displayName = "VhyxTabsTrigger";
190
+ function H({ value: e, children: c, className: f, ...n }) {
191
+ const t = $("Tabs.Content"), i = t.value === e, u = `${t.tabsId}-panel-${e}`, x = `${t.tabsId}-trigger-${e}`;
192
+ if (!i) return null;
193
+ const l = [_.panel, f].filter(Boolean).join(" ");
194
+ return /* @__PURE__ */ h.jsx(
195
+ "div",
196
+ {
197
+ id: u,
198
+ role: "tabpanel",
199
+ "aria-labelledby": x,
200
+ tabIndex: 0,
201
+ className: l,
202
+ "data-state": "active",
203
+ ...n,
204
+ children: c
205
+ }
206
+ );
207
+ }
208
+ H.displayName = "VhyxTabsContent";
209
+ const rt = { ...z, id: "vhyxui-tabs" }, nt = Object.assign(
210
+ F(V, rt),
211
+ {
212
+ List: k,
213
+ Trigger: B,
214
+ Content: H
215
+ }
216
+ );
217
+ nt.displayName = "VhyxTabs";
218
+ export {
219
+ nt as T
220
+ };
@@ -0,0 +1 @@
1
+ "use strict";const h=require("./jsx-runtime-BRMkMA8J.cjs"),r=require("react"),j=require("@vhyxui/core"),M=require("@vhyxseal/react"),U=require("./useId-D2AEOm2G.cjs"),X="_root_11mqx_3",D="_list_11mqx_16",P="_trigger_11mqx_49",W="_indicator_11mqx_114",Y="_panel_11mqx_149",v={root:X,list:D,trigger:P,indicator:W,panel:Y},q=r.createContext(null);function N(e){const l=r.useContext(q);if(!l)throw new j.VhyxUIError({code:j.VhyxUIErrorCode.VHYXUI_MISSING_CONTEXT,message:`${e} must be used within <Tabs>`,suggestion:"Wrap your component tree with <Tabs>"});return l}const S=r.forwardRef(({value:e,defaultValue:l,onValueChange:u,orientation:a="horizontal",variant:t="default",size:o="md",contract:x,className:b,children:f,...n},i)=>{const y=U.useId("vhyx-tabs"),C=e!==void 0,[I,E]=r.useState(l),_=C?e:I,p=r.useRef([]),m=r.useRef(new Map),s=r.useCallback((d,R)=>{R?(p.current.includes(d)||p.current.push(d),m.current.set(d,R)):(m.current.delete(d),p.current=p.current.filter(c=>c!==d))},[]),g=r.useCallback(d=>{C||E(d),u==null||u(d)},[C,u]),w=r.useCallback((d,R)=>{var $;const c=p.current;if(c.length===0)return;let T;if(R==="first")T=c[0];else if(R==="last")T=c[c.length-1];else{const k=c.indexOf(d);R==="next"?T=c[(k+1)%c.length]:T=c[(k-1+c.length)%c.length]}T!==void 0&&(g(T),($=m.current.get(T))==null||$.focus())},[g]),V=r.useMemo(()=>({...j.tabsContract,id:y,...x}),[y,x]),B=r.useMemo(()=>({value:_,onValueChange:g,orientation:a,variant:t,size:o,tabsId:y,triggerOrderRef:p,triggerElementsRef:m,registerTrigger:s,navigateTab:w}),[_,g,a,t,o,y,s,w]),H=[v.root,b].filter(Boolean).join(" ");return h.jsxRuntimeExports.jsx(q.Provider,{value:B,children:h.jsxRuntimeExports.jsx("div",{ref:i,className:H,"data-orientation":a,"data-variant":t,"data-size":o,"data-vhyx-contract":JSON.stringify(V),...n,children:f})})});S.displayName="VhyxTabs";const A=r.forwardRef(({children:e,className:l,...u},a)=>{const t=N("Tabs.List"),o=r.useRef(null),[x,b]=r.useState({}),f=r.useCallback(i=>{o.current=i,typeof a=="function"?a(i):a&&(a.current=i)},[a]);r.useEffect(()=>{if(!t.value||!o.current)return;const i=t.triggerElementsRef.current.get(t.value);i&&(t.orientation==="horizontal"?b({width:i.offsetWidth,transform:`translateX(${i.offsetLeft}px)`}):b({height:i.offsetHeight,transform:`translateY(${i.offsetTop}px)`}))},[t.value,t.orientation,t.triggerElementsRef]);const n=[v.list,l].filter(Boolean).join(" ");return h.jsxRuntimeExports.jsxs("div",{ref:f,role:"tablist","aria-orientation":t.orientation,className:n,"data-variant":t.variant,"data-orientation":t.orientation,...u,children:[e,h.jsxRuntimeExports.jsx("span",{className:v.indicator,"data-orientation":t.orientation,"aria-hidden":"true",style:x})]})});A.displayName="VhyxTabsList";const L=r.forwardRef(({value:e,children:l,className:u,onClick:a,onKeyDown:t,disabled:o,asChild:x=!1,...b},f)=>{const n=N("Tabs.Trigger"),i=n.value===e,y=`${n.tabsId}-panel-${e}`,C=`${n.tabsId}-trigger-${e}`,I=r.useCallback(s=>{n.registerTrigger(e,s),typeof f=="function"?f(s):f&&(f.current=s)},[f,n,e]),E=r.useCallback(s=>{a==null||a(s),o||n.onValueChange(e)},[a,o,n,e]),_=r.useCallback(s=>{t==null||t(s);const g=n.orientation==="horizontal";g&&s.key==="ArrowRight"||!g&&s.key==="ArrowDown"?(s.preventDefault(),n.navigateTab(e,"next")):g&&s.key==="ArrowLeft"||!g&&s.key==="ArrowUp"?(s.preventDefault(),n.navigateTab(e,"prev")):s.key==="Home"?(s.preventDefault(),n.navigateTab(e,"first")):s.key==="End"&&(s.preventDefault(),n.navigateTab(e,"last"))},[t,n,e]),p=[v.trigger,u].filter(Boolean).join(" "),m={id:C,role:"tab","aria-selected":i,"aria-controls":y,disabled:o,tabIndex:i?0:-1,onClick:E,onKeyDown:_,className:p,"data-state":i?"active":"inactive","data-size":n.size,...b};return x?h.jsxRuntimeExports.jsx(j.Slot,{ref:I,...m,children:l}):h.jsxRuntimeExports.jsx("button",{ref:I,type:"button",...m,children:l})});L.displayName="VhyxTabsTrigger";function z({value:e,children:l,className:u,...a}){const t=N("Tabs.Content"),o=t.value===e,x=`${t.tabsId}-panel-${e}`,b=`${t.tabsId}-trigger-${e}`;if(!o)return null;const f=[v.panel,u].filter(Boolean).join(" ");return h.jsxRuntimeExports.jsx("div",{id:x,role:"tabpanel","aria-labelledby":b,tabIndex:0,className:f,"data-state":"active",...a,children:l})}z.displayName="VhyxTabsContent";const G={...j.tabsContract,id:"vhyxui-tabs"},O=Object.assign(M.withAgentContract(S,G),{List:A,Trigger:L,Content:z});O.displayName="VhyxTabs";exports.Tabs=O;
@@ -0,0 +1,104 @@
1
+ import { j as l } from "./jsx-runtime-CL69jGNW.js";
2
+ import V, { useRef as Y, useCallback as d, useEffect as $ } from "react";
3
+ import { textareaContract as y } from "@vhyxui/core";
4
+ import { withAgentContract as k } from "@vhyxseal/react";
5
+ import { u as A } from "./useId-BGRmH6iF.js";
6
+ const F = "_wrapper_lafqn_1", J = "_textarea_lafqn_8", M = "_count_lafqn_72", f = {
7
+ wrapper: F,
8
+ textarea: J,
9
+ count: M
10
+ }, m = V.forwardRef(
11
+ ({
12
+ size: v = "md",
13
+ resize: a = "vertical",
14
+ minRows: g = 3,
15
+ maxRows: s,
16
+ showCount: _ = !1,
17
+ error: u = !1,
18
+ contract: b,
19
+ className: j,
20
+ id: w,
21
+ value: r,
22
+ onChange: o,
23
+ maxLength: n,
24
+ "aria-label": H,
25
+ "aria-describedby": N,
26
+ style: C,
27
+ ...T
28
+ }, e) => {
29
+ const R = A("vhyx-textarea"), p = w ?? R, x = Y(null), q = d(
30
+ (t) => {
31
+ x.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
32
+ },
33
+ [e]
34
+ ), i = d(() => {
35
+ const t = x.current;
36
+ if (!t || a !== "auto") return;
37
+ t.style.height = "auto";
38
+ const c = t.scrollHeight;
39
+ if (s !== void 0) {
40
+ const h = (parseFloat(getComputedStyle(t).lineHeight) || 20) * s;
41
+ t.style.height = `${Math.min(c, h)}px`, t.style.overflowY = c > h ? "auto" : "hidden";
42
+ } else
43
+ t.style.height = `${c}px`, t.style.overflowY = "hidden";
44
+ }, [a, s]);
45
+ $(() => {
46
+ a === "auto" && i();
47
+ }, [r, a, i]);
48
+ const I = d(
49
+ (t) => {
50
+ o == null || o(t), a === "auto" && i();
51
+ },
52
+ [o, a, i]
53
+ ), S = typeof r == "string" ? r.length : 0, B = {
54
+ ...y,
55
+ id: p,
56
+ ...b
57
+ }, E = [f.textarea, j].filter(Boolean).join(" ");
58
+ return /* @__PURE__ */ l.jsxs("div", { className: f.wrapper, children: [
59
+ /* @__PURE__ */ l.jsx(
60
+ "textarea",
61
+ {
62
+ ref: q,
63
+ id: p,
64
+ value: r,
65
+ onChange: I,
66
+ maxLength: n,
67
+ rows: g,
68
+ "aria-invalid": u ? !0 : void 0,
69
+ "aria-label": H,
70
+ "aria-describedby": N,
71
+ className: E,
72
+ "data-size": v,
73
+ "data-resize": a,
74
+ "data-error": u ? !0 : void 0,
75
+ "data-vhyx-contract": JSON.stringify(B),
76
+ style: {
77
+ resize: a === "auto" ? "none" : a,
78
+ ...C
79
+ },
80
+ ...T
81
+ }
82
+ ),
83
+ _ && n !== void 0 && /* @__PURE__ */ l.jsxs(
84
+ "span",
85
+ {
86
+ className: f.count,
87
+ "aria-live": "polite",
88
+ "aria-atomic": "true",
89
+ children: [
90
+ S,
91
+ "/",
92
+ n
93
+ ]
94
+ }
95
+ )
96
+ ] });
97
+ }
98
+ );
99
+ m.displayName = "VhyxTextarea";
100
+ const O = { ...y, id: "vhyxui-textarea" }, D = k(m, O);
101
+ D.displayName = "VhyxTextarea";
102
+ export {
103
+ D as T
104
+ };
@@ -0,0 +1 @@
1
+ "use strict";const u=require("./jsx-runtime-BRMkMA8J.cjs"),a=require("react"),y=require("@vhyxui/core"),V=require("@vhyxseal/react"),Y=require("./useId-D2AEOm2G.cjs"),$="_wrapper_lafqn_1",A="_textarea_lafqn_8",F="_count_lafqn_72",d={wrapper:$,textarea:A,count:F},v=a.forwardRef(({size:m="md",resize:e="vertical",minRows:b=3,maxRows:c,showCount:j=!1,error:x=!1,contract:_,className:q,id:C,value:s,onChange:i,maxLength:o,"aria-label":w,"aria-describedby":H,style:R,...N},r)=>{const T=Y.useId("vhyx-textarea"),f=C??T,h=a.useRef(null),E=a.useCallback(t=>{h.current=t,typeof r=="function"?r(t):r&&(r.current=t)},[r]),n=a.useCallback(()=>{const t=h.current;if(!t||e!=="auto")return;t.style.height="auto";const l=t.scrollHeight;if(c!==void 0){const p=(parseFloat(getComputedStyle(t).lineHeight)||20)*c;t.style.height=`${Math.min(l,p)}px`,t.style.overflowY=l>p?"auto":"hidden"}else t.style.height=`${l}px`,t.style.overflowY="hidden"},[e,c]);a.useEffect(()=>{e==="auto"&&n()},[s,e,n]);const I=a.useCallback(t=>{i==null||i(t),e==="auto"&&n()},[i,e,n]),k=typeof s=="string"?s.length:0,S={...y.textareaContract,id:f,..._},B=[d.textarea,q].filter(Boolean).join(" ");return u.jsxRuntimeExports.jsxs("div",{className:d.wrapper,children:[u.jsxRuntimeExports.jsx("textarea",{ref:E,id:f,value:s,onChange:I,maxLength:o,rows:b,"aria-invalid":x?!0:void 0,"aria-label":w,"aria-describedby":H,className:B,"data-size":m,"data-resize":e,"data-error":x?!0:void 0,"data-vhyx-contract":JSON.stringify(S),style:{resize:e==="auto"?"none":e,...R},...N}),j&&o!==void 0&&u.jsxRuntimeExports.jsxs("span",{className:d.count,"aria-live":"polite","aria-atomic":"true",children:[k,"/",o]})]})});v.displayName="VhyxTextarea";const J={...y.textareaContract,id:"vhyxui-textarea"},g=V.withAgentContract(v,J);g.displayName="VhyxTextarea";exports.Textarea=g;
@@ -0,0 +1,167 @@
1
+ import { j as s } from "./jsx-runtime-CL69jGNW.js";
2
+ import { useState as p, useEffect as d, useCallback as h, useRef as b } from "react";
3
+ import { toastContract as g } from "@vhyxui/core";
4
+ import { withAgentContract as j } from "@vhyxseal/react";
5
+ let r = [], _ = 5;
6
+ const u = /* @__PURE__ */ new Set();
7
+ let m = 0;
8
+ function f() {
9
+ for (const t of u)
10
+ t();
11
+ }
12
+ function v(t) {
13
+ t.maxToasts !== void 0 && (_ = t.maxToasts);
14
+ }
15
+ function x() {
16
+ return r;
17
+ }
18
+ function B(t) {
19
+ m += 1;
20
+ const o = `vhyx-toast-${m}`, e = { ...t, id: o }, a = [...r];
21
+ return a.length >= _ && a.shift(), r = [...a, e], f(), o;
22
+ }
23
+ function y(t) {
24
+ r = r.filter((o) => o.id !== t), f();
25
+ }
26
+ function D() {
27
+ r = [], f();
28
+ }
29
+ function T(t) {
30
+ return u.add(t), () => {
31
+ u.delete(t);
32
+ };
33
+ }
34
+ const N = "_region_1l6lf_3", C = "_toast_1l6lf_49", n = {
35
+ region: N,
36
+ toast: C,
37
+ "toast-content": "_toast-content_1l6lf_60",
38
+ "toast-icon": "_toast-icon_1l6lf_89",
39
+ "toast-body": "_toast-body_1l6lf_103",
40
+ "toast-message": "_toast-message_1l6lf_111",
41
+ "toast-description": "_toast-description_1l6lf_119",
42
+ "toast-action": "_toast-action_1l6lf_128",
43
+ "toast-dismiss": "_toast-dismiss_1l6lf_154"
44
+ };
45
+ function k({
46
+ position: t = "bottom-right",
47
+ maxToasts: o = 5,
48
+ defaultDuration: e = 5e3,
49
+ children: a
50
+ }) {
51
+ const [i, c] = p(() => x());
52
+ return d(() => {
53
+ v({ maxToasts: o });
54
+ }, [o]), d(() => T(() => {
55
+ c(x());
56
+ }), []), /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
57
+ a,
58
+ /* @__PURE__ */ s.jsx(
59
+ "div",
60
+ {
61
+ role: "status",
62
+ "aria-live": "polite",
63
+ "aria-atomic": "false",
64
+ "aria-label": "Notifications",
65
+ className: n.region,
66
+ "data-position": t,
67
+ children: i.map((l) => /* @__PURE__ */ s.jsx(
68
+ w,
69
+ {
70
+ item: l,
71
+ defaultDuration: e
72
+ },
73
+ l.id
74
+ ))
75
+ }
76
+ )
77
+ ] });
78
+ }
79
+ function w({
80
+ item: t,
81
+ defaultDuration: o
82
+ }) {
83
+ const e = h(() => y(t.id), [t.id]), a = b(null), i = t.duration ?? o;
84
+ return d(() => {
85
+ if (!(!isFinite(i) || i <= 0))
86
+ return a.current = setTimeout(e, i), () => {
87
+ a.current && clearTimeout(a.current);
88
+ };
89
+ }, [e, i]), /* @__PURE__ */ s.jsx(
90
+ "div",
91
+ {
92
+ role: "status",
93
+ "aria-live": "polite",
94
+ className: n.toast,
95
+ "data-variant": t.variant,
96
+ "data-state": "open",
97
+ children: /* @__PURE__ */ s.jsxs("div", { className: n["toast-content"], children: [
98
+ /* @__PURE__ */ s.jsx("span", { className: n["toast-icon"], "aria-hidden": "true", children: I(t.variant) }),
99
+ /* @__PURE__ */ s.jsxs("div", { className: n["toast-body"], children: [
100
+ /* @__PURE__ */ s.jsx("span", { className: n["toast-message"], children: t.message }),
101
+ t.description && /* @__PURE__ */ s.jsx("span", { className: n["toast-description"], children: t.description })
102
+ ] }),
103
+ t.action && /* @__PURE__ */ s.jsx(
104
+ "button",
105
+ {
106
+ type: "button",
107
+ className: n["toast-action"],
108
+ onClick: () => {
109
+ var c;
110
+ (c = t.action) == null || c.onClick(), e();
111
+ },
112
+ children: t.action.label
113
+ }
114
+ ),
115
+ t.dismissible !== !1 && /* @__PURE__ */ s.jsx(
116
+ "button",
117
+ {
118
+ type: "button",
119
+ className: n["toast-dismiss"],
120
+ onClick: e,
121
+ "aria-label": "Dismiss",
122
+ children: /* @__PURE__ */ s.jsxs(
123
+ "svg",
124
+ {
125
+ "aria-hidden": "true",
126
+ viewBox: "0 0 12 12",
127
+ fill: "none",
128
+ stroke: "currentColor",
129
+ strokeWidth: 1.5,
130
+ strokeLinecap: "round",
131
+ children: [
132
+ /* @__PURE__ */ s.jsx("line", { x1: "2", y1: "2", x2: "10", y2: "10" }),
133
+ /* @__PURE__ */ s.jsx("line", { x1: "10", y1: "2", x2: "2", y2: "10" })
134
+ ]
135
+ }
136
+ )
137
+ }
138
+ )
139
+ ] })
140
+ }
141
+ );
142
+ }
143
+ function I(t) {
144
+ switch (t) {
145
+ case "success":
146
+ return "✓";
147
+ case "danger":
148
+ return "✕";
149
+ case "warning":
150
+ return "⚠";
151
+ case "info":
152
+ return "ℹ";
153
+ default:
154
+ return "●";
155
+ }
156
+ }
157
+ const S = { ...g, id: "vhyxui-toast" }, L = Object.assign(
158
+ j(k, S),
159
+ { displayName: "VhyxToast" }
160
+ );
161
+ export {
162
+ L as T,
163
+ k as a,
164
+ B as b,
165
+ y as c,
166
+ D as d
167
+ };
@@ -0,0 +1 @@
1
+ "use strict";const s=require("./jsx-runtime-BRMkMA8J.cjs"),r=require("react"),h=require("@vhyxui/core"),b=require("@vhyxseal/react");let c=[],p=5;const d=new Set;let f=0;function x(){for(const t of d)t()}function R(t){t.maxToasts!==void 0&&(p=t.maxToasts)}function m(){return c}function T(t){f+=1;const e=`vhyx-toast-${f}`,i={...t,id:e},o=[...c];return o.length>=p&&o.shift(),c=[...o,i],x(),e}function j(t){c=c.filter(e=>e.id!==t),x()}function g(){c=[],x()}function E(t){return d.add(t),()=>{d.delete(t)}}const v="_region_1l6lf_3",y="_toast_1l6lf_49",n={region:v,toast:y,"toast-content":"_toast-content_1l6lf_60","toast-icon":"_toast-icon_1l6lf_89","toast-body":"_toast-body_1l6lf_103","toast-message":"_toast-message_1l6lf_111","toast-description":"_toast-description_1l6lf_119","toast-action":"_toast-action_1l6lf_128","toast-dismiss":"_toast-dismiss_1l6lf_154"};function _({position:t="bottom-right",maxToasts:e=5,defaultDuration:i=5e3,children:o}){const[a,l]=r.useState(()=>m());return r.useEffect(()=>{R({maxToasts:e})},[e]),r.useEffect(()=>E(()=>{l(m())}),[]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[o,s.jsxRuntimeExports.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"false","aria-label":"Notifications",className:n.region,"data-position":t,children:a.map(u=>s.jsxRuntimeExports.jsx(N,{item:u,defaultDuration:i},u.id))})]})}function N({item:t,defaultDuration:e}){const i=r.useCallback(()=>j(t.id),[t.id]),o=r.useRef(null),a=t.duration??e;return r.useEffect(()=>{if(!(!isFinite(a)||a<=0))return o.current=setTimeout(i,a),()=>{o.current&&clearTimeout(o.current)}},[i,a]),s.jsxRuntimeExports.jsx("div",{role:"status","aria-live":"polite",className:n.toast,"data-variant":t.variant,"data-state":"open",children:s.jsxRuntimeExports.jsxs("div",{className:n["toast-content"],children:[s.jsxRuntimeExports.jsx("span",{className:n["toast-icon"],"aria-hidden":"true",children:C(t.variant)}),s.jsxRuntimeExports.jsxs("div",{className:n["toast-body"],children:[s.jsxRuntimeExports.jsx("span",{className:n["toast-message"],children:t.message}),t.description&&s.jsxRuntimeExports.jsx("span",{className:n["toast-description"],children:t.description})]}),t.action&&s.jsxRuntimeExports.jsx("button",{type:"button",className:n["toast-action"],onClick:()=>{var l;(l=t.action)==null||l.onClick(),i()},children:t.action.label}),t.dismissible!==!1&&s.jsxRuntimeExports.jsx("button",{type:"button",className:n["toast-dismiss"],onClick:i,"aria-label":"Dismiss",children:s.jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",children:[s.jsxRuntimeExports.jsx("line",{x1:"2",y1:"2",x2:"10",y2:"10"}),s.jsxRuntimeExports.jsx("line",{x1:"10",y1:"2",x2:"2",y2:"10"})]})})]})})}function C(t){switch(t){case"success":return"✓";case"danger":return"✕";case"warning":return"⚠";case"info":return"ℹ";default:return"●"}}const k={...h.toastContract,id:"vhyxui-toast"},w=Object.assign(b.withAgentContract(_,k),{displayName:"VhyxToast"});exports.Toast=w;exports.ToastProvider=_;exports.addToast=T;exports.dismissAllToasts=g;exports.dismissToast=j;
@@ -0,0 +1,107 @@
1
+ import { j as h } from "./jsx-runtime-CL69jGNW.js";
2
+ import P, { useState as b, useRef as y, useCallback as c, useEffect as E } from "react";
3
+ import k from "react-dom";
4
+ import { tooltipContract as F } from "@vhyxui/core";
5
+ import { withAgentContract as I } from "@vhyxseal/react";
6
+ import { u as N } from "./useId-BGRmH6iF.js";
7
+ const V = "_tooltip_jlaje_1", _ = {
8
+ tooltip: V
9
+ };
10
+ function R({
11
+ content: j,
12
+ side: e = "top",
13
+ align: w = "center",
14
+ delayDuration: g = 400,
15
+ skipDelayDuration: M = 300,
16
+ children: n
17
+ }) {
18
+ const x = N("vhyx-tooltip"), [l, f] = b(!1), [T, C] = b({ top: 0, left: 0 }), v = y(null), a = y(null), m = y(null), i = c(() => {
19
+ a.current && clearTimeout(a.current), m.current && clearTimeout(m.current);
20
+ }, []);
21
+ E(() => () => i(), [i]);
22
+ const d = c(() => {
23
+ const o = v.current;
24
+ if (!o) return;
25
+ const t = o.getBoundingClientRect(), p = 6;
26
+ let s = 0, r = 0;
27
+ e === "top" ? (s = t.top - p, r = t.left + t.width / 2) : e === "bottom" ? (s = t.bottom + p, r = t.left + t.width / 2) : e === "right" ? (s = t.top + t.height / 2, r = t.right + p) : (s = t.top + t.height / 2, r = t.left - p), C({ top: s, left: r });
28
+ }, [e]), B = c(() => {
29
+ i(), a.current = setTimeout(() => {
30
+ d(), f(!0);
31
+ }, g);
32
+ }, [i, g, d]), u = c(
33
+ (o = 0) => {
34
+ i(), o > 0 ? m.current = setTimeout(() => f(!1), o) : f(!1);
35
+ },
36
+ [i]
37
+ );
38
+ E(() => {
39
+ if (!l) return;
40
+ function o(t) {
41
+ t.key === "Escape" && u(0);
42
+ }
43
+ return document.addEventListener("keydown", o), () => document.removeEventListener("keydown", o);
44
+ }, [l, u]);
45
+ const L = P.cloneElement(
46
+ n,
47
+ {
48
+ ref: c(
49
+ (o) => {
50
+ v.current = o;
51
+ const t = n.ref;
52
+ typeof t == "function" ? t(o) : t && typeof t == "object" && (t.current = o);
53
+ },
54
+ // eslint-disable-next-line react-hooks/exhaustive-deps
55
+ []
56
+ ),
57
+ "aria-describedby": l ? x : void 0,
58
+ onMouseEnter: (o) => {
59
+ const t = n.props.onMouseEnter;
60
+ typeof t == "function" && t(o), B();
61
+ },
62
+ onMouseLeave: (o) => {
63
+ const t = n.props.onMouseLeave;
64
+ typeof t == "function" && t(o), u(M);
65
+ },
66
+ onFocus: (o) => {
67
+ const t = n.props.onFocus;
68
+ typeof t == "function" && t(o), d(), f(!0);
69
+ },
70
+ onBlur: (o) => {
71
+ const t = n.props.onBlur;
72
+ typeof t == "function" && t(o), u(0);
73
+ }
74
+ }
75
+ ), O = l ? k.createPortal(
76
+ /* @__PURE__ */ h.jsx(
77
+ "div",
78
+ {
79
+ id: x,
80
+ role: "tooltip",
81
+ className: _.tooltip,
82
+ "data-side": e,
83
+ "data-align": w,
84
+ style: {
85
+ position: "fixed",
86
+ top: T.top,
87
+ left: T.left,
88
+ zIndex: 550,
89
+ // --vhyx-z-tooltip
90
+ transform: e === "top" || e === "bottom" ? "translateX(-50%)" : "translateY(-50%)"
91
+ },
92
+ children: j
93
+ }
94
+ ),
95
+ document.body
96
+ ) : null;
97
+ return /* @__PURE__ */ h.jsxs(h.Fragment, { children: [
98
+ L,
99
+ O
100
+ ] });
101
+ }
102
+ R.displayName = "VhyxTooltip";
103
+ const A = { ...F, id: "vhyxui-tooltip" }, S = I(R, A);
104
+ S.displayName = "VhyxTooltip";
105
+ export {
106
+ S as T
107
+ };
@@ -0,0 +1 @@
1
+ "use strict";const h=require("./jsx-runtime-BRMkMA8J.cjs"),o=require("react"),q=require("react-dom"),B=require("@vhyxui/core"),L=require("@vhyxseal/react"),O=require("./useId-D2AEOm2G.cjs"),P="_tooltip_jlaje_1",F={tooltip:P};function R({content:T,side:n="top",align:v="center",delayDuration:y=400,skipDelayDuration:C=300,children:s}){const x=O.useId("vhyx-tooltip"),[l,u]=o.useState(!1),[b,j]=o.useState({top:0,left:0}),g=o.useRef(null),p=o.useRef(null),m=o.useRef(null),i=o.useCallback(()=>{p.current&&clearTimeout(p.current),m.current&&clearTimeout(m.current)},[]);o.useEffect(()=>()=>i(),[i]);const d=o.useCallback(()=>{const e=g.current;if(!e)return;const t=e.getBoundingClientRect(),a=6;let r=0,c=0;n==="top"?(r=t.top-a,c=t.left+t.width/2):n==="bottom"?(r=t.bottom+a,c=t.left+t.width/2):n==="right"?(r=t.top+t.height/2,c=t.right+a):(r=t.top+t.height/2,c=t.left-a),j({top:r,left:c})},[n]),k=o.useCallback(()=>{i(),p.current=setTimeout(()=>{d(),u(!0)},y)},[i,y,d]),f=o.useCallback((e=0)=>{i(),e>0?m.current=setTimeout(()=>u(!1),e):u(!1)},[i]);o.useEffect(()=>{if(!l)return;function e(t){t.key==="Escape"&&f(0)}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[l,f]);const w=o.cloneElement(s,{ref:o.useCallback(e=>{g.current=e;const t=s.ref;typeof t=="function"?t(e):t&&typeof t=="object"&&(t.current=e)},[]),"aria-describedby":l?x:void 0,onMouseEnter:e=>{const t=s.props.onMouseEnter;typeof t=="function"&&t(e),k()},onMouseLeave:e=>{const t=s.props.onMouseLeave;typeof t=="function"&&t(e),f(C)},onFocus:e=>{const t=s.props.onFocus;typeof t=="function"&&t(e),d(),u(!0)},onBlur:e=>{const t=s.props.onBlur;typeof t=="function"&&t(e),f(0)}}),M=l?q.createPortal(h.jsxRuntimeExports.jsx("div",{id:x,role:"tooltip",className:F.tooltip,"data-side":n,"data-align":v,style:{position:"fixed",top:b.top,left:b.left,zIndex:550,transform:n==="top"||n==="bottom"?"translateX(-50%)":"translateY(-50%)"},children:T}),document.body):null;return h.jsxRuntimeExports.jsxs(h.jsxRuntimeExports.Fragment,{children:[w,M]})}R.displayName="VhyxTooltip";const I={...B.tooltipContract,id:"vhyxui-tooltip"},E=L.withAgentContract(R,I);E.displayName="VhyxTooltip";exports.Tooltip=E;
@@ -0,0 +1 @@
1
+ "use strict";const i=require("./jsx-runtime-BRMkMA8J.cjs"),c=require("@vhyxseal/react"),a=require("./Toast-ndaxbpcV.cjs"),x={"skip-link":"_skip-link_1u818_1"},d={domain:"",domainVerified:!1,verificationToken:""};function e({children:s,toastPosition:o="bottom-right",maxToasts:r=5,defaultDuration:n=4e3}){const t=process.env.NODE_ENV!=="production";return i.jsxRuntimeExports.jsxs(c.SealProvider,{config:d,dev:t,children:[i.jsxRuntimeExports.jsx("a",{href:"#vhyx-main",className:x["skip-link"],children:"Skip to main content"}),i.jsxRuntimeExports.jsx(a.ToastProvider,{position:o,maxToasts:r,defaultDuration:n,children:s})]})}e.displayName="VhyxUIProvider";exports.VhyxUIProvider=e;
@@ -0,0 +1,34 @@
1
+ import { j as i } from "./jsx-runtime-CL69jGNW.js";
2
+ import { SealProvider as t } from "@vhyxseal/react";
3
+ import { a } from "./Toast-0acAjZTB.js";
4
+ const m = {
5
+ "skip-link": "_skip-link_1u818_1"
6
+ }, p = {
7
+ domain: "",
8
+ domainVerified: !1,
9
+ verificationToken: ""
10
+ };
11
+ function c({
12
+ children: o,
13
+ toastPosition: r = "bottom-right",
14
+ maxToasts: s = 5,
15
+ defaultDuration: e = 4e3
16
+ }) {
17
+ const n = process.env.NODE_ENV !== "production";
18
+ return /* @__PURE__ */ i.jsxs(t, { config: p, dev: n, children: [
19
+ /* @__PURE__ */ i.jsx("a", { href: "#vhyx-main", className: m["skip-link"], children: "Skip to main content" }),
20
+ /* @__PURE__ */ i.jsx(
21
+ a,
22
+ {
23
+ position: r,
24
+ maxToasts: s,
25
+ defaultDuration: e,
26
+ children: o
27
+ }
28
+ )
29
+ ] });
30
+ }
31
+ c.displayName = "VhyxUIProvider";
32
+ export {
33
+ c as V
34
+ };
package/dist/alert.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Alert-BJ1O0bnK.cjs");exports.Alert=e.Alert;