@vokril/ui-solid 0.9.1 → 0.9.2

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 (62) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/{CommandPalette-BBDBVARB.cjs → CommandPalette-DToM9pUp.cjs} +1 -1
  3. package/dist/{CommandPalette-e6FePgys.js → CommandPalette-ZCFlLqrP.js} +1 -1
  4. package/dist/Popover-C24npAQ7.js +206 -0
  5. package/dist/Popover-hhGcYQ-a.cjs +1 -0
  6. package/dist/{StatusBarNotificationBell-B5knnCWK.js → StatusBarNotificationBell-CZmym2gV.js} +1 -1
  7. package/dist/{StatusBarNotificationBell-2bIRvg2s.cjs → StatusBarNotificationBell-DG8Pe6R-.cjs} +1 -1
  8. package/dist/{Stepper-B26aF0bA.js → Stepper-BxXwbDq4.js} +1 -1
  9. package/dist/{Stepper-Bl8P6HJx.cjs → Stepper-DoJFCfC7.cjs} +1 -1
  10. package/dist/{ToggleButton-DwvUV2en.js → ToggleButton-BfjXnp-P.js} +1 -1
  11. package/dist/{ToggleButton-DuKoI5PE.cjs → ToggleButton-Bjxv8KGH.cjs} +1 -1
  12. package/dist/forms/index.cjs +1 -1
  13. package/dist/forms/index.js +1 -1
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.js +6 -6
  16. package/dist/layout/index.cjs +1 -1
  17. package/dist/layout/index.js +1 -1
  18. package/dist/navigation/index.cjs +1 -1
  19. package/dist/navigation/index.js +1 -1
  20. package/dist/notifications/index.cjs +1 -1
  21. package/dist/notifications/index.js +1 -1
  22. package/dist/overlay/index.cjs +1 -1
  23. package/dist/overlay/index.js +2 -2
  24. package/dist/server/{CommandPalette-39UA8MVn.cjs → CommandPalette-C3Bw1teR.cjs} +1 -1
  25. package/dist/server/{CommandPalette-DIlbFrNy.js → CommandPalette-S7tfmFMb.js} +3 -3
  26. package/dist/server/{GuidedTour-bV_r4vSt.js → GuidedTour-BhJGkoPa.js} +2 -2
  27. package/dist/server/{GuidedTour-CMLjHh-y.cjs → GuidedTour-Dx0endYh.cjs} +1 -1
  28. package/dist/server/{IconPicker-B4wK1LxJ.js → IconPicker-B-d_Wcsj.js} +2 -2
  29. package/dist/server/{IconPicker-DoWUHbst.cjs → IconPicker-CSFowOa0.cjs} +1 -1
  30. package/dist/server/{Modal-Bt5zABLw.cjs → Modal-CAVr4DU6.cjs} +1 -1
  31. package/dist/server/{Modal-BJqeQWr2.js → Modal-usxkqDtK.js} +1 -1
  32. package/dist/server/Popover-AYYDbpLv.cjs +1 -0
  33. package/dist/server/{Popover-DOl2Wob7.js → Popover-BolicH3A.js} +123 -123
  34. package/dist/server/{StatusBarNotificationBell-BA53G1Rm.cjs → StatusBarNotificationBell-BJyGqDCX.cjs} +1 -1
  35. package/dist/server/{StatusBarNotificationBell-5QIZhWif.js → StatusBarNotificationBell-C9MCuKT6.js} +2 -2
  36. package/dist/server/{Stepper-DPIaVHC2.js → Stepper-B8hDDujj.js} +1 -1
  37. package/dist/server/{Stepper-lTAo7tM9.cjs → Stepper-DvoJXLcM.cjs} +1 -1
  38. package/dist/server/{ToggleButton-Cd8Dmcuj.js → ToggleButton--G4HCOTD.js} +1 -1
  39. package/dist/server/{ToggleButton-BSOdOzjN.cjs → ToggleButton-DTI2HB97.cjs} +1 -1
  40. package/dist/server/{createResizableSidebar-94M9e5Oc.js → createResizableSidebar-D96TivmC.js} +1 -1
  41. package/dist/server/{createResizableSidebar-BriIvZzI.cjs → createResizableSidebar-SJ2NCIYW.cjs} +1 -1
  42. package/dist/server/forms/index.cjs +1 -1
  43. package/dist/server/forms/index.js +2 -2
  44. package/dist/server/{index-BqIOYH6R.js → index-BZO0w8b6.js} +2 -2
  45. package/dist/server/{index-DwEHhkL-.cjs → index-DgIX9RIA.cjs} +1 -1
  46. package/dist/server/index.cjs +1 -1
  47. package/dist/server/index.js +10 -10
  48. package/dist/server/layout/index.cjs +1 -1
  49. package/dist/server/layout/index.js +2 -2
  50. package/dist/server/navigation/index.cjs +1 -1
  51. package/dist/server/navigation/index.js +1 -1
  52. package/dist/server/notifications/index.cjs +1 -1
  53. package/dist/server/notifications/index.js +2 -2
  54. package/dist/server/overlay/index.cjs +1 -1
  55. package/dist/server/overlay/index.js +4 -4
  56. package/dist/solid/overlay/popover/Popover.jsx +6 -1
  57. package/dist/style.css +1 -1
  58. package/dist/ui.css +1 -1
  59. package/package.json +1 -1
  60. package/dist/Popover-C3dFuObM.js +0 -206
  61. package/dist/Popover-Dbi7L860.cjs +0 -1
  62. package/dist/server/Popover-BSHOd_RH.cjs +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vokril/ui-solid",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "Vokril UI for SolidJS: accessible components, design tokens and the Vokril palette",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1,206 +0,0 @@
1
- import { createComponent as f, Portal as S, use as T, insert as C, effect as I, setAttribute as x, className as _, style as M, memo as N, template as $, delegateEvents as D } from "solid-js/web";
2
- import { createSignal as O, createEffect as H, onCleanup as W, Show as E } from "solid-js";
3
- import { o as F } from "./ownerWindow-9mx_LD47.js";
4
- import { r as K, h as q } from "./anchoredLayout-FC-qv8xm.js";
5
- import { u as z } from "./overlayStack-DvGdPMdq.js";
6
- import { O as R } from "./OverlayScrollArea-c8Za77qs.js";
7
- import { i as V } from "./keys-Bfgdfak_.js";
8
- const k = [
9
- '[role="menuitem"]',
10
- '[role="menuitemcheckbox"]',
11
- '[role="menuitemradio"]'
12
- ].map((e) => `${e}:not([disabled]):not([aria-disabled="true"])`).join(", "), L = '[role="option"]:not([aria-disabled="true"])', B = /* @__PURE__ */ new Set([
13
- "ArrowDown",
14
- "ArrowUp",
15
- "Home",
16
- "End"
17
- ]);
18
- function U(e) {
19
- return B.has(e);
20
- }
21
- function j(e, d, w) {
22
- if (e === 0) return -1;
23
- switch (w) {
24
- case "ArrowDown":
25
- return d < 0 ? 0 : (d + 1) % e;
26
- case "ArrowUp":
27
- return d < 0 ? e - 1 : (d - 1 + e) % e;
28
- case "Home":
29
- return 0;
30
- case "End":
31
- return e - 1;
32
- default:
33
- return d;
34
- }
35
- }
36
- const G = "vk_popover_dzAQl vk_surface_3ZOnl", Q = "vk_scrollArea_cBiT4", P = {
37
- popover: G,
38
- scrollArea: Q
39
- };
40
- var X = /* @__PURE__ */ $("<div>");
41
- function re(e) {
42
- const [d, w] = O(null), [b, A] = O(null);
43
- let i;
44
- const g = () => typeof e.open == "function" ? e.open() : e.open, v = () => {
45
- const o = e.anchor();
46
- return (o ? F(o) : null) ?? e.ownerWindow ?? null;
47
- }, p = z(() => g() && d() !== null, "popover", {
48
- type: "popover",
49
- element: () => b(),
50
- document: () => {
51
- var o;
52
- return (o = v()) == null ? void 0 : o.document;
53
- }
54
- }), y = () => {
55
- const o = e.anchor(), s = v();
56
- if (!o || s === null) return;
57
- const n = o.getBoundingClientRect(), t = i == null ? void 0 : i.querySelector('[data-overlay-scroll-viewport], [class*="viewport"]'), u = t ? t.scrollHeight + Math.max(0, i.offsetHeight - t.offsetHeight) : 0, m = t ? t.scrollWidth + Math.max(0, i.offsetWidth - t.offsetWidth) : 0, {
58
- left: r,
59
- top: l,
60
- anchorWidth: a,
61
- maxHeight: h
62
- } = q({
63
- anchor: {
64
- left: n.left,
65
- right: n.right,
66
- top: n.top,
67
- bottom: n.bottom,
68
- width: n.width
69
- },
70
- panelWidth: i ? Math.max(i.offsetWidth, i.scrollWidth, m) : 0,
71
- panelHeight: i ? Math.max(i.offsetHeight, i.scrollHeight, u) : 0,
72
- viewportWidth: s.innerWidth,
73
- viewportHeight: s.innerHeight,
74
- placement: e.placement ?? "bottom-start",
75
- gap: e.gap ?? 4
76
- }), c = d();
77
- c && c.x === r && c.y === l && c.w === a && c.maxHeight === h || w({
78
- x: r,
79
- y: l,
80
- w: a,
81
- maxHeight: h
82
- });
83
- };
84
- return H(() => {
85
- if (!g()) {
86
- w(null), A(null), i = void 0;
87
- return;
88
- }
89
- const o = v(), s = e.anchor();
90
- if (o === null || !s) return;
91
- y();
92
- const n = K(s, () => {
93
- y();
94
- const r = e.role;
95
- if (r === "menu" || r === "listbox") {
96
- const l = r === "menu" ? k : L, a = i;
97
- if (a) {
98
- const h = a.querySelector(l);
99
- (h ?? a).focus({
100
- preventScroll: !1
101
- }), h == null || h.scrollIntoView({
102
- block: "nearest"
103
- });
104
- }
105
- }
106
- }), t = (r) => {
107
- var a;
108
- const l = r.target;
109
- !l || !p.isTopmostForPointer() || i != null && i.contains(l) || (a = e.anchor()) != null && a.contains(l) || l instanceof Element && l.closest('[role="listbox"], [role="menu"]') || e.onClose();
110
- }, u = (r) => {
111
- !V(r, "Escape") || !p.isTopmost() || (r.stopPropagation(), r.stopImmediatePropagation(), e.onClose());
112
- }, m = () => y();
113
- o.addEventListener("mousedown", t, !0), o.addEventListener("keydown", u, !0), o.addEventListener("resize", m), o.addEventListener("scroll", m, !0), W(() => {
114
- n(), o.removeEventListener("mousedown", t, !0), o.removeEventListener("keydown", u, !0), o.removeEventListener("resize", m), o.removeEventListener("scroll", m, !0);
115
- });
116
- }), H(() => {
117
- const o = b(), s = v();
118
- if (!o || !g() || s === null) return;
119
- const n = s.ResizeObserver;
120
- if (!n) return;
121
- const t = new n(() => {
122
- y();
123
- });
124
- t.observe(o), W(() => {
125
- t.disconnect();
126
- });
127
- }), // The window is read once the panel has a position — the anchor is attached by then; at
128
- // render time it may still belong to the window-less template document.
129
- f(E, {
130
- get when() {
131
- return N(() => !!(g() && d()))() ? v() : null;
132
- },
133
- children: (o) => f(E, {
134
- get when() {
135
- return d();
136
- },
137
- children: (s) => f(S, {
138
- get mount() {
139
- return o().document.body;
140
- },
141
- get children() {
142
- var n = X();
143
- return n.$$keydown = (t) => {
144
- const u = e.role;
145
- if (u !== "menu" && u !== "listbox" || !U(t.key)) return;
146
- t.preventDefault();
147
- const m = u === "menu" ? k : L, r = i;
148
- if (!r) return;
149
- const l = Array.from(r.querySelectorAll(m)), a = l.indexOf(r.ownerDocument.activeElement), h = j(l.length, a, t.key);
150
- if (h >= 0) {
151
- const c = l[h];
152
- c == null || c.focus({
153
- preventScroll: !1
154
- }), c == null || c.scrollIntoView({
155
- block: "nearest"
156
- });
157
- }
158
- }, T((t) => {
159
- i = t, A(t);
160
- }, n), C(n, f(E, {
161
- get when() {
162
- return e.scrollable;
163
- },
164
- get fallback() {
165
- return e.children;
166
- },
167
- get children() {
168
- return f(R, {
169
- get rootClass() {
170
- return P.scrollArea;
171
- },
172
- get children() {
173
- return e.children;
174
- }
175
- });
176
- }
177
- })), I((t) => {
178
- var u = e.role ?? "dialog", m = e.ariaLabel, r = e.role === "menu" || e.role === "listbox" ? -1 : void 0, l = `${P.popover} ${e.class ?? ""}`, a = {
179
- left: `${s().x}px`,
180
- top: `${s().y}px`,
181
- "max-height": `${s().maxHeight}px`,
182
- ...e.matchAnchorWidth ? {
183
- "min-width": `${s().w}px`
184
- } : {}
185
- };
186
- return u !== t.e && x(n, "role", t.e = u), m !== t.t && x(n, "aria-label", t.t = m), r !== t.a && x(n, "tabindex", t.a = r), l !== t.o && _(n, t.o = l), t.i = M(n, a, t.i), t;
187
- }, {
188
- e: void 0,
189
- t: void 0,
190
- a: void 0,
191
- o: void 0,
192
- i: void 0
193
- }), n;
194
- }
195
- })
196
- })
197
- });
198
- }
199
- D(["keydown"]);
200
- export {
201
- L,
202
- k as M,
203
- re as P,
204
- U as i,
205
- j as r
206
- };
@@ -1 +0,0 @@
1
- "use strict";const s=require("solid-js/web"),f=require("solid-js"),C=require("./ownerWindow-BCmJFMbR.cjs"),L=require("./anchoredLayout-Dstwa5OH.cjs"),W=require("./overlayStack-DvKYN7SD.cjs"),H=require("./OverlayScrollArea-BSlaXG1h.cjs"),T=require("./keys-BeeC5_RZ.cjs"),b=['[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]'].map(e=>`${e}:not([disabled]):not([aria-disabled="true"])`).join(", "),x='[role="option"]:not([aria-disabled="true"])',_=new Set(["ArrowDown","ArrowUp","Home","End"]);function k(e){return _.has(e)}function p(e,m,g){if(e===0)return-1;switch(g){case"ArrowDown":return m<0?0:(m+1)%e;case"ArrowUp":return m<0?e-1:(m-1+e)%e;case"Home":return 0;case"End":return e-1;default:return m}}const q="vk_popover_dzAQl vk_surface_3ZOnl",I="vk_scrollArea_cBiT4",P={popover:q,scrollArea:I};var N=s.template("<div>");function M(e){const[m,g]=f.createSignal(null),[S,A]=f.createSignal(null);let i;const y=()=>typeof e.open=="function"?e.open():e.open,w=()=>{const o=e.anchor();return(o?C.ownerWindow(o):null)??e.ownerWindow??null},O=W.useOverlayRegistration(()=>y()&&m()!==null,"popover",{type:"popover",element:()=>S(),document:()=>{var o;return(o=w())==null?void 0:o.document}}),E=()=>{const o=e.anchor(),c=w();if(!o||c===null)return;const n=o.getBoundingClientRect(),t=i==null?void 0:i.querySelector('[data-overlay-scroll-viewport], [class*="viewport"]'),d=t?t.scrollHeight+Math.max(0,i.offsetHeight-t.offsetHeight):0,v=t?t.scrollWidth+Math.max(0,i.offsetWidth-t.offsetWidth):0,{left:r,top:l,anchorWidth:a,maxHeight:h}=L.computePopoverPosition({anchor:{left:n.left,right:n.right,top:n.top,bottom:n.bottom,width:n.width},panelWidth:i?Math.max(i.offsetWidth,i.scrollWidth,v):0,panelHeight:i?Math.max(i.offsetHeight,i.scrollHeight,d):0,viewportWidth:c.innerWidth,viewportHeight:c.innerHeight,placement:e.placement??"bottom-start",gap:e.gap??4}),u=m();u&&u.x===r&&u.y===l&&u.w===a&&u.maxHeight===h||g({x:r,y:l,w:a,maxHeight:h})};return f.createEffect(()=>{if(!y()){g(null),A(null),i=void 0;return}const o=w(),c=e.anchor();if(o===null||!c)return;E();const n=L.requestOwnerAnimationFrame(c,()=>{E();const r=e.role;if(r==="menu"||r==="listbox"){const l=r==="menu"?b:x,a=i;if(a){const h=a.querySelector(l);(h??a).focus({preventScroll:!1}),h==null||h.scrollIntoView({block:"nearest"})}}}),t=r=>{var a;const l=r.target;!l||!O.isTopmostForPointer()||i!=null&&i.contains(l)||(a=e.anchor())!=null&&a.contains(l)||l instanceof Element&&l.closest('[role="listbox"], [role="menu"]')||e.onClose()},d=r=>{!T.isKey(r,"Escape")||!O.isTopmost()||(r.stopPropagation(),r.stopImmediatePropagation(),e.onClose())},v=()=>E();o.addEventListener("mousedown",t,!0),o.addEventListener("keydown",d,!0),o.addEventListener("resize",v),o.addEventListener("scroll",v,!0),f.onCleanup(()=>{n(),o.removeEventListener("mousedown",t,!0),o.removeEventListener("keydown",d,!0),o.removeEventListener("resize",v),o.removeEventListener("scroll",v,!0)})}),f.createEffect(()=>{const o=S(),c=w();if(!o||!y()||c===null)return;const n=c.ResizeObserver;if(!n)return;const t=new n(()=>{E()});t.observe(o),f.onCleanup(()=>{t.disconnect()})}),s.createComponent(f.Show,{get when(){return s.memo(()=>!!(y()&&m()))()?w():null},children:o=>s.createComponent(f.Show,{get when(){return m()},children:c=>s.createComponent(s.Portal,{get mount(){return o().document.body},get children(){var n=N();return n.$$keydown=t=>{const d=e.role;if(d!=="menu"&&d!=="listbox"||!k(t.key))return;t.preventDefault();const v=d==="menu"?b:x,r=i;if(!r)return;const l=Array.from(r.querySelectorAll(v)),a=l.indexOf(r.ownerDocument.activeElement),h=p(l.length,a,t.key);if(h>=0){const u=l[h];u==null||u.focus({preventScroll:!1}),u==null||u.scrollIntoView({block:"nearest"})}},s.use(t=>{i=t,A(t)},n),s.insert(n,s.createComponent(f.Show,{get when(){return e.scrollable},get fallback(){return e.children},get children(){return s.createComponent(H.OverlayScrollArea,{get rootClass(){return P.scrollArea},get children(){return e.children}})}})),s.effect(t=>{var d=e.role??"dialog",v=e.ariaLabel,r=e.role==="menu"||e.role==="listbox"?-1:void 0,l=`${P.popover} ${e.class??""}`,a={left:`${c().x}px`,top:`${c().y}px`,"max-height":`${c().maxHeight}px`,...e.matchAnchorWidth?{"min-width":`${c().w}px`}:{}};return d!==t.e&&s.setAttribute(n,"role",t.e=d),v!==t.t&&s.setAttribute(n,"aria-label",t.t=v),r!==t.a&&s.setAttribute(n,"tabindex",t.a=r),l!==t.o&&s.className(n,t.o=l),t.i=s.style(n,a,t.i),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),n}})})})}s.delegateEvents(["keydown"]);exports.LISTBOX_OPTION_SELECTOR=x;exports.MENU_ITEM_SELECTOR=b;exports.Popover=M;exports.isPopoverNavigationKey=k;exports.resolvePopoverFocusForKey=p;
@@ -1 +0,0 @@
1
- "use strict";const v=require("solid-js/web"),S=require("./base-CrwDbIhF.cjs"),E=require("solid-js"),W=require("./ownerWindow-BCmJFMbR.cjs"),G=require("./overlayStack-DvKYN7SD.cjs"),U=require("./OverlayScrollArea-D4e9D9Nd.cjs"),$=require("./keys-GMxY2wcl.cjs");var z='<path d="m7 9.5 5 5 5-5"></path>';const K=S.createIcon({name:"VpChevronDown",a:{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",viewBox:"0 0 24 24"},c:()=>v.ssr(z)});function M(t,o){let n=!1,e=null;const l=()=>{if(n)return;const r=W.ownerWindow(t);if(r===null||!t.isConnected)return;const g=r.requestAnimationFrame(()=>{n||o()});e=()=>r.cancelAnimationFrame(g)};return t.isConnected?l():queueMicrotask(l),()=>{n=!0,e==null||e()}}var R=(t=>(t[t.LEFT=0]="LEFT",t[t.RIGHT=1]="RIGHT",t))(R||{}),T=(t=>(t[t.BELOW=0]="BELOW",t[t.ABOVE=1]="ABOVE",t))(T||{}),_=(t=>(t[t.VERTICAL=0]="VERTICAL",t[t.HORIZONTAL=1]="HORIZONTAL",t))(_||{});function H(t,o){const n=Math.max(t.start,o.start);return Math.min(t.end,o.end)-n>0}function O(t,o,n){const e=n.mode===1?n.offset:n.offset+n.size,l=n.mode===1?n.offset+n.size:n.offset;return n.position===0?o<=t-e?{position:e,result:"ok"}:o<=l?{position:l-o,result:"flipped"}:{position:Math.max(t-o,0),result:"overlap"}:o<=l?{position:l-o,result:"ok"}:o<=t-e&&l<o/2?{position:e,result:"flipped"}:{position:0,result:"overlap"}}function Y(t,o,n,e){let l=(e==null?void 0:e.anchorAlignment)??0,r=(e==null?void 0:e.anchorPosition)??0;const g=(e==null?void 0:e.anchorAxisAlignment)??0,w=(e==null?void 0:e.gap)??0,p=(e==null?void 0:e.margin)??0,c=p>0?{top:t.top+p,left:t.left+p,width:Math.max(0,t.width-2*p),height:Math.max(0,t.height-2*p)}:t;let i,s;if(g===0){const d={offset:n.top-c.top-w,size:n.height+2*w,position:r===0?0:1},b={offset:n.left-c.left,size:n.width,position:l===0?0:1,mode:1},u=O(c.height,o.height,d);i=u.position+c.top,u.result==="flipped"&&(r=r===0?1:0),H({start:i,end:i+o.height},{start:d.offset+c.top,end:d.offset+d.size+c.top})&&(b.mode=0);const a=O(c.width,o.width,b);s=a.position+c.left,a.result==="flipped"&&(l=l===0?1:0)}else{const d={offset:n.left-c.left-w,size:n.width+2*w,position:l===0?0:1},b={offset:n.top-c.top,size:n.height,position:r===0?0:1,mode:1},u=O(c.width,o.width,d);s=u.position+c.left,u.result==="flipped"&&(l=l===0?1:0),H({start:s,end:s+o.width},{start:d.offset+c.left,end:d.offset+d.size+c.left})&&(b.mode=0);const a=O(c.height,o.height,b);i=a.position+c.top,a.result==="flipped"&&(r=r===0?1:0)}const m=t.width-(s+o.width),f=t.height-(i+o.height);return{top:i,left:s,bottom:f,right:m,anchorAlignment:l,anchorPosition:r}}const A=8,Z=4,I=8,B=4;function C(t,o,n,e=8){return t+o>n-e?Math.max(e,n-e-o):t}function j(t){const o=t.margin??8,n=t.gap??4,e=t.anchorRect,l="bottom"in e&&typeof e.bottom=="number"?e.bottom:e.top+e.height,r=t.viewportHeight-l-o,g=e.top-o,w=t.desiredHeight??t.measuredHeight??240,p=r<Math.min(w,200)&&g>r,c=t.minMaxHeight??120,i=Math.max(c,p?g-n:r-n),s=p?Math.max(o,e.top-n-Math.min(w,i)):l+n,m=t.measuredWidth??0,f=Math.max(e.width,m),d=C(e.left,f,t.viewportWidth,o);return{top:s,left:d,width:e.width,maxHeight:i,side:p?"top":"bottom",preferAbove:p}}function L(t,o,n){return Math.max(o,Math.min(t,n))}function X(t){return t.endsWith("-end")}function V(t){const{placement:o,anchor:n,panelHeight:e,viewportHeight:l,gap:r}=t;if(o.startsWith("top"))return"top";if(o.startsWith("bottom"))return"bottom";const g=l-n.bottom-A,w=n.top-A;return(e>0?e:200)+r<=g||g>=w?"bottom":"top"}function F(t){const{anchor:o,panelWidth:n,panelHeight:e,viewportWidth:l,viewportHeight:r,gap:g}=t,w=X(t.placement)?o.right-n:o.left,p=L(w,A,l-n-A),c=V(t);if(c==="top"){const d=Math.max(0,o.top-g-A),b=Math.min(r-2*A,d),u=e>0?Math.min(e,b):Math.min(200,b),a=o.top-g-u,h=L(a,A,Math.max(A,o.top-g));return{left:p,top:h,anchorWidth:o.width,side:c,maxHeight:b}}const i=o.bottom+g,s=L(i,A,r-e-A),m=Math.max(0,r-s-A),f=Math.min(r-2*A,m);return{left:p,top:s,anchorWidth:o.width,side:c,maxHeight:f}}function J(t){const o=t.margin??I,n=t.gap??B;let e;if("x"in t.anchor){const a="width"in t.anchor&&typeof t.anchor.width=="number"?t.anchor.width:0,h="height"in t.anchor&&typeof t.anchor.height=="number"?t.anchor.height:0;e={left:t.anchor.x,top:t.anchor.y,width:a,height:h}}else{const a=t.anchor.left,h=t.anchor.top,y="right"in t.anchor&&typeof t.anchor.right=="number"?t.anchor.right:void 0,x="bottom"in t.anchor&&typeof t.anchor.bottom=="number"?t.anchor.bottom:void 0,N=t.anchor.width??(y!==void 0?y-a:0),q=t.anchor.height??(x!==void 0?x-h:0);e={left:a,top:h,width:N,height:q}}const l="left"in t.viewport?t.viewport.left:0,r="top"in t.viewport?t.viewport.top:0,g=t.viewport.width,w=t.viewport.height,p=l+g,c=r+w,i=t.placement??"bottom-start";let s,m;if(i.startsWith("auto")){m=i==="auto-end"?"end":i==="auto-start"?"start":"center";const a=c-(e.top+e.height)-o,h=e.top-r-o;s=t.overlay.height+n<=a||a>=h?"bottom":"top"}else if(s=i.startsWith("bottom")?"bottom":i.startsWith("top")?"top":i.startsWith("left")?"left":"right",m=i.endsWith("-end")?"end":i.endsWith("-start")?"start":"center",s==="bottom"){const a=c-(e.top+e.height)-o,h=e.top-r-o;t.overlay.height+n>a&&h>a&&(s="top")}else if(s==="top"){const a=e.top-r-o,h=c-(e.top+e.height)-o;t.overlay.height+n>a&&h>a&&(s="bottom")}else if(s==="right"){const a=p-(e.left+e.width)-o,h=e.left-l-o;t.overlay.width+n>a&&h>a&&(s="left")}else if(s==="left"){const a=e.left-l-o,h=p-(e.left+e.width)-o;t.overlay.width+n>a&&h>a&&(s="right")}let f=0,d=0;s==="bottom"?f=e.top+e.height+n:s==="top"?f=e.top-t.overlay.height-n:s==="left"?d=e.left-t.overlay.width-n:d=e.left+e.width+n,s==="bottom"||s==="top"?m==="start"?d=e.left:m==="end"?d=e.left+e.width-t.overlay.width:d=e.left+(e.width-t.overlay.width)/2:m==="start"?f=e.top:m==="end"?f=e.top+e.height-t.overlay.height:f=e.top+(e.height-t.overlay.height)/2;const b=L(d,l+o,p-t.overlay.width-o),u=L(f,r+o,c-t.overlay.height-o);return{left:b,top:u,anchorWidth:e.width,anchorHeight:e.height,side:s,alignment:m}}const k=['[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]'].map(t=>`${t}:not([disabled]):not([aria-disabled="true"])`).join(", "),D='[role="option"]:not([aria-disabled="true"])',Q=new Set(["ArrowDown","ArrowUp","Home","End"]);function tt(t){return Q.has(t)}function et(t,o,n){if(t===0)return-1;switch(n){case"ArrowDown":return o<0?0:(o+1)%t;case"ArrowUp":return o<0?t-1:(o-1+t)%t;case"Home":return 0;case"End":return t-1;default:return o}}const ot="vk_popover_dzAQl vk_surface_3ZOnl",nt="vk_scrollArea_cBiT4",P={popover:ot,scrollArea:nt};var rt=["<div",' class="','" style="','">',"</div>"];function it(t){const[o,n]=E.createSignal(null),[e,l]=E.createSignal(null);let r;const g=()=>typeof t.open=="function"?t.open():t.open,w=()=>{const i=t.anchor();return(i?W.ownerWindow(i):null)??t.ownerWindow??null},p=G.useOverlayRegistration(()=>g()&&o()!==null,"popover",{type:"popover",element:()=>e(),document:()=>{var i;return(i=w())==null?void 0:i.document}}),c=()=>{const i=t.anchor(),s=w();if(!i||s===null)return;const m=i.getBoundingClientRect(),f=r==null?void 0:r.querySelector('[data-overlay-scroll-viewport], [class*="viewport"]'),d=f?f.scrollHeight+Math.max(0,r.offsetHeight-f.offsetHeight):0,b=f?f.scrollWidth+Math.max(0,r.offsetWidth-f.offsetWidth):0,{left:u,top:a,anchorWidth:h,maxHeight:y}=F({anchor:{left:m.left,right:m.right,top:m.top,bottom:m.bottom,width:m.width},panelWidth:r?Math.max(r.offsetWidth,r.scrollWidth,b):0,panelHeight:r?Math.max(r.offsetHeight,r.scrollHeight,d):0,viewportWidth:s.innerWidth,viewportHeight:s.innerHeight,placement:t.placement??"bottom-start",gap:t.gap??4}),x=o();x&&x.x===u&&x.y===a&&x.w===h&&x.maxHeight===y||n({x:u,y:a,w:h,maxHeight:y})};return E.createEffect(()=>{if(!g()){n(null),l(null),r=void 0;return}const i=w(),s=t.anchor();if(i===null||!s)return;c();const m=M(s,()=>{c();const u=t.role;if(u==="menu"||u==="listbox"){const a=u==="menu"?k:D,h=r;if(h){const y=h.querySelector(a);(y??h).focus({preventScroll:!1}),y==null||y.scrollIntoView({block:"nearest"})}}}),f=u=>{var h;const a=u.target;!a||!p.isTopmostForPointer()||r!=null&&r.contains(a)||(h=t.anchor())!=null&&h.contains(a)||a instanceof Element&&a.closest('[role="listbox"], [role="menu"]')||t.onClose()},d=u=>{!$.isKey(u,"Escape")||!p.isTopmost()||(u.stopPropagation(),u.stopImmediatePropagation(),t.onClose())},b=()=>c();i.addEventListener("mousedown",f,!0),i.addEventListener("keydown",d,!0),i.addEventListener("resize",b),i.addEventListener("scroll",b,!0),E.onCleanup(()=>{m(),i.removeEventListener("mousedown",f,!0),i.removeEventListener("keydown",d,!0),i.removeEventListener("resize",b),i.removeEventListener("scroll",b,!0)})}),E.createEffect(()=>{const i=e(),s=w();if(!i||!g()||s===null)return;const m=s.ResizeObserver;if(!m)return;const f=new m(()=>{c()});f.observe(i),E.onCleanup(()=>{f.disconnect()})}),v.createComponent(E.Show,{get when(){return v.memo(()=>!!(g()&&o()))()?w():null},children:i=>v.createComponent(E.Show,{get when(){return o()},children:s=>v.createComponent(v.Portal,{get mount(){return i().document.body},get children(){return v.ssr(rt,v.ssrAttribute("role",v.escape(t.role??"dialog",!0),!1)+v.ssrAttribute("aria-label",v.escape(t.ariaLabel,!0),!1)+v.ssrAttribute("tabindex",t.role==="menu"||t.role==="listbox"?-1:v.escape(void 0,!0),!1),`${v.escape(P.popover,!0)} ${v.escape(t.class??"",!0)}`,v.ssrStyle({left:`${s().x}px`,top:`${s().y}px`,"max-height":`${s().maxHeight}px`,...t.matchAnchorWidth?{"min-width":`${s().w}px`}:{}}),v.escape(v.createComponent(E.Show,{get when(){return t.scrollable},get fallback(){return t.children},get children(){return v.createComponent(U.OverlayScrollArea,{get rootClass(){return P.scrollArea},get children(){return t.children}})}})))}})})})}exports.AnchorAlignment=R;exports.AnchorAxisAlignment=_;exports.AnchorPosition=T;exports.LISTBOX_OPTION_SELECTOR=D;exports.MENU_ITEM_SELECTOR=k;exports.OVERLAY_DEFAULT_GAP=B;exports.OVERLAY_DEFAULT_MARGIN=I;exports.POPOVER_DEFAULT_GAP=Z;exports.POPOVER_VIEWPORT_MARGIN=A;exports.Popover=it;exports.VpChevronDown=K;exports.calcFixedWidthDropdownLeft=C;exports.computeAnchoredPosition=J;exports.computeDropdownPosition=j;exports.computePopoverPosition=F;exports.isPopoverNavigationKey=tt;exports.layout2d=Y;exports.requestOwnerAnimationFrame=M;exports.resolvePopoverFocusForKey=et;exports.resolvePopoverSide=V;