ono-react-element 0.0.20 → 0.0.21

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 (87) hide show
  1. package/dist/es/AutoSliderList-DD7w6KlD.js +1 -0
  2. package/dist/es/AvatarCrop-CSkrjAcy.js +1 -0
  3. package/dist/es/Button-DXWGWvF-.js +1 -0
  4. package/dist/es/Card3D-DrfpLxw2.js +1 -0
  5. package/dist/es/Checkbox-jOOMkqbP.js +1 -0
  6. package/dist/es/ContextMenu-BL414VF5.js +1 -0
  7. package/dist/es/InjunctiveBox-vLlRm8LB.js +1 -0
  8. package/dist/es/Input-lVK5hctw.js +1 -0
  9. package/dist/es/List-DXRmDwDo.js +1 -0
  10. package/dist/es/MenuButton-C22ekETH.js +1 -0
  11. package/dist/es/Message-AC7MOJ5X.js +1 -0
  12. package/dist/es/Modal-e1dQi2y3.js +1 -0
  13. package/dist/es/Pagination-L17GYQVO.js +1 -0
  14. package/dist/es/PortalRenderer-izu9LyVc.js +1 -0
  15. package/dist/es/Radio-m9BOKzf5.js +1 -0
  16. package/dist/es/ScrollableTabs-DgcrSjsb.js +1 -0
  17. package/dist/es/Select-BSNVfoEp.js +1 -0
  18. package/dist/es/SvgImg-HkuwJQ4_.js +1 -0
  19. package/dist/es/Switch-DoiR9_x4.js +1 -0
  20. package/dist/es/TemplateDialog-D4D6YS2U.js +1 -0
  21. package/dist/es/Toast-CERLQ4i7.js +1 -0
  22. package/dist/es/Tooltip-DDUtx7BP.js +1 -0
  23. package/dist/es/VirtualList-YXDe-9GK.js +1 -0
  24. package/dist/es/Waterfall-D8AExUDu.js +1 -0
  25. package/dist/es/colorUtils.ts-Cxx4mvOB.js +1 -0
  26. package/dist/es/common.ts-OTJMJPHg.js +1 -0
  27. package/dist/es/dependencies-B7YNjh_z.js +15719 -0
  28. package/dist/es/event-B2tGdMqN.js +1 -0
  29. package/dist/es/fileFormatConversion.ts-3AQHtta9.js +1 -0
  30. package/dist/es/formatTimeUtils.ts-ng_eAUID.js +1 -0
  31. package/dist/es/index.js +1 -1
  32. package/dist/es/useClickOutSide.tsx-C6XuLZzd.js +1 -0
  33. package/dist/es/useCountdown.tsx-DWqs6wNp.js +1 -0
  34. package/dist/es/useEventListener.tsx-C8V9Qip6.js +1 -0
  35. package/dist/es/useGetElementSize.tsx-DML7z5Xp.js +1 -0
  36. package/dist/es/useKeyPress.tsx-hgs6v_Jt.js +1 -0
  37. package/dist/es/useMouseClick.tsx-BmzbuM6X.js +1 -0
  38. package/dist/es/useTheme.tsx-C-GCpzAS.js +1 -0
  39. package/dist/es/useThemePro.tsx-BIU8EPPB.js +1 -0
  40. package/dist/es/viewTransitionUtils.ts-tmSvCt31.js +1 -0
  41. package/dist/types/components/ContextMenu/ContextMenu.d.ts +9 -0
  42. package/dist/types/components/ContextMenu/index.d.ts +1 -0
  43. package/dist/types/components/Modal/types.d.ts +1 -1
  44. package/dist/types/components/index.d.ts +1 -0
  45. package/dist/types/index.d.ts +2 -2
  46. package/dist/umd/index.umd.cjs +1 -1
  47. package/dist/umd/index.umd.cjs.br +0 -0
  48. package/dist/umd/index.umd.cjs.gz +0 -0
  49. package/package.json +1 -1
  50. package/dist/es/AutoSliderList-tkaOmfnx.js +0 -1
  51. package/dist/es/AvatarCrop-DrA-SARP.js +0 -1
  52. package/dist/es/Button-QIC7QPK9.js +0 -1
  53. package/dist/es/Card3D-DMvCSUhe.js +0 -1
  54. package/dist/es/Checkbox-daBabj14.js +0 -1
  55. package/dist/es/InjunctiveBox-DUNoNHCO.js +0 -1
  56. package/dist/es/Input-DLOeg2pz.js +0 -1
  57. package/dist/es/List-UAKCMuGC.js +0 -1
  58. package/dist/es/MenuButton-DHkU5Bq7.js +0 -1
  59. package/dist/es/Message-BGDILiLc.js +0 -1
  60. package/dist/es/Modal-D2289ZPX.js +0 -1
  61. package/dist/es/Pagination-m71H2tfS.js +0 -1
  62. package/dist/es/PortalRenderer-CDAzQJgm.js +0 -1
  63. package/dist/es/Radio-D_GKVoOC.js +0 -1
  64. package/dist/es/ScrollableTabs--449B73p.js +0 -1
  65. package/dist/es/Select-B11NvK-I.js +0 -1
  66. package/dist/es/SvgImg-CZwq2D7J.js +0 -1
  67. package/dist/es/Switch-C61q7rR5.js +0 -1
  68. package/dist/es/TemplateDialog-CAimG5cv.js +0 -1
  69. package/dist/es/Toast-CQEsbqUJ.js +0 -1
  70. package/dist/es/Tooltip-CgttMIcX.js +0 -1
  71. package/dist/es/VirtualList-BAiIymCF.js +0 -1
  72. package/dist/es/Waterfall-C7SWCxJ1.js +0 -1
  73. package/dist/es/colorUtils.ts-DYuRvCXZ.js +0 -1
  74. package/dist/es/common.ts-BbDnZ7vC.js +0 -1
  75. package/dist/es/dependencies-CbQbPZZ-.js +0 -15524
  76. package/dist/es/event-CtX9rswE.js +0 -1
  77. package/dist/es/fileFormatConversion.ts-tUlewYon.js +0 -1
  78. package/dist/es/formatTimeUtils.ts-CkdWJ_Sl.js +0 -1
  79. package/dist/es/useClickOutSide.tsx-CMvd2uTW.js +0 -1
  80. package/dist/es/useCountdown.tsx-Btzj-keH.js +0 -1
  81. package/dist/es/useEventListener.tsx-BBGVcI5T.js +0 -1
  82. package/dist/es/useGetElementSize.tsx-Dtshth0Y.js +0 -1
  83. package/dist/es/useKeyPress.tsx-Db44HXXz.js +0 -1
  84. package/dist/es/useMouseClick.tsx-C7uAH4n4.js +0 -1
  85. package/dist/es/useTheme.tsx-C5b7BRYz.js +0 -1
  86. package/dist/es/useThemePro.tsx-DQuSI8J7.js +0 -1
  87. package/dist/es/viewTransitionUtils.ts-CHa9uBpi.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as y}from "./dependencies-B7YNjh_z.js";import{u as V}from "./useGetElementSize.tsx-DML7z5Xp.js";import{p as g}from "./common.ts-OTJMJPHg.js";import{useState as a,useRef as H,useMemo as z,useEffect as T,cloneElement as F}from "react";var $=((r)=>(r.Horizontal="Horizontal",r.Vertical="Vertical",r))($||{});const G=({list:r,style:v,disable:s,children:m,sliderBox:A,className:C,sliderStyle:N,duration:c=300,sliderClassName:b,currentIndex:p=0,direction:n=$.Horizontal,sliderTransitionTimingFunction:h="ease-in-out"})=>{const [B,E]=a(!1),[t,w]=a(0),[d,S]=a({t:0,l:0}),[u,j]=a({w:0,h:0}),l=H(null),x=H(null),k=z(()=>["width","height","transform"].map((e)=>`${e}${c/1e3}s ${h}`).join(","),[n,c,h]),D=z(()=>({width:u.w,height:u.h,transition:B ? k:"initial",transform:`translate(${d.l}px,${d.t}px)`}),[u,d]),{w:I,h:L}=V();return T(()=>{w(p);},[p]),T(()=>{(()=>{if(typeof t!="number"||!l.current||!x.current)return;const e=Array.from(l.current.children).slice(1);e.forEach((o)=>{o.style.position="relative",o.style.cursor=s ? "not-allowed":"pointer",o.style.zIndex="1";});const i=window.getComputedStyle(l.current),f={t:n==="Horizontal" ? g(i.paddingTop):e[t].offsetTop,l:n==="Horizontal" ? e[t].offsetLeft:g(i.paddingLeft)};S(f),j({w:e[t].offsetWidth,h:e[t].offsetHeight}),setTimeout(()=>E(!0),c);})();},[t,I,L,s]),y.jsxs("ul",{ref:l,className:["ono-auto-slider-list-container",C,s ? "ono-auto-slider-list-is-disable":""].filter(Boolean).join(" "),style:{flexDirection:n==="Horizontal" ? "row":"column",...v},children:[y.jsx("li",{ref:x,className:["ono-auto-slider-list-slider",b].filter(Boolean).join(" "),style:{...N,...D},children:A}),r.map((e,i)=>F(m({item:e,index:i,isActive:i===t}),{onClick:(f)=>{if(s)return;const o=m({item:e,index:i,isActive:i===t}).props.onClick;o&&o(f),w(i);}}))]});};export{G as A,$ as D};
@@ -0,0 +1 @@
1
+ import{j as x}from "./dependencies-B7YNjh_z.js";import{useState as g,useRef as G,useEffect as N}from "react";const X=({imageFile:b,cvsW:$=520,maskBG:F="rgba(0,0,0,0.5)",border:k="4px solid #fff",wheelScale:C=0.1,setCtx:S,maskInfo:a,setMaskInfo:v,imageStartState:R,setImageStartState:B,imageState:e,setImageState:c})=>{const [w,L]=g(),[h,U]=g({w:0,h:0}),[p,d]=g({w:0,h:0}),[I,y]=g({x:0,y:0}),[M,j]=g(!1),u=G(null),f=G(null),r=(t,l)=>{l((n)=>({...n,...t}));},Y=()=>{const t=k.split(" ");let l=0;return t.forEach((n)=>{n.includes("px")&&(l=Number(n.split("px")[0]));}),l;},W=()=>{j(!1),e.l>a.l&&r({l:a.l},c),e.t>a.l&&r({t:a.l},c),-e.l>e.w-a.l-a.w&&r({l:-(e.w-a.l-a.w)},c),-e.t>e.h-a.l-a.w&&r({t:-(e.h-a.l-a.w)},c);};return N(()=>{(()=>{if(!u.current)return;const{width:t}=u.current.getBoundingClientRect();((l)=>{const n=new Image();n.src=typeof b=="string" ? b:URL.createObjectURL(b),n.onload=()=>{var E;let m=1,s=n.width,i=n.height;s>i ?(m=s/l,s=l,i/=m,r({w:i},v)):(m=i/l,i=l,s/=m,r({w:s},v));const o=(l-s)/2,D=(l-i)/2;r({w:n.width,h:n.height},d),L(n),r({w:s,h:i,t:D,l:o},c),B({w:s,h:i,t:D,l:o}),r(o>D ?{l:o}:{l:D},v),S((E=f.current)==null ? void 0:E.getContext("2d"));};})(t),U({w:t,h:t});})();},[u]),N(()=>{if(!f.current||!w)return;const t=f.current.getContext("2d");t&&(t.clearRect(0,0,f.current.width,f.current.height),t.drawImage(w,e.l,e.t,e.w,e.h));},[f,w,e]),x.jsxs("div",{ref:u,className:"ono-avatar-canvas",style:{width:$,cursor:M ? "grabbing":"grab"},onWheel:(t)=>{t.preventDefault(),t.stopPropagation();const l=t.deltaY<0 ? "in":"out",n=((s,i)=>{let o=s+(i==="in" ? s*C:-s*C);return o>p.w&&(o=p.w),o<R.w&&(o=R.w),o;})(e.w,l),m=n/p.w;r({w:n,h:p.h*m},c),W();},onMouseUp:W,onMouseLeave:W,children:[x.jsx("canvas",{width:h.w,height:h.h,ref:f,onMouseDown:(t)=>{r({x:t.clientX,y:t.clientY},y),j(!0);},onMouseMove:(t)=>{if(M){const l=t.clientX-I.x,n=t.clientY-I.y;(Math.abs(l)>10||Math.abs(n)>10)&&(r({t:e.t+n,l:e.l+l},c),r({x:t.clientX,y:t.clientY},y));}}}),w&&x.jsx("div",{className:"ono-avatar-mask",children:x.jsx("div",{style:{border:k,boxShadow:`${F}0 0 0 10000px`,width:`${a.w+2*Y()}px`,height:`${a.w+2*Y()}px`}})})]});},A=({imageFile:b,cvsW:$=520,maskBG:F="rgba(0,0,0,0.5)",border:k="4px solid #fff",wheelScale:C=0.1,children:S})=>{const [a,v]=g({w:0,h:0,t:0,l:0}),[R,B]=g({w:0,h:0,t:0,l:0}),[e,c]=g({w:0,l:0}),[w,L]=g();return x.jsxs(x.Fragment,{children:[x.jsx(X,{imageFile:b,cvsW:$,maskBG:F,border:k,wheelScale:C,maskInfo:e,setMaskInfo:c,setCtx:L,imageStartState:a,setImageStartState:v,imageState:R,setImageState:B}),S==null ? void 0:S({handleConfirm:(h,U)=>{if(!w)return;const p=w.getImageData(e.l,e.l,e.w,e.w),d=document.createElement("canvas"),I=d.getContext("2d");if(d.width=e.w,d.height=e.w,!I)return;const{imageSaveType:y="png",dataSaveType:M="base64",quality:j=100}=U||{};I.putImageData(p,0,0,0,0,e.w,e.w),M==="base64" ? h(d.toDataURL(`image/${y}`,j/100)):M==="blob"&&d.toBlob((u)=>{if(u)return h(u);},`image/${y}`,j/100);},handleReduction:(h)=>{B({w:a.w,h:a.h,t:a.t,l:a.l}),h==null||h();}})]});};export{A};
@@ -0,0 +1 @@
1
+ import{j as t}from "./dependencies-B7YNjh_z.js";import{t as B}from "./common.ts-OTJMJPHg.js";import{forwardRef as w,useState as L,useRef as h,useEffect as c}from "react";const T=w(({onClick:d,children:m,disabled:r,loading:n,plain:y,shape:u="default",htmlType:g="button",type:j="primary",throttleDuration:l,className:x,style:b,icon:a},s)=>{const [f,p]=L(!1),o=h(null),i=h(null),C=d ? B(d,l ? typeof l=="number" ? l:500:0):void 0;return c(()=>{(()=>{if(!i.current)return;const e=i.current;n ?(p(!0),e.classList.add("ono-loading-start")):(setTimeout(()=>{p(!1);},300),e.classList.remove("ono-loading-start"),e.classList.add("ono-loading-end"));})();},[n,i]),c(()=>{(()=>{if(!o.current)return;const e=o.current,v=e.getBoundingClientRect();e.style.setProperty("--btn-height",v.height+"px");})();},[o]),c(()=>{s&&o&&(typeof s=="function" ? s(o.current):s.current=o.current);},[s,o]),t.jsxs("button",{ref:o,className:[`ono-btn-${j}`,n||f ? "ono-is-loading":"",n||a ? "ono-is-icon":"",r ? "ono-btn-is-disabled":"",u==="round" ? "ono-is-round":u==="circle" ? "ono-is-circle":"",y ? "ono-is-plain":"",x ?? ""].filter(Boolean).join(" "),type:g,disabled:(typeof r=="function" ? r():r)||!!n,style:b,onClick:C,children:[(()=>{const e=t.jsx("span",{ref:i,className:"ono-btn-icon",children:t.jsx("span",{children:typeof n=="object" ? n.icon:t.jsx("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"loading",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})})})});return n||f ? e:a ? t.jsx("span",{children:a}):t.jsx(t.Fragment,{});})(),m]});});export{T as B};
@@ -0,0 +1 @@
1
+ import{j as d}from "./dependencies-B7YNjh_z.js";import{useState as R,useRef as E,useEffect as f}from "react";const w=({src:t,children:s,enlarge:l=!1,scale:y=1.1,shadow:a,xRange:i=[-10,10],yRange:g=[-10,10],borderRadius:p=20})=>{const [v,c]=R(!1),e=E(null),u=(r,o,n)=>o/n*(r[1]-r[0])+r[0];return f(()=>{e.current&&a&&e.current.style.setProperty("--sd",a);},[e.current]),f(()=>{if(!s&&!t)throw new Error("请传入children或者src属性");},[s,t]),d.jsx("div",{ref:e,className:"ono-card",style:{borderRadius:p,transform:`perspective(500px)scale(${v&&l ? y:1})rotateX(var(--rx,0deg))rotateY(var(--ry,0deg))`},onMouseEnter:()=>c(!0),onMouseMove:(r)=>{const{offsetX:o,offsetY:n}=r.nativeEvent,{offsetWidth:x,offsetHeight:h}=e.current,m=u(i,n,h),P=-u(g,o,x);e.current.style.setProperty("--rx",`${m}deg`),e.current.style.setProperty("--ry",`${P}deg`);},onMouseLeave:()=>{c(!1),e.current.style.setProperty("--rx","0deg"),e.current.style.setProperty("--ry","0deg");},children:s ?? d.jsx("img",{src:t,alt:"图片"})});};export{w as C};
@@ -0,0 +1 @@
1
+ import{j as b}from "./dependencies-B7YNjh_z.js";import{useState as x,useRef as g,useEffect as v}from "react";const S=({id:d,style:o,checked:c,onChange:h,className:a,indeterminate:t=!1,checkedColor:l="#0077cc",indeterminateStyle:y="line",indeterminateColor:p="#0077cc"})=>{const [i,f]=x(""),e=g(null),C=[{value:l,name:"checkedColor"},{value:p,name:"indeterminateColor"}];return v(()=>{(()=>{if(!e.current)return;const r=getComputedStyle(e.current);i||f(r.borderColor),e.current.style.height=r.width,[{value:r.width,name:"w"},{value:c||t ? l:i,name:"border-color"},...C].forEach(({value:s,name:k})=>{s&&((n,u,m)=>{typeof n=="string" ? m.style.setProperty(`--${u}`,n):m.style.setProperty(`--${u}`,`${n}px`);})(s,k,e.current);});})(),e.current&&(e.current.indeterminate=t);},[e,a,o,t]),b.jsx("input",{id:d,type:"checkbox",ref:e,checked:c,onChange:h,className:[a,y==="line" ? "ono-checkbox-line":"ono-checkbox-border"].filter(Boolean).join(" "),style:o});};export{S as C};
@@ -0,0 +1 @@
1
+ import{j as m}from "./dependencies-B7YNjh_z.js";import{u as f}from "./useEventListener.tsx-C8V9Qip6.js";import{p as v}from "./PortalRenderer-izu9LyVc.js";const x=({className:o,content:e,style:n,onClick:t,onDoubleClick:l,onContextMenu:u,onMouseDown:i,onMouseUp:a,onMouseEnter:M,onMouseLeave:r,onMouseMove:p,destroy:s})=>(f("click",s),m.jsx("div",{className:o,style:n,onClick:t,onDoubleClick:l,onContextMenu:u,onMouseDown:i,onMouseUp:a,onMouseEnter:M,onMouseLeave:r,onMouseMove:p,children:typeof e=="function" ? e((c)=>{s(),c&&c();}):e})),k=({e:o,style:e,content:n,className:t})=>{o.preventDefault(),v(x,{className:t,content:n,style:{zIndex:9999,...e,position:"fixed",left:o.clientX,top:o.clientY}},"content-menu-root");};export{k as c};
@@ -0,0 +1 @@
1
+ import{j as t,R as v}from "./dependencies-B7YNjh_z.js";import{u as k}from "./useEventListener.tsx-C8V9Qip6.js";let l,o=null;const x=({className:e,content:n,style:u,onClick:i,onDoubleClick:c,onContextMenu:r,onMouseDown:M,onMouseUp:a,onMouseEnter:m,onMouseLeave:d,onMouseMove:C,isClickBoxToClose:p})=>(k("click",()=>{p&&o&&(o.remove(),o=null);}),t.jsx("div",{className:e,style:u,onClick:i,onDoubleClick:c,onContextMenu:r,onMouseDown:M,onMouseUp:a,onMouseEnter:m,onMouseLeave:d,onMouseMove:C,children:typeof n=="function" ? n((s)=>{o&&(o.remove(),o=null,s&&s());}):n})),b=(e)=>(f(e.isSingle||!1).render(t.jsx(x,{...e})),o),f=(e)=>(e&&o&&l||(o=document.createElement("div"),document.body.appendChild(o),l=v.createRoot(o)),l);export{b as i};
@@ -0,0 +1 @@
1
+ import{j as o}from "./dependencies-B7YNjh_z.js";import{useState as f,useRef as $,useEffect as q}from "react";import{u as A}from "./useKeyPress.tsx-hgs6v_Jt.js";const H=()=>o.jsx("svg",{className:"ono-input-icon",viewBox:"64 64 896 896",focusable:"false","data-icon":"close-circle",fill:"currentColor","aria-hidden":"true",children:o.jsx("path",{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"})}),I=({open:x})=>o.jsx("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":x ? "eye":"eye-invisible",fill:"currentColor","aria-hidden":"true",className:"ono-input-icon",children:x ? o.jsx("path",{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}):o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"}),o.jsx("path",{d:"M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"})]})}),J=({id:x,name:D,max:R,min:N,maxLength:L,minLength:Q,type:Y="text",className:E,defaultValue:F,placeholder:O,readonly:V,autocomplete:W="off",autofocus:z,form:y,disabled:v,clearable:S,showPassword:B,prepend:p,append:d,prefix:g,suffix:m,showCount:M,border:P="1px solid #5644b8",boxShadow:b="0 0 0 2px #7969d11a",value:w="",onChange:h,onFocus:C,onBlur:s,onClear:j})=>{const [k,t]=f(w),[e,a]=f(!1),[r,i]=f(!1),n=$(null),l=S&&!v&&k,u=B&&!v;return q(()=>{n.current&&(n.current.style.setProperty("--ono-input-border",P),n.current.style.setProperty("--ono-input-box-shadow",b));},[n]),q(()=>{t(w);},[w]),o.jsxs("div",{className:["ono-input","ono-input-border",v ? "ono-input-is-disabled":""].filter(Boolean).join(" "),children:[p&&o.jsx("div",{className:"ono-prepend",children:p}),o.jsxs("div",{ref:n,className:["ono-input-wrapper",e ? "ono-input-is-focus":"",E].filter(Boolean).join(" "),onMouseDown:(c)=>{c.target.tagName!=="INPUT"&&c.preventDefault();},children:[g&&o.jsx("span",{className:"ono-prefix",children:g}),o.jsx("input",{id:x,max:R,min:N,name:D,maxLength:L,minLength:Q,defaultValue:F,className:"ono-input-inner",type:B ? r ? "text":"password":Y,placeholder:O,readOnly:V,autoComplete:W,autoFocus:z,form:y,disabled:v,onFocus:(c)=>{C==null||C(c),a(!0);},onBlur:(c)=>{s==null||s(c),a(!1);},value:k,onChange:(c)=>{h==null||h(c),t(c.target.value);}}),(m||l||u||M)&&o.jsxs("span",{className:"ono-suffix",children:[m,l&&o.jsx("button",{className:"ono-clear-icon",onClick:()=>{j==null||j(),t("");},children:o.jsx(H,{})}),u&&o.jsx("button",{className:"ono-eye-icon",onClick:()=>i(!r),children:o.jsx(I,{open:r})}),M&&L&&o.jsxs("p",{className:"ono-count",children:[k.length,"/",L]})]})]}),d&&o.jsx("div",{className:"ono-append",children:d})]});},K=({id:x,name:D,rows:R,maxLength:N,minLength:L,className:Q,placeholder:Y,readonly:E,resize:F=!0,autocomplete:O="off",autofocus:V,form:W,disabled:z,autoSize:y,showCount:v,border:S="1px solid #5644b8",boxShadow:B="0 0 0 2px #7969d11a",value:p="",onChange:d})=>{const [g,m]=f(p),[M,P]=f(!1),[b,w]=f([p]),[h,C]=f(0),s=$(null),j=(t)=>{const e=b.slice(0,h+1);e.push(t),w(e),C(e.length-1);};return [{key:"CommandOrControl+z",handler:(t)=>{document.activeElement===s.current&&(t.preventDefault(),(()=>{if(h>0&&s.current){const e=h-1,a=b[e];if(s.current.value=a,m(a),C(e),d){const r={target:s.current};d(r);}}})());},deps:[b]},{key:"CommandOrControl+d",handler:(t)=>{if(s.current&&document.activeElement===s.current){t.preventDefault();const e=((a)=>{const{value:r,selectionStart:i,selectionEnd:n}=a,l=r.substring(0,i)+r.substring(n);return a.value=l,a.setSelectionRange(i,i),l;})(s.current);if(m(e),j(e),d){const a={target:s.current};d(a);}}},deps:[b]}].forEach(({key:t,handler:e,deps:a})=>A(t,e,{target:s.current,deps:a})),q(()=>{m(p);},[p]),q(()=>{(()=>{if(!s.current)return;const t=s.current;((e,a,r,i,n)=>{const l=e.parentNode;e.style.resize=a ? "none":r ? "vertical":"none",l.style.setProperty("--ono-input-border",i),l.style.setProperty("--ono-input-box-shadow",n),l.style.setProperty("--ono-input-height","auto");})(t,y||!1,F,S,B),y&&((e,a)=>{const{minRows:r=2,maxRows:i}=typeof a=="object" ? a:{},n=document.createElement("div");n.style.position="absolute",n.style.visibility="hidden",n.style.whiteSpace="pre-wrap",n.style.wordWrap="break-word",n.style.width=`${e.clientWidth}px`,n.style.font=getComputedStyle(e).font,n.style.padding=getComputedStyle(e).padding,n.style.border=getComputedStyle(e).border,n.style.boxSizing="border-box",document.body.appendChild(n);const l=34*r;let u=l;if(e.value){n.textContent=e.value;const c=n.offsetHeight;u=Math.max(l,c),i&&u>34*i ?(u=34*i,e.style.overflowY="auto"):e.style.overflowY="hidden";}else e.style.overflowY="hidden";e.style.height=`${u}px`,e.style.resize=a ? "none":"vertical",document.body.removeChild(n),Math.floor(u/34);})(t,y);})();},[s,y,g]),o.jsxs("div",{className:["ono-textarea",z ? "ono-input-is-disabled":""].filter(Boolean).join(" "),children:[o.jsx("div",{className:["ono-textarea-wrapper",M ? S==="none" ? "":"ono-input-is-focus":"",Q].filter(Boolean).join(" "),onClick:()=>{var t;return(t=s.current)==null ? void 0:t.focus();},children:o.jsx("textarea",{ref:s,className:"ono-textarea-inner",id:x,rows:R,name:D,maxLength:N,minLength:L,placeholder:Y,readOnly:E,autoComplete:O,autoFocus:V,form:W,disabled:z,onFocus:()=>P(!0),onBlur:()=>P(!1),value:g,onChange:(t)=>{m(t.target.value),j(t.target.value),d==null||d(t);}})}),v&&N&&o.jsx("p",{className:"ono-count-bar",onClick:(t)=>t.stopPropagation(),children:g.length+"/"+N})]});};export{J as O,K as a};
@@ -0,0 +1 @@
1
+ import{useState as h,useEffect as m}from "react";const g=({list:e,children:o,fallback:c,deps:i=[],insertBetweenDom:l})=>{const [t,a]=h([]);return m(()=>{(async()=>{if(!e)return;a(c);const n=typeof e=="function" ? await e():e;a(n.length>0 ?((r,s)=>s ? r.reduce((u,p,f)=>(u.push(p),f<r.length-1&&u.push(s(f)),u),[]):r)(((r)=>r.map(o).filter((s)=>s))(n),l):c);})();},[...i]),t;},w=({list:e,children:o,fallback:c,insertBetweenDom:i})=>(()=>{const l=typeof e=="function" ? e():e;return l.length>0 ?((t,a)=>a ? t.reduce((n,r,s)=>(n.push(r),s<t.length-1&&n.push(a(s)),n),[]):t)(((t)=>t.map(o).filter(Boolean))(l),i):c;})();export{g as A,w as L};
@@ -0,0 +1 @@
1
+ import{j as c}from "./dependencies-B7YNjh_z.js";import{useState as b,useEffect as p}from "react";const j=({active:s,onchange:r,w:t="40px",duration:d=400,clr:m="#f5f5f5",bgc:f="#342A7C"})=>{const [a,h]=b(!1),e=(o,i)=>{let u;const l=o.split("");return l[l.length-1]==="x"&&(u=Number(l.slice(0,-2).join(""))*i+"px"),u;},n={width:e(t,0.6),height:e(t,0.06),left:e(t,a ? 0.11:0.2),borderRadius:e(t,1),background:m,transition:`all ${d/1e3}s`},g=[{...n,width:e(t,a ? 0.8:0.5),height:e(t,a ? 0.05:0.06),transform:a ? "translateY(0)rotate(45deg)":`translateY(-${e(t,0.22)})`},{...n,width:e(t,a ? 0.8:0.3),height:e(t,a ? 0.05:0.06),transform:a ? "translateY(0)rotate(315deg)":`translateY(${e(t,0.22)})`},{...n,left:"auto",transform:a ? `translateX(${e(t,1.1)})`:"translateX(0)"}];return p(()=>{h(!!s);},[s]),c.jsx("button",{className:"ono-menu-button",style:{width:t,height:t,background:f,borderRadius:e(t,0.2)},onClick:()=>requestAnimationFrame(()=>{r==null||r(!a),h(!a);}),children:g.map((o,i)=>c.jsx("span",{style:{...o}},i))});};export{j as M};
@@ -0,0 +1 @@
1
+ import{j as o}from "./dependencies-B7YNjh_z.js";import{useState as j,useRef as O,useMemo as J,useCallback as Q,useEffect as M}from "react";import{p as U}from "./PortalRenderer-izu9LyVc.js";let B=1;const i=[],m=(e,r,a)=>(i.length===0&&(B=1),W(r.instancesKey||"",e,{id:`${a}-${B++}`,key:r.instancesKey||"",reactNode:e,props:r,offsetOptions:{topOffset:0,height:0,bottomOffset:0}}),i),S=(e)=>{const r=i.findIndex((a)=>a.id===e);return r<=0 ? 0:i[r-1].offsetOptions.bottomOffset;},W=(e,r,a)=>{const f=(t)=>U(r,{zIndex:999+B-1,...t.props,id:t.id},t.id,"ono-message-root");if(!e){const t=f(a);i.push({...a,props:{...a.props,id:a.id,destroy:t},destroy:t});}let y=!1;const k=i.map((t)=>{if(t.key===e){y=!0;const p={...t.props,...a.props};return{...t,props:p};}{const p=f(t);return{...t,props:{...t.props,id:t.id,destroy:p},destroy:p};}});if(Object.assign(i,k),!y){const t=f(a);i.push({...a,props:{...a.props,id:a.id,destroy:t},destroy:t});}},X={info:{light:"#1677ff",dark:"#1677ff"},success:{light:"#52c41a",dark:"#49aa19"},error:{light:"#ff4d4f",dark:"#a61d24"},warning:{light:"#faad14",dark:"#d89614"},loading:{light:"#9254de",dark:"#f5f5f5"}},C=(e,r)=>X[e][r],K=(e)=>{switch(e){case "success":return o.jsx("svg",{className:"ono-type-icon",viewBox:"0 0 1024 1024",focusable:"false","data-icon":"check-circle",fill:C(e,"light"),"aria-hidden":"true",children:o.jsx("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})});case "error":return o.jsx("svg",{className:"ono-type-icon",viewBox:"0 0 1024 1024",focusable:"false","data-icon":"close-circle",fill:C(e,"light"),"aria-hidden":"true",children:o.jsx("path",{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"})});case "loading":return o.jsx("svg",{className:["ono-info-icon","ono-loading"].join(" "),viewBox:"0 0 1024 1024",focusable:"false","data-icon":"loading",fill:C(e,"light"),"aria-hidden":"true",children:o.jsx("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});default:return o.jsx("svg",{className:"ono-info-icon",viewBox:"64 64 896 896",focusable:"false","data-icon":"exclamation-circle",fill:C(e,"light"),"aria-hidden":"true",children:o.jsx("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"})});}},T=({handleDestroy:e})=>o.jsx("button",{onClick:e,children:o.jsx("svg",{className:"ono-clear-icon",viewBox:"64 64 896 896",focusable:"false","data-icon":"close-circle",fill:"currentColor","aria-hidden":"true",children:o.jsx("path",{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"})})}),g=({id:e,instancesKey:r,duration:a=3e3,speed:f=300,offset:y=20,message:k,type:t,plain:p=!0,showClose:D=!1,zIndex:F,onClose:E=()=>{},destroy:R})=>{const [,q]=j(!1),[w,A]=j(0),[x,H]=j(((n)=>{const c=i.findIndex((l)=>l.id===n);return c<=0 ? 0:i[c-1].offsetOptions.topOffset;})(e)),[s,P]=j({duration:a,speed:f,message:k,type:t,showClose:D,onClose:E}),v=O(null),z=O(null),d=O(null),I=x+w,V=J(()=>({transform:`translate(-50%,${x}px)`,transition:`transform ${f}ms ease-in-out`,zIndex:F}),[x,f]),L=()=>{d.current&&(d.current.classList.remove("ono-message-enter"),d.current.classList.add("ono-message-leave"),d.current.style.transform=`translate(-50%,${S(e)-w}px)`,((n)=>{const c=i.findIndex((l)=>l.id===n);c!==-1&&i.splice(c,1);})(e),setTimeout(()=>R(s.onClose),f));},b=(n,c,l)=>{n!=="loading"&&(v.current=setTimeout(L,c-l));},N=()=>{const n=S(e);q((c)=>(c&&H(n+y),!0)),requestAnimationFrame(N);},$=Q(()=>{if(s.type==="loading"){if(z.current)return;z.current=setTimeout(()=>{var l;z.current=null;const n=(c=r||"")?(l=i.find((u)=>u.key===c))==null ? void 0:l.props:null;var c;n&&(((u)=>{P((G)=>({...G,...u}));})({...n}),b(s.type,n.duration||s.duration,n.speed||s.speed),$());},100);}},[s]);return M(()=>{b(s.type,s.duration,s.speed),N(),$();},[s.type,s.duration,s.speed]),M(()=>{(()=>{if(!d.current)return;const{height:n}=d.current.getBoundingClientRect();d.current.style.setProperty("--speed",`${s.speed}ms`),A(n);})();},[d]),M(()=>{((n,c)=>{const l=i.findIndex((u)=>u.id===n);l<0||(i[l].offsetOptions=c);})(e,{topOffset:x,height:w,bottomOffset:I});},[I]),o.jsx("div",{ref:d,className:["ono-message",`ono-message-${s.type}`,"ono-message-enter",p ? "":"ono-message-color"].filter(Boolean).join(" "),style:V,onMouseEnter:()=>{v.current&&(clearTimeout(v.current),v.current=null);},onMouseLeave:()=>b(s.type,s.duration,s.speed),children:typeof s.message=="function" ? s.message(K(s.type),s.showClose&&o.jsx(T,{handleDestroy:L})):o.jsxs(o.Fragment,{children:[K(s.type),o.jsx("div",{children:s.message}),s.showClose&&o.jsx(T,{handleDestroy:L})]})});},h=(e)=>{if(typeof e=="string")return{message:e};{const r={...e,instancesKey:e.key};return delete r.key,{...r};}},e0={info:(e)=>{m(g,{...h(e),type:"info"},"ono-message");},success:(e)=>{m(g,{...h(e),type:"success"},"ono-message");},warning:(e)=>{m(g,{...h(e),type:"warning"},"ono-message");},error:(e)=>{m(g,{...h(e),type:"error"},"ono-message");},loading:(e)=>{m(g,{...h(e),type:"loading"},"ono-message");}};export{e0 as m};
@@ -0,0 +1 @@
1
+ import{j as o}from "./dependencies-B7YNjh_z.js";import{a as h}from "./colorUtils.ts-Cxx4mvOB.js";import{useState as D,useRef as v,useEffect as y}from "react";import{p as E}from "./PortalRenderer-izu9LyVc.js";import{B as w}from "./Button-DXWGWvF-.js";const F=({title:c="This is a modal title",icon:C,content:g="This is a modal content",okText:k="confirm",cancelText:B="cancel",confirmDisabled:N,cancelDisabled:P,startPosition:t,onConfirm:d,onCancel:m,mask:x=!0,maskClosable:T=!1,width:u,btnClr:n,footer:f=({OkBtn:s,CancelBtn:i})=>o.jsxs(o.Fragment,{children:[o.jsx(i,{}),o.jsx(s,{})]}),modalBody:b,destroy:p})=>{const [s,i]=D(!1),l=v(null),a=v(null),z=[{label:"themeColor",value:n||""},{label:"themeHoverColor",value:n&&h(n,"light",10)||""},{label:"themeActiveColor",value:n&&h(n,"dark",20)||""},{label:"themeDisabledClr",value:n&&h(n,"light",20)||""}],r=()=>{if(t){if(!a.current)return;a.current.classList.remove("ono-modal-enter"),a.current.classList.add("ono-modal-leave"),setTimeout(()=>{p();},300);}else p();};return y(()=>(l.current&&(x ? l.current.showModal():l.current.show()),()=>{l.current&&l.current.close();}),[l.current,x]),y(()=>{(()=>{if(!a.current)return;const e=a.current.style;u&&e.setProperty("--width",u+"px"),t&&(e.setProperty("--left",(t.x/window.innerWidth*100).toFixed(2)+"%"),e.setProperty("--top",(t.y/window.innerHeight*100).toFixed(2)+"%")),n&&z.forEach((j)=>e.setProperty(`--${j.label}`,j.value));})();},[a]),o.jsx("dialog",{ref:l,className:"ono-modal",onClick:()=>T&&r(),children:b ? b(r):o.jsxs("div",{ref:a,className:["ono-modal-box",t ? "ono-modal-enter":""].join(" "),onClick:(e)=>e.stopPropagation(),children:[o.jsxs("div",{className:"ono-modal-box-body",children:[C ?? o.jsx("div",{className:"ono-modal-box-body-icon",children:o.jsx("svg",{color:"#faad14",viewBox:"64 64 896 896",focusable:"false","data-icon":"exclamation-circle",width:"22px",height:"22px",fill:"currentColor","aria-hidden":"true",style:{marginInlineEnd:"12px"},children:o.jsx("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"})})}),o.jsxs("div",{className:"ono-modal-box-body-contentBar",children:[o.jsx("h1",{className:"ono-modal-box-body-contentBar-title",children:c}),o.jsx("p",{className:"ono-modal-box-body-contentBar-content",children:g})]})]}),f&&o.jsx("div",{className:"ono-modal-box-footer",children:f({OkBtn:()=>o.jsx(w,{className:"ono-modal-box-footer-confirmBtn",loading:s,disabled:N,onClick:async()=>{i(!0);try{const e=d==null ? void 0:d();e instanceof Promise&&await e;}finally{i(!1),r();}},children:k ?? "Confirm"}),CancelBtn:()=>o.jsx(w,{className:"ono-modal-box-footer-cancelBtn",disabled:P||s,onClick:()=>{m==null||m(),r();},children:B ?? "Cancel"}),handleClose:()=>r()})})]})});},A=(c)=>E(F,c,"ono-modal");export{A as M};
@@ -0,0 +1 @@
1
+ import{j as t}from "./dependencies-B7YNjh_z.js";const C=({firstBtn:r,lastBtn:g,currentPage:n,total:a,prevBtn:e,nextBtn:l,styles:m,className:b,children:p,onChange:c,pageBtnClassName:x,pageBtnActiveClassName:N,hiddenNextBtnOnLastPage:u,hiddenPrevBtnOnFirstPage:j})=>{const d=Math.max(1,Math.min(n,a));return t.jsxs("ul",{className:`ono-pagination ${b}`,style:m,children:[r&&t.jsx("li",{className:r ? "ono-pagination-base":"ono-pagination-btn",onClick:()=>c(1),children:r}),j&&n===1 ? null:t.jsx("li",{className:"ono-pagination-base",style:{cursor:n!==1 ? "pointer":"no-drop"},onClick:()=>{n<=1||c(n-1);},children:e ? typeof e=="function" ? e(n!==1):e:t.jsx("div",{className:e ? "ono-pagination-base":"ono-pagination-btn",children:"prevBtn"})}),(()=>{const i=Array.from({length:a},(v,s)=>t.jsx("li",{className:"ono-pagination-base",onClick:()=>c(s+1),children:p ? p({page:s+1,isActive:n===s+1}):t.jsx("div",{className:`ono-pagination-base ${x ?? "ono-pagination-btn"}${d===s+1 ? N ?? "ono-pagination-btn-active":""}`,children:s+1})},s+1));if(i.length<=7)return i;const h=a-1,o=d,B=o>=a-2;return o<=3 ? [...i.slice(0,o===3 ? 4:3),"...",i[h]]:B ? [i[0],"...",...i.slice(o===a-2 ?-4:-3)]:[i[0],"...",...i.slice(o-2,o+1),"...",i[h]];})(),u&&n===a ? null:t.jsx("li",{className:"ono-pagination-base",style:{cursor:n!==a ? "pointer":"no-drop"},onClick:()=>{c(n>=a ? a:n+1);},children:l ? typeof l=="function" ? l(n!==a):l:t.jsx("div",{className:l ? "ono-pagination-base":"ono-pagination-btn",children:"nextBtn"})}),g&&t.jsx("li",{className:g ? "ono-pagination-base":"ono-pagination-btn",onClick:()=>c(a),children:g})]});};export{C as P};
@@ -0,0 +1 @@
1
+ import{j as l,R as p}from "./dependencies-B7YNjh_z.js";const y=(c,i,r,u)=>{const{target:o,root:a}=((n,d)=>{let e=null,t=null;return d&&(e=document.getElementById(d),e||(e=document.createElement("div"),e.id=d,document.body.appendChild(e))),n ?(t=document.getElementById(n),t||(t=document.createElement("div"),t.id=n,e ? e.appendChild(t):document.body.appendChild(t))):(t=document.createElement("div"),e ? e.appendChild(t):document.body.appendChild(t)),{target:t,root:e};})(r,u),m=(n)=>{var d;typeof n=="function"&&n(),r ?(d=document.getElementById(r))==null||d.remove():o.remove(),requestAnimationFrame(()=>a&&a.children.length===0&&a.remove());};if(o.__reactContainer$!==void 0)o.__reactContainer$.render(l.jsx(c,{...i,destroy:m}));else{const n=p.createRoot(o);o.__reactContainer$=n,n.render(l.jsx(c,{...i,destroy:m}));}return m;};export{y as p};
@@ -0,0 +1 @@
1
+ import{j as o}from "./dependencies-B7YNjh_z.js";import{useState as W,useRef as y,useEffect as E}from "react";const P=({name:h,value:a,style:m,checked:n,onChange:C,children:r,className:p,radioW:f=16,radioGap:v=4,checkedColor:c="#532ce1",unCheckedColor:t="transparent",disabled:d=!1})=>{const [e,l]=W(""),b=y(null),i=y(null),s=y(null),x=[{value:f,name:"w"},{value:v,name:"gap"},{value:c,name:"checkedColor"},{value:t,name:"unCheckedColor"}];return E(()=>{(()=>{if(!s.current||!i.current)return;x.forEach(({value:j,name:g})=>{j&&((k,N,w)=>{const G=typeof k=="number";w.style.setProperty(`--${N}`,G ? `${k}px`:k);})(j,g,i.current);});const u=getComputedStyle(s.current);e||l(u.borderColor),s.current.style.borderColor=n ? c:e;})();},[i,s,n,e]),o.jsxs("div",{ref:i,className:["ono-radio-box",p].join(" "),style:m,children:[o.jsx("div",{ref:s,className:"ono-radio",onClick:()=>{var u;return(u=b.current)==null ? void 0:u.click();},children:o.jsx("input",{type:"radio",name:h,ref:b,value:a+"",checked:n,disabled:d,id:a+""+r,onChange:C})}),r&&o.jsx("label",{htmlFor:a+""+r||"",children:r})]});},$=({name:h,style:a,options:m,onChange:n,className:C,radioW:r=16,radioGap:p=4,labelPosition:f="right",checkedColor:v="#532ce1",unCheckedColor:c="transparent",value:t})=>o.jsx("div",{className:["ono-radio-group",C].join(" "),style:a,children:m.map(({label:d,value:e,disabled:l})=>o.jsx(P,{name:h,value:e,radioW:r,radioGap:p,style:{flexDirection:f==="left" ? "row-reverse":"row"},checkedColor:v,unCheckedColor:c,onChange:()=>n(e),checked:t+""==e+"",disabled:typeof l=="function" ? l(t):l||!1,children:d},d))});export{P as R,$ as a};
@@ -0,0 +1 @@
1
+ import{j as g}from "./dependencies-B7YNjh_z.js";import{forwardRef as b,useState as j,useRef as k,useEffect as m}from "react";const C=({children:s,disabled:f,className:h,style:n,onClick:l})=>g.jsx("li",{className:["ono-scrollable-tab",h].filter(Boolean).join(" "),style:n,onClick:(o)=>!f&&(l==null ? void 0:l(o)),children:s}),S=b(({activeIndex:s,children:f,className:h,style:n,position:l="center",onChange:o},c)=>{const [a,p]=j(0),r=k(null);return m(()=>{const e=r.current;if(!e||a<0)return;const u=e.offsetWidth,t=Array.from(e.children);if(a>=t.length)return;const d=parseInt(((n==null ? void 0:n.gap)||getComputedStyle(e).gap||"0").toString(),10)||0;let i=0;switch(t.slice(0,a+1).forEach((y)=>i+=y.offsetWidth+d),l){case "start":e.scrollLeft=i-t[a].offsetWidth-d;break;case "end":e.scrollLeft=i-u;break;default:i-=t[a].offsetWidth/2+(s!==t.length-1 ? d:0),e.scrollLeft=i-u/2;}},[r,f,s,l]),m(()=>{p(s||0);},[s]),m(()=>{c&&(typeof c=="function" ? c(r.current):c.current=r.current);},[c]),g.jsx("ul",{ref:r,className:["ono-scrollable-tabs",h].filter(Boolean).join(" "),style:n,onClick:(e)=>{r.current&&Array.from(r.current.children).some((u,t)=>{if(u.contains(e.target))return p(t),o==null||o(t),!0;});},children:f(C)});});export{S};
@@ -0,0 +1 @@
1
+ import{j as n}from "./dependencies-B7YNjh_z.js";import{useState as s,useEffect as v}from "react";import{T as A}from "./Tooltip-DDUtx7BP.js";import{O as F}from "./Input-lVK5hctw.js";import{L as z}from "./List-DXRmDwDo.js";const D=({label:e,value:a,disabled:i,onChange:c,selectValue:d,optionRender:f,currentValue:u,onChangeCursor:m})=>n.jsx("button",{role:"option","aria-label":e,disabled:i,className:"ono-option-item",onClick:()=>c==null ? void 0:c(a),onMouseEnter:()=>!i&&(m==null ? void 0:m(e)),children:f ? f({label:e,value:a,disabled:i},d===e):n.jsx("div",{className:["ono-option-item-content",u===e&&d!==e ? "ono-option-item-content-active":"",d===e ? "ono-option-item-content-selected":"",i ? "ono-option-item-content-disabled":""].filter(Boolean).join(" "),children:e})}),I=({options:e,defaultValue:a,placeholder:i,inputBorder:c,isShowArrow:d,disabled:f,clearable:u,selectClassName:m,optionsClassName:B,notFoundContent:k,optionRender:M,onClear:b,onChange:r,filterOption:t})=>{const [h,w]=s(""),[O,g]=s(""),[p,j]=s(""),[N,x]=s(!1),[L,y]=s(!1),[E,S]=s(""),V=(o)=>{const l=e.find((C)=>C.value===o);w(l ? l.label:"");},R=(o)=>{r==null||r(o),S(o),V(o);};return v(()=>{a&&V(a);},[a]),v(()=>{var o;if(e.length>0){if(a){const l=e.find((C)=>C.value===a);l&&g(l.label);}else e:for(let l=0;l<e.length;l++)if(((o=e[l])==null ? void 0:o.disabled)!==!0){g(e[0].label);break e;}}},[e,a]),n.jsx(A,{sameWidth:!0,trigger:"click",placement:"bottom",isShowArrow:d,className:["ono-option-container",B].filter(Boolean).join(" "),onOpenChange:(o)=>{y(o),t&&p&&!o&&j("");},content:n.jsx(z,{list:t ? typeof t=="function" ? t(p,e):e.filter((o)=>o.label.toLocaleLowerCase().includes(p.toLocaleLowerCase())):e,fallback:n.jsx("div",{className:"ono-option-item",children:n.jsx("div",{className:"ono-option-item-content-no-data",onClick:(o)=>o.stopPropagation(),children:k ?? "No Data"})}),children:(o)=>n.jsx(D,{...o,onChange:R,selectValue:h.toString(),currentValue:O.toString(),optionRender:M,onChangeCursor:g},o.value)}),children:n.jsx("div",{className:"ono-select",onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),children:n.jsx(F,{className:[t ? "":"ono-select-readonly",m].filter(Boolean).join(" "),border:c,disabled:f,placeholder:t&&E ? h.toString()||"":i,readonly:!t,value:t&&L ? p:h.toString(),clearable:N&&u,suffix:N&&u&&h||u&&p&&t ? n.jsx(n.Fragment,{}):n.jsx(P,{isVisible:L}),onClear:()=>{b==null||b(),r==null||r(""),S(""),w(""),j("");},onChange:(o)=>j(o.target.value)})})});},P=({isVisible:e})=>n.jsx("svg",{className:["ono-select-arrow-down-icon",e ? "ono-select-arrow-down-active":""].filter(Boolean).join(" "),viewBox:"64 64 896 896",focusable:"false","data-icon":"down",fill:"currentColor","aria-hidden":"true",children:n.jsx("path",{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"})});export{I as O};
@@ -0,0 +1 @@
1
+ import{j as n}from "./dependencies-B7YNjh_z.js";import{useRef as v,useEffect as p}from "react";const h=({w:o,h:c,src:m,clr:l,className:i,onClick:u})=>{const e=v(null),f=[{value:o,name:"w"},{value:c,name:"h"},{value:l,name:"clr"}];return p(()=>{e.current&&f.forEach((s)=>{var r,a,t;s.value&&(r=s.value,a=s.name,t=e.current,typeof r=="string" ? t.style.setProperty(`--${a}`,r):t.style.setProperty(`--${a}`,`${r}px`));});},[e,l]),n.jsx("div",{ref:e,className:["ono-svg-img",i].join(" "),onClick:u,children:n.jsx("img",{src:m,alt:""})});};export{h as S};
@@ -0,0 +1 @@
1
+ import{j as c}from "./dependencies-B7YNjh_z.js";import{p as w}from "./common.ts-OTJMJPHg.js";import{useRef as t,useEffect as y}from "react";const A=({id:k,text:e,style:d,color:n,checked:u,onChange:h,name:g="",className:m,disabled:v=!1})=>{const a=t(null),i=t(null),s=t(null),l=t(null),p=t(null),x=t(null),N=[{value:typeof n=="string" ? n:n==null ? void 0:n.active,name:"checkedClr"},{value:typeof n=="string"||n==null ? void 0:n.inactive,name:"uncheckedClr"}];return y(()=>{(()=>{if(!i.current||!a.current)return;let r=60,j=32;if(m||d){const o=getComputedStyle(i.current);r=w(o.width),j=w(o.height);}[...N,{value:r,name:"w"},{value:j,name:"h"}].forEach(({value:o,name:b})=>{o&&((f,C,B)=>{const E=typeof f=="number";B.style.setProperty(`--${C}`,E ? `${f}px`:f);})(o,b,a.current);}),requestAnimationFrame(()=>{l.current&&(l.current.style.transition="transform 0.3s");});})();},[i,a,l,m,d,n,e,p,x]),y(()=>{s.current&&(s.current.checked=u);},[s,u]),c.jsxs("div",{ref:a,className:["ono-switch",v ? "ono-switch-is-disabled":""].filter(Boolean).join(" "),children:[c.jsx("input",{id:k,name:g,role:"switch",ref:s,type:"checkbox",checked:u,onChange:(r)=>{v||(h==null||h(r.currentTarget.checked,r));}}),c.jsx("div",{ref:i,className:["ono-switch-box",m||""].filter(Boolean).join(" "),style:d,onClick:()=>{var r;return(r=s.current)==null ? void 0:r.click();},children:c.jsxs("div",{ref:l,className:"ono-switch-children-bar",children:[(e==null ? void 0:e.active)&&c.jsx("div",{ref:p,className:"ono-switch-children",children:e==null ? void 0:e.active}),c.jsx("div",{className:"ono-switch-slider"}),(e==null ? void 0:e.inactive)&&c.jsx("div",{ref:x,className:"ono-switch-children",children:e==null ? void 0:e.inactive})]})})]});};export{A as S};
@@ -0,0 +1 @@
1
+ import{j as d}from "./dependencies-B7YNjh_z.js";import{g as $}from "./common.ts-OTJMJPHg.js";import{useState as b,useRef as h,useEffect as P,useCallback as w}from "react";const F=({children:s,animation:e,className:u,duration:l=300,style:p,maskColor:f="rgba(0,0,0,0.5)",disableContextMenu:m,maskClickClose:y=!0,dialogClose:a})=>{const [r,k]=b(!1),o=h(null),c=()=>{if(o.current)if(k(!0),e){const t=o.current;t.classList.remove(`ono-${e.type}-enter`),t.classList.add(`ono-${e.type}-leave`),setTimeout(a,l);}else a();};P(()=>{(()=>{if(!e||!o.current)return;const t=o.current.parentElement.style,n=o.current.style;switch(t.setProperty("--duration",l/1e3+"s"),e.type){case "zoom":{const{x:i,y:C}=$(e.element),x=(i/window.innerWidth*100).toFixed(2)+"%",v=(C/window.innerHeight*100).toFixed(2)+"%";n.setProperty("--left",x),n.setProperty("--top",v);break;}case "fade":{const i=e.direction==="left-center" ? "--left":"--top";n.setProperty(i,e.startPosition);break;}}})();},[o,e]);const g=w(()=>{if(!e)return "";const t=`ono-${e.type}-enter`,n=`ono-${e.type}-leave`;return r ? n:t;},[e,r]);return d.jsx("div",{className:` ono-dialog-mask ono-dialog-mask-${r ? "leave":"enter"}`,style:{background:f},onClick:()=>y&&c(),onContextMenu:(t)=>m&&t.preventDefault(),children:d.jsx("div",{ref:o,className:` ono-dialog ${u||""}${g()}`,style:p,onClick:(t)=>t.stopPropagation(),children:typeof s=="function" ? s(c):s})});};export{F as T};
@@ -0,0 +1 @@
1
+ import{j as i}from "./dependencies-B7YNjh_z.js";import{useEffect as f,useRef as h}from "react";import{i as _}from "./InjunctiveBox-vLlRm8LB.js";const L="_enter_974ly_32";let t=[];const v={success:{light:"#52c41a",dark:"#49aa19"},error:{light:"#ff4d4f",dark:"#a61d24"},warning:{light:"#faad14",dark:"#d89614"},promise:{light:"",dark:""}},g=(s,a)=>v[s][a],w=(s)=>{switch(s){case "success":return i.jsx("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"check-circle",width:"24px",height:"24px",fill:g(s,"light"),"aria-hidden":"true",children:i.jsx("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})});case "error":return i.jsx("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"close-circle",width:"24px",height:"24px",fill:g(s,"light"),"aria-hidden":"true",children:i.jsx("path",{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"})});case "warning":return i.jsx("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"exclamation-circle",width:"24px",height:"24px",fill:g(s,"light"),"aria-hidden":"true",children:i.jsx("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"})});}},j=({type:s,speed:a=200,message:o,duration:m=2e3,className:d,style:u,isUseEnterAnimation:y=!0,promiseOptions:e,toastList:p,handleDestroy:c})=>{const r=h(null);return f(()=>{r.current&&(r.current.style.setProperty("--speed",a/1e3+"s"),y&&r.current.classList.add(L),s!=="promise"&&setTimeout(()=>{var n,x;(n=r.current)==null||n.classList.remove(L),(x=r.current)==null||x.classList.add("_leave_974ly_36");},m-a));},[r]),f(()=>{s==="promise" ?(typeof o=="function" ? o():o).then((n)=>setTimeout(()=>{c(),l({type:"success",message:typeof(e==null ? void 0:e.success)=="function" ? e.success(n):(e==null ? void 0:e.success)||"",isUseEnterAnimation:!1,toastList:p});},a)).catch((n)=>setTimeout(()=>{c(),l({type:"error",message:typeof(e==null ? void 0:e.error)=="function" ? e.error(n):(e==null ? void 0:e.error)||"",isUseEnterAnimation:!1,toastList:p});},a)):setTimeout(()=>c(()=>p=[]),m);},[s]),i.jsxs("div",{ref:r,className:[s==="promise" ? "_promise_974ly_15":"_base_974ly_15",d].join(" "),style:u,onClick:()=>{},children:[i.jsx("div",{className:"_icon_974ly_40",children:w(s)}),i.jsx("p",{children:typeof o=="string" ? o:e&&e.loading})]});},l=({type:s,speed:a=200,message:o,duration:m=2e3,zIndex:d=9999,className:u,style:y,isUseEnterAnimation:e=!0,promiseOptions:p,toastList:c})=>_({className:"_container_974ly_1",isSingle:!0,style:{zIndex:d},content:(r)=>(f(()=>{},[c]),i.jsx(j,{className:u,style:y,type:s,message:o,speed:a,duration:m,isUseEnterAnimation:e,promiseOptions:p,handleDestroy:r,toastList:c}))}),N={success:(s)=>{t.push({type:"success",message:s}),l(typeof s=="string" ?{type:"success",message:s,toastList:t}:{type:"success",...s,toastList:t});},error:(s)=>{t.push({type:"error",message:s}),l(typeof s=="string" ?{type:"error",message:s,toastList:t}:{type:"error",...s,toastList:t});},warning:(s)=>{t.push({type:"warning",message:s}),l(typeof s=="string" ?{type:"warning",message:s,toastList:t}:{type:"warning",...s,toastList:t});},promise:(s,a)=>{t.push({type:"promise",message:s}),l({type:"promise",message:s,promiseOptions:a,toastList:t});}};export{N as t};
@@ -0,0 +1 @@
1
+ import{j as o}from "./dependencies-B7YNjh_z.js";import{u as b}from "./useClickOutSide.tsx-C6XuLZzd.js";import{createPopper as k}from "@popperjs/core";import{useState as W,useRef as d,useEffect as h}from "react";let u=null,p=null;const S=({children:c,content:a,onOpenChange:l,trigger:n="hover",placement:f="top",popperOptions:m={},className:w,style:x,isShowArrow:v=!0,sameWidth:y,autoAdjustOverflow:g=!0})=>{const [s,j]=W(!1),i=d(null),e=d(null),r=(t)=>{l==null||l(t),j(t);};return b(e,()=>{n!=="click"&&n!=="contextmenu"||r(!1);},{event:["click","contextmenu"],deps:[n,l]}),h(()=>{(()=>{if(!e.current)return;const t=Array.from(e.current.children);if(t.length>1)throw new Error("Tooltip only support one child");e.current.style.width=t[0].getBoundingClientRect().width+"px";})();},[e,c]),h(()=>{e.current&&(n==="hover" ?(e.current.onmouseenter=()=>r(!0),e.current.onmouseleave=()=>r(!1)):n==="click" ? e.current.onclick=()=>r(!s):n==="focus" ?(e.current.onfocus=()=>r(!0),e.current.onblur=()=>r(!1)):e.current.oncontextmenu=()=>r(!s)),s&&e.current&&i.current ? p=k(e.current,i.current,{placement:f,modifiers:[{name:"offset",options:{offset:[0,6]}},y ?{name:"sameWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn({state:t}){t.styles.popper.width=`${t.rects.reference.width}px`;},effect({state:t}){t.elements.popper.style.width=`${t.elements.reference.offsetWidth}px`;}}:{},g ?{name:"flip",enabled:!0}:{}],...m}):p&&(p.destroy(),p=null,u&&u.remove(),u=null);},[s,e,i]),o.jsxs(o.Fragment,{children:[s&&o.jsxs("div",{ref:i,style:x,className:["ono-tooltip-popper",w].join(" "),"data-popper-placement":m.placement||f,children:[o.jsx("div",{children:a instanceof Function ? a():a}),v&&o.jsx("div",{className:"ono-tooltip-popper-arrow","data-popper-arrow":!0})]}),o.jsx("div",{ref:e,children:c instanceof Function ? c():c})]});};export{S as T};
@@ -0,0 +1 @@
1
+ import{j as g}from "./dependencies-B7YNjh_z.js";import{u as k}from "./useEventListener.tsx-C8V9Qip6.js";import{t as B}from "./common.ts-OTJMJPHg.js";import{memo as q,useState as b,useMemo as x,useRef as j,useEffect as C}from "react";const O=q(({containerClassName:z,dataSource:d,containerStyle:w={},onEndCallback:p,refreshSpeed:E=50,wrapperClassName:A,wrapperStyle:M={},estimatedSize:I=35,updateDataSourceScroll2Top:L,direction:n="vertical"})=>{const [s,H]=b({viewSize:0,startIndex:0,listSize:0,renderCount:0,prevLen:0}),[l,T]=b([]),h=typeof I=="number" ? I:I(),N=x(()=>Math.min(d.length,s.startIndex+s.renderCount),[d,s]),m=x(()=>{var t;return s.startIndex>0 ?(t=l[s.startIndex-1])==null ? void 0:t.end:0;},[s.startIndex,l]),W=x(()=>d.slice(s.startIndex,N).map(({id:t,data:r})=>g.jsx("li",{"data-virtual-id":t,style:n==="vertical" ?{width:"100%"}:{height:"100%"},children:r},t)),[N,d,s.startIndex,n]),D=x(()=>({display:"flex",listStyle:"none",flexDirection:n==="vertical" ? "column":"row",height:n==="vertical" ? s.listSize-m+"px":"100%",width:n==="vertical" ? "auto":s.listSize-m+"px",transform:n==="vertical" ? `translate3d(0,${m}px,0)`:`translate3d(${m}px,0,0)`}),[s.listSize,m,n]),u=j(null),f=j(null),S=(t)=>H((r)=>({...r,...t})),R=B(()=>{const{scrollTop:t,clientHeight:r,scrollHeight:o,scrollLeft:a,clientWidth:i,scrollWidth:e}=u.current,c=n==="vertical" ? o-r-t:e-i-a;S({startIndex:$(l,n==="vertical" ? t:a)}),(n==="vertical" ? t===h/2:a===h/2)&&S({startIndex:0}),c<=20&&p&&p();},E),$=(t,r)=>{let o=0,a=t.length-1,i=-1;for(;o<=a;){const e=o+Math.floor((a-o)/2),c=t[e].end;if(c===r)return e+1;c<r ? o=e+1:((i===-1||i>e)&&(i=e),a=e-1);}return i;};return k("scroll",R,{target:u.current,deps:[l,n]}),C(()=>{(()=>{if(!u.current)return;const t=(n==="vertical" ? u.current.offsetHeight:u.current.offsetWidth)||0;S({viewSize:t,renderCount:Math.ceil(t/h)+1});})();},[u,n]),C(()=>{d.length&&f&&(()=>{var i;const t=[],r=d.length-s.prevLen,o=r>0 ? l.length:0,a=o>0 ? l[o-1].end:0;for(let e=0;e<(r>0 ? r:d.length);e++){const c=d[(r>0 ? s.prevLen:0)+e];t.push({index:c.id,size:h,start:a ? a+e*h:c.id*h,end:a ? a+(e+1)*h:(c.id+1)*h,dSize:0});}T((e)=>[...r>0 ? e:[],...t]),S({prevLen:d.length}),L&&((i=u.current)==null||i.scrollTo(0,0));})();},[f,d,L]),C(()=>{(()=>{if(!f.current||l.length===0)return;const t=Array.from(f.current.childNodes);if(!t.length)return;t.forEach((i)=>{const e=i.getBoundingClientRect(),c=+i.getAttribute("data-virtual-id"),v=l[c],y=v.size-(n==="vertical" ? e.height:e.width);y&&(v.size=n==="vertical" ? e.height:e.width,v.end=v.end-y,v.dSize=y);});const r=+t[0].getAttribute("data-virtual-id"),o=l.length;let a=l[r].dSize;l[r].dSize=0;for(let i=r+1;i<o;i++){const e=l[i];e.start=l[i-1].end,e.end=e.end-a,e.dSize&&(a+=e.dSize,e.dSize=0);}S({listSize:l[o-1].end});})();},[f,l,s.startIndex,n]),g.jsx("div",{ref:u,className:z,style:{width:"100%",height:"100%",overflow:"auto",...w},children:g.jsx("ul",{ref:f,className:A,style:{...D,...M},children:W})});}),P=(z,d)=>z.map((w,p)=>({id:p,data:d(w,p)}));export{O as E,P as c};
@@ -0,0 +1 @@
1
+ import{j as m}from "./dependencies-B7YNjh_z.js";import{u as J}from "./useEventListener.tsx-C8V9Qip6.js";import{t as R}from "./common.ts-OTJMJPHg.js";import{useState as v,useRef as j,useCallback as B,useEffect as z}from "react";const Q=({options:t,pageSize:h,children:S,request:$,reloadData:o,className:A,style:H,updateData:D,loading:s=!0,bottomThreshold:O=50})=>{const [a,u]=v({page:1,reloadData:o,loading:!1,isFinish:!1,gap:typeof t=="number" ? 0:t.gap,imageWidth:typeof t=="number" ? t:0,columns:typeof t=="number" ? 0:t.columns,imageList:[]}),[f,L]=v([]),[x,N]=v([]),y=j(null),g=j(null),c=j(null),p=(i)=>u((e)=>({...e,...i})),w=async(i,e)=>{const r=o&&a.reloadData!==o;if(a.isFinish)return;p({loading:!0});const n=await $(i,e);k(n),p({isFinish:!n.length,imageList:r ? [...n]:[...a.imageList,...n],page:i+1,loading:!1});},k=(i)=>u((e)=>{const r=o&&a.reloadData!==o,n=r ? []:[...x],d=r ? Array(e.columns).fill(0):[...JSON.stringify(f)!=="[]" ? f:Array(e.columns).fill(0)];return i.forEach((M)=>{const l=((W)=>{let b=0,T=0;return b=W.indexOf(Math.min(...W)),T=W[b],{index:b,height:T};})(d),C=Math.floor(M.height*e.imageWidth/M.width);n.push({x:l.index%e.columns!==0 ? l.index*e.imageWidth+e.gap*l.index:l.index*e.imageWidth,y:l.height}),d[l.index]+=C+e.gap,L(d);}),N(n),e;}),E=B(()=>{if(!c.current)return;const i=c.current.clientWidth;let e=0,r=a.page;if(o&&a.reloadData!==o&&(u({page:1,reloadData:o,loading:!1,isFinish:!1,gap:typeof t=="number" ? 0:t.gap,imageWidth:typeof t=="number" ? t:0,columns:typeof t=="number" ? 0:t.columns,imageList:[]}),L([]),N([]),r=1),typeof t=="number"){const n=Math.floor(i/a.imageWidth);e=n-1;const d=e ?(i-n*a.imageWidth)/e:0;p({columns:n,gap:d});}else{e=a.columns-1;const n=(i-e*a.gap)/a.columns;p({imageWidth:n});}w(r,h);},[a,o]),F=()=>{y.current&&clearTimeout(y.current),y.current=setTimeout(E,50);},q=R(()=>{const{scrollTop:i,clientHeight:e,scrollHeight:r}=g.current;r-e-i>O||!a.loading&&w(a.page,h);},50);return J("scroll",q,{target:g.current,deps:[a.loading,a.page]}),z(()=>(E(),window.addEventListener("resize",F),()=>{window.removeEventListener("resize",F);}),[c,o]),z(()=>{D&&w(a.page,h);},[D,a.loading,a.page,g.current]),m.jsxs("div",{className:"ono-waterfall-container",children:[m.jsx("div",{ref:g,className:[A,"ono-waterfall-content"].join(" ").trim(),style:H,children:m.jsx("div",{ref:c,className:"ono-waterfall-wrapper",style:{height:Math.max(...f)-a.gap+"px"},children:a.imageList.map((i,e)=>m.jsx("div",{className:"ono-waterfall-item",style:{width:`${a.imageWidth}px`,transform:`translate(${x[e].x}px,${x[e].y}px)`},children:S(i,e)},i.id))})}),a.loading&&(typeof s=="function" ? s():s&&typeof s=="boolean" ? m.jsx("div",{className:"ono-waterfall-loading",children:"loading..."}):s)]});};export{Q as W};
@@ -0,0 +1 @@
1
+ const g=/\d+/g,$=(n)=>{const a=n.match(g),t=(s)=>Number(s).toString(16).padStart(2,"0"),r=(s)=>s.reduce((i,h)=>i+t(h),"#"),e=(s)=>{const i=s,h=Number(s[s.length-1])!==1 ? Number(s[s.length-1]):100;return i.pop(),r(i)+t(2.56*h);};return a.length===3 ? r(a):a.length===5 ? e([a[0],a[1],a[2],10*Number(a[a.length-1])]):e(a);},p=(n)=>{const a=n.split("#")[1],t=(r)=>[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16)];if(a.length===8){const r=parseInt(a.slice(-2),16)/256,e=t(a.slice(0,-2));return e.push(r),"rgba("+e.join(",")+")";}return "rgb("+t(a).join(",")+")";},d=(n)=>{const a=n.match(g),t=Number(a[0])/255,r=Number(a[1])/255,e=Number(a[2])/255,s=Math.min(t,r,e),i=Math.max(t,r,e);let h=0,o=0,l=(i+s)/2;if(i===s)h=o=0;else{const u=i-s;switch(o=l>0.5 ? u/(2-i-s):u/(i+s),i){case t:h=(r-e)/u+(r<e ? 6:0);break;case r:h=(e-t)/u+2;break;case e:h=(t-r)/u+4;}h/=6;}return `hsl(${Math.round(360*h)},${Math.round(100*o)}%,${Math.round(100*l)}%)`;},N=(n)=>{const a=n.match(g),t=Number(a[0])/360,r=Number(a[1])/100,e=Number(a[2])/100;let s,i,h;function o(m,c,b){return b<0&&(b+=1),b>1&&(b-=1),b<0.16666666666666666 ? m+6*(c-m)*b:b<0.5 ? c:b<0.6666666666666666 ? m+(c-m)*(0.6666666666666666-b)*6:m;}let l=e<0.5 ? e*(1+r):e+r-e*r,u=2*e-l;return s=o(u,l,t+0.3333333333333333),i=o(u,l,t),h=o(u,l,t-0.3333333333333333),`rgb(${Math.round(255*s)},${Math.round(255*i)},${Math.round(255*h)})`;},I=(n)=>d(p(n)),S=(n)=>$(N(n)),M=(n)=>{const a=n.match(g);let t=Number(a[0])/255,r=Number(a[1])/255,e=Number(a[2])/255;const s=Math.max(t,r,e),i=Math.min(t,r,e);let h=0,o=0,l=s;const u=s-i;if(o=s===0 ? 0:u/s,s===i)h=0;else{switch(s){case t:h=(r-e)/u+(r<e ? 6:0);break;case r:h=(e-t)/u+2;break;case e:h=(t-r)/u+4;}h/=6;}return `hsv(${360*h},${100*o},${100*l})`;},f=(n)=>{const a=n.match(g);let t,r,e,s,i,h,o,l,u=Number(a[0])/360,m=Number(a[1])/100,c=Number(a[2])/100;if(u&&m===0)t=r=e=c;else switch(u/=60,s=Math.floor(u),i=u-s,h=c*(1-m),o=c*(1-m*i),l=c*(1-m*(1-i)),s){case 0:t=c,r=l,e=h;break;case 1:t=o,r=c,e=h;break;case 2:t=h,r=c,e=l;break;case 3:t=h,r=o,e=c;break;case 4:t=l,r=h,e=c;break;default:t=c,r=h,e=o;}return `rgb(${Math.round(255*t)},${Math.round(255*r)},${Math.round(255*e)})`;},x=(n)=>/^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$/.test(n)? "hex":/^rgb\((1?\d{1,3},\s*1?\d{1,3},\s*1?\d{1,3})\)$/.test(n)? "rgb":"unknown",k=(n,a,t)=>{let r=[];if(n.includes("#"))r=I(n).match(g);else if(n.includes("rgb"))r=d(n).match(g);else{if(!n.includes("hsl"))throw new Error("颜色格式错误");r=n.match(g);}return S(`${r[0]},${r[1]}%,${a==="light" ? Number(r[2])+t>100 ? 100:Number(r[2])+t:Number(r[2])-t<0 ? 0:Number(r[2])-t}%`);},C={randomColor:()=>"#"+Math.random().toString(16).slice(2,8).padEnd(6,"0"),rgb2hex:$,hex2rgb:p,rgb2rgba:(n,a)=>{if(!a)return n;if(n.includes("rgba")){const t=n.split(",");return t.pop(),t.push(a+")"),t.join(",");}if(n.includes("rgb")){const t=n.split(","),r="rgba("+t[0].split("(")[1],e=t[t.length-1].split(")")[0];return [r,t[1],e," "+a+")"].join(",");}},rgb2hsl:d,hsl2rgb:N,hex2hsl:I,hsl2hex:S,rgb2hsv:M,hsv2rgb:f,hex2hsv:(n)=>M(p(n)),hsv2hex:(n)=>$(f(n)),formatColor:(n,a,t="rgba")=>{const r=n.match(g);let e=Number(r[0])/255,s=Number(r[1])/255,i=Number(r[2])/255;return t==="rgba" ? `rgba(${e},${s},${i},${a})`:t==="rgb" ? n:t==="hex" ? $(n):t==="hsl" ? d(`rgba(${e},${s},${i},${a})`):`rgba(${e},${s},${i},${a})`;},getContrastColor:(n)=>{const a=(function(r){if(r.startsWith("#"))return r.length===4&&(r=`#${r.slice(1).repeat(2)}`),[parseInt(r.substr(1,2),16),parseInt(r.substr(3,2),16),parseInt(r.substr(5,2),16)];if(r.startsWith("rgb")){const e=r.match(/\d+/g);return [parseInt(e[0]),parseInt(e[1]),parseInt(e[2])];}return null;})(n);return a===null ? null:(299*(t=a)[0]+587*t[1]+114*t[2])/1e3>128 ? "#000":"#fff";var t;},adjustColor:(n,a,t)=>{const r=x(n);if(r==="hex"){const e=n.replace("#",""),s=parseInt(e.slice(0,2),16),i=parseInt(e.slice(2,4),16),h=parseInt(e.slice(4,6),16);if(a==="lighten"){const o=Math.min(255,Math.max(0,s+(255-s)*t/100)),l=Math.min(255,Math.max(0,i+(255-i)*t/100)),u=Math.min(255,Math.max(0,h+(255-h)*t/100));return `#${o.toString(16).padStart(2,"0")}${l.toString(16).padStart(2,"0")}${u.toString(16).padStart(2,"0")}`;}if(a==="darken"){const o=Math.min(255,Math.max(0,s-s*t/100)),l=Math.min(255,Math.max(0,i-i*t/100)),u=Math.min(255,Math.max(0,h-h*t/100));return `#${o.toString(16).padStart(2,"0")}${l.toString(16).padStart(2,"0")}${u.toString(16).padStart(2,"0")}`;}}else if(r==="rgb"){const e=n.match(/\d+/g),s=parseInt(e[0]),i=parseInt(e[1]),h=parseInt(e[2]);if(a==="lighten")return `rgb(${Math.min(255,Math.max(0,s+(255-s)*t/100))},${Math.min(255,Math.max(0,i+(255-i)*t/100))},${Math.min(255,Math.max(0,h+(255-h)*t/100))})`;if(a==="darken")return `rgb(${Math.min(255,Math.max(0,s-s*t/100))},${Math.min(255,Math.max(0,i-i*t/100))},${Math.min(255,Math.max(0,h-h*t/100))})`;}return n;},isValidColor:(n)=>!(!/^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$/.test(n)&&!/^rgb\((1?\d{1,3},\s*1?\d{1,3},\s*1?\d{1,3})\)$/.test(n)),getColorType:x,hex3To6:(n)=>{const a=n.replace("#","").split("");return `#${a[0]+a[0]+a[1]+a[1]+a[2]+a[2]}`;},adjustingColors:k};export{k as a,C as c};
@@ -0,0 +1 @@
1
+ const y=(t,e,n=t.length)=>(e<0&&(e=Math.max(0,e+t.length)),n<0&&(n=t.length+n),e>n&&([e,n]=[n,e]),e>=t.length ? t:(e=Math.max(0,Math.min(e,t.length)),(n=Math.max(0,Math.min(n,t.length)))-e>3 ? t.substring(0,e)+"..."+t.substring(n):t)),S=(t)=>/^\d+$/.test(t),x=/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+])[\da-zA-Z]{8,}$/,h=(t)=>t<=11 ? Math.random().toString(36).substring(2,2+t).padEnd(t,"0"):h(11)+h(t-11),M=({el:t,str:e="hello world",speed:n=100,isExtendStr:r=!0,onDone:o})=>{let s=0,a=null;t.textContent&&r&&(s=t.textContent.length,e=t.textContent+e);const l=()=>{clearTimeout(a);const i=e.substring(0,s+1);t.textContent=i,s++,s!==e.length ? a=setTimeout(l,n):o&&o();};l();},C=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),O=async(t,e)=>{const n=(r,o)=>{const s=window.URL.createObjectURL(r),a=document.createElement("a");a.href=s,a.download=encodeURIComponent(o),document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(s);};try{if(typeof t=="string"){const r=await fetch(t);if(!r.ok)throw new Error(`Network response was not ok:${r.statusText}`);n(await r.blob(),e);}else n(t,e);}catch(r){console.error("文件下载失败:",r instanceof Error ? r.message:String(r));}},T=(t,e)=>{t.toString().startsWith("2")? e.onSuccess&&e.onSuccess():(t.toString().startsWith("4")||t.toString().startsWith("5"))&&e.onFail&&e.onFail();},E=(t)=>{const e=t.getBoundingClientRect();return{x:e.left+e.width/2,y:e.top+e.height/2};},A=(t,e,n)=>{const r=new IntersectionObserver(e,n);t instanceof HTMLElement ? r.observe(t):t.forEach((o)=>r.observe(o));},I=(t)=>{const e=Math.floor(t/3600),n=Math.floor(t%3600/60),r=Math.floor(t%60),o=(s)=>s.toString().padStart(2,"0");return(e>0 ? `${o(e)}:${o(n)}:${o(r)}`:`${o(n)}:${o(r)}`)+(t<10 ? ".00":t<100 ? ".0":"");},g=(t)=>{if(t.length<2)return t;const e=t[0],n=t.slice(1).filter((o)=>o<=e),r=t.slice(1).filter((o)=>o>e);return [...g(n),e,...g(r)];},P=(t,e)=>{const n=["B","KB","MB","GB","TB"];let o=n.indexOf((e==null ? void 0:e.unit)?? "B");if(o===-1)throw new Error("Invalid unit");if(!(e!=null&&e.unit))for(;t/Math.pow(1024,o)>=1024;)o++;return `${(t/Math.pow(1024,o)).toFixed((e==null ? void 0:e.decimalPlaces)?? 0)}${n[o]}`;},$=(t,e)=>`${Math.floor(t/p(t,e))}:${Math.floor(e/p(t,e))}`,p=(t,e)=>{for(;e!==0;){const n=e;e=t%e,t=n;}return t;},v=(t,e,n)=>{t.muted=!0,t.play();const r=new AudioContext(),o=r.state==="running";r.close(),o ?(t.muted=!1,e==null||e()):n==null||n();},F=(t)=>new URLSearchParams(window.location.search).get(t),R=(t)=>{let e;const n=new Proxy(t,{construct:(r,o)=>(e||(e=Reflect.construct(r,o)),e)});return n.prototype.construct=n,n;},k=(t)=>typeof t!="string"||t.length===0 ? "":t.charAt(0).toUpperCase()+t.slice(1),w=(t)=>{if(typeof t!="object"||t===null)return t;const e=Array.isArray(t)? []:{};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=w(t[n]));return e;},B=(t)=>new Promise((e)=>{const n=new Image();n.src=typeof t=="string" ? t:URL.createObjectURL(t),n.onload=()=>e({width:n.width,height:n.height});}),U=(t,e)=>{let n=0;const r=(o)=>{n||(n=o),o-n>=e ? t():requestAnimationFrame(r);};requestAnimationFrame(r);},j=(t,e,n)=>{const r=t[e];t[e]=function(o){r&&typeof r=="function"&&r.call(this,o),n.call(this,o);};},L=(t)=>{if(typeof t!="number"||isNaN(t))throw new Error("请输入有效的数字");const e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),e.join(".");},D=(t)=>parseFloat(t.replace(/[^0-9.]/g,"")),N=(t,e,n,r)=>Math.sqrt((t-n)**2+(e-r)**2),z=(t)=>navigator.clipboard.writeText(t),q=(t)=>Math.ceil((t.getTime()-new Date(t.getFullYear(),0,1).getTime())/864e5),W=(t,e,n)=>0.2126*t+0.7152*e+0.0722*n,H=(t)=>{const e={};return t.replace(/([^?=&]+)=([^&]+)/g,(n,r,o)=>e[r]=o),e;},G=(t,...e)=>Object.fromEntries(Object.entries(t).filter(([n])=>e.includes(n))),b=(t)=>{if(!t)return "";const e=t.lastIndexOf(".");return e===-1 ? b(t.substring(t.lastIndexOf("/")+1)):t.substring(0,e);},Y=(t)=>{if(!t)return "";const e=t.lastIndexOf(".");return t.substring(e+1);},Z=(t,e)=>{let n=null;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>{t(...r),n=null;},e);};};function K(t,e,n={}){let r,o=null,s=null,a=0;const l=n.leading!==!1,i=n.trailing!==!1;function f(){s&&(t.apply(r,s),s=null);}function u(){const c=Date.now();c-a>=e ?(i&&s&&f(),o=null):o=setTimeout(u,e-(c-a));}const m=function(...c){const d=Date.now();s=c,r=this,d-a>=e ? o||(a=d,l ? f():i&&(o=setTimeout(u,e))):!o&&i&&(o=setTimeout(u,e-(d-a)));};return m.cancel=function(){o&&(clearTimeout(o),o=null),a=0,s=null;},m;}const Q={addCommasToNumber:L,addEventWithOriginHandler:j,calculateAspectRatio:$,checkDeviceIsMobile:C,checkStatusCode:T,copy2Clipboard:z,createIntersectionObserver:A,dayOfYear:q,deepCopy:w,downloadFile:O,formatFileSize:P,formatSecondes:I,getElementCenterPosition:E,getFileName:b,getFileSuffix:Y,getImageSIze:B,getPointDistance:N,getURLSearchParams:F,grayColor:W,mediaAutoplayPolicies:v,parseQuery:H,passwordStrength:x,pick:G,printStr:M,pureNumber:D,quickSort:g,rafTimeout:U,randomString:h,safeCapitalizeWord:k,singleton:R,throttle:K,debounce:Z,ellipsisString:y,isPureNumber:S};export{H as A,x as B,G as C,M as D,g as E,U as F,h as G,k as H,R as I,L as a,j as b,$ as c,C as d,T as e,Q as f,E as g,z as h,A as i,q as j,Z as k,w as l,O as m,y as n,P as o,D as p,I as q,b as r,Y as s,K as t,B as u,N as v,F as w,W as x,S as y,v as z};