@vhyxui/react 0.2.1-alpha → 0.3.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.
@@ -0,0 +1 @@
1
+ "use strict";const x=require("./jsx-runtime-BRMkMA8J.cjs"),o=require("react"),M=require("react-dom"),j=require("@vhyxui/core"),A=require("@vhyxseal/react"),O=require("./useId-D2AEOm2G.cjs"),I=require("./floatingPosition-oslPPzF_.cjs"),H="_trigger_5e049_1",W="_content_5e049_7",z="_arrow_5e049_21",U="_close_5e049_29",b={trigger:H,content:W,arrow:z,close:U},N=o.createContext(null);function _(n){const c=o.useContext(N);if(!c)throw new j.VhyxUIError({code:j.VhyxUIErrorCode.VHYXUI_MISSING_CONTEXT,message:`${n} must be used within <Popover>`,suggestion:"Wrap your component tree with <Popover>"});return c}const V=o.forwardRef(({open:n,defaultOpen:c=!1,onOpenChange:t,contract:s,children:P},a)=>{const e=O.useId("vhyx-popover"),l=`${e}-trigger`,v=`${e}-content`,f=n!==void 0,[m,p]=o.useState(c),g=f?n:m,E=o.useRef(null),C=o.useRef(null),u=o.useCallback(i=>{f||p(i),t==null||t(i)},[f,t]);o.useEffect(()=>{if(!g)return;function i(h){var d;h.key==="Escape"&&(u(!1),(d=E.current)==null||d.focus())}return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[g,u]),o.useEffect(()=>{if(!g)return;function i(h){var R,y;const d=h.target;(R=E.current)!=null&&R.contains(d)||(y=C.current)!=null&&y.contains(d)||u(!1)}return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[g,u]);const r=o.useMemo(()=>({...j.popoverContract,id:e,...s}),[e,s]),w=o.useMemo(()=>({open:g,onOpenChange:u,triggerId:l,contentId:v,triggerRef:E,contentRef:C}),[g,u,l,v]);return x.jsxRuntimeExports.jsx(N.Provider,{value:w,children:x.jsxRuntimeExports.jsx("div",{ref:a,"data-state":g?"open":"closed","data-vhyx-contract":JSON.stringify(r),children:P})})});V.displayName="VhyxPopover";const L=o.forwardRef(({children:n,className:c,onClick:t,asChild:s=!1,...P},a)=>{const e=_("Popover.Trigger"),l=o.useCallback(p=>{e.triggerRef.current=p,typeof a=="function"?a(p):a&&(a.current=p)},[a,e.triggerRef]),v=o.useCallback(p=>{t==null||t(p),e.onOpenChange(!e.open)},[t,e]),f=[b.trigger,c].filter(Boolean).join(" "),m={id:e.triggerId,"aria-haspopup":"dialog","aria-expanded":e.open,"aria-controls":e.open?e.contentId:void 0,onClick:v,className:f,...P};return s?x.jsxRuntimeExports.jsx(j.Slot,{ref:l,...m,children:n}):x.jsxRuntimeExports.jsx("button",{ref:l,type:"button",...m,children:n})});L.displayName="VhyxPopoverTrigger";function S({children:n,className:c,side:t="bottom",align:s="center",style:P,...a}){const e=_("Popover.Content"),[l,v]=o.useState(!1),[f,m]=o.useState({top:0,left:0});o.useEffect(()=>{v(!0)},[]),o.useEffect(()=>{if(!l||!e.open||!e.triggerRef.current)return;const C=()=>{const r=e.triggerRef.current.getBoundingClientRect(),w=e.contentRef.current,i=(w==null?void 0:w.offsetWidth)??r.width,h=(w==null?void 0:w.offsetHeight)??0,d=8;let R,y;t==="bottom"||t==="top"?(R=t==="bottom"?r.bottom+d:r.top-d-h,s==="start"?y=r.left:s==="end"?y=r.right-i:y=r.left+r.width/2-i/2):(y=t==="right"?r.right+d:r.left-d-i,s==="start"?R=r.top:s==="end"?R=r.bottom-h:R=r.top+r.height/2-h/2),m({top:I.clampToViewport(R,h,window.innerHeight),left:I.clampToViewport(y,i,window.innerWidth)})};C();const u=I.rafBatched(C);return window.addEventListener("scroll",u.run,!0),window.addEventListener("resize",u.run),()=>{u.cancel(),window.removeEventListener("scroll",u.run,!0),window.removeEventListener("resize",u.run)}},[l,e.open,e.triggerRef,t,s]);const p=o.useCallback(C=>{e.contentRef.current=C},[e.contentRef]);if(!l||!e.open)return null;const g=[b.content,c].filter(Boolean).join(" "),E=x.jsxRuntimeExports.jsx("div",{ref:p,id:e.contentId,role:"dialog","aria-modal":"false","aria-labelledby":e.triggerId,className:g,"data-state":"open","data-side":t,"data-align":s,...a,style:{...P,position:"fixed",top:f.top,left:f.left,zIndex:450},children:n});return M.createPortal(E,document.body)}S.displayName="VhyxPopoverContent";function T({className:n,...c}){const t=[b.arrow,n].filter(Boolean).join(" ");return x.jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 10 5",...c,children:x.jsxRuntimeExports.jsx("path",{d:"M0 5L5 0L10 5",fill:"currentColor"})})}T.displayName="VhyxPopoverArrow";const q=o.forwardRef(({children:n,className:c,onClick:t,asChild:s=!1,...P},a)=>{const e=_("Popover.Close"),l=o.useCallback(m=>{t==null||t(m),e.onOpenChange(!1)},[t,e]),v=[b.close,c].filter(Boolean).join(" "),f={onClick:l,className:v,...P};return s?x.jsxRuntimeExports.jsx(j.Slot,{ref:a,...f,children:n}):x.jsxRuntimeExports.jsx("button",{ref:a,type:"button",...f,children:n??"Close"})});q.displayName="VhyxPopoverClose";const $={...j.popoverContract,id:"vhyxui-popover"},B=Object.assign(A.withAgentContract(V,$),{Trigger:L,Content:S,Arrow:T,Close:q});B.displayName="VhyxPopover";exports.Popover=B;
@@ -0,0 +1,215 @@
1
+ import { j as g } from "./jsx-runtime-CL69jGNW.js";
2
+ import N, { useState as _, useRef as L, useCallback as b, useEffect as j, useMemo as V, createContext as U, useContext as $ } from "react";
3
+ import D from "react-dom";
4
+ import { popoverContract as T, Slot as M, VhyxUIError as G, VhyxUIErrorCode as X } from "@vhyxui/core";
5
+ import { withAgentContract as J } from "@vhyxseal/react";
6
+ import { u as K } from "./useId-BGRmH6iF.js";
7
+ import { c as B, r as Y } from "./floatingPosition-UeYoO5K4.js";
8
+ const q = "_trigger_5e049_1", F = "_content_5e049_7", Q = "_arrow_5e049_21", Z = "_close_5e049_29", I = {
9
+ trigger: q,
10
+ content: F,
11
+ arrow: Q,
12
+ close: Z
13
+ }, S = U(null);
14
+ function E(r) {
15
+ const i = $(S);
16
+ if (!i)
17
+ throw new G({
18
+ code: X.VHYXUI_MISSING_CONTEXT,
19
+ message: `${r} must be used within <Popover>`,
20
+ suggestion: "Wrap your component tree with <Popover>"
21
+ });
22
+ return i;
23
+ }
24
+ const A = N.forwardRef(
25
+ ({
26
+ open: r,
27
+ defaultOpen: i = !1,
28
+ onOpenChange: t,
29
+ contract: n,
30
+ children: P
31
+ }, c) => {
32
+ const e = K("vhyx-popover"), l = `${e}-trigger`, m = `${e}-content`, f = r !== void 0, [v, u] = _(i), p = f ? r : v, C = L(null), R = L(null), a = b(
33
+ (s) => {
34
+ f || u(s), t == null || t(s);
35
+ },
36
+ [f, t]
37
+ );
38
+ j(() => {
39
+ if (!p) return;
40
+ function s(h) {
41
+ var d;
42
+ h.key === "Escape" && (a(!1), (d = C.current) == null || d.focus());
43
+ }
44
+ return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
45
+ }, [p, a]), j(() => {
46
+ if (!p) return;
47
+ function s(h) {
48
+ var x, y;
49
+ const d = h.target;
50
+ (x = C.current) != null && x.contains(d) || (y = R.current) != null && y.contains(d) || a(!1);
51
+ }
52
+ return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
53
+ }, [p, a]);
54
+ const o = V(
55
+ () => ({ ...T, id: e, ...n }),
56
+ [e, n]
57
+ ), w = V(
58
+ () => ({
59
+ open: p,
60
+ onOpenChange: a,
61
+ triggerId: l,
62
+ contentId: m,
63
+ triggerRef: C,
64
+ contentRef: R
65
+ }),
66
+ [p, a, l, m]
67
+ );
68
+ return /* @__PURE__ */ g.jsx(S.Provider, { value: w, children: /* @__PURE__ */ g.jsx(
69
+ "div",
70
+ {
71
+ ref: c,
72
+ "data-state": p ? "open" : "closed",
73
+ "data-vhyx-contract": JSON.stringify(o),
74
+ children: P
75
+ }
76
+ ) });
77
+ }
78
+ );
79
+ A.displayName = "VhyxPopover";
80
+ const O = N.forwardRef(
81
+ ({ children: r, className: i, onClick: t, asChild: n = !1, ...P }, c) => {
82
+ const e = E("Popover.Trigger"), l = b(
83
+ (u) => {
84
+ e.triggerRef.current = u, typeof c == "function" ? c(u) : c && (c.current = u);
85
+ },
86
+ [c, e.triggerRef]
87
+ ), m = b(
88
+ (u) => {
89
+ t == null || t(u), e.onOpenChange(!e.open);
90
+ },
91
+ [t, e]
92
+ ), f = [I.trigger, i].filter(Boolean).join(" "), v = {
93
+ id: e.triggerId,
94
+ "aria-haspopup": "dialog",
95
+ "aria-expanded": e.open,
96
+ "aria-controls": e.open ? e.contentId : void 0,
97
+ onClick: m,
98
+ className: f,
99
+ ...P
100
+ };
101
+ return n ? /* @__PURE__ */ g.jsx(M, { ref: l, ...v, children: r }) : /* @__PURE__ */ g.jsx("button", { ref: l, type: "button", ...v, children: r });
102
+ }
103
+ );
104
+ O.displayName = "VhyxPopoverTrigger";
105
+ function H({
106
+ children: r,
107
+ className: i,
108
+ side: t = "bottom",
109
+ align: n = "center",
110
+ style: P,
111
+ ...c
112
+ }) {
113
+ const e = E("Popover.Content"), [l, m] = _(!1), [f, v] = _({
114
+ top: 0,
115
+ left: 0
116
+ });
117
+ j(() => {
118
+ m(!0);
119
+ }, []), j(() => {
120
+ if (!l || !e.open || !e.triggerRef.current) return;
121
+ const R = () => {
122
+ const o = e.triggerRef.current.getBoundingClientRect(), w = e.contentRef.current, s = (w == null ? void 0 : w.offsetWidth) ?? o.width, h = (w == null ? void 0 : w.offsetHeight) ?? 0, d = 8;
123
+ let x, y;
124
+ t === "bottom" || t === "top" ? (x = t === "bottom" ? o.bottom + d : o.top - d - h, n === "start" ? y = o.left : n === "end" ? y = o.right - s : y = o.left + o.width / 2 - s / 2) : (y = t === "right" ? o.right + d : o.left - d - s, n === "start" ? x = o.top : n === "end" ? x = o.bottom - h : x = o.top + o.height / 2 - h / 2), v({
125
+ top: B(x, h, window.innerHeight),
126
+ left: B(y, s, window.innerWidth)
127
+ });
128
+ };
129
+ R();
130
+ const a = Y(R);
131
+ return window.addEventListener("scroll", a.run, !0), window.addEventListener("resize", a.run), () => {
132
+ a.cancel(), window.removeEventListener("scroll", a.run, !0), window.removeEventListener("resize", a.run);
133
+ };
134
+ }, [l, e.open, e.triggerRef, t, n]);
135
+ const u = b(
136
+ (R) => {
137
+ e.contentRef.current = R;
138
+ },
139
+ [e.contentRef]
140
+ );
141
+ if (!l || !e.open) return null;
142
+ const p = [I.content, i].filter(Boolean).join(" "), C = /* @__PURE__ */ g.jsx(
143
+ "div",
144
+ {
145
+ ref: u,
146
+ id: e.contentId,
147
+ role: "dialog",
148
+ "aria-modal": "false",
149
+ "aria-labelledby": e.triggerId,
150
+ className: p,
151
+ "data-state": "open",
152
+ "data-side": t,
153
+ "data-align": n,
154
+ ...c,
155
+ style: {
156
+ // Consumer's cosmetic style first — internal positioning keys below
157
+ // are applied explicitly afterward so they always win, instead of
158
+ // letting a whole `style` object from a blind `{...rest}` spread
159
+ // replace this element's positioning outright.
160
+ ...P,
161
+ position: "fixed",
162
+ top: f.top,
163
+ left: f.left,
164
+ zIndex: 450
165
+ // --vhyx-z-popover
166
+ },
167
+ children: r
168
+ }
169
+ );
170
+ return D.createPortal(C, document.body);
171
+ }
172
+ H.displayName = "VhyxPopoverContent";
173
+ function W({ className: r, ...i }) {
174
+ const t = [I.arrow, r].filter(Boolean).join(" ");
175
+ return /* @__PURE__ */ g.jsx(
176
+ "svg",
177
+ {
178
+ "aria-hidden": "true",
179
+ className: t,
180
+ viewBox: "0 0 10 5",
181
+ ...i,
182
+ children: /* @__PURE__ */ g.jsx("path", { d: "M0 5L5 0L10 5", fill: "currentColor" })
183
+ }
184
+ );
185
+ }
186
+ W.displayName = "VhyxPopoverArrow";
187
+ const z = N.forwardRef(
188
+ ({ children: r, className: i, onClick: t, asChild: n = !1, ...P }, c) => {
189
+ const e = E("Popover.Close"), l = b(
190
+ (v) => {
191
+ t == null || t(v), e.onOpenChange(!1);
192
+ },
193
+ [t, e]
194
+ ), m = [I.close, i].filter(Boolean).join(" "), f = {
195
+ onClick: l,
196
+ className: m,
197
+ ...P
198
+ };
199
+ return n ? /* @__PURE__ */ g.jsx(M, { ref: c, ...f, children: r }) : /* @__PURE__ */ g.jsx("button", { ref: c, type: "button", ...f, children: r ?? "Close" });
200
+ }
201
+ );
202
+ z.displayName = "VhyxPopoverClose";
203
+ const k = { ...T, id: "vhyxui-popover" }, ee = Object.assign(
204
+ J(A, k),
205
+ {
206
+ Trigger: O,
207
+ Content: H,
208
+ Arrow: W,
209
+ Close: z
210
+ }
211
+ );
212
+ ee.displayName = "VhyxPopover";
213
+ export {
214
+ ee as P
215
+ };
@@ -0,0 +1 @@
1
+ "use strict";const f=require("./jsx-runtime-BRMkMA8J.cjs"),e=require("react"),ie=require("react-dom"),N=require("@vhyxui/core"),ce=require("@vhyxseal/react"),M=require("./useId-D2AEOm2G.cjs"),O=require("./floatingPosition-oslPPzF_.cjs"),ae="_trigger_1t193_3",le="_content_1t193_81",ue="_item_1t193_101",de="_group_1t193_152",fe="_label_1t193_158",pe="_separator_1t193_170",w={trigger:ae,"trigger-value":"_trigger-value_1t193_62","trigger-icon":"_trigger-icon_1t193_70",content:le,item:ue,"item-check":"_item-check_1t193_141",group:de,label:fe,separator:pe},J=e.createContext(null);function A(t){return t==null||typeof t=="boolean"?"":typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(A).join(""):e.isValidElement(t)?A(t.props.children):""}function D(t){const r=e.useContext(J);if(!r)throw new N.VhyxUIError({code:N.VhyxUIErrorCode.VHYXUI_MISSING_CONTEXT,message:`${t} must be used within <Select>`,suggestion:"Wrap your component tree with <Select>"});return r}const $=e.forwardRef(({value:t,defaultValue:r,onValueChange:u,disabled:x=!1,size:s="md",placeholder:d,contract:v,children:o,className:y,...i},b)=>{const S=M.useId("vhyx-select-trigger"),p=M.useId("vhyx-select-content"),h=M.useId("vhyx-select"),a=t!==void 0,[E,_]=e.useState(r),g=a?t:E,[n,C]=e.useState(!1),[k,R]=e.useState(void 0),V=e.useRef(null),H=e.useRef(null),L=e.useRef(new Map),B=e.useRef([]),q=e.useRef(new Map),[z,T]=e.useState(void 0),P=e.useRef(g);P.current=g,e.useEffect(()=>{if(g===void 0){T(void 0);return}const c=L.current.get(g);T(c?c.label:void 0)},[g]);const W=e.useCallback((c,l,m)=>{L.current.has(c)||B.current.push(c);const j={label:l};m!==void 0&&(j.disabled=m),L.current.set(c,j),c===P.current&&T(l)},[]),U=e.useCallback(()=>z,[z]),G=e.useCallback(c=>{var j;const l=B.current.filter(I=>{var Y;return!((Y=L.current.get(I))!=null&&Y.disabled)});if(l.length===0)return;let m;if(c==="home")m=l[0];else if(c==="end")m=l[l.length-1];else{const I=k!==void 0?l.indexOf(k):-1;m=c==="down"?l[Math.min(I+1,l.length-1)]:l[Math.max(I-1,0)]}m!==void 0&&(R(m),(j=q.current.get(m))==null||j.focus())},[k]),F=e.useCallback(c=>{var l;a||_(c),u==null||u(c),C(!1),R(void 0),(l=V.current)==null||l.focus()},[a,u]),X=e.useCallback(c=>{if(C(c),c){const l=g??B.current[0];R(l)}else R(void 0)},[g]),se=e.useMemo(()=>({...N.selectContract,id:h,...v}),[h,v]),oe=e.useMemo(()=>({value:g,onValueChange:F,open:n,onOpenChange:X,disabled:x,size:s,placeholder:d,triggerId:S,contentId:p,triggerRef:V,contentRef:H,focusedValue:k,setFocusedValue:R,registerItem:W,getSelectedLabel:U,navigateItems:G,itemElementsRef:q,itemOrderRef:B,itemRegistryRef:L}),[g,F,n,X,x,s,d,S,p,k,W,U,G]);return e.useEffect(()=>{if(!n)return;function c(l){var m;l.key==="Escape"&&(C(!1),R(void 0),(m=V.current)==null||m.focus())}return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[n]),e.useEffect(()=>{if(!n)return;function c(l){var j,I;const m=l.target;(j=V.current)!=null&&j.contains(m)||(I=H.current)!=null&&I.contains(m)||(C(!1),R(void 0))}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]),f.jsxRuntimeExports.jsx(J.Provider,{value:oe,children:f.jsxRuntimeExports.jsx("div",{ref:b,className:y,"data-size":s,"data-disabled":x?!0:void 0,"data-vhyx-contract":JSON.stringify(se),...i,children:o})})});$.displayName="VhyxSelect";const K=e.forwardRef((t,r)=>{const{icon:u,className:x,asChild:s=!1,children:d,...v}=t,o=D("Select.Trigger"),y=o.getSelectedLabel(),i=e.useCallback(a=>{o.triggerRef.current=a,typeof r=="function"?r(a):r&&(r.current=a)},[r,o.triggerRef]),b=e.useCallback(()=>{o.disabled||o.onOpenChange(!o.open)},[o]),S=e.useCallback(a=>{(a.key==="ArrowDown"||a.key==="ArrowUp")&&(a.preventDefault(),o.open||o.onOpenChange(!0))},[o]),p=[w.trigger,x].filter(Boolean).join(" "),h={id:o.triggerId,role:"combobox","aria-haspopup":"listbox","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,disabled:o.disabled,onClick:b,onKeyDown:S,className:p,"data-size":o.size,"data-state":o.open?"open":"closed","data-placeholder":y?void 0:!0,...v};return s?f.jsxRuntimeExports.jsx(N.Slot,{ref:i,...h,children:d}):f.jsxRuntimeExports.jsxs("button",{ref:i,type:"button",...h,children:[f.jsxRuntimeExports.jsx("span",{className:w["trigger-value"],children:y??o.placeholder??"Select…"}),f.jsxRuntimeExports.jsx("span",{className:w["trigger-icon"],"aria-hidden":"true",children:u??f.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:f.jsxRuntimeExports.jsx("path",{d:"M2.5 4.5L6 8L9.5 4.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})});K.displayName="VhyxSelectTrigger";function Q({children:t,className:r,style:u,...x}){const s=D("Select.Content"),[d,v]=e.useState(!1),[o,y]=e.useState({position:"fixed",top:0,left:0,minWidth:0,zIndex:"var(--vhyx-z-dropdown)"});e.useEffect(()=>{v(!0)},[]),e.useEffect(()=>{if(!s.open||!s.triggerRef.current)return;const p=()=>{var R;const a=s.triggerRef.current.getBoundingClientRect(),E=window.innerHeight-a.bottom,_=a.top,g=((R=s.contentRef.current)==null?void 0:R.scrollHeight)??300,n=E<g&&_>E,C=n?Math.min(g,_-8):Math.min(g,E-8),k=n?a.top-C-4:a.bottom+4;y({position:"fixed",top:O.clampToViewport(k,C,window.innerHeight),left:O.clampToViewport(a.left,a.width,window.innerWidth),minWidth:a.width,zIndex:"var(--vhyx-z-dropdown)",maxHeight:C,overflowY:"auto"})};p();const h=O.rafBatched(p);return window.addEventListener("scroll",h.run,!0),window.addEventListener("resize",h.run),()=>{h.cancel(),window.removeEventListener("scroll",h.run,!0),window.removeEventListener("resize",h.run)}},[s.open,s.triggerRef]),e.useEffect(()=>{var p;!s.open||!s.focusedValue||(p=s.itemElementsRef.current.get(s.focusedValue))==null||p.focus()},[s.open]);const i=e.useCallback(p=>{s.contentRef.current=p},[s.contentRef]);if(!d)return null;const b=[w.content,r].filter(Boolean).join(" "),S=f.jsxRuntimeExports.jsx("div",{ref:i,id:s.contentId,role:"listbox","aria-labelledby":s.triggerId,className:b,"data-state":s.open?"open":"closed",...x,style:{...u,...o},children:t});return ie.createPortal(S,document.body)}Q.displayName="VhyxSelectContent";const Z=e.forwardRef(({value:t,disabled:r,children:u,className:x,onClick:s,onKeyDown:d,onMouseEnter:v,...o},y)=>{const i=D("Select.Item"),b=i.value===t,S=i.focusedValue===t,p=A(u);e.useEffect(()=>{i.registerItem(t,p,r)},[i,t,p,r]);const h=e.useCallback(n=>{n?i.itemElementsRef.current.set(t,n):i.itemElementsRef.current.delete(t),typeof y=="function"?y(n):y&&(y.current=n)},[y,i,t]),a=e.useCallback(n=>{s==null||s(n),r||i.onValueChange(t)},[s,r,i,t]),E=e.useCallback(n=>{d==null||d(n),n.key==="Enter"||n.key===" "?(n.preventDefault(),r||i.onValueChange(t)):n.key==="ArrowDown"?(n.preventDefault(),i.navigateItems("down")):n.key==="ArrowUp"?(n.preventDefault(),i.navigateItems("up")):n.key==="Home"?(n.preventDefault(),i.navigateItems("home")):n.key==="End"&&(n.preventDefault(),i.navigateItems("end"))},[d,r,i,t]),_=e.useCallback(n=>{v==null||v(n),!r&&(i.setFocusedValue(t),n.currentTarget.focus())},[v,r,i,t]),g=[w.item,x].filter(Boolean).join(" ");return f.jsxRuntimeExports.jsxs("div",{ref:h,role:"option","aria-selected":b,"aria-disabled":r?!0:void 0,tabIndex:S?0:-1,onClick:a,onKeyDown:E,onMouseEnter:_,className:g,"data-state":b?"selected":"unselected","data-disabled":r?!0:void 0,"data-focused":S?!0:void 0,...o,children:[u,b&&f.jsxRuntimeExports.jsx("span",{className:w["item-check"],"aria-hidden":"true",children:f.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:f.jsxRuntimeExports.jsx("polyline",{points:"2,6 5,9 10,3"})})})]})});Z.displayName="VhyxSelectItem";function ee({children:t,className:r,...u}){const x=M.useId("vhyx-select-group-label"),s=[w.group,r].filter(Boolean).join(" ");return f.jsxRuntimeExports.jsx("div",{role:"group","aria-labelledby":x,className:s,...u,children:e.Children.map(t,d=>e.isValidElement(d)&&d.type.displayName==="VhyxSelectLabel"?e.cloneElement(d,{id:x}):d)})}ee.displayName="VhyxSelectGroup";function te({children:t,className:r,...u}){const x=[w.label,r].filter(Boolean).join(" ");return f.jsxRuntimeExports.jsx("span",{className:x,...u,children:t})}te.displayName="VhyxSelectLabel";function ne({className:t,...r}){const u=[w.separator,t].filter(Boolean).join(" ");return f.jsxRuntimeExports.jsx("hr",{"aria-hidden":"true",className:u,...r})}ne.displayName="VhyxSelectSeparator";const ge={...N.selectContract,id:"vhyxui-select"},re=Object.assign(ce.withAgentContract($,ge),{Trigger:K,Content:Q,Item:Z,Group:ee,Label:te,Separator:ne});re.displayName="VhyxSelect";exports.Select=re;
@@ -0,0 +1,350 @@
1
+ import { j as d } from "./jsx-runtime-CL69jGNW.js";
2
+ import N, { useState as B, useRef as E, useEffect as k, useCallback as x, useMemo as K, createContext as ue, useContext as de } from "react";
3
+ import fe from "react-dom";
4
+ import { selectContract as Z, Slot as pe, VhyxUIError as ge, VhyxUIErrorCode as me } from "@vhyxui/core";
5
+ import { withAgentContract as he } from "@vhyxseal/react";
6
+ import { u as D } from "./useId-BGRmH6iF.js";
7
+ import { c as Q, r as xe } from "./floatingPosition-UeYoO5K4.js";
8
+ const ye = "_trigger_1t193_3", ve = "_content_1t193_81", we = "_item_1t193_101", Se = "_group_1t193_152", be = "_label_1t193_158", Ce = "_separator_1t193_170", C = {
9
+ trigger: ye,
10
+ "trigger-value": "_trigger-value_1t193_62",
11
+ "trigger-icon": "_trigger-icon_1t193_70",
12
+ content: ve,
13
+ item: we,
14
+ "item-check": "_item-check_1t193_141",
15
+ group: Se,
16
+ label: be,
17
+ separator: Ce
18
+ }, ee = ue(null);
19
+ function H(e) {
20
+ return e == null || typeof e == "boolean" ? "" : typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(H).join("") : N.isValidElement(e) ? H(e.props.children) : "";
21
+ }
22
+ function z(e) {
23
+ const n = de(ee);
24
+ if (!n)
25
+ throw new ge({
26
+ code: me.VHYXUI_MISSING_CONTEXT,
27
+ message: `${e} must be used within <Select>`,
28
+ suggestion: "Wrap your component tree with <Select>"
29
+ });
30
+ return n;
31
+ }
32
+ const te = N.forwardRef(
33
+ ({
34
+ value: e,
35
+ defaultValue: n,
36
+ onValueChange: l,
37
+ disabled: m = !1,
38
+ size: r = "md",
39
+ placeholder: u,
40
+ contract: v,
41
+ children: o,
42
+ className: y,
43
+ ...s
44
+ }, S) => {
45
+ const b = D("vhyx-select-trigger"), f = D("vhyx-select-content"), h = D("vhyx-select"), c = e !== void 0, [_, V] = B(n), p = c ? e : _, [t, R] = B(!1), [j, w] = B(void 0), T = E(null), W = E(null), O = E(/* @__PURE__ */ new Map()), A = E([]), P = E(/* @__PURE__ */ new Map()), [U, M] = B(void 0), G = E(p);
46
+ G.current = p, k(() => {
47
+ if (p === void 0) {
48
+ M(void 0);
49
+ return;
50
+ }
51
+ const i = O.current.get(p);
52
+ M(i ? i.label : void 0);
53
+ }, [p]);
54
+ const F = x(
55
+ (i, a, g) => {
56
+ O.current.has(i) || A.current.push(i);
57
+ const I = { label: a };
58
+ g !== void 0 && (I.disabled = g), O.current.set(i, I), i === G.current && M(a);
59
+ },
60
+ []
61
+ ), X = x(() => U, [U]), Y = x(
62
+ (i) => {
63
+ var I;
64
+ const a = A.current.filter(
65
+ (L) => {
66
+ var q;
67
+ return !((q = O.current.get(L)) != null && q.disabled);
68
+ }
69
+ );
70
+ if (a.length === 0) return;
71
+ let g;
72
+ if (i === "home")
73
+ g = a[0];
74
+ else if (i === "end")
75
+ g = a[a.length - 1];
76
+ else {
77
+ const L = j !== void 0 ? a.indexOf(j) : -1;
78
+ g = i === "down" ? a[Math.min(L + 1, a.length - 1)] : a[Math.max(L - 1, 0)];
79
+ }
80
+ g !== void 0 && (w(g), (I = P.current.get(g)) == null || I.focus());
81
+ },
82
+ [j]
83
+ ), J = x(
84
+ (i) => {
85
+ var a;
86
+ c || V(i), l == null || l(i), R(!1), w(void 0), (a = T.current) == null || a.focus();
87
+ },
88
+ [c, l]
89
+ ), $ = x(
90
+ (i) => {
91
+ if (R(i), i) {
92
+ const a = p ?? A.current[0];
93
+ w(a);
94
+ } else
95
+ w(void 0);
96
+ },
97
+ [p]
98
+ ), ae = K(
99
+ () => ({ ...Z, id: h, ...v }),
100
+ [h, v]
101
+ ), le = K(
102
+ () => ({
103
+ value: p,
104
+ onValueChange: J,
105
+ open: t,
106
+ onOpenChange: $,
107
+ disabled: m,
108
+ size: r,
109
+ placeholder: u,
110
+ triggerId: b,
111
+ contentId: f,
112
+ triggerRef: T,
113
+ contentRef: W,
114
+ focusedValue: j,
115
+ setFocusedValue: w,
116
+ registerItem: F,
117
+ getSelectedLabel: X,
118
+ navigateItems: Y,
119
+ itemElementsRef: P,
120
+ itemOrderRef: A,
121
+ itemRegistryRef: O
122
+ }),
123
+ [
124
+ p,
125
+ J,
126
+ t,
127
+ $,
128
+ m,
129
+ r,
130
+ u,
131
+ b,
132
+ f,
133
+ j,
134
+ F,
135
+ X,
136
+ Y
137
+ ]
138
+ );
139
+ return k(() => {
140
+ if (!t) return;
141
+ function i(a) {
142
+ var g;
143
+ a.key === "Escape" && (R(!1), w(void 0), (g = T.current) == null || g.focus());
144
+ }
145
+ return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
146
+ }, [t]), k(() => {
147
+ if (!t) return;
148
+ function i(a) {
149
+ var I, L;
150
+ const g = a.target;
151
+ (I = T.current) != null && I.contains(g) || (L = W.current) != null && L.contains(g) || (R(!1), w(void 0));
152
+ }
153
+ return document.addEventListener("mousedown", i), () => document.removeEventListener("mousedown", i);
154
+ }, [t]), /* @__PURE__ */ d.jsx(ee.Provider, { value: le, children: /* @__PURE__ */ d.jsx(
155
+ "div",
156
+ {
157
+ ref: S,
158
+ className: y,
159
+ "data-size": r,
160
+ "data-disabled": m ? !0 : void 0,
161
+ "data-vhyx-contract": JSON.stringify(ae),
162
+ ...s,
163
+ children: o
164
+ }
165
+ ) });
166
+ }
167
+ );
168
+ te.displayName = "VhyxSelect";
169
+ const ne = N.forwardRef((e, n) => {
170
+ const { icon: l, className: m, asChild: r = !1, children: u, ...v } = e, o = z("Select.Trigger"), y = o.getSelectedLabel(), s = x(
171
+ (c) => {
172
+ o.triggerRef.current = c, typeof n == "function" ? n(c) : n && (n.current = c);
173
+ },
174
+ [n, o.triggerRef]
175
+ ), S = x(() => {
176
+ o.disabled || o.onOpenChange(!o.open);
177
+ }, [o]), b = x(
178
+ (c) => {
179
+ (c.key === "ArrowDown" || c.key === "ArrowUp") && (c.preventDefault(), o.open || o.onOpenChange(!0));
180
+ },
181
+ [o]
182
+ ), f = [C.trigger, m].filter(Boolean).join(" "), h = {
183
+ id: o.triggerId,
184
+ role: "combobox",
185
+ "aria-haspopup": "listbox",
186
+ "aria-expanded": o.open,
187
+ "aria-controls": o.open ? o.contentId : void 0,
188
+ disabled: o.disabled,
189
+ onClick: S,
190
+ onKeyDown: b,
191
+ className: f,
192
+ "data-size": o.size,
193
+ "data-state": o.open ? "open" : "closed",
194
+ "data-placeholder": y ? void 0 : !0,
195
+ ...v
196
+ };
197
+ return r ? /* @__PURE__ */ d.jsx(pe, { ref: s, ...h, children: u }) : /* @__PURE__ */ d.jsxs("button", { ref: s, type: "button", ...h, children: [
198
+ /* @__PURE__ */ d.jsx("span", { className: C["trigger-value"], children: y ?? o.placeholder ?? "Select…" }),
199
+ /* @__PURE__ */ d.jsx("span", { className: C["trigger-icon"], "aria-hidden": "true", children: l ?? /* @__PURE__ */ d.jsx("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, children: /* @__PURE__ */ d.jsx("path", { d: "M2.5 4.5L6 8L9.5 4.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) })
200
+ ] });
201
+ });
202
+ ne.displayName = "VhyxSelectTrigger";
203
+ function re({ children: e, className: n, style: l, ...m }) {
204
+ const r = z("Select.Content"), [u, v] = B(!1), [o, y] = B({
205
+ position: "fixed",
206
+ top: 0,
207
+ left: 0,
208
+ minWidth: 0,
209
+ zIndex: "var(--vhyx-z-dropdown)"
210
+ });
211
+ k(() => {
212
+ v(!0);
213
+ }, []), k(() => {
214
+ if (!r.open || !r.triggerRef.current) return;
215
+ const f = () => {
216
+ var w;
217
+ const c = r.triggerRef.current.getBoundingClientRect(), _ = window.innerHeight - c.bottom, V = c.top, p = ((w = r.contentRef.current) == null ? void 0 : w.scrollHeight) ?? 300, t = _ < p && V > _, R = t ? Math.min(p, V - 8) : Math.min(p, _ - 8), j = t ? c.top - R - 4 : c.bottom + 4;
218
+ y({
219
+ position: "fixed",
220
+ top: Q(j, R, window.innerHeight),
221
+ left: Q(c.left, c.width, window.innerWidth),
222
+ minWidth: c.width,
223
+ zIndex: "var(--vhyx-z-dropdown)",
224
+ maxHeight: R,
225
+ overflowY: "auto"
226
+ });
227
+ };
228
+ f();
229
+ const h = xe(f);
230
+ return window.addEventListener("scroll", h.run, !0), window.addEventListener("resize", h.run), () => {
231
+ h.cancel(), window.removeEventListener("scroll", h.run, !0), window.removeEventListener("resize", h.run);
232
+ };
233
+ }, [r.open, r.triggerRef]), k(() => {
234
+ var f;
235
+ !r.open || !r.focusedValue || (f = r.itemElementsRef.current.get(r.focusedValue)) == null || f.focus();
236
+ }, [r.open]);
237
+ const s = x(
238
+ (f) => {
239
+ r.contentRef.current = f;
240
+ },
241
+ [r.contentRef]
242
+ );
243
+ if (!u) return null;
244
+ const S = [C.content, n].filter(Boolean).join(" "), b = /* @__PURE__ */ d.jsx(
245
+ "div",
246
+ {
247
+ ref: s,
248
+ id: r.contentId,
249
+ role: "listbox",
250
+ "aria-labelledby": r.triggerId,
251
+ className: S,
252
+ "data-state": r.open ? "open" : "closed",
253
+ ...m,
254
+ style: {
255
+ // Consumer's cosmetic style first — internal positioning/sizing keys
256
+ // (position/top/left/minWidth/zIndex/maxHeight/overflowY) are spread
257
+ // explicitly afterward so they always win, instead of letting a
258
+ // whole `style` object from a blind `{...rest}` spread replace this
259
+ // element's positioning outright.
260
+ ...l,
261
+ ...o
262
+ },
263
+ children: e
264
+ }
265
+ );
266
+ return fe.createPortal(b, document.body);
267
+ }
268
+ re.displayName = "VhyxSelectContent";
269
+ const oe = N.forwardRef(
270
+ ({ value: e, disabled: n, children: l, className: m, onClick: r, onKeyDown: u, onMouseEnter: v, ...o }, y) => {
271
+ const s = z("Select.Item"), S = s.value === e, b = s.focusedValue === e, f = H(l);
272
+ k(() => {
273
+ s.registerItem(e, f, n);
274
+ }, [s, e, f, n]);
275
+ const h = x(
276
+ (t) => {
277
+ t ? s.itemElementsRef.current.set(e, t) : s.itemElementsRef.current.delete(e), typeof y == "function" ? y(t) : y && (y.current = t);
278
+ },
279
+ [y, s, e]
280
+ ), c = x(
281
+ (t) => {
282
+ r == null || r(t), n || s.onValueChange(e);
283
+ },
284
+ [r, n, s, e]
285
+ ), _ = x(
286
+ (t) => {
287
+ u == null || u(t), t.key === "Enter" || t.key === " " ? (t.preventDefault(), n || s.onValueChange(e)) : t.key === "ArrowDown" ? (t.preventDefault(), s.navigateItems("down")) : t.key === "ArrowUp" ? (t.preventDefault(), s.navigateItems("up")) : t.key === "Home" ? (t.preventDefault(), s.navigateItems("home")) : t.key === "End" && (t.preventDefault(), s.navigateItems("end"));
288
+ },
289
+ [u, n, s, e]
290
+ ), V = x(
291
+ (t) => {
292
+ v == null || v(t), !n && (s.setFocusedValue(e), t.currentTarget.focus());
293
+ },
294
+ [v, n, s, e]
295
+ ), p = [C.item, m].filter(Boolean).join(" ");
296
+ return /* @__PURE__ */ d.jsxs(
297
+ "div",
298
+ {
299
+ ref: h,
300
+ role: "option",
301
+ "aria-selected": S,
302
+ "aria-disabled": n ? !0 : void 0,
303
+ tabIndex: b ? 0 : -1,
304
+ onClick: c,
305
+ onKeyDown: _,
306
+ onMouseEnter: V,
307
+ className: p,
308
+ "data-state": S ? "selected" : "unselected",
309
+ "data-disabled": n ? !0 : void 0,
310
+ "data-focused": b ? !0 : void 0,
311
+ ...o,
312
+ children: [
313
+ l,
314
+ S && /* @__PURE__ */ d.jsx("span", { className: C["item-check"], "aria-hidden": "true", children: /* @__PURE__ */ d.jsx("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", children: /* @__PURE__ */ d.jsx("polyline", { points: "2,6 5,9 10,3" }) }) })
315
+ ]
316
+ }
317
+ );
318
+ }
319
+ );
320
+ oe.displayName = "VhyxSelectItem";
321
+ function se({ children: e, className: n, ...l }) {
322
+ const m = D("vhyx-select-group-label"), r = [C.group, n].filter(Boolean).join(" ");
323
+ return /* @__PURE__ */ d.jsx("div", { role: "group", "aria-labelledby": m, className: r, ...l, children: N.Children.map(e, (u) => N.isValidElement(u) && u.type.displayName === "VhyxSelectLabel" ? N.cloneElement(u, { id: m }) : u) });
324
+ }
325
+ se.displayName = "VhyxSelectGroup";
326
+ function ie({ children: e, className: n, ...l }) {
327
+ const m = [C.label, n].filter(Boolean).join(" ");
328
+ return /* @__PURE__ */ d.jsx("span", { className: m, ...l, children: e });
329
+ }
330
+ ie.displayName = "VhyxSelectLabel";
331
+ function ce({ className: e, ...n }) {
332
+ const l = [C.separator, e].filter(Boolean).join(" ");
333
+ return /* @__PURE__ */ d.jsx("hr", { "aria-hidden": "true", className: l, ...n });
334
+ }
335
+ ce.displayName = "VhyxSelectSeparator";
336
+ const Re = { ...Z, id: "vhyxui-select" }, Ie = Object.assign(
337
+ he(te, Re),
338
+ {
339
+ Trigger: ne,
340
+ Content: re,
341
+ Item: oe,
342
+ Group: se,
343
+ Label: ie,
344
+ Separator: ce
345
+ }
346
+ );
347
+ Ie.displayName = "VhyxSelect";
348
+ export {
349
+ Ie as S
350
+ };
@@ -1,6 +1,6 @@
1
1
  import { j as e } from "./jsx-runtime-CL69jGNW.js";
2
2
  import { F as f } from "./Field-Bv07PL2M.js";
3
- import { S as r } from "./Select-DHalg36V.js";
3
+ import { S as r } from "./Select-DfV10hZt.js";
4
4
  function h({
5
5
  name: s,
6
6
  label: i,
@@ -1 +1 @@
1
- "use strict";const e=require("./jsx-runtime-BRMkMA8J.cjs"),R=require("./Field-D6FSsUGj.cjs"),t=require("./Select-CGfKq69f.cjs");function r({name:l,label:i,hint:n,error:c,required:x,optional:u,layout:d,options:j,placeholder:o,value:m,onValueChange:a,disabled:S,size:p}){return e.jsxRuntimeExports.jsx(R.Field,{name:l,label:i,hint:n,error:c,required:x,optional:u,layout:d,children:e.jsxRuntimeExports.jsxs(t.Select,{value:m,onValueChange:a,disabled:S,size:p,placeholder:o,children:[e.jsxRuntimeExports.jsx(t.Select.Trigger,{"aria-label":typeof i=="string"?i:void 0}),e.jsxRuntimeExports.jsx(t.Select.Content,{children:j.map(s=>e.jsxRuntimeExports.jsx(t.Select.Item,{value:s.value,children:s.label},s.value))})]})})}r.displayName="VhyxSelectField";exports.SelectField=r;
1
+ "use strict";const e=require("./jsx-runtime-BRMkMA8J.cjs"),R=require("./Field-D6FSsUGj.cjs"),t=require("./Select-BkJNe4Lc.cjs");function r({name:l,label:i,hint:n,error:c,required:x,optional:u,layout:d,options:j,placeholder:o,value:m,onValueChange:a,disabled:S,size:p}){return e.jsxRuntimeExports.jsx(R.Field,{name:l,label:i,hint:n,error:c,required:x,optional:u,layout:d,children:e.jsxRuntimeExports.jsxs(t.Select,{value:m,onValueChange:a,disabled:S,size:p,placeholder:o,children:[e.jsxRuntimeExports.jsx(t.Select.Trigger,{"aria-label":typeof i=="string"?i:void 0}),e.jsxRuntimeExports.jsx(t.Select.Content,{children:j.map(s=>e.jsxRuntimeExports.jsx(t.Select.Item,{value:s.value,children:s.label},s.value))})]})})}r.displayName="VhyxSelectField";exports.SelectField=r;
@@ -0,0 +1,18 @@
1
+ function l(a, n, c, t = 8) {
2
+ const e = Math.max(t, c - n - t);
3
+ return Math.min(Math.max(a, t), e);
4
+ }
5
+ function r(a) {
6
+ let n = null;
7
+ return { run: () => {
8
+ n === null && (n = requestAnimationFrame(() => {
9
+ n = null, a();
10
+ }));
11
+ }, cancel: () => {
12
+ n !== null && (cancelAnimationFrame(n), n = null);
13
+ } };
14
+ }
15
+ export {
16
+ l as c,
17
+ r
18
+ };
@@ -0,0 +1 @@
1
+ "use strict";function l(a,n,c,t=8){const e=Math.max(t,c-n-t);return Math.min(Math.max(a,t),e)}function r(a){let n=null;return{run:()=>{n===null&&(n=requestAnimationFrame(()=>{n=null,a()}))},cancel:()=>{n!==null&&(cancelAnimationFrame(n),n=null)}}}exports.clampToViewport=l;exports.rafBatched=r;
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./VhyxUIProvider-C7ie8u2L.cjs"),u=require("./Button-akOSYEu9.cjs"),l=require("./Input-UQ2fQwE7.cjs"),T=require("./Textarea-H6evM8L4.cjs"),q=require("./Select-CGfKq69f.cjs"),g=require("./Checkbox-DvkT6QP9.cjs"),c=require("./RadioItem-BfkTHBxQ.cjs"),F=require("./Switch-BU_Tcttb.cjs"),s=require("./Field-D6FSsUGj.cjs"),m=require("./TextField-C3r-6jr6.cjs"),x=require("./SelectField-DG7SlT9m.cjs"),S=require("./TextareaField-D234Lyi_.cjs"),t=require("./Toast-ndaxbpcV.cjs"),P=require("./Alert-BJ1O0bnK.cjs"),f=require("./Badge-SBO9tGzn.cjs"),b=require("./Progress-FO-4WX0i.cjs"),v=require("./Spinner-CeIDpqkx.cjs"),I=require("./Dialog-gPT4noD8.cjs"),h=require("./Drawer-BygSIQQn.cjs"),w=require("./Tooltip-CCd6VRvZ.cjs"),B=require("./Popover-BHGX_cC4.cjs"),C=require("./Card-DSCA-Igh.cjs"),D=require("./Separator-C5lPGzes.cjs"),y=require("./Tabs-DuU02-UD.cjs"),A=require("./Breadcrumb-StitgXXx.cjs"),R=require("./Pagination-CmmcBPNz.cjs"),U=5e3;function o(i,r,e){const n={message:i,variant:r,duration:(e==null?void 0:e.duration)??U,dismissible:(e==null?void 0:e.dismissible)??!0};return(e==null?void 0:e.description)!==void 0&&(n.description=e.description),(e==null?void 0:e.action)!==void 0&&(n.action=e.action),n}function a(i,r){return t.addToast(o(i,"default",r))}a.success=function(r,e){return t.addToast(o(r,"success",e))};a.danger=function(r,e){return t.addToast(o(r,"danger",e))};a.warning=function(r,e){return t.addToast(o(r,"warning",e))};a.info=function(r,e){return t.addToast(o(r,"info",e))};a.dismiss=function(r){r!==void 0?t.dismissToast(r):t.dismissAllToasts()};const k=a;exports.VhyxUIProvider=d.VhyxUIProvider;exports.Button=u.Button;exports.Input=l.Input;exports.Textarea=T.Textarea;exports.Select=q.Select;exports.Checkbox=g.Checkbox;exports.RadioGroup=c.RadioGroup;exports.RadioItem=c.RadioItem;exports.Switch=F.Switch;exports.Field=s.Field;exports.Form=s.Form;exports.useFormContext=s.useFormContext;exports.TextField=m.TextField;exports.SelectField=x.SelectField;exports.TextareaField=S.TextareaField;exports.Toast=t.Toast;exports.ToastProvider=t.ToastProvider;exports.Alert=P.Alert;exports.Badge=f.Badge;exports.Progress=b.Progress;exports.Spinner=v.Spinner;exports.Dialog=I.Dialog;exports.Drawer=h.Drawer;exports.Tooltip=w.Tooltip;exports.Popover=B.Popover;exports.Card=C.Card;exports.Separator=D.Separator;exports.Tabs=y.Tabs;exports.Breadcrumb=A.Breadcrumb;exports.Pagination=R.Pagination;exports.toast=k;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./VhyxUIProvider-C7ie8u2L.cjs"),u=require("./Button-akOSYEu9.cjs"),l=require("./Input-UQ2fQwE7.cjs"),T=require("./Textarea-H6evM8L4.cjs"),q=require("./Select-BkJNe4Lc.cjs"),g=require("./Checkbox-DvkT6QP9.cjs"),c=require("./RadioItem-BfkTHBxQ.cjs"),F=require("./Switch-BU_Tcttb.cjs"),s=require("./Field-D6FSsUGj.cjs"),m=require("./TextField-C3r-6jr6.cjs"),x=require("./SelectField-Dxl2Mgbv.cjs"),S=require("./TextareaField-D234Lyi_.cjs"),t=require("./Toast-ndaxbpcV.cjs"),P=require("./Alert-BJ1O0bnK.cjs"),f=require("./Badge-SBO9tGzn.cjs"),b=require("./Progress-FO-4WX0i.cjs"),v=require("./Spinner-CeIDpqkx.cjs"),I=require("./Dialog-gPT4noD8.cjs"),h=require("./Drawer-BygSIQQn.cjs"),w=require("./Tooltip-CCd6VRvZ.cjs"),B=require("./Popover-BlCmIF9J.cjs"),C=require("./Card-DSCA-Igh.cjs"),D=require("./Separator-C5lPGzes.cjs"),y=require("./Tabs-DuU02-UD.cjs"),A=require("./Breadcrumb-StitgXXx.cjs"),R=require("./Pagination-CmmcBPNz.cjs"),U=5e3;function o(i,r,e){const n={message:i,variant:r,duration:(e==null?void 0:e.duration)??U,dismissible:(e==null?void 0:e.dismissible)??!0};return(e==null?void 0:e.description)!==void 0&&(n.description=e.description),(e==null?void 0:e.action)!==void 0&&(n.action=e.action),n}function a(i,r){return t.addToast(o(i,"default",r))}a.success=function(r,e){return t.addToast(o(r,"success",e))};a.danger=function(r,e){return t.addToast(o(r,"danger",e))};a.warning=function(r,e){return t.addToast(o(r,"warning",e))};a.info=function(r,e){return t.addToast(o(r,"info",e))};a.dismiss=function(r){r!==void 0?t.dismissToast(r):t.dismissAllToasts()};const k=a;exports.VhyxUIProvider=d.VhyxUIProvider;exports.Button=u.Button;exports.Input=l.Input;exports.Textarea=T.Textarea;exports.Select=q.Select;exports.Checkbox=g.Checkbox;exports.RadioGroup=c.RadioGroup;exports.RadioItem=c.RadioItem;exports.Switch=F.Switch;exports.Field=s.Field;exports.Form=s.Form;exports.useFormContext=s.useFormContext;exports.TextField=m.TextField;exports.SelectField=x.SelectField;exports.TextareaField=S.TextareaField;exports.Toast=t.Toast;exports.ToastProvider=t.ToastProvider;exports.Alert=P.Alert;exports.Badge=f.Badge;exports.Progress=b.Progress;exports.Spinner=v.Spinner;exports.Dialog=I.Dialog;exports.Drawer=h.Drawer;exports.Tooltip=w.Tooltip;exports.Popover=B.Popover;exports.Card=C.Card;exports.Separator=D.Separator;exports.Tabs=y.Tabs;exports.Breadcrumb=A.Breadcrumb;exports.Pagination=R.Pagination;exports.toast=k;
package/dist/index.d.ts CHANGED
@@ -678,6 +678,14 @@ export declare interface PopoverCloseProps extends default_2.ButtonHTMLAttribute
678
678
  * eliminating both a hydration mismatch and a `document is not defined`
679
679
  * crash from `ReactDOM.createPortal(..., document.body)` if this is open
680
680
  * on first render (`document` doesn't exist during SSR).
681
+ *
682
+ * Position is computed as plain pixel coordinates (not a CSS `transform`
683
+ * trick) precisely so the result can be clamped to the viewport — `align`
684
+ * previously had no effect at all (only `side` was read), and even a
685
+ * correct anchor computation would still let content overflow past a
686
+ * viewport edge near the trigger (e.g. a right-aligned header popover) with
687
+ * no boundary awareness. Both are fixed together here since they share the
688
+ * same measurement (the content's own rendered size).
681
689
  */
682
690
  declare function PopoverContent({ children, className, side, align, style, ...rest }: PopoverContentProps): default_2.ReactPortal | null;
683
691