@vhyxui/react 0.1.2-alpha.2 → 0.2.0-alpha

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 (53) hide show
  1. package/dist/{Badge-Fuc7l-1E.js → Badge-Bbxb4wyt.js} +7 -7
  2. package/dist/{Badge-RM7n86Rq.cjs → Badge-SBO9tGzn.cjs} +1 -1
  3. package/dist/{Button-D7eX45GC.js → Button-DDMc7-3S.js} +28 -28
  4. package/dist/{Button-AkUYT9eN.cjs → Button-akOSYEu9.cjs} +1 -1
  5. package/dist/Card-DSCA-Igh.cjs +1 -0
  6. package/dist/Card-Dh9Pcmfa.js +79 -0
  7. package/dist/Popover-BHGX_cC4.cjs +1 -0
  8. package/dist/Popover-u9vlClum.js +211 -0
  9. package/dist/Select-CGfKq69f.cjs +1 -0
  10. package/dist/Select-DHalg36V.js +344 -0
  11. package/dist/SelectField-DG7SlT9m.cjs +1 -0
  12. package/dist/SelectField-DTfYCDWa.js +49 -0
  13. package/dist/{Spinner-CZSz1OpT.js → Spinner-BYi9eTfl.js} +19 -19
  14. package/dist/Spinner-CeIDpqkx.cjs +1 -0
  15. package/dist/TextField-C3r-6jr6.cjs +1 -0
  16. package/dist/TextField-DtXQQJJk.js +31 -0
  17. package/dist/TextareaField-CpqPinvx.js +31 -0
  18. package/dist/TextareaField-D234Lyi_.cjs +1 -0
  19. package/dist/badge.cjs +1 -1
  20. package/dist/badge.js +1 -1
  21. package/dist/button.cjs +1 -1
  22. package/dist/button.js +1 -1
  23. package/dist/card.cjs +1 -1
  24. package/dist/card.js +1 -1
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.d.ts +129 -6
  27. package/dist/index.js +47 -41
  28. package/dist/popover.cjs +1 -1
  29. package/dist/popover.d.ts +7 -1
  30. package/dist/popover.js +1 -1
  31. package/dist/select.cjs +1 -1
  32. package/dist/select.d.ts +19 -5
  33. package/dist/select.js +1 -1
  34. package/dist/selectfield.cjs +1 -0
  35. package/dist/selectfield.d.ts +82 -0
  36. package/dist/selectfield.js +4 -0
  37. package/dist/spinner.cjs +1 -1
  38. package/dist/spinner.js +1 -1
  39. package/dist/style.css +1 -1
  40. package/dist/textareafield.cjs +1 -0
  41. package/dist/textareafield.d.ts +84 -0
  42. package/dist/textareafield.js +4 -0
  43. package/dist/textfield.cjs +1 -0
  44. package/dist/textfield.d.ts +82 -0
  45. package/dist/textfield.js +4 -0
  46. package/package.json +16 -1
  47. package/dist/Card-D7ZNeWtE.js +0 -75
  48. package/dist/Card-d5xrWgQS.cjs +0 -1
  49. package/dist/Popover-BPFkS4xn.cjs +0 -1
  50. package/dist/Popover-MxUovsIt.js +0 -194
  51. package/dist/Select-C9yB2B8M.cjs +0 -1
  52. package/dist/Select-DjeJOdb7.js +0 -327
  53. package/dist/Spinner-BZGPmp9c.cjs +0 -1
@@ -2,27 +2,27 @@ import { j as m } from "./jsx-runtime-CL69jGNW.js";
2
2
  import f from "react";
3
3
  import { badgeContract as p } from "@vhyxui/core";
4
4
  import { withAgentContract as b } from "@vhyxseal/react";
5
- const u = "_badge_12qri_1", B = {
5
+ const u = "_badge_1s34s_1", B = {
6
6
  badge: u
7
7
  }, r = f.forwardRef(
8
8
  ({
9
- variant: o = "default",
10
- size: d = "md",
9
+ variant: s = "default",
10
+ size: o = "md",
11
11
  dot: t = !1,
12
12
  count: a,
13
13
  max: e = 99,
14
- className: s,
14
+ className: d,
15
15
  children: n,
16
16
  ...i
17
17
  }, g) => {
18
- const l = [B.badge, s].filter(Boolean).join(" "), c = () => t ? null : a !== void 0 ? a > e ? `${e}+` : String(a) : n;
18
+ const l = [B.badge, d].filter(Boolean).join(" "), c = () => t ? null : a !== void 0 ? a > e ? `${e}+` : String(a) : n;
19
19
  return /* @__PURE__ */ m.jsx(
20
20
  "span",
21
21
  {
22
22
  ref: g,
23
23
  className: l,
24
- "data-variant": o,
25
- "data-size": d,
24
+ "data-variant": s,
25
+ "data-size": o,
26
26
  "data-dot": t ? !0 : void 0,
27
27
  ...i,
28
28
  children: c()
@@ -1 +1 @@
1
- "use strict";const b=require("./jsx-runtime-BRMkMA8J.cjs"),f=require("react"),B=require("@vhyxui/core"),x=require("@vhyxseal/react"),y="_badge_12qri_1",h={badge:y},r=f.forwardRef(({variant:n="default",size:d="md",dot:a=!1,count:e,max:t=99,className:i,children:o,...c},g)=>{const l=[h.badge,i].filter(Boolean).join(" "),u=()=>a?null:e!==void 0?e>t?`${t}+`:String(e):o;return b.jsxRuntimeExports.jsx("span",{ref:g,className:l,"data-variant":n,"data-size":d,"data-dot":a?!0:void 0,...c,children:u()})});r.displayName="VhyxBadge";const m={...B.badgeContract,id:"vhyxui-badge"},s=x.withAgentContract(r,m);s.displayName="VhyxBadge";exports.Badge=s;
1
+ "use strict";const b=require("./jsx-runtime-BRMkMA8J.cjs"),f=require("react"),B=require("@vhyxui/core"),x=require("@vhyxseal/react"),y="_badge_1s34s_1",h={badge:y},s=f.forwardRef(({variant:n="default",size:d="md",dot:a=!1,count:e,max:t=99,className:i,children:o,...c},g)=>{const l=[h.badge,i].filter(Boolean).join(" "),u=()=>a?null:e!==void 0?e>t?`${t}+`:String(e):o;return b.jsxRuntimeExports.jsx("span",{ref:g,className:l,"data-variant":n,"data-size":d,"data-dot":a?!0:void 0,...c,children:u()})});s.displayName="VhyxBadge";const m={...B.badgeContract,id:"vhyxui-badge"},r=x.withAgentContract(s,m);r.displayName="VhyxBadge";exports.Badge=r;
@@ -1,15 +1,15 @@
1
1
  import { j as t } from "./jsx-runtime-CL69jGNW.js";
2
- import C, { useMemo as S } from "react";
3
- import { buttonContract as p, Slot as g } from "@vhyxui/core";
4
- import { withAgentContract as I } from "@vhyxseal/react";
5
- import { S as V } from "./Spinner-CZSz1OpT.js";
6
- import { u as E } from "./useId-BGRmH6iF.js";
7
- const R = "_button_1wjdv_1", U = "_content_1wjdv_57", q = "_spinner_1wjdv_190", z = "_icon_1wjdv_198", a = {
8
- button: R,
9
- content: U,
10
- spinner: q,
11
- icon: z
12
- }, f = C.forwardRef(
2
+ import z, { useMemo as C } from "react";
3
+ import { buttonContract as p, Slot as S } from "@vhyxui/core";
4
+ import { withAgentContract as g } from "@vhyxseal/react";
5
+ import { S as I } from "./Spinner-BYi9eTfl.js";
6
+ import { u as V } from "./useId-BGRmH6iF.js";
7
+ const E = "_button_z02sw_1", R = "_content_z02sw_57", U = "_spinner_z02sw_196", q = "_icon_z02sw_204", a = {
8
+ button: E,
9
+ content: R,
10
+ spinner: U,
11
+ icon: q
12
+ }, f = z.forwardRef(
13
13
  ({
14
14
  variant: r = "primary",
15
15
  size: b = "md",
@@ -18,40 +18,40 @@ const R = "_button_1wjdv_1", U = "_content_1wjdv_57", q = "_spinner_1wjdv_190",
18
18
  iconPosition: i = "left",
19
19
  iconOnly: s = !1,
20
20
  asChild: h = !1,
21
- contract: d,
22
- className: v,
23
- children: u,
24
- disabled: x,
25
- id: j,
26
- "aria-label": c,
27
- ..._
21
+ contract: u,
22
+ className: x,
23
+ children: c,
24
+ disabled: v,
25
+ id: _,
26
+ "aria-label": d,
27
+ ...y
28
28
  }, l) => {
29
- const y = E("vhyx-button"), o = j ?? y;
30
- process.env.NODE_ENV !== "production" && s && !c && console.warn(
29
+ const N = V("vhyx-button"), o = _ ?? N;
30
+ process.env.NODE_ENV !== "production" && s && !d && console.warn(
31
31
  "[VhyxUI] <Button iconOnly> requires an aria-label for accessibility. Screen reader users will not be able to identify this button."
32
32
  );
33
- const N = S(() => ({ ...p, id: o, ...r === "destructive" ? { safetyLevel: "high", destructive: !0, requiresConfirmation: !0 } : {}, ...d }), [r, o, d]), w = x ?? n, B = [a.button, v].filter(Boolean).join(" "), m = {
33
+ const j = C(() => ({ ...p, id: o, ...r === "destructive" ? { safetyLevel: "high", destructive: !0, requiresConfirmation: !0 } : {}, ...u }), [r, o, u]), w = v ?? n, B = [a.button, x].filter(Boolean).join(" "), m = {
34
34
  id: o,
35
35
  className: B,
36
36
  "aria-busy": n ? !0 : void 0,
37
- "aria-label": c,
37
+ "aria-label": d,
38
38
  "data-variant": r,
39
39
  "data-size": b,
40
40
  "data-loading": n ? !0 : void 0,
41
41
  "data-icon-only": s ? !0 : void 0,
42
- "data-vhyx-contract": JSON.stringify(N),
43
- ..._
42
+ "data-vhyx-contract": JSON.stringify(j),
43
+ ...y
44
44
  };
45
- return h ? /* @__PURE__ */ t.jsx(g, { ref: l, ...m, children: u }) : /* @__PURE__ */ t.jsxs("button", { ref: l, disabled: w, ...m, children: [
46
- n && /* @__PURE__ */ t.jsx(V, { size: "sm", variant: "white", "aria-hidden": "true", label: "", className: a.spinner }),
45
+ return h ? /* @__PURE__ */ t.jsx(S, { ref: l, ...m, children: c }) : /* @__PURE__ */ t.jsxs("button", { ref: l, disabled: w, ...m, children: [
46
+ n && /* @__PURE__ */ t.jsx(I, { size: "sm", variant: "white", "aria-hidden": "true", label: "", className: a.spinner }),
47
47
  e && i === "left" && !s && /* @__PURE__ */ t.jsx("span", { className: a.icon, "aria-hidden": "true", children: e }),
48
- s && e ? /* @__PURE__ */ t.jsx("span", { className: a.icon, "aria-hidden": "true", children: e }) : !s && /* @__PURE__ */ t.jsx("span", { className: a.content, children: u }),
48
+ s && e ? /* @__PURE__ */ t.jsx("span", { className: a.icon, "aria-hidden": "true", children: e }) : !s && /* @__PURE__ */ t.jsx("span", { className: a.content, children: c }),
49
49
  e && i === "right" && !s && /* @__PURE__ */ t.jsx("span", { className: a.icon, "aria-hidden": "true", children: e })
50
50
  ] });
51
51
  }
52
52
  );
53
53
  f.displayName = "VhyxButton";
54
- const D = { ...p, id: "vhyxui-button" }, A = I(f, D);
54
+ const D = { ...p, id: "vhyxui-button" }, A = g(f, D);
55
55
  A.displayName = "VhyxButton";
56
56
  export {
57
57
  A as B
@@ -1 +1 @@
1
- "use strict";const t=require("./jsx-runtime-BRMkMA8J.cjs"),b=require("react"),i=require("@vhyxui/core"),C=require("@vhyxseal/react"),S=require("./Spinner-BZGPmp9c.cjs"),I=require("./useId-D2AEOm2G.cjs"),V="_button_1wjdv_1",g="_content_1wjdv_57",z="_spinner_1wjdv_190",D="_icon_1wjdv_198",n={button:V,content:g,spinner:z,icon:D},m=b.forwardRef(({variant:a="primary",size:j="md",loading:r=!1,icon:e,iconPosition:u="left",iconOnly:s=!1,asChild:f=!1,contract:c,className:v,children:d,disabled:_,id:y,"aria-label":l,...N},x)=>{const R=I.useId("vhyx-button"),o=y??R;process.env.NODE_ENV!=="production"&&s&&!l&&console.warn("[VhyxUI] <Button iconOnly> requires an aria-label for accessibility. Screen reader users will not be able to identify this button.");const w=b.useMemo(()=>{const B=a==="destructive"?{safetyLevel:"high",destructive:!0,requiresConfirmation:!0}:{};return{...i.buttonContract,id:o,...B,...c}},[a,o,c]),E=_??r,q=[n.button,v].filter(Boolean).join(" "),p={id:o,className:q,"aria-busy":r?!0:void 0,"aria-label":l,"data-variant":a,"data-size":j,"data-loading":r?!0:void 0,"data-icon-only":s?!0:void 0,"data-vhyx-contract":JSON.stringify(w),...N};return f?t.jsxRuntimeExports.jsx(i.Slot,{ref:x,...p,children:d}):t.jsxRuntimeExports.jsxs("button",{ref:x,disabled:E,...p,children:[r&&t.jsxRuntimeExports.jsx(S.Spinner,{size:"sm",variant:"white","aria-hidden":"true",label:"",className:n.spinner}),e&&u==="left"&&!s&&t.jsxRuntimeExports.jsx("span",{className:n.icon,"aria-hidden":"true",children:e}),s&&e?t.jsxRuntimeExports.jsx("span",{className:n.icon,"aria-hidden":"true",children:e}):!s&&t.jsxRuntimeExports.jsx("span",{className:n.content,children:d}),e&&u==="right"&&!s&&t.jsxRuntimeExports.jsx("span",{className:n.icon,"aria-hidden":"true",children:e})]})});m.displayName="VhyxButton";const U={...i.buttonContract,id:"vhyxui-button"},h=C.withAgentContract(m,U);h.displayName="VhyxButton";exports.Button=h;
1
+ "use strict";const t=require("./jsx-runtime-BRMkMA8J.cjs"),b=require("react"),i=require("@vhyxui/core"),C=require("@vhyxseal/react"),z=require("./Spinner-CeIDpqkx.cjs"),S=require("./useId-D2AEOm2G.cjs"),I="_button_z02sw_1",V="_content_z02sw_57",g="_spinner_z02sw_196",D="_icon_z02sw_204",n={button:I,content:V,spinner:g,icon:D},m=b.forwardRef(({variant:a="primary",size:f="md",loading:r=!1,icon:e,iconPosition:u="left",iconOnly:s=!1,asChild:j=!1,contract:c,className:_,children:d,disabled:v,id:y,"aria-label":l,...N},x)=>{const R=S.useId("vhyx-button"),o=y??R;process.env.NODE_ENV!=="production"&&s&&!l&&console.warn("[VhyxUI] <Button iconOnly> requires an aria-label for accessibility. Screen reader users will not be able to identify this button.");const w=b.useMemo(()=>{const B=a==="destructive"?{safetyLevel:"high",destructive:!0,requiresConfirmation:!0}:{};return{...i.buttonContract,id:o,...B,...c}},[a,o,c]),E=v??r,q=[n.button,_].filter(Boolean).join(" "),p={id:o,className:q,"aria-busy":r?!0:void 0,"aria-label":l,"data-variant":a,"data-size":f,"data-loading":r?!0:void 0,"data-icon-only":s?!0:void 0,"data-vhyx-contract":JSON.stringify(w),...N};return j?t.jsxRuntimeExports.jsx(i.Slot,{ref:x,...p,children:d}):t.jsxRuntimeExports.jsxs("button",{ref:x,disabled:E,...p,children:[r&&t.jsxRuntimeExports.jsx(z.Spinner,{size:"sm",variant:"white","aria-hidden":"true",label:"",className:n.spinner}),e&&u==="left"&&!s&&t.jsxRuntimeExports.jsx("span",{className:n.icon,"aria-hidden":"true",children:e}),s&&e?t.jsxRuntimeExports.jsx("span",{className:n.icon,"aria-hidden":"true",children:e}):!s&&t.jsxRuntimeExports.jsx("span",{className:n.content,children:d}),e&&u==="right"&&!s&&t.jsxRuntimeExports.jsx("span",{className:n.icon,"aria-hidden":"true",children:e})]})});m.displayName="VhyxButton";const U={...i.buttonContract,id:"vhyxui-button"},h=C.withAgentContract(m,U);h.displayName="VhyxButton";exports.Button=h;
@@ -0,0 +1 @@
1
+ "use strict";const r=require("./jsx-runtime-BRMkMA8J.cjs"),i=require("react"),y=require("@vhyxui/core"),g=require("@vhyxseal/react"),N=require("./useId-D2AEOm2G.cjs"),q="_card_wvqde_1",R="_header_wvqde_35",b="_body_wvqde_36",B="_footer_wvqde_37",w="_image_wvqde_102",s={card:q,header:R,body:b,footer:B,image:w};function E(e){return i.isValidElement(e)&&(e.type===c||e.type===n||e.type===m||e.type===u)}const l=i.forwardRef(({variant:e="default",padding:t="md",interactive:a=!1,contract:o,className:C,children:d,...f},p)=>{const j=N.useId("vhyx-card"),v={...y.cardContract,id:j,...o},_=[s.card,C].filter(Boolean).join(" "),h=i.Children.toArray(d).some(E)?d:r.jsxRuntimeExports.jsx(n,{children:d});return r.jsxRuntimeExports.jsx("div",{ref:p,className:_,"data-variant":e,"data-padding":t,"data-interactive":a?!0:void 0,"data-vhyx-contract":JSON.stringify(v),...f,children:h})});l.displayName="VhyxCard";function c({children:e,className:t,...a}){const o=[s.header,t].filter(Boolean).join(" ");return r.jsxRuntimeExports.jsx("div",{className:o,...a,children:e})}c.displayName="VhyxCardHeader";function n({children:e,className:t,...a}){const o=[s.body,t].filter(Boolean).join(" ");return r.jsxRuntimeExports.jsx("div",{className:o,...a,children:e})}n.displayName="VhyxCardBody";function m({children:e,className:t,...a}){const o=[s.footer,t].filter(Boolean).join(" ");return r.jsxRuntimeExports.jsx("div",{className:o,...a,children:e})}m.displayName="VhyxCardFooter";function u({children:e,className:t,...a}){const o=[s.image,t].filter(Boolean).join(" ");return r.jsxRuntimeExports.jsx("div",{className:o,...a,children:e})}u.displayName="VhyxCardImage";const V={...y.cardContract,id:"vhyxui-card"},x=Object.assign(g.withAgentContract(l,V),{Header:c,Body:n,Footer:m,Image:u});x.displayName="VhyxCard";exports.Card=x;
@@ -0,0 +1,79 @@
1
+ import { j as r } from "./jsx-runtime-CL69jGNW.js";
2
+ import i from "react";
3
+ import { cardContract as l } from "@vhyxui/core";
4
+ import { withAgentContract as h } from "@vhyxseal/react";
5
+ import { u as g } from "./useId-BGRmH6iF.js";
6
+ const N = "_card_wvqde_1", b = "_header_wvqde_35", B = "_body_wvqde_36", w = "_footer_wvqde_37", V = "_image_wvqde_102", s = {
7
+ card: N,
8
+ header: b,
9
+ body: B,
10
+ footer: w,
11
+ image: V
12
+ };
13
+ function q(a) {
14
+ return i.isValidElement(a) && (a.type === c || a.type === d || a.type === m || a.type === y);
15
+ }
16
+ const f = i.forwardRef(
17
+ ({
18
+ variant: a = "default",
19
+ padding: e = "md",
20
+ interactive: o = !1,
21
+ contract: t,
22
+ className: C,
23
+ children: n,
24
+ ...p
25
+ }, u) => {
26
+ const x = g("vhyx-card"), v = {
27
+ ...l,
28
+ id: x,
29
+ ...t
30
+ }, _ = [s.card, C].filter(Boolean).join(" "), j = i.Children.toArray(n).some(q) ? n : /* @__PURE__ */ r.jsx(d, { children: n });
31
+ return /* @__PURE__ */ r.jsx(
32
+ "div",
33
+ {
34
+ ref: u,
35
+ className: _,
36
+ "data-variant": a,
37
+ "data-padding": e,
38
+ "data-interactive": o ? !0 : void 0,
39
+ "data-vhyx-contract": JSON.stringify(v),
40
+ ...p,
41
+ children: j
42
+ }
43
+ );
44
+ }
45
+ );
46
+ f.displayName = "VhyxCard";
47
+ function c({ children: a, className: e, ...o }) {
48
+ const t = [s.header, e].filter(Boolean).join(" ");
49
+ return /* @__PURE__ */ r.jsx("div", { className: t, ...o, children: a });
50
+ }
51
+ c.displayName = "VhyxCardHeader";
52
+ function d({ children: a, className: e, ...o }) {
53
+ const t = [s.body, e].filter(Boolean).join(" ");
54
+ return /* @__PURE__ */ r.jsx("div", { className: t, ...o, children: a });
55
+ }
56
+ d.displayName = "VhyxCardBody";
57
+ function m({ children: a, className: e, ...o }) {
58
+ const t = [s.footer, e].filter(Boolean).join(" ");
59
+ return /* @__PURE__ */ r.jsx("div", { className: t, ...o, children: a });
60
+ }
61
+ m.displayName = "VhyxCardFooter";
62
+ function y({ children: a, className: e, ...o }) {
63
+ const t = [s.image, e].filter(Boolean).join(" ");
64
+ return /* @__PURE__ */ r.jsx("div", { className: t, ...o, children: a });
65
+ }
66
+ y.displayName = "VhyxCardImage";
67
+ const I = { ...l, id: "vhyxui-card" }, S = Object.assign(
68
+ h(f, I),
69
+ {
70
+ Header: c,
71
+ Body: d,
72
+ Footer: m,
73
+ Image: y
74
+ }
75
+ );
76
+ S.displayName = "VhyxCard";
77
+ export {
78
+ S as C
79
+ };
@@ -0,0 +1 @@
1
+ "use strict";const d=require("./jsx-runtime-BRMkMA8J.cjs"),o=require("react"),B=require("react-dom"),h=require("@vhyxui/core"),T=require("@vhyxseal/react"),A=require("./useId-D2AEOm2G.cjs"),O="_trigger_5e049_1",X="_content_5e049_7",z="_arrow_5e049_21",U="_close_5e049_29",E={trigger:O,content:X,arrow:z,close:U},_=o.createContext(null);function j(n){const i=o.useContext(_);if(!i)throw new h.VhyxUIError({code:h.VhyxUIErrorCode.VHYXUI_MISSING_CONTEXT,message:`${n} must be used within <Popover>`,suggestion:"Wrap your component tree with <Popover>"});return i}const N=o.forwardRef(({open:n,defaultOpen:i=!1,onOpenChange:t,contract:g,children:m},a)=>{const e=A.useId("vhyx-popover"),u=`${e}-trigger`,x=`${e}-content`,c=n!==void 0,[v,f]=o.useState(i),p=c?n:v,P=o.useRef(null),l=o.useRef(null),r=o.useCallback(s=>{c||f(s),t==null||t(s)},[c,t]);o.useEffect(()=>{if(!p)return;function s(R){var C;R.key==="Escape"&&(r(!1),(C=P.current)==null||C.focus())}return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[p,r]),o.useEffect(()=>{if(!p)return;function s(R){var b,I;const C=R.target;(b=P.current)!=null&&b.contains(C)||(I=l.current)!=null&&I.contains(C)||r(!1)}return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[p,r]);const y=o.useMemo(()=>({...h.popoverContract,id:e,...g}),[e,g]),w=o.useMemo(()=>({open:p,onOpenChange:r,triggerId:u,contentId:x,triggerRef:P,contentRef:l}),[p,r,u,x]);return d.jsxRuntimeExports.jsx(_.Provider,{value:w,children:d.jsxRuntimeExports.jsx("div",{ref:a,"data-state":p?"open":"closed","data-vhyx-contract":JSON.stringify(y),children:m})})});N.displayName="VhyxPopover";const L=o.forwardRef(({children:n,className:i,onClick:t,asChild:g=!1,...m},a)=>{const e=j("Popover.Trigger"),u=o.useCallback(f=>{e.triggerRef.current=f,typeof a=="function"?a(f):a&&(a.current=f)},[a,e.triggerRef]),x=o.useCallback(f=>{t==null||t(f),e.onOpenChange(!e.open)},[t,e]),c=[E.trigger,i].filter(Boolean).join(" "),v={id:e.triggerId,"aria-haspopup":"dialog","aria-expanded":e.open,"aria-controls":e.open?e.contentId:void 0,onClick:x,className:c,...m};return g?d.jsxRuntimeExports.jsx(h.Slot,{ref:u,...v,children:n}):d.jsxRuntimeExports.jsx("button",{ref:u,type:"button",...v,children:n})});L.displayName="VhyxPopoverTrigger";function S({children:n,className:i,side:t="bottom",align:g="center",style:m,...a}){const e=j("Popover.Content"),[u,x]=o.useState(!1),[c,v]=o.useState({top:0,left:0,transform:"translateX(-50%)"});o.useEffect(()=>{x(!0)},[]),o.useEffect(()=>{if(!e.open||!e.triggerRef.current)return;const l=()=>{const r=e.triggerRef.current.getBoundingClientRect(),y=8;let w=0,s=0,R="translateX(-50%)";t==="bottom"?(w=r.bottom+y,s=r.left+r.width/2):t==="top"?(w=r.top-y,s=r.left+r.width/2):t==="right"?(w=r.top+r.height/2,s=r.right+y):(w=r.top+r.height/2,s=r.left-y,R="translateX(-100%)"),v({top:w,left:s,transform:R})};return l(),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),()=>{window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)}},[e.open,e.triggerRef,t]);const f=o.useCallback(l=>{e.contentRef.current=l},[e.contentRef]);if(!u||!e.open)return null;const p=[E.content,i].filter(Boolean).join(" "),P=d.jsxRuntimeExports.jsx("div",{ref:f,id:e.contentId,role:"dialog","aria-modal":"false","aria-labelledby":e.triggerId,className:p,"data-state":"open","data-side":t,"data-align":g,...a,style:{...m,position:"fixed",top:c.top,left:c.left,zIndex:450,transform:c.transform},children:n});return B.createPortal(P,document.body)}S.displayName="VhyxPopoverContent";function V({className:n,...i}){const t=[E.arrow,n].filter(Boolean).join(" ");return d.jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 10 5",...i,children:d.jsxRuntimeExports.jsx("path",{d:"M0 5L5 0L10 5",fill:"currentColor"})})}V.displayName="VhyxPopoverArrow";const M=o.forwardRef(({children:n,className:i,onClick:t,asChild:g=!1,...m},a)=>{const e=j("Popover.Close"),u=o.useCallback(v=>{t==null||t(v),e.onOpenChange(!1)},[t,e]),x=[E.close,i].filter(Boolean).join(" "),c={onClick:u,className:x,...m};return g?d.jsxRuntimeExports.jsx(h.Slot,{ref:a,...c,children:n}):d.jsxRuntimeExports.jsx("button",{ref:a,type:"button",...c,children:n??"Close"})});M.displayName="VhyxPopoverClose";const $={...h.popoverContract,id:"vhyxui-popover"},q=Object.assign(T.withAgentContract(N,$),{Trigger:L,Content:S,Arrow:V,Close:M});q.displayName="VhyxPopover";exports.Popover=q;
@@ -0,0 +1,211 @@
1
+ import { j as d } from "./jsx-runtime-CL69jGNW.js";
2
+ import E, { useState as I, useRef as L, useCallback as C, useEffect as R, useMemo as V, createContext as U, useContext as $ } from "react";
3
+ import D from "react-dom";
4
+ import { popoverContract as B, Slot as M, VhyxUIError as G, 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", j = {
8
+ trigger: W,
9
+ content: Y,
10
+ arrow: q,
11
+ close: F
12
+ }, S = U(null);
13
+ function _(r) {
14
+ const s = $(S);
15
+ if (!s)
16
+ throw new G({
17
+ code: H.VHYXUI_MISSING_CONTEXT,
18
+ message: `${r} must be used within <Popover>`,
19
+ suggestion: "Wrap your component tree with <Popover>"
20
+ });
21
+ return s;
22
+ }
23
+ const T = E.forwardRef(
24
+ ({
25
+ open: r,
26
+ defaultOpen: s = !1,
27
+ onOpenChange: t,
28
+ contract: p,
29
+ children: v
30
+ }, i) => {
31
+ const e = K("vhyx-popover"), l = `${e}-trigger`, g = `${e}-content`, a = r !== void 0, [m, f] = I(s), u = a ? r : m, h = L(null), c = L(null), o = C(
32
+ (n) => {
33
+ a || f(n), t == null || t(n);
34
+ },
35
+ [a, t]
36
+ );
37
+ R(() => {
38
+ if (!u) return;
39
+ function n(y) {
40
+ var P;
41
+ y.key === "Escape" && (o(!1), (P = h.current) == null || P.focus());
42
+ }
43
+ return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
44
+ }, [u, o]), R(() => {
45
+ if (!u) return;
46
+ function n(y) {
47
+ var b, N;
48
+ const P = y.target;
49
+ (b = h.current) != null && b.contains(P) || (N = c.current) != null && N.contains(P) || o(!1);
50
+ }
51
+ return document.addEventListener("mousedown", n), () => document.removeEventListener("mousedown", n);
52
+ }, [u, o]);
53
+ const w = V(
54
+ () => ({ ...B, id: e, ...p }),
55
+ [e, p]
56
+ ), x = V(
57
+ () => ({
58
+ open: u,
59
+ onOpenChange: o,
60
+ triggerId: l,
61
+ contentId: g,
62
+ triggerRef: h,
63
+ contentRef: c
64
+ }),
65
+ [u, o, l, g]
66
+ );
67
+ return /* @__PURE__ */ d.jsx(S.Provider, { value: x, children: /* @__PURE__ */ d.jsx(
68
+ "div",
69
+ {
70
+ ref: i,
71
+ "data-state": u ? "open" : "closed",
72
+ "data-vhyx-contract": JSON.stringify(w),
73
+ children: v
74
+ }
75
+ ) });
76
+ }
77
+ );
78
+ T.displayName = "VhyxPopover";
79
+ const A = E.forwardRef(
80
+ ({ children: r, className: s, onClick: t, asChild: p = !1, ...v }, i) => {
81
+ const e = _("Popover.Trigger"), l = C(
82
+ (f) => {
83
+ e.triggerRef.current = f, typeof i == "function" ? i(f) : i && (i.current = f);
84
+ },
85
+ [i, e.triggerRef]
86
+ ), g = C(
87
+ (f) => {
88
+ t == null || t(f), e.onOpenChange(!e.open);
89
+ },
90
+ [t, e]
91
+ ), a = [j.trigger, s].filter(Boolean).join(" "), m = {
92
+ id: e.triggerId,
93
+ "aria-haspopup": "dialog",
94
+ "aria-expanded": e.open,
95
+ "aria-controls": e.open ? e.contentId : void 0,
96
+ onClick: g,
97
+ className: a,
98
+ ...v
99
+ };
100
+ return p ? /* @__PURE__ */ d.jsx(M, { ref: l, ...m, children: r }) : /* @__PURE__ */ d.jsx("button", { ref: l, type: "button", ...m, children: r });
101
+ }
102
+ );
103
+ A.displayName = "VhyxPopoverTrigger";
104
+ function O({
105
+ children: r,
106
+ className: s,
107
+ side: t = "bottom",
108
+ align: p = "center",
109
+ style: v,
110
+ ...i
111
+ }) {
112
+ const e = _("Popover.Content"), [l, g] = I(!1), [a, m] = I({
113
+ top: 0,
114
+ left: 0,
115
+ transform: "translateX(-50%)"
116
+ });
117
+ R(() => {
118
+ g(!0);
119
+ }, []), R(() => {
120
+ if (!e.open || !e.triggerRef.current) return;
121
+ const c = () => {
122
+ const o = e.triggerRef.current.getBoundingClientRect(), w = 8;
123
+ let x = 0, n = 0, y = "translateX(-50%)";
124
+ t === "bottom" ? (x = o.bottom + w, n = o.left + o.width / 2) : t === "top" ? (x = o.top - w, n = o.left + o.width / 2) : t === "right" ? (x = o.top + o.height / 2, n = o.right + w) : (x = o.top + o.height / 2, n = o.left - w, y = "translateX(-100%)"), m({ top: x, left: n, transform: y });
125
+ };
126
+ return c(), window.addEventListener("scroll", c, !0), window.addEventListener("resize", c), () => {
127
+ window.removeEventListener("scroll", c, !0), window.removeEventListener("resize", c);
128
+ };
129
+ }, [e.open, e.triggerRef, t]);
130
+ const f = C(
131
+ (c) => {
132
+ e.contentRef.current = c;
133
+ },
134
+ [e.contentRef]
135
+ );
136
+ if (!l || !e.open) return null;
137
+ const u = [j.content, s].filter(Boolean).join(" "), h = /* @__PURE__ */ d.jsx(
138
+ "div",
139
+ {
140
+ ref: f,
141
+ id: e.contentId,
142
+ role: "dialog",
143
+ "aria-modal": "false",
144
+ "aria-labelledby": e.triggerId,
145
+ className: u,
146
+ "data-state": "open",
147
+ "data-side": t,
148
+ "data-align": p,
149
+ ...i,
150
+ style: {
151
+ // Consumer's cosmetic style first — internal positioning keys below
152
+ // are applied explicitly afterward so they always win, instead of
153
+ // letting a whole `style` object from a blind `{...rest}` spread
154
+ // replace this element's positioning outright.
155
+ ...v,
156
+ position: "fixed",
157
+ top: a.top,
158
+ left: a.left,
159
+ zIndex: 450,
160
+ // --vhyx-z-popover
161
+ transform: a.transform
162
+ },
163
+ children: r
164
+ }
165
+ );
166
+ return D.createPortal(h, document.body);
167
+ }
168
+ O.displayName = "VhyxPopoverContent";
169
+ function X({ className: r, ...s }) {
170
+ const t = [j.arrow, r].filter(Boolean).join(" ");
171
+ return /* @__PURE__ */ d.jsx(
172
+ "svg",
173
+ {
174
+ "aria-hidden": "true",
175
+ className: t,
176
+ viewBox: "0 0 10 5",
177
+ ...s,
178
+ children: /* @__PURE__ */ d.jsx("path", { d: "M0 5L5 0L10 5", fill: "currentColor" })
179
+ }
180
+ );
181
+ }
182
+ X.displayName = "VhyxPopoverArrow";
183
+ const z = E.forwardRef(
184
+ ({ children: r, className: s, onClick: t, asChild: p = !1, ...v }, i) => {
185
+ const e = _("Popover.Close"), l = C(
186
+ (m) => {
187
+ t == null || t(m), e.onOpenChange(!1);
188
+ },
189
+ [t, e]
190
+ ), g = [j.close, s].filter(Boolean).join(" "), a = {
191
+ onClick: l,
192
+ className: g,
193
+ ...v
194
+ };
195
+ return p ? /* @__PURE__ */ d.jsx(M, { ref: i, ...a, children: r }) : /* @__PURE__ */ d.jsx("button", { ref: i, type: "button", ...a, children: r ?? "Close" });
196
+ }
197
+ );
198
+ z.displayName = "VhyxPopoverClose";
199
+ const Q = { ...B, id: "vhyxui-popover" }, Z = Object.assign(
200
+ J(T, Q),
201
+ {
202
+ Trigger: A,
203
+ Content: O,
204
+ Arrow: X,
205
+ Close: z
206
+ }
207
+ );
208
+ Z.displayName = "VhyxPopover";
209
+ export {
210
+ Z as P
211
+ };
@@ -0,0 +1 @@
1
+ "use strict";const p=require("./jsx-runtime-BRMkMA8J.cjs"),e=require("react"),re=require("react-dom"),L=require("@vhyxui/core"),oe=require("@vhyxseal/react"),O=require("./useId-D2AEOm2G.cjs"),ce="_trigger_1t193_3",ie="_content_1t193_81",ae="_item_1t193_101",le="_group_1t193_152",ue="_label_1t193_158",de="_separator_1t193_170",b={trigger:ce,"trigger-value":"_trigger-value_1t193_62","trigger-icon":"_trigger-icon_1t193_70",content:ie,item:ae,"item-check":"_item-check_1t193_141",group:le,label:ue,separator:de},X=e.createContext(null);function D(r){const n=e.useContext(X);if(!n)throw new L.VhyxUIError({code:L.VhyxUIErrorCode.VHYXUI_MISSING_CONTEXT,message:`${r} must be used within <Select>`,suggestion:"Wrap your component tree with <Select>"});return n}const Y=e.forwardRef(({value:r,defaultValue:n,onValueChange:l,disabled:m=!1,size:s="md",placeholder:f,contract:y,children:o,className:v,...c},R)=>{const S=O.useId("vhyx-select-trigger"),u=O.useId("vhyx-select-content"),x=O.useId("vhyx-select"),d=r!==void 0,[k,C]=e.useState(n),h=d?r:k,[t,N]=e.useState(!1),[I,E]=e.useState(void 0),V=e.useRef(null),T=e.useRef(null),_=e.useRef(new Map),B=e.useRef([]),z=e.useRef(new Map),[A,M]=e.useState(void 0),q=e.useRef(h);q.current=h,e.useEffect(()=>{if(h===void 0){M(void 0);return}const i=_.current.get(h);M(i?i.label:void 0)},[h]);const H=e.useCallback((i,a,g)=>{_.current.has(i)||B.current.push(i);const j={label:a};g!==void 0&&(j.disabled=g),_.current.set(i,j),i===q.current&&M(a)},[]),P=e.useCallback(()=>A,[A]),U=e.useCallback(i=>{var j;const a=B.current.filter(w=>{var F;return!((F=_.current.get(w))!=null&&F.disabled)});if(a.length===0)return;let g;if(i==="home")g=a[0];else if(i==="end")g=a[a.length-1];else{const w=I!==void 0?a.indexOf(I):-1;g=i==="down"?a[Math.min(w+1,a.length-1)]:a[Math.max(w-1,0)]}g!==void 0&&(E(g),(j=z.current.get(g))==null||j.focus())},[I]),W=e.useCallback(i=>{var a;d||C(i),l==null||l(i),N(!1),E(void 0),(a=V.current)==null||a.focus()},[d,l]),G=e.useCallback(i=>{if(N(i),i){const a=h??B.current[0];E(a)}else E(void 0)},[h]),ne=e.useMemo(()=>({...L.selectContract,id:x,...y}),[x,y]),se=e.useMemo(()=>({value:h,onValueChange:W,open:t,onOpenChange:G,disabled:m,size:s,placeholder:f,triggerId:S,contentId:u,triggerRef:V,contentRef:T,focusedValue:I,setFocusedValue:E,registerItem:H,getSelectedLabel:P,navigateItems:U,itemElementsRef:z,itemOrderRef:B,itemRegistryRef:_}),[h,W,t,G,m,s,f,S,u,I,H,P,U]);return e.useEffect(()=>{if(!t)return;function i(a){var g;a.key==="Escape"&&(N(!1),E(void 0),(g=V.current)==null||g.focus())}return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t]),e.useEffect(()=>{if(!t)return;function i(a){var j,w;const g=a.target;(j=V.current)!=null&&j.contains(g)||(w=T.current)!=null&&w.contains(g)||(N(!1),E(void 0))}return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[t]),p.jsxRuntimeExports.jsx(X.Provider,{value:se,children:p.jsxRuntimeExports.jsx("div",{ref:R,className:v,"data-size":s,"data-disabled":m?!0:void 0,"data-vhyx-contract":JSON.stringify(ne),...c,children:o})})});Y.displayName="VhyxSelect";const J=e.forwardRef((r,n)=>{const{icon:l,className:m,asChild:s=!1,children:f,...y}=r,o=D("Select.Trigger"),v=o.getSelectedLabel(),c=e.useCallback(d=>{o.triggerRef.current=d,typeof n=="function"?n(d):n&&(n.current=d)},[n,o.triggerRef]),R=e.useCallback(()=>{o.disabled||o.onOpenChange(!o.open)},[o]),S=e.useCallback(d=>{(d.key==="ArrowDown"||d.key==="ArrowUp")&&(d.preventDefault(),o.open||o.onOpenChange(!0))},[o]),u=[b.trigger,m].filter(Boolean).join(" "),x={id:o.triggerId,role:"combobox","aria-haspopup":"listbox","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,disabled:o.disabled,onClick:R,onKeyDown:S,className:u,"data-size":o.size,"data-state":o.open?"open":"closed","data-placeholder":v?void 0:!0,...y};return s?p.jsxRuntimeExports.jsx(L.Slot,{ref:c,...x,children:f}):p.jsxRuntimeExports.jsxs("button",{ref:c,type:"button",...x,children:[p.jsxRuntimeExports.jsx("span",{className:b["trigger-value"],children:v??o.placeholder??"Select…"}),p.jsxRuntimeExports.jsx("span",{className:b["trigger-icon"],"aria-hidden":"true",children:l??p.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:p.jsxRuntimeExports.jsx("path",{d:"M2.5 4.5L6 8L9.5 4.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})});J.displayName="VhyxSelectTrigger";function $({children:r,className:n,style:l,...m}){const s=D("Select.Content"),[f,y]=e.useState(!1),[o,v]=e.useState({position:"fixed",top:0,left:0,minWidth:0,zIndex:"var(--vhyx-z-dropdown)"});e.useEffect(()=>{y(!0)},[]),e.useEffect(()=>{if(!s.open||!s.triggerRef.current)return;const u=()=>{var t;const x=s.triggerRef.current.getBoundingClientRect(),d=window.innerHeight-x.bottom,k=x.top,C=((t=s.contentRef.current)==null?void 0:t.scrollHeight)??300,h=d<C&&k>d;v({position:"fixed",top:h?x.top-C-4:x.bottom+4,left:x.left,minWidth:x.width,zIndex:"var(--vhyx-z-dropdown)",maxHeight:h?Math.min(C,k-8):Math.min(C,d-8),overflowY:"auto"})};return u(),window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[s.open,s.triggerRef]),e.useEffect(()=>{var u;!s.open||!s.focusedValue||(u=s.itemElementsRef.current.get(s.focusedValue))==null||u.focus()},[s.open]);const c=e.useCallback(u=>{s.contentRef.current=u},[s.contentRef]);if(!f)return null;const R=[b.content,n].filter(Boolean).join(" "),S=p.jsxRuntimeExports.jsx("div",{ref:c,id:s.contentId,role:"listbox","aria-labelledby":s.triggerId,className:R,"data-state":s.open?"open":"closed",...m,style:{...l,...o},children:r});return re.createPortal(S,document.body)}$.displayName="VhyxSelectContent";const K=e.forwardRef(({value:r,disabled:n,children:l,className:m,onClick:s,onKeyDown:f,onMouseEnter:y,...o},v)=>{const c=D("Select.Item"),R=c.value===r,S=c.focusedValue===r,u=typeof l=="string"?l:"";e.useEffect(()=>{c.registerItem(r,u,n)},[c,r,u,n]);const x=e.useCallback(t=>{t?c.itemElementsRef.current.set(r,t):c.itemElementsRef.current.delete(r),typeof v=="function"?v(t):v&&(v.current=t)},[v,c,r]),d=e.useCallback(t=>{s==null||s(t),n||c.onValueChange(r)},[s,n,c,r]),k=e.useCallback(t=>{f==null||f(t),t.key==="Enter"||t.key===" "?(t.preventDefault(),n||c.onValueChange(r)):t.key==="ArrowDown"?(t.preventDefault(),c.navigateItems("down")):t.key==="ArrowUp"?(t.preventDefault(),c.navigateItems("up")):t.key==="Home"?(t.preventDefault(),c.navigateItems("home")):t.key==="End"&&(t.preventDefault(),c.navigateItems("end"))},[f,n,c,r]),C=e.useCallback(t=>{y==null||y(t),!n&&(c.setFocusedValue(r),t.currentTarget.focus())},[y,n,c,r]),h=[b.item,m].filter(Boolean).join(" ");return p.jsxRuntimeExports.jsxs("div",{ref:x,role:"option","aria-selected":R,"aria-disabled":n?!0:void 0,tabIndex:S?0:-1,onClick:d,onKeyDown:k,onMouseEnter:C,className:h,"data-state":R?"selected":"unselected","data-disabled":n?!0:void 0,"data-focused":S?!0:void 0,...o,children:[l,R&&p.jsxRuntimeExports.jsx("span",{className:b["item-check"],"aria-hidden":"true",children:p.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:p.jsxRuntimeExports.jsx("polyline",{points:"2,6 5,9 10,3"})})})]})});K.displayName="VhyxSelectItem";function Q({children:r,className:n,...l}){const m=O.useId("vhyx-select-group-label"),s=[b.group,n].filter(Boolean).join(" ");return p.jsxRuntimeExports.jsx("div",{role:"group","aria-labelledby":m,className:s,...l,children:e.Children.map(r,f=>e.isValidElement(f)&&f.type.displayName==="VhyxSelectLabel"?e.cloneElement(f,{id:m}):f)})}Q.displayName="VhyxSelectGroup";function Z({children:r,className:n,...l}){const m=[b.label,n].filter(Boolean).join(" ");return p.jsxRuntimeExports.jsx("span",{className:m,...l,children:r})}Z.displayName="VhyxSelectLabel";function ee({className:r,...n}){const l=[b.separator,r].filter(Boolean).join(" ");return p.jsxRuntimeExports.jsx("hr",{"aria-hidden":"true",className:l,...n})}ee.displayName="VhyxSelectSeparator";const fe={...L.selectContract,id:"vhyxui-select"},te=Object.assign(oe.withAgentContract(Y,fe),{Trigger:J,Content:$,Item:K,Group:Q,Label:Z,Separator:ee});te.displayName="VhyxSelect";exports.Select=te;