efficient-shell 7.18.1 → 7.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -2
- package/dist/{Browser-K4DQBJWS.js → Browser-MGN247WU.js} +15 -15
- package/dist/Calculator-QLVWIU4C.js +29 -0
- package/dist/{ConfirmDialog-JMQI6CGW.js → ConfirmDialog-AVFQGXKL.js} +1 -1
- package/dist/{CurrencyConverter-PICVES6A.js → CurrencyConverter-7UT6W5OA.js} +6 -6
- package/dist/{Documents-QEPM2X7B.js → Documents-B5YGM7XF.js} +13 -13
- package/dist/Files-J7S5TI5N.js +87 -0
- package/dist/{Notepad-XEROGOZT.js → Notepad-EZDWJGSM.js} +11 -11
- package/dist/{PomodoroTimer-OCAJKGQU.js → PomodoroTimer-3OJYMVX7.js} +45 -45
- package/dist/{Preview-S4UIOU43.js → Preview-JASABTYI.js} +17 -17
- package/dist/Spreadsheet-ZHNUUC72.js +37 -0
- package/dist/{Stock-74K5L75A.js → Stock-5RQ2JXWL.js} +7 -7
- package/dist/{Weather-QTRJYIPS.js → Weather-3AMX2QSU.js} +16 -16
- package/dist/{WorldClock-L6PSFBLE.js → WorldClock-JNHPO3ZQ.js} +4 -4
- package/dist/apps/index.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/{chunk-NXYHRDRD.js → chunk-46NGPIEZ.js} +4 -4
- package/dist/{chunk-BIYMQKF3.js → chunk-5V3IFQ7F.js} +1 -1
- package/dist/chunk-76VCH7N6.js +29 -0
- package/dist/chunk-7LRJBINZ.js +108 -0
- package/dist/chunk-BVYOUFSW.js +19 -0
- package/dist/{chunk-23C25QZV.js → chunk-FVU7WDST.js} +1 -1
- package/dist/{chunk-VFBUDSMF.js → chunk-GIWC2ZTG.js} +2 -2
- package/dist/{chunk-QWSVX6OP.js → chunk-HMCE2MKM.js} +1 -1
- package/dist/chunk-IJ7RXIWX.js +13 -0
- package/dist/chunk-P7IKSYFJ.js +1 -0
- package/dist/chunk-QKMXKK6P.js +1027 -0
- package/dist/chunk-VOFDPOB6.js +1 -0
- package/dist/{index-C4iOtAIZ.d.ts → index-DsObAHbf.d.ts} +37 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +631 -631
- package/dist/map/index.js +3 -3
- package/dist/page-tabs/index.js +5 -5
- package/dist/telemetry/index.js +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-NGSHZWOR.js +0 -29
- package/dist/Files-S45MKBYC.js +0 -87
- package/dist/Spreadsheet-L7QG3LGD.js +0 -37
- package/dist/chunk-7BX3JQBP.js +0 -19
- package/dist/chunk-ERDQLQVK.js +0 -1
- package/dist/chunk-IBGEW3OA.js +0 -108
- package/dist/chunk-L5YNA4NS.js +0 -1025
- package/dist/chunk-QBXX5A7U.js +0 -29
- package/dist/chunk-WYNQLAKD.js +0 -13
package/dist/chunk-QBXX5A7U.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import{useDismissPopupsOnOpen as e}from"./chunk-UVBK6YSR.js";import{buttonClasses as t}from"./chunk-JTNKC4CR.js";import{registerModalEscapeInterceptor as n,Z_LAYERS as r}from"./chunk-FIEA5CGB.js";import{useShellStrings as o,splitAround as i}from"./chunk-QRCDQPJA.js";import{Icon as l}from"./chunk-ZGUQLVY4.js";import{createContext as a,useEffect as s,useRef as c,useId as d,useContext as u,useState as m,useCallback as f}from"react";import{jsxs as h,jsx as b,Fragment as g}from"react/jsx-runtime";var p=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function v(e){return Array.from(e.querySelectorAll(p)).filter(e=>null!==e.offsetParent||e===document.activeElement)}var y=[];function x(e){const t=y.findIndex(t=>t!==e&&e.contains(t));-1===t?y.push(e):y.splice(t,0,e)}function w(e){const t=y.lastIndexOf(e);-1!==t&&y.splice(t,1)}var N=/* @__PURE__ */new WeakSet;function k(e){return v(e)}function C(e,t){s(()=>{if(!t)return;const n=e.current;return n?(N.add(n),x(n),()=>{w(n),N.delete(n)}):void 0},[e,t])}function E(e,t){const n=y.lastIndexOf(t),r=n>0?y[n-1]:-1===n?y[y.length-1]??null:null,o=v(r??e.ownerDocument.body).filter(n=>!t.contains(n)&&!e.contains(n)),i=o.find(t=>0!==(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING));return i||(r&&!N.has(r)?o[0]??null:null)}function L(e,t,n){s(()=>{if(!t)return;const r=e.current;if(!r)return;const o=document.activeElement,i=n?.current??v(r)[0]??r;i!==r||r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),i.focus();const l=e=>{if("Tab"!==e.key)return;if(y[y.length-1]!==r)return;const t=v(r);if(0===t.length)return void e.preventDefault();const n=t[0],o=t[t.length-1],i=document.activeElement;!e.shiftKey||i!==n&&r.contains(i)?e.shiftKey||i!==o&&r.contains(i)||(e.preventDefault(),n.focus()):(e.preventDefault(),o.focus())};return x(r),document.addEventListener("keydown",l,!0),()=>{w(r),document.removeEventListener("keydown",l,!0),(r.contains(document.activeElement)||document.activeElement===document.body)&&o?.focus?.()}},[e,t,n])}var P=0,j=null;function D(e){s(()=>{if(!e)return;const t=document.body;if(0===P){j={overflow:t.style.overflow,paddingRight:t.style.paddingRight};const e=window.innerWidth-document.documentElement.clientWidth;t.style.overflow="hidden",e>0&&(t.style.paddingRight=`${e}px`)}return P+=1,()=>{0===(P-=1)&&j&&(t.style.overflow=j.overflow,t.style.paddingRight=j.paddingRight,j=null)}},[e])}var T={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-4xl"};function F({open:t,onClose:i,title:a,description:u,role:m="dialog",children:f,footer:g,blocking:p=!1,size:v="md",initialFocus:y,"aria-label":x,"aria-labelledby":w,"aria-describedby":N,className:k=""}){const C=c(null),E=d(),P=d(),j=!p&&!g,F=d(),I=o().dialog;return e(t),L(C,t,y),D(t),s(()=>{if(t)return n(()=>(p||i(),!0),()=>C.current)},[t,p,i]),t?/* @__PURE__ */h("div",{className:"fixed inset-0",style:{zIndex:r.overlay},role:"presentation",children:[
|
|
2
|
-
/* @__PURE__ */b("div",{className:"fixed inset-0 bg-black/30","aria-hidden":"true"}),
|
|
3
|
-
/* @__PURE__ */b("div",{className:"fixed inset-0 flex items-center justify-center p-4",onClick:p?void 0:e=>{e.target===e.currentTarget&&i()},children:/* @__PURE__ */h("div",{ref:C,role:m,"aria-modal":"true","aria-labelledby":a?F:w,"aria-label":a||w?void 0:x,"aria-describedby":N??(u?P:f?E:void 0),className:`relative max-h-full w-full ${T[v]} overflow-y-auto overscroll-contain rounded-(--radius-card) bg-white p-6 shadow-xl ${k}`.trim(),children:[a&&/* @__PURE__ */b("h2",{id:F,className:(j?"pr-8 ":"")+"text-base font-semibold text-gray-900",children:a}),u&&/* @__PURE__ */b("p",{id:P,className:((a?"mt-1":j?"pr-8":"")+" text-sm text-gray-500").trim(),children:u}),f&&/* @__PURE__ */b("div",{id:E,className:"mt-2 text-sm text-gray-600",children:f}),g&&/* @__PURE__ */b("div",{className:"mt-6 flex flex-wrap justify-end gap-3",children:g}),j&&/* @__PURE__ */b("button",{type:"button",onClick:i,"aria-label":I.close,className:"absolute right-3 top-3 rounded-(--radius-control) p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */b(l,{name:"close",className:"h-5 w-5",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})]})})]}):null}var I=a(()=>Promise.resolve(!1)),R=()=>u(I),W=()=>Promise.resolve(!1),O=e=>W(e),$=()=>Promise.resolve(!1),A=e=>$(e),K=()=>Promise.resolve(null),S=e=>K(e),G={danger:{icon:"text-red-600 bg-red-100",button:t({variant:"danger"})},warning:{icon:"text-yellow-600 bg-yellow-100",button:t({variant:"warning"})},info:{icon:"text-blue-600 bg-blue-100",button:t({variant:"primary"})}},Q=t({variant:"secondary"}),U=t({variant:"primary"}),V="w-full rounded-md border border-gray-300 h-8 px-3 text-sm";function z(){/* @__PURE__ */
|
|
4
|
-
return b(l,{name:"warning",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function B(){/* @__PURE__ */
|
|
5
|
-
return b(l,{name:"close",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function J({children:e}){const[t,n]=m(!1),[r,l]=m({message:""}),[a,d]=m(0),u=c(),p=c(null),v=c(0),y=c([]),x=c(null),w=c(null),N=f(e=>{p.current=e.id,u.current=e.resolve,d(e.id),l(e.options),n(!0)},[]),k=f(e=>{const t="string"==typeof e?{message:e}:e;return new Promise(e=>{const n={id:++v.current,options:t,resolve:e};null===p.current?N(n):y.current.push(n)})},[N]),[C,E]=m(!1),[L,P]=m({message:""}),[j,D]=m(""),T=c(),R=f(e=>(P(e),D(""),E(!0),new Promise(e=>{T.current=e})),[]),[O,A]=m(!1),[S,J]=m({}),[Y,_]=m(""),q=c(),M=f(e=>{const t="string"==typeof e?{message:e}:e;return J(t),_(t.defaultValue??""),A(!0),new Promise(e=>{q.current=e})},[]);s(()=>{W=k,$=R,K=M},[k,R,M]);const Z=(e,t)=>{if(p.current!==e)return;const r=u.current,o=y.current.shift();o?N(o):(p.current=null,u.current=void 0,n(!1)),r?.(t)},H=e=>{E(!1),D(""),T.current?.(e)},X=e=>{if(e){const e=Y.trim();if(!e&&!S.allowEmpty)return A(!1),void q.current?.(null);A(!1),q.current?.(e)}else A(!1),q.current?.(null)},ee=r.variant||(r.confirmLabel?.toLowerCase().includes("delete")||r.message.toLowerCase().includes("delete")?"danger":"info"),te=G[ee],ne=G["warning"===L.variant?"warning":"danger"],re=L.confirmWord,oe=null==re||j===re,ie=o().dialog,[le,ae]=i(ie.typeToConfirm);/* @__PURE__ */
|
|
6
|
-
return h(I.Provider,{value:k,children:[e,
|
|
7
|
-
/* @__PURE__ */b(F,{open:t,onClose:()=>Z(a,!1),initialFocus:x,footer:/* @__PURE__ */h(g,{children:[
|
|
8
|
-
/* @__PURE__ */b("button",{ref:x,type:"button",onClick:()=>Z(a,!1),className:Q,children:r.cancelLabel||ie.cancel}),
|
|
9
|
-
/* @__PURE__ */b("button",{type:"button",onClick:()=>Z(a,!0),className:te.button,children:r.confirmLabel||ie.ok})]}),children:/* @__PURE__ */h("div",{className:"flex gap-4",children:[
|
|
10
|
-
/* @__PURE__ */b("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${te.icon}`,children:/* @__PURE__ */b(z,{})}),
|
|
11
|
-
/* @__PURE__ */h("div",{className:"flex-1",children:[
|
|
12
|
-
/* @__PURE__ */b("h2",{className:"text-base font-semibold text-gray-900",children:r.title||ie.confirmTitle}),
|
|
13
|
-
/* @__PURE__ */b("p",{className:"mt-2 text-sm text-gray-600",children:r.message})]})]})}),
|
|
14
|
-
/* @__PURE__ */h(F,{open:C,onClose:()=>H(!1),initialFocus:null!=re?void 0:w,footer:/* @__PURE__ */h(g,{children:[
|
|
15
|
-
/* @__PURE__ */b("button",{ref:w,type:"button",onClick:()=>H(!1),className:Q,children:L.cancelLabel||ie.destructiveCancel}),
|
|
16
|
-
/* @__PURE__ */b("button",{type:"button",onClick:()=>H(!0),disabled:!oe,className:ne.button,children:re??L.confirmLabel??ie.destructiveConfirm})]}),children:[
|
|
17
|
-
/* @__PURE__ */b("button",{type:"button",onClick:()=>H(!1),"aria-label":ie.close,className:"absolute right-4 top-4 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:/* @__PURE__ */b(B,{})}),
|
|
18
|
-
/* @__PURE__ */h("div",{className:"flex gap-4",children:[
|
|
19
|
-
/* @__PURE__ */b("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${ne.icon}`,children:/* @__PURE__ */b(z,{})}),
|
|
20
|
-
/* @__PURE__ */h("div",{className:"flex-1",children:[
|
|
21
|
-
/* @__PURE__ */b("h2",{className:"text-base font-semibold text-gray-900 pr-6",children:L.title||ie.destructiveTitle}),
|
|
22
|
-
/* @__PURE__ */b("p",{className:"mt-2 text-sm text-gray-600",children:L.message}),null!=re&&/* @__PURE__ */h(g,{children:[
|
|
23
|
-
/* @__PURE__ */h("p",{className:"mt-3 text-sm text-gray-700",children:[le,
|
|
24
|
-
/* @__PURE__ */b("kbd",{className:"rounded border border-gray-300 bg-gray-50 px-2 py-0.5 text-xs font-bold text-red-600 font-mono",children:re}),ae]}),
|
|
25
|
-
/* @__PURE__ */b("input",{autoFocus:!0,type:"text",value:j,onChange:e=>D(e.target.value),onKeyDown:e=>{"Enter"===e.key&&j===re&&H(!0)},placeholder:re,className:`mt-2 ${V} focus:border-red-500`})]})]})]})]}),
|
|
26
|
-
/* @__PURE__ */h(F,{open:O,onClose:()=>X(!1),title:S.title||ie.promptTitle,footer:/* @__PURE__ */h(g,{children:[
|
|
27
|
-
/* @__PURE__ */b("button",{type:"button",onClick:()=>X(!1),className:Q,children:S.cancelLabel||ie.cancel}),
|
|
28
|
-
/* @__PURE__ */b("button",{type:"button",onClick:()=>X(!0),disabled:!S.allowEmpty&&!Y.trim(),className:U,children:S.confirmLabel||ie.ok})]}),children:[S.message&&/* @__PURE__ */b("p",{className:"text-sm text-gray-600",children:S.message}),
|
|
29
|
-
/* @__PURE__ */b("input",{autoFocus:!0,type:"text",value:Y,onChange:e=>_(e.target.value),onKeyDown:e=>{"Enter"===e.key?X(!0):"Escape"===e.key&&X(!1)},onFocus:e=>e.target.select(),placeholder:S.placeholder,className:`mt-3 ${V} focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]`})]})]})}export{J as ConfirmProvider,F as Dialog,O as confirm,A as confirmDestructive,k as focusableIn,S as prompt,E as stopAfter,R as useConfirm,L as useFocusTrap,D as useScrollLock,C as useTabLayer};
|
package/dist/chunk-WYNQLAKD.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{buttonClasses as t}from"./chunk-JTNKC4CR.js";import{solidSurfaceStyle as e}from"./chunk-7IQ3B77H.js";import{registerModalEscapeInterceptor as o,escapeSurfaceAbove as i,onOverlayOpen as r,Z_LAYERS as n}from"./chunk-FIEA5CGB.js";import{useBrowserLayoutEffect as a}from"./chunk-D65T4H6J.js";import{createContext as l,forwardRef as h,useId as s,useState as d,useRef as c,useEffect as m,isValidElement as f,cloneElement as u,useContext as p}from"react";import{createPortal as g}from"react-dom";import{jsxs as b,jsx as x,Fragment as w}from"react/jsx-runtime";var v=448,M=240,N=8,y=()=>({left:0,right:window.innerWidth,top:0,bottom:window.innerHeight});function W(t){const e=y(),o=t?.closest?.("[data-modal-panel]");if(!o)return e;const i=o.getBoundingClientRect();return i.width<=0||i.height<=0?e:{left:Math.max(e.left,i.left),right:Math.min(e.right,i.right),top:Math.max(e.top,i.top),bottom:Math.min(e.bottom,i.bottom)}}var k=/* @__PURE__ */new Set(["hidden","clip","auto","scroll"]);var C={top:"bottom",bottom:"top",left:"right",right:"left"},H={top:["right","left"],bottom:["right","left"],left:["top","bottom"],right:["top","bottom"]};function B(t,e,o){return{top:t.top-o-(e.top+8),bottom:e.bottom-8-(t.bottom+o),left:t.left-o-(e.left+8),right:e.right-8-(t.right+o)}}var E=(t,e,o)=>Math.max(e,Math.min(t,o));function R(t,e,o){let i=NaN,r=NaN,n=NaN,a=NaN,l=NaN;const h=()=>{const e=t()?.getBoundingClientRect();if(!e)return!1;const h=o?o():NaN,s=e.left!==i||e.top!==r||e.right!==n||e.bottom!==a||h!==l&&!(Number.isNaN(h)&&Number.isNaN(l));return i=e.left,r=e.top,n=e.right,a=e.bottom,l=h,s};h();const s=()=>{h(),e()};let d=requestAnimationFrame(function t(){h()&&e(),d=requestAnimationFrame(t)});return window.addEventListener("scroll",s,!0),window.addEventListener("resize",s),()=>{cancelAnimationFrame(d),window.removeEventListener("scroll",s,!0),window.removeEventListener("resize",s)}}function z({trigger:t,menu:e,bounds:o,align:i,side:r}){const n=B(t,o,4),a="bottom"===r?"top":"bottom",l=e.height>n[r]&&(e.height<=n[a]||n[a]>n[r])?a:r,h=Math.max(Math.min(e.height,96),n[l]),s=Math.min(e.height,h),d=E("bottom"===l?t.bottom+4:t.top-4-s,o.top+8,o.bottom-8-s),c=Math.max(0,o.right-o.left-16),m=Math.min(e.width,c);return{left:E("start"===i?t.left:t.right-m,o.left+8,o.right-8-m),top:d,side:l,maxHeight:h,maxWidth:c}}function j(t,e,o={}){const{matchTriggerWidth:i=!1,preferredMaxWidth:r=v,preferredMaxHeight:n=M,popupRef:l}=o,[h,s]=d(null);return a(()=>{if(!e)return void s(null);const o=()=>{const e=t.current,o=e?.getBoundingClientRect();if(!o)return;const a=W(e),h=a.bottom-o.bottom-4-8,d=o.top-a.top-4-8,c=h<Math.min(n,160)&&d>h,m=Math.max(96,Math.min(n,c?d:h)),f=Math.max(0,a.right-a.left-16),u={minWidth:o.width,maxWidth:Math.min(r,f),maxHeight:m};if(i){const t=Math.min(o.width,f);u.width=t,u.maxWidth=t,u.left=Math.min(Math.max(a.left+8,o.left),a.right-8-t)}else if(l&&a.right-8-o.left<u.maxWidth&&Math.min(o.right,a.right-8)-a.left-8<u.maxWidth){const t=l.current?.offsetWidth??0,e=t>0?Math.min(t,u.maxWidth):u.maxWidth;u.left=Math.max(a.left+8,Math.min(o.left,a.right-8-e))}else if(a.right-8-o.left<u.maxWidth){const t=Math.min(o.right,a.right-8);u.right=window.innerWidth-t,u.maxWidth=Math.min(u.maxWidth,Math.max(0,t-a.left-8))}else u.left=Math.max(a.left+8,o.left);c?u.bottom=window.innerHeight-o.top+4:u.top=o.bottom+4,s(u)};return o(),R(()=>t.current,o,l?()=>l.current?.offsetWidth??NaN:void 0)},[e,t,i,r,n,l]),h}function T({point:t,menu:e,bounds:o}){const i={left:t.x,right:t.x,top:t.y,bottom:t.y},r=o.right-8-t.x,n=t.x-(o.left+8);return z({trigger:i,menu:e,bounds:o,align:e.width<=r||r>=n?"start":"end",side:"bottom"})}var F=l(!1),I=()=>p(F),L={top:"bottom-full left-1/2 -translate-x-1/2 mb-3",bottom:"top-full left-1/2 -translate-x-1/2 mt-3",left:"right-full top-1/2 -translate-y-1/2 mr-3",right:"left-full top-1/2 -translate-y-1/2 ml-3"};function A({content:t,side:l="top",delay:h=200,children:p,className:w="relative inline-flex",describe:v=!0}){const[M,N]=d(!1),z=M&&!(null==t||!1===t||""===t),[j,T]=d(null),I=c(void 0),A=c(null),D=c(null),P=s(),S=c(!1),$=()=>{window.clearTimeout(I.current),S.current||(I.current=window.setTimeout(()=>N(!0),h))},q=()=>{window.clearTimeout(I.current),N(!1)},J=()=>{S.current=!0,q()},G=()=>{S.current=!1,q()};m(()=>()=>window.clearTimeout(I.current),[]),a(()=>{if(!z)return void T(null);const t=()=>{const t=A.current,e=D.current;if(!t||!e)return;const o=W(t),i=Math.max(0,o.right-o.left-16),r=Math.max(0,o.bottom-o.top-16);e.style.maxWidth=`${i}px`,e.style.maxHeight=`${r}px`;const n=e.getBoundingClientRect();if(n.width<=0||n.height<=0)return;const a=t.getBoundingClientRect();if(!function(t){const e=t.getBoundingClientRect();if(e.width<=0&&e.height<=0&&0===e.left&&0===e.top)return null;const o=y(),i={left:Math.max(o.left,e.left),right:Math.min(o.right,e.right),top:Math.max(o.top,e.top),bottom:Math.min(o.bottom,e.bottom)};let r=getComputedStyle(t).position;for(let e=t.parentElement;e&&e!==document.documentElement&&"fixed"!==r;e=e.parentElement){const t=getComputedStyle(e);if("absolute"===r&&"static"===t.position)continue;r=t.position;const o=k.has(t.overflowX),n=k.has(t.overflowY);if(!o&&!n)continue;const a=e.getBoundingClientRect();a.width<=0&&a.height<=0||(o&&(i.left=Math.max(i.left,a.left),i.right=Math.min(i.right,a.right)),n&&(i.top=Math.max(i.top,a.top),i.bottom=Math.min(i.bottom,a.bottom)))}return i.right>=i.left&&i.bottom>=i.top?i:null}(t))return void q();const h=function(t,e,o,i,r){const n=B(t,i,r),a=t=>n[t]-("top"===t||"bottom"===t?e.height:e.width),l=[o,C[o],...H[o]],h=l.find(t=>a(t)>=0)??l.reduce((t,e)=>a(e)>a(t)?e:t),s=(t.left+t.right)/2,d=(t.top+t.bottom)/2;let c,m;switch(h){case"top":c=s-e.width/2,m=t.top-r-e.height;break;case"bottom":c=s-e.width/2,m=t.bottom+r;break;case"left":c=t.left-r-e.width,m=d-e.height/2;break;case"right":c=t.right+r,m=d-e.height/2}return{side:h,left:E(c,i.left+8,i.right-8-e.width),top:E(m,i.top+8,i.bottom-8-e.height)}}(a,n,l,o,12),s=function(t,e,o,i,r){const{side:n,left:a,top:l}=e,h=a+o.width,s=l+o.height;if({top:t.top-s,bottom:l-t.bottom,left:t.left-h,right:a-t.right}[n]<r)return null;const d=(t,e,o)=>o<2*i?e+o/2:Math.max(e+i,Math.min(t,e+o-i)),c=(t.left+t.right)/2,m=(t.top+t.bottom)/2;switch(n){case"top":return{side:n,x:d(c,a,o.width),y:s};case"bottom":return{side:n,x:d(c,a,o.width),y:l};case"left":return{side:n,x:h,y:d(m,l,o.height)};case"right":return{side:n,x:a,y:d(m,l,o.height)}}}(a,h,n,16,6),d={anchor:{left:a.left,top:a.top,width:a.width,height:a.height},left:h.left-a.left,top:h.top-a.top,maxWidth:i,maxHeight:r,side:h.side,arrow:s&&{left:s.x-a.left,top:s.y-a.top}};T(t=>{return t&&(o=d,(e=t).anchor.left===o.anchor.left&&e.anchor.top===o.anchor.top&&e.anchor.width===o.anchor.width&&e.anchor.height===o.anchor.height&&e.left===o.left&&e.top===o.top&&e.maxWidth===o.maxWidth&&e.maxHeight===o.maxHeight&&e.side===o.side&&e.arrow?.left===o.arrow?.left&&e.arrow?.top===o.arrow?.top)?t:d;var e,o})};return t(),R(()=>A.current,t)},[z,l,t]),m(()=>{if(!z)return;const t=o(t=>"Escape"===t.key&&(q(),!i(A.current))),e=r(q);return()=>{t(),e()}},[z]);const K=z&&v?P:void 0,Q=f(p)?u(p,{"aria-describedby":[p.props["aria-describedby"],K].filter(Boolean).join(" ")||void 0}):p,X=z?e():void 0;/* @__PURE__ */
|
|
2
|
-
return b("span",{ref:A,className:w,"aria-describedby":f(p)?void 0:K,onMouseEnter:$,onMouseLeave:G,onFocus:$,onBlur:G,onPointerDown:J,onClick:J,children:[
|
|
3
|
-
/* @__PURE__ */x(F.Provider,{value:!0,children:Q}),z&&g(
|
|
4
|
-
/* @__PURE__ */b("span",{className:"pointer-events-none fixed left-0 top-0",style:{zIndex:n.hint,...j?.anchor},children:[
|
|
5
|
-
/* @__PURE__ */x("span",{ref:D,id:P,role:"tooltip",className:`pointer-events-none absolute z-(--z-hint) box-border w-max overflow-hidden whitespace-normal break-words text-start rounded-md px-2 py-1 text-xs text-gray-800 ${j?"":L[l]}`,style:{...X,...j&&{left:j.left,top:j.top,maxWidth:j.maxWidth,maxHeight:j.maxHeight}},children:t}),(!j||j.arrow)&&
|
|
6
|
-
/* @__PURE__ */x("span",{"aria-hidden":"true",className:"rosh-tooltip-arrow","data-side":j?.side??l,style:{background:X?.background,"--rosh-tooltip-edge":X?.border,...j?.arrow&&{left:j.arrow.left,top:j.arrow.top}}})]}),document.body)]})}var D=t=>!0===t||"true"===t;function P(t){t.preventDefault(),t.stopPropagation()}var S=(t,e)=>[t,e].filter(Boolean).join(" ")||void 0;function $({reason:t,id:e,block:o=!1,children:i}){/* @__PURE__ */
|
|
7
|
-
return b(w,{children:[
|
|
8
|
-
/* @__PURE__ */x(A,{content:t,describe:!1,className:o?"relative flex w-full":"relative inline-flex",children:i}),
|
|
9
|
-
/* @__PURE__ */x("span",{id:e,className:"sr-only",children:t})]})}function q(){/* @__PURE__ */
|
|
10
|
-
return b("svg",{className:"h-3.5 w-3.5 animate-spin",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[
|
|
11
|
-
/* @__PURE__ */x("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),
|
|
12
|
-
/* @__PURE__ */x("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]})}var J=h(function({variant:e="primary",size:o="md",loading:i=!1,leftIcon:r,rightIcon:n,block:a=!1,disabled:l,type:h="button",children:d,className:c="",disabledReason:m,onClick:f,pressed:u,"aria-disabled":p,"aria-describedby":g,...w},v){const M=s(),N=l||i,y=null!=m&&""!==m,W=N&&y,k=!N&&D(p),C=k&&y,H=W||C?M:void 0,B=/* @__PURE__ */b("button",{ref:v,type:h,disabled:N,"aria-busy":i||void 0,"aria-disabled":!!k||p,"aria-describedby":S(g,H),onClick:k?P:f,className:t({variant:e,size:o,block:a,pressed:u??(!0===w["aria-pressed"]||"true"===w["aria-pressed"]),className:c}),...w,children:[i?/* @__PURE__ */x(q,{}):r,d,!i&&n]});return C?/* @__PURE__ */x($,{reason:m,id:M,block:a,children:B}):W?/* @__PURE__ */b("span",{className:a?"flex w-full flex-col gap-1":"inline-flex flex-col items-start gap-1",children:[B,
|
|
13
|
-
/* @__PURE__ */x("span",{id:H,className:"text-xs text-red-600",children:m})]}):B});export{J as Button_default,M as MENU_MAX_HEIGHT,$ as OffWithReason,v as POPUP_MAX_WIDTH,A as Tooltip,N as VIEWPORT_MARGIN,S as describedByWith,R as followAnchor,D as isAriaDisabled,T as placeAtPoint,z as placeMenu,W as popupBounds,P as swallowPress,j as useDropdownPosition,I as useInsideTooltip};
|