ono-react-element 0.1.6 → 0.1.7

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.
Binary file
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ono-react-element",
3
3
  "private": false,
4
- "version": "0.1.6",
4
+ "version": "0.1.7",
5
5
  "description": "Component library by React + Typescript",
6
6
  "type": "module",
7
7
  "main": "./dist/umd/index.umd.cjs",
@@ -34,16 +34,16 @@
34
34
  "license": "MIT",
35
35
  "dependencies": {
36
36
  "@popperjs/core": "^2.11.8",
37
- "@onoxm/react-hooks": "0.1.6",
38
- "@onoxm/react-tools": "0.1.6",
39
- "@onoxm/event": "0.1.6",
40
- "@onoxm/utils": "0.1.6"
37
+ "@onoxm/event": "0.1.7",
38
+ "@onoxm/react-hooks": "0.1.7",
39
+ "@onoxm/react-tools": "0.1.7",
40
+ "@onoxm/utils": "0.1.7"
41
41
  },
42
42
  "peerDependencies": {
43
- "@types/react": ">=18",
44
- "@types/react-dom": ">=18",
45
- "react": ">=18",
46
- "react-dom": ">=18",
43
+ "@types/react": ">=19",
44
+ "@types/react-dom": ">=19",
45
+ "react": ">=19",
46
+ "react-dom": ">=19",
47
47
  "zustand": ">=5"
48
48
  },
49
49
  "peerDependenciesMeta": {
@@ -1 +0,0 @@
1
- import{jsx as re,jsxs as ae}from "react/jsx-runtime";import{c as ce}from "react/compiler-runtime";import{useGetElementSize as de,chainClassNames as X,pureNumber as Y}from "./index.js";import{useState as A,useRef as Z,useEffect as ee,cloneElement as me}from "react";const ye=(te)=>{const e=ce(51),{list:E,style:_,disable:i,children:l,sliderBox:$,className:j,sliderStyle:k,duration:J,sliderClassName:I,currentIndex:K,direction:M,sliderTransitionTimingFunction:O}=te,y=J===void 0 ? 300:J,w=K===void 0 ? 0:K,u=M===void 0 ? "Horizontal":M,ie=O===void 0 ? "ease-in-out":O,[oe,se]=A(!1),[t,P]=A(0);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x={t:0,l:0},e[0]=x):x=e[0];const [Q,le]=A(x);let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v={w:0,h:0},e[1]=v):v=e[1];const [n,ne]=A(v),b=Z(null),U=Z(null),L=oe ? `translate ${y/1e3}s ${ie}`:"initial",B=`${Q.l}px ${Q.t}px`;let g;e[2]!==n.h||e[3]!==n.w||e[4]!==L||e[5]!==B ?(g={width:n.w,height:n.h,transition:L,translate:B},e[2]=n.h,e[3]=n.w,e[4]=L,e[5]=B,e[6]=g):g=e[6];const D=g;let z;e[7]!==u||e[8]!==i||e[9]!==y||e[10]!==t ?(z=()=>{if(typeof t!="number"||!b.current||!U.current)return;const o=Array.from(b.current.children).slice(1);o.forEach((p)=>{p.style.position="relative",p.style.cursor=i ? "not-allowed":"pointer",p.style.zIndex="1";});const h=window.getComputedStyle(b.current),s={t:u==="Horizontal" ? Y(h.paddingTop):o[t].offsetTop,l:u==="Horizontal" ? o[t].offsetLeft:Y(h.paddingLeft)};le(s),ne({w:o[t].offsetWidth,h:o[t].offsetHeight}),setTimeout(()=>se(!0),y);},e[7]=u,e[8]=i,e[9]=y,e[10]=t,e[11]=z):z=e[11];const F=z,{w:G,h:R}=de();let N,S,C,H;e[12]!==w ?(N=()=>{P(w);},S=[w],e[12]=w,e[13]=N,e[14]=S):(N=e[13],S=e[14]),ee(N,S),e[15]!==F ?(C=()=>{F();},e[15]=F,e[16]=C):C=e[16],e[17]!==i||e[18]!==t||e[19]!==R||e[20]!==G ?(H=[t,G,R,i],e[17]=i,e[18]=t,e[19]=R,e[20]=G,e[21]=H):H=e[21],ee(C,H);const W=i ? "ono-auto-slider-list-is-disable":"";let r;e[22]!==j||e[23]!==W ?(r=X("ono-auto-slider-list-container",j,W),e[22]=j,e[23]=W,e[24]=r):r=e[24];const q=u==="Horizontal" ? "row":"column";let a,c,d,m,f,T;if(e[25]!==_||e[26]!==q ?(a={flexDirection:q,..._},e[25]=_,e[26]=q,e[27]=a):a=e[27],e[28]!==I ?(c=X("ono-auto-slider-list-slider",I),e[28]=I,e[29]=c):c=e[29],e[30]!==D||e[31]!==k ?(d={...k,...D},e[30]=D,e[31]=k,e[32]=d):d=e[32],e[33]!==$||e[34]!==c||e[35]!==d ?(m=re("li",{ref:U,className:c,style:d,children:$}),e[33]=$,e[34]=c,e[35]=d,e[36]=m):m=e[36],e[37]!==l||e[38]!==i||e[39]!==t||e[40]!==E){let o;e[42]!==l||e[43]!==i||e[44]!==t ?(o=(h,s)=>me(l({item:h,index:s,isActive:s===t}),{onClick:(p)=>{if(i)return;const V=l({item:h,index:s,isActive:s===t}).props.onClick;V&&V(p),P(s);}}),e[42]=l,e[43]=i,e[44]=t,e[45]=o):o=e[45],f=E.map(o),e[37]=l,e[38]=i,e[39]=t,e[40]=E,e[41]=f;}else f=e[41];return e[46]!==r||e[47]!==a||e[48]!==m||e[49]!==f ?(T=ae("ul",{ref:b,className:r,style:a,children:[m,f]}),e[46]=r,e[47]=a,e[48]=m,e[49]=f,e[50]=T):T=e[50],T;};export{ye as A};
@@ -1 +0,0 @@
1
- import{jsx as se,jsxs as me,Fragment as fe}from "react/jsx-runtime";import{c as de}from "react/compiler-runtime";import{useState as _,useRef as we,useEffect as he}from "react";import{loadImage as ge}from "./index.js";const ue=(H)=>{const e=de(70),{imageFile:u,cvsW:J,maskBG:K,border:O,wheelScale:Q,setCtx:R,maskInfo:o,setMaskInfo:v,imageStartState:I,setImageStartState:$,imageState:t,setImageState:a}=H,V=J===void 0 ? 520:J,M=K===void 0 ? "rgba(0,0,0,0.5)":K,w=O===void 0 ? "4px solid #fff":O,F=Q===void 0 ? 0.1:Q,[s,c]=_();let X;e[0]===Symbol.for("react.memo_cache_sentinel")?(X={w:0,h:0},e[0]=X):X=e[0];const [h,ce]=_(X);let S;e[1]===Symbol.for("react.memo_cache_sentinel")?(S={w:0,h:0},e[1]=S):S=e[1];const [i,j]=_(S);let k;e[2]===Symbol.for("react.memo_cache_sentinel")?(k={x:0,y:0},e[2]=k):k=e[2];const [m,b]=_(k),[p,W]=_(!1),L=we(null),x=we(null),r=ve;let d,y,Y;if(e[3]!==w||e[4]!==u||e[5]!==R||e[6]!==$||e[7]!==a||e[8]!==v){let l;y=()=>{if(!L.current)return;const{width:n}=L.current.getBoundingClientRect();C(n),ce({w:n,h:n});},e[11]!==w ?(l=()=>{const n=w.split(" ");let g=0;return n.forEach((N)=>{N.includes("px")&&(g=Number(N.split("px")[0]));}),g;},e[11]=w,e[12]=l):l=e[12],d=l;const C=async(n)=>{const g=await ge(u);let N,B=g.width,D=g.height;B>D ?(N=B/n,B=n,D/=N,r({w:D},v)):(N=D/n,D=n,B/=N,r({w:B},v));const ne=(n-B)/2,re=(n-D)/2;r({w:g.width,h:g.height},j),c(g),r({w:B,h:D,t:re,l:ne},a),$({w:B,h:D,t:re,l:ne}),r(ne>re ?{l:ne}:{l:re},v),R(x.current?.getContext("2d"));};e[3]=w,e[4]=u,e[5]=R,e[6]=$,e[7]=a,e[8]=v,e[9]=d,e[10]=y;}else d=e[9],y=e[10];e[13]!==t.h||e[14]!==t.l||e[15]!==t.t||e[16]!==t.w||e[17]!==o.l||e[18]!==o.w||e[19]!==a ?(Y=()=>{W(!1),t.l>o.l&&r({l:o.l},a),t.t>o.l&&r({t:o.l},a),-t.l>t.w-o.l-o.w&&r({l:-(t.w-o.l-o.w)},a),-t.t>t.h-o.l-o.w&&r({t:-(t.h-o.l-o.w)},a);},e[13]=t.h,e[14]=t.l,e[15]=t.t,e[16]=t.w,e[17]=o.l,e[18]=o.w,e[19]=a,e[20]=Y):Y=e[20];const f=Y;let G;e[21]!==I.w||e[22]!==i.w||e[23]!==F ?(G=(l,C)=>{let n=l+(C==="in" ? l*F:-l*F);return n>i.w&&(n=i.w),n<I.w&&(n=I.w),n;},e[21]=I.w,e[22]=i.w,e[23]=F,e[24]=G):G=e[24];const T=G;let E;e[25]!==T||e[26]!==t.w||e[27]!==i.h||e[28]!==i.w||e[29]!==f||e[30]!==a ?(E=(l)=>{l.preventDefault(),l.stopPropagation();const C=l.deltaY<0 ? "in":"out",n=T(t.w,C),g=n/i.w;r({w:n,h:i.h*g},a),f();},e[25]=T,e[26]=t.w,e[27]=i.h,e[28]=i.w,e[29]=f,e[30]=a,e[31]=E):E=e[31];const U=E;let Z,ee,te,ae;e[32]!==y ?(Z=()=>{y();},e[32]=y,e[33]=Z):Z=e[33],e[34]===Symbol.for("react.memo_cache_sentinel")?(ee=[L],e[34]=ee):ee=e[34],he(Z,ee),e[35]!==s||e[36]!==t.h||e[37]!==t.l||e[38]!==t.t||e[39]!==t.w ?(te=()=>{if(!x.current||!s)return;const l=x.current.getContext("2d");l&&(l.clearRect(0,0,x.current.width,x.current.height),l.drawImage(s,t.l,t.t,t.w,t.h));},e[35]=s,e[36]=t.h,e[37]=t.l,e[38]=t.t,e[39]=t.w,e[40]=te):te=e[40],e[41]!==s||e[42]!==t ?(ae=[x,s,t],e[41]=s,e[42]=t,e[43]=ae):ae=e[43],he(te,ae);const ie=p ? "grabbing":"grab";let q,oe,A,P,z,le;return e[44]!==V||e[45]!==ie ?(q={width:V,cursor:ie},e[44]=V,e[45]=ie,e[46]=q):q=e[46],e[47]===Symbol.for("react.memo_cache_sentinel")?(oe=(l)=>{r({x:l.clientX,y:l.clientY},b),W(!0);},e[47]=oe):oe=e[47],e[48]!==t.l||e[49]!==t.t||e[50]!==p||e[51]!==a||e[52]!==m ?(A=(l)=>{if(p){const C=l.clientX-m.x,n=l.clientY-m.y;(Math.abs(C)>10||Math.abs(n)>10)&&(r({t:t.t+n,l:t.l+C},a),r({x:l.clientX,y:l.clientY},b));}},e[48]=t.l,e[49]=t.t,e[50]=p,e[51]=a,e[52]=m,e[53]=A):A=e[53],e[54]!==h.h||e[55]!==h.w||e[56]!==A ?(P=se("canvas",{width:h.w,height:h.h,ref:x,onMouseDown:oe,onMouseMove:A}),e[54]=h.h,e[55]=h.w,e[56]=A,e[57]=P):P=e[57],e[58]!==w||e[59]!==d||e[60]!==s||e[61]!==M||e[62]!==o.w ?(z=s&&se("div",{className:"ono-avatar-mask",children:se("div",{style:{border:w,boxShadow:`${M}0 0 0 10000px`,width:`${o.w+2*d()}px`,height:`${o.w+2*d()}px`}})}),e[58]=w,e[59]=d,e[60]=s,e[61]=M,e[62]=o.w,e[63]=z):z=e[63],e[64]!==U||e[65]!==f||e[66]!==q||e[67]!==P||e[68]!==z ?(le=me("div",{ref:L,className:"ono-avatar-canvas",style:q,onWheel:U,onMouseUp:f,onMouseLeave:f,children:[P,z]}),e[64]=U,e[65]=f,e[66]=q,e[67]=P,e[68]=z,e[69]=le):le=e[69],le;};function ve(H,e){e((u)=>({...u,...H}));}const ye=(H)=>{const e=de(24),{imageFile:u,cvsW:J,maskBG:K,border:O,wheelScale:Q,children:R}=H,o=J===void 0 ? 520:J,v=K===void 0 ? "rgba(0,0,0,0.5)":K,I=O===void 0 ? "4px solid #fff":O,$=Q===void 0 ? 0.1:Q;let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={w:0,h:0,t:0,l:0},e[0]=t):t=e[0];const [a,V]=_(t);let M;e[1]===Symbol.for("react.memo_cache_sentinel")?(M={w:0,h:0,t:0,l:0},e[1]=M):M=e[1];const [w,F]=_(M);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s={w:0,l:0},e[2]=s):s=e[2];const [c,X]=_(s),[h,ce]=_();let S;e[3]!==a ?(S=(W)=>{F({w:a.w,h:a.h,t:a.t,l:a.l}),W?.();},e[3]=a,e[4]=S):S=e[4];const i=S;let j;e[5]!==h||e[6]!==c ?(j=(W,L)=>{if(!h)return;const x=h.getImageData(c.l,c.l,c.w,c.w),r=document.createElement("canvas"),d=r.getContext("2d");if(r.width=c.w,r.height=c.w,!d)return;const{imageSaveType:y,dataSaveType:Y,quality:f}=L||{},G=y===void 0 ? "png":y,T=Y===void 0 ? "base64":Y,E=f===void 0 ? 100:f;d.putImageData(x,0,0,0,0,c.w,c.w),T==="base64" ? W(r.toDataURL(`image/${G}`,E/100)):T==="blob"&&r.toBlob((U)=>{if(U)return W(U);},`image/${G}`,E/100);},e[5]=h,e[6]=c,e[7]=j):j=e[7];const k=j;let m,b,p;return e[8]!==I||e[9]!==o||e[10]!==u||e[11]!==a||e[12]!==w||e[13]!==v||e[14]!==c||e[15]!==$ ?(m=se(ue,{imageFile:u,cvsW:o,maskBG:v,border:I,wheelScale:$,maskInfo:c,setMaskInfo:X,setCtx:ce,imageStartState:a,setImageStartState:V,imageState:w,setImageState:F}),e[8]=I,e[9]=o,e[10]=u,e[11]=a,e[12]=w,e[13]=v,e[14]=c,e[15]=$,e[16]=m):m=e[16],e[17]!==R||e[18]!==k||e[19]!==i ?(b=R?.({handleConfirm:k,handleReduction:i}),e[17]=R,e[18]=k,e[19]=i,e[20]=b):b=e[20],e[21]!==m||e[22]!==b ?(p=me(fe,{children:[m,b]}),e[21]=m,e[22]=b,e[23]=p):p=e[23],p;};export{ye as A};
@@ -1 +0,0 @@
1
- import{jsx as D}from "react/jsx-runtime";import{c as F}from "react/compiler-runtime";import{chainClassNames as G}from "./index.js";import{useState as R,useRef as H,useEffect as I}from "react";const Q=(d)=>{const e=F(29),{id:r,style:n,checked:c,onChange:v,className:a,indeterminate:N,checkedColor:S,indeterminateStyle:$,indeterminateColor:E}=d,t=N!==void 0&&N,s=S===void 0 ? "#0077cc":S,j=$===void 0 ? "line":$,k=E===void 0 ? "#0077cc":E,[u,q]=R(""),o=H(null);let i,l,h;e[0]!==s ?(i={value:s,name:"checkedColor"},e[0]=s,e[1]=i):i=e[1],e[2]!==k ?(l={value:k,name:"indeterminateColor"},e[2]=k,e[3]=l):l=e[3],e[4]!==i||e[5]!==l ?(h=[i,l],e[4]=i,e[5]=l,e[6]=h):h=e[6];const b=h,z=J;let f;e[7]!==u||e[8]!==c||e[9]!==s||e[10]!==t||e[11]!==b ?(f=()=>{if(!o.current)return;const w=getComputedStyle(o.current);u||q(w.borderColor),o.current.style.height=w.width,[{value:w.width,name:"w"},{value:c||t ? s:u,name:"border-color"},...b].forEach((A)=>{const{value:P,name:B}=A;P&&z(P,B,o.current);});},e[7]=u,e[8]=c,e[9]=s,e[10]=t,e[11]=b,e[12]=f):f=e[12];const x=f;let p,y;e[13]!==t||e[14]!==x ?(p=()=>{x(),o.current&&(o.current.indeterminate=t);},e[13]=t,e[14]=x,e[15]=p):p=e[15],e[16]!==a||e[17]!==t||e[18]!==n ?(y=[o,a,n,t],e[16]=a,e[17]=t,e[18]=n,e[19]=y):y=e[19],I(p,y);const g=j==="line" ? "ono-checkbox-line":"ono-checkbox-border";let m,C;return e[20]!==a||e[21]!==g ?(m=G(a,g),e[20]=a,e[21]=g,e[22]=m):m=e[22],e[23]!==c||e[24]!==r||e[25]!==v||e[26]!==n||e[27]!==m ?(C=D("input",{id:r,type:"checkbox",ref:o,checked:c,onChange:v,className:m,style:n}),e[23]=c,e[24]=r,e[25]=v,e[26]=n,e[27]=m,e[28]=C):C=e[28],C;};function J(d,e,r){typeof d=="string" ? r.style.setProperty(`--${e}`,d):r.style.setProperty(`--${e}`,`${d}px`);}export{Q as C};
@@ -1 +0,0 @@
1
- import{jsxs as b,Fragment as j,jsx as z}from "react/jsx-runtime";import{chainClassNames as A}from "./index.js";import{useState as N,useRef as G}from "react";const L=({isBox:s=!1,multiple:h=!1,children:o,allowFileType:E="image",style:g={},className:y="",isCanClick:F=!0,getFileListData:w,onFileTypeError:c,readingAnimationOptions:a})=>{const [r,D]=N(!1),S=G(null);let f=0,p=[],m=[],l=[],C=[];const T=E==="all" ? ["image","video","audio","document","directory"]:E,v=(e)=>{const i=[];l.forEach((n)=>i.push({name:n.name,fileType:"directory",file:"",isFile:!1,fileSize:0,children:[],parent:""}));for(let n=0;n<i.length;n++)for(let t=0;t<e.length;t++)e[t].parent===i[n].name&&e[t].name!==".DS_Store"&&i[n].children.push(e[t]);i.length===0&&i.push(...e),w(i),p=[],f=0,m=[],l=[],C=[],D(!1);},d=(e,i="")=>{if(e.isDirectory){if(!T.includes("directory"))return c&&c();const n=e.createReader(),t=(O)=>O.readEntries((k)=>{let x=0;k.forEach((u)=>{x++,u.isDirectory&&d(u);}),m.push(...k),C.includes(e.name)||(l.push(e),C.push(e.name)),x>=100 ? t(O):m.forEach((u)=>d(u,e.name));});t(n);}else e.file((n)=>{if(!T.includes(n.type.split("/")[0])&&n.name!==".DS_Store")return c&&c();p.push({name:n.name,fileType:n.type,file:n,isFile:!0,fileSize:n.size,children:[],parent:i});const t=f>=l.length&&l.length===0 ? f:m.length;p.length===t&&v(p);});};return b(j,{children:[z("input",{ref:S,type:"file",style:{display:"none"},multiple:h,value:"",onChange:(e)=>{const i=[...e.target.files],n=[];D(!0),i.forEach((t)=>n.push({name:t.name,fileType:t.type,file:t,isFile:!0,fileSize:t.size,children:[],parent:""})),v(n);}}),z("div",{className:A("ono-file-process-container",s ? "ono-file-process-container-box":"",typeof y=="string" ? y:y(r)),style:{justifyContent:s&&!o ? "center":"initial",cursor:s&&F ? r ? "not-allowed":"pointer":"",...g instanceof Function ? g(r):g},onClick:()=>{if(s&&F){if(r&&a?.readingCannotOperattion)return;S.current.click();}},onDragEnter:(e)=>e.preventDefault(),onDragOver:(e)=>e.preventDefault(),onDrop:(e)=>{if(e.preventDefault(),!r||!a?.readingCannotOperattion)if(f=h ? e.dataTransfer.items.length:1,D(!0),h)for(const i of e.dataTransfer.items)d(i.webkitGetAsEntry());else d(e.dataTransfer.items[0].webkitGetAsEntry());},children:s ? o ? r&&a?.readingCannotOperattion ? a?.animations||"正在读取文件...":o:r&&a?.readingCannotOperattion ? a?.animations||"正在读取文件...":"请将要上传的文件拖拽到此处":o})]});};export{L as F};
@@ -1 +0,0 @@
1
- import{jsxs as A,jsx as c,Fragment as Le}from "react/jsx-runtime";import{c as ge}from "react/compiler-runtime";import{chainClassNames as he,useKeyPress as Se}from "./index.js";import{forwardRef as Ce,useState as z,useRef as we,useEffect as oe}from "react";const ze=()=>{const d=ge(1);let a;return d[0]===Symbol.for("react.memo_cache_sentinel")?(a=c("svg",{className:"ono-input-icon",viewBox:"64 64 896 896",focusable:"false","data-icon":"close-circle",fill:"currentColor","aria-hidden":"true",children:c("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"})}),d[0]=a):a=d[0],a;},De=(d)=>{const a=ge(5),{open:e}=d,p=e ? "eye":"eye-invisible";let u,f;return a[0]!==e ?(u=e ? c("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"}):A(Le,{children:[c("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"}),c("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"})]}),a[0]=e,a[1]=u):u=a[1],a[2]!==p||a[3]!==u ?(f=c("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":p,fill:"currentColor","aria-hidden":"true",className:"ono-input-icon",children:u}),a[2]=p,a[3]=u,a[4]=f):f=a[4],f;},Ee=Ce((d,a)=>{const e=ge(67),{id:p,name:u,max:f,min:H,maxLength:v,minLength:I,type:ne,className:T,defaultValue:G,placeholder:D,readonly:b,autocomplete:te,autofocus:F,form:J,disabled:m,clearable:w,showPassword:ae,prepend:K,append:M,prefix:P,suffix:y,showCount:g,border:N,boxShadow:re,value:X,onChange:x,onFocus:Z,onBlur:L,onClear:B,onKeyUp:t,onKeyDown:E}=d,xe=ne===void 0 ? "text":ne,n=te===void 0 ? "off":te,o=N===void 0 ? "1px solid #5644b8":N,l=re===void 0 ? "0 0 0 2px #7969d11a":re,i=X===void 0 ? "":X,[s,r]=z(i),[h,C]=z(!1),[S,Ne]=z(!1),ee=we(null),le=w&&!m&&s,se=ae&&!m;let ce;e[0]!==o||e[1]!==l ?(ce=()=>{ee.current&&(ee.current.style.setProperty("--ono-input-border",o),ee.current.style.setProperty("--ono-input-box-shadow",l));},e[0]=o,e[1]=l,e[2]=ce):ce=e[2];const fe=ce;let ie,de,ue,pe;e[3]!==fe ?(ie=()=>{fe();},e[3]=fe,e[4]=ie):ie=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(de=[ee],e[5]=de):de=e[5],oe(ie,de),e[6]!==i ?(pe=()=>{r(i);},ue=[i],e[6]=i,e[7]=ue,e[8]=pe):(ue=e[7],pe=e[8]),oe(pe,ue);const ye=m ? "ono-input-is-disabled":"";let R,O;e[9]!==ye ?(R=he("ono-input","ono-input-border",ye),e[9]=ye,e[10]=R):R=e[10],e[11]!==K ?(O=K&&c("div",{className:"ono-prepend",children:K}),e[11]=K,e[12]=O):O=e[12];const ve=h ? "ono-input-is-focus":"";let U,q;e[13]!==T||e[14]!==ve ?(U=he("ono-input-wrapper",ve,T),e[13]=T,e[14]=ve,e[15]=U):U=e[15],e[16]!==P ?(q=P&&c("span",{className:"ono-prefix",children:P}),e[16]=P,e[17]=q):q=e[17];const be=ae ? S ? "text":"password":xe;let _,j,k,Q,Y,V,W,me;return e[18]!==Z ?(_=($)=>{Z?.($),C(!0);},e[18]=Z,e[19]=_):_=e[19],e[20]!==L ?(j=($)=>{L?.($),C(!1);},e[20]=L,e[21]=j):j=e[21],e[22]!==x ?(k=($)=>{x?.($),r($.target.value);},e[22]=x,e[23]=k):k=e[23],e[24]!==n||e[25]!==F||e[26]!==G||e[27]!==m||e[28]!==J||e[29]!==p||e[30]!==s||e[31]!==f||e[32]!==v||e[33]!==H||e[34]!==I||e[35]!==u||e[36]!==E||e[37]!==t||e[38]!==D||e[39]!==b||e[40]!==a||e[41]!==be||e[42]!==_||e[43]!==j||e[44]!==k ?(Q=c("input",{id:p,ref:a,max:f,min:H,name:u,maxLength:v,minLength:I,defaultValue:G,className:"ono-input-inner",type:be,placeholder:D,readOnly:b,autoComplete:n,autoFocus:F,form:J,disabled:m,onFocus:_,onBlur:j,value:s,onChange:k,onKeyUp:t,onKeyDown:E}),e[24]=n,e[25]=F,e[26]=G,e[27]=m,e[28]=J,e[29]=p,e[30]=s,e[31]=f,e[32]=v,e[33]=H,e[34]=I,e[35]=u,e[36]=E,e[37]=t,e[38]=D,e[39]=b,e[40]=a,e[41]=be,e[42]=_,e[43]=j,e[44]=k,e[45]=Q):Q=e[45],e[46]!==S||e[47]!==s||e[48]!==v||e[49]!==B||e[50]!==le||e[51]!==g||e[52]!==se||e[53]!==y ?(Y=(y||le||se||g)&&A("span",{className:"ono-suffix",children:[y,le&&c("button",{className:"ono-clear-icon",onClick:()=>{B?.(),r("");},children:c(ze,{})}),se&&c("button",{className:"ono-eye-icon",onClick:()=>Ne(!S),children:c(De,{open:S})}),g&&v&&A("p",{className:"ono-count",children:[s.length,"/",v]})]}),e[46]=S,e[47]=s,e[48]=v,e[49]=B,e[50]=le,e[51]=g,e[52]=se,e[53]=y,e[54]=Y):Y=e[54],e[55]!==U||e[56]!==q||e[57]!==Q||e[58]!==Y ?(V=A("div",{ref:ee,className:U,onMouseDown:Fe,children:[q,Q,Y]}),e[55]=U,e[56]=q,e[57]=Q,e[58]=Y,e[59]=V):V=e[59],e[60]!==M ?(W=M&&c("div",{className:"ono-append",children:M}),e[60]=M,e[61]=W):W=e[61],e[62]!==R||e[63]!==O||e[64]!==V||e[65]!==W ?(me=A("div",{className:R,children:[O,V,W]}),e[62]=R,e[63]=O,e[64]=V,e[65]=W,e[66]=me):me=e[66],me;});function Fe(d){d.target.tagName!=="INPUT"&&d.preventDefault();}const Re=Ce(({id:d,name:a,rows:e,maxLength:p,minLength:u,className:f,placeholder:H,readonly:v,resize:I=!0,autocomplete:ne="off",autofocus:T,form:G,disabled:D,autoSize:b,showCount:te,border:F="1px solid #5644b8",boxShadow:J="0 0 0 2px #7969d11a",value:m="",onChange:w,onFocus:ae,onBlur:K,onKeyUp:M,onKeyDown:P},y)=>{const [g,N]=z(m),[re,X]=z(!1),[x,Z]=z([m]),[L,B]=z(0),t=we(null),E=(n)=>{const o=x.slice(0,L+1);o.push(n),Z(o),B(o.length-1);};return [{key:"CommandOrControl+z",handler:(n)=>{document.activeElement===t.current&&(n.preventDefault(),(()=>{if(L>0&&t.current){const o=L-1,l=x[o];if(t.current.value=l,N(l),B(o),w){const i={target:t.current};w(i);}}})());},deps:[x]},{key:"CommandOrControl+d",handler:(n)=>{if(t.current&&document.activeElement===t.current){n.preventDefault();const o=((l)=>{const{value:i,selectionStart:s,selectionEnd:r}=l,h=i.substring(0,s)+i.substring(r);return l.value=h,l.setSelectionRange(s,s),h;})(t.current);if(N(o),E(o),w){const l={target:t.current};w(l);}}},deps:[x]}].forEach(({key:n,handler:o,deps:l})=>Se(n,o,{target:t.current,deps:l})),oe(()=>{N(m);},[m]),oe(()=>{(()=>{if(!t.current)return;const n=t.current;((o,l,i,s,r)=>{const h=o.parentNode;o.style.resize=l ? "none":i ? "vertical":"none",h.style.setProperty("--ono-input-border",s),h.style.setProperty("--ono-input-box-shadow",r),h.style.setProperty("--ono-input-height","auto");})(n,b||!1,I,F,J),b&&((o,l)=>{const{minRows:i=2,maxRows:s}=typeof l=="object" ? l:{},r=document.createElement("div");r.style.position="absolute",r.style.visibility="hidden",r.style.whiteSpace="pre-wrap",r.style.wordWrap="break-word",r.style.width=`${o.clientWidth}px`,r.style.font=getComputedStyle(o).font,r.style.padding=getComputedStyle(o).padding,r.style.border=getComputedStyle(o).border,r.style.boxSizing="border-box",document.body.appendChild(r);const h=34*i;let C=h;if(o.value){r.textContent=o.value;const S=r.offsetHeight;C=Math.max(h,S),s&&C>34*s ?(C=34*s,o.style.overflowY="auto"):o.style.overflowY="hidden";}else o.style.overflowY="hidden";o.style.height=`${C}px`,o.style.resize=l ? "none":"vertical",document.body.removeChild(r),Math.floor(C/34);})(n,b);})();},[t,b,g]),oe(()=>{y&&t.current&&(y instanceof Function ? y(t.current):y.current=t.current);},[y,t]),A("div",{className:he("ono-textarea",D ? "ono-input-is-disabled":""),children:[c("div",{className:he("ono-textarea-wrapper",re ? F==="none" ? "":"ono-input-is-focus":"",f),onClick:()=>t.current?.focus(),children:c("textarea",{ref:t,className:"ono-textarea-inner",id:d,rows:e,name:a,maxLength:p,minLength:u,placeholder:H,readOnly:v,autoComplete:ne,autoFocus:T,form:G,disabled:D,onFocus:(n)=>{ae?.(n),X(!0);},onBlur:(n)=>{K?.(n),X(!1);},value:g,onChange:(n)=>{N(n.target.value),E(n.target.value),w?.(n);},onKeyUp:M,onKeyDown:P})}),te&&p&&c("p",{className:"ono-count-bar",onClick:(n)=>n.stopPropagation(),children:g.length+"/"+p})]});});export{Ee as O,Re as a};
@@ -1 +0,0 @@
1
- import{jsx as o,jsxs as c,Fragment as M}from "react/jsx-runtime";import{portalRenderer as E,adjustingColors as m,chainClassNames as F}from "./index.js";import{useState as H,useRef as x,useEffect as y}from "react";import{B as v}from "./Button-CGyWgrQj.js";const L=({title:d="This is a modal title",icon:B,content:g="This is a modal content",okText:N="confirm",cancelText:k="cancel",confirmDisabled:P,cancelDisabled:T,startPosition:t,onConfirm:j,onCancel:w,mask:h=!0,maskClosable:z=!1,width:f,btnClr:a,footer:u=({OkBtn:s,CancelBtn:i})=>c(M,{children:[o(i,{}),o(s,{})]}),modalBody:b,destroy:C})=>{const [s,i]=H(!1),l=x(null),n=x(null),D=[{label:"themeColor",value:a||""},{label:"themeHoverColor",value:a&&m(a,"light",10)||""},{label:"themeActiveColor",value:a&&m(a,"dark",20)||""},{label:"themeDisabledClr",value:a&&m(a,"light",20)||""}],r=()=>{if(t){if(!n.current)return;n.current.classList.remove("ono-modal-enter"),n.current.classList.add("ono-modal-leave"),setTimeout(()=>{C();},300);}else C();};return y(()=>(l.current&&(h ? l.current.showModal():l.current.show()),()=>{l.current&&l.current.close();}),[l.current,h]),y(()=>{(()=>{if(!n.current)return;const e=n.current.style;f&&e.setProperty("--width",f+"px"),t&&(e.setProperty("--left",(t.x/window.innerWidth*100).toFixed(2)+"%"),e.setProperty("--top",(t.y/window.innerHeight*100).toFixed(2)+"%")),a&&D.forEach((p)=>e.setProperty(`--${p.label}`,p.value));})();},[n]),o("dialog",{ref:l,className:"ono-modal",onClick:()=>z&&r(),children:b ? b(r):c("div",{ref:n,className:F("ono-modal-box",t ? "ono-modal-enter":""),onClick:(e)=>e.stopPropagation(),children:[c("div",{className:"ono-modal-box-body",children:[B ?? o("div",{className:"ono-modal-box-body-icon",children:o("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("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"})})}),c("div",{className:"ono-modal-box-body-contentBar",children:[o("h1",{className:"ono-modal-box-body-contentBar-title",children:d}),o("p",{className:"ono-modal-box-body-contentBar-content",children:g})]})]}),u&&o("div",{className:"ono-modal-box-footer",children:u({OkBtn:()=>o(v,{className:"ono-modal-box-footer-confirmBtn",loading:s,disabled:P,onClick:async()=>{i(!0);try{const e=j?.();e instanceof Promise&&await e;}finally{i(!1),r();}},children:N ?? "Confirm"}),CancelBtn:()=>o(v,{className:"ono-modal-box-footer-cancelBtn",disabled:T||s,onClick:()=>{w?.(),r();},children:k ?? "Cancel"}),handleClose:()=>r()})})]})});},I=(d)=>E(L,d,"ono-modal");export{I as M};
@@ -1 +0,0 @@
1
- import{jsx as R,jsxs as V}from "react/jsx-runtime";import{c as L}from "react/compiler-runtime";import{chainClassNames as M}from "./index.js";import{useState as X,useRef as J,useEffect as Y}from "react";const Z=(C)=>{const e=L(41),{name:n,value:l,style:f,checked:o,onChange:k,children:d,className:b,radioW:j,radioGap:E,checkedColor:P,unCheckedColor:i,disabled:v}=C,u=j===void 0 ? 16:j,m=E===void 0 ? 4:E,a=P===void 0 ? "#532ce1":P,h=i===void 0 ? "transparent":i,t=v!==void 0&&v,[r,g]=X(""),y=J(null),x=J(null),p=J(null);let c,s,N,w,_;e[0]!==u ?(c={value:u,name:"w"},e[0]=u,e[1]=c):c=e[1],e[2]!==m ?(s={value:m,name:"gap"},e[2]=m,e[3]=s):s=e[3],e[4]!==a ?(N={value:a,name:"checkedColor"},e[4]=a,e[5]=N):N=e[5],e[6]!==h ?(w={value:h,name:"unCheckedColor"},e[6]=h,e[7]=w):w=e[7],e[8]!==c||e[9]!==s||e[10]!==N||e[11]!==w ?(_=[c,s,N,w],e[8]=c,e[9]=s,e[10]=N,e[11]=w,e[12]=_):_=e[12];const A=_,O=ee;let $;e[13]!==r||e[14]!==o||e[15]!==a||e[16]!==A ?($=()=>{if(!p.current||!x.current)return;A.forEach((T)=>{const{value:K,name:U}=T;K&&O(K,U,x.current);});const Q=getComputedStyle(p.current);r||g(Q.borderColor),p.current.style.borderColor=o ? a:r;},e[13]=r,e[14]=o,e[15]=a,e[16]=A,e[17]=$):$=e[17];const B=$;let D,F,G,q;e[18]!==B ?(D=()=>{B();},e[18]=B,e[19]=D):D=e[19],e[20]!==r||e[21]!==o ?(F=[x,p,o,r],e[20]=r,e[21]=o,e[22]=F):F=e[22],Y(D,F),e[23]!==b ?(G=M("ono-radio-box",b),e[23]=b,e[24]=G):G=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(q=()=>y.current?.click(),e[25]=q):q=e[25];const H=l+"",I=l+""+d;let S,W,z;return e[26]!==o||e[27]!==t||e[28]!==n||e[29]!==k||e[30]!==H||e[31]!==I ?(S=R("div",{ref:p,className:"ono-radio",onClick:q,children:R("input",{type:"radio",name:n,ref:y,value:H,checked:o,disabled:t,id:I,onChange:k})}),e[26]=o,e[27]=t,e[28]=n,e[29]=k,e[30]=H,e[31]=I,e[32]=S):S=e[32],e[33]!==d||e[34]!==l ?(W=d&&R("label",{htmlFor:l+""+d||"",children:d}),e[33]=d,e[34]=l,e[35]=W):W=e[35],e[36]!==f||e[37]!==G||e[38]!==S||e[39]!==W ?(z=V("div",{ref:x,className:G,style:f,children:[S,W]}),e[36]=f,e[37]=G,e[38]=S,e[39]=W,e[40]=z):z=e[40],z;};function ee(C,e,n){const l=typeof C=="number";n.style.setProperty(`--${e}`,l ? `${C}px`:C);}const le=(C)=>{const e=L(25),{name:n,style:l,options:f,onChange:o,className:k,radioW:d,radioGap:b,labelPosition:j,checkedColor:E,unCheckedColor:P,value:i}=C,v=d===void 0 ? 16:d,u=b===void 0 ? 4:b,m=j===void 0 ? "right":j,a=E===void 0 ? "#532ce1":E,h=P===void 0 ? "transparent":P;let t,r,g;if(e[0]!==k ?(t=M("ono-radio-group",k),e[0]=k,e[1]=t):t=e[1],e[2]!==a||e[3]!==m||e[4]!==n||e[5]!==o||e[6]!==f||e[7]!==u||e[8]!==v||e[9]!==i||e[10]!==h){let y;e[12]!==a||e[13]!==m||e[14]!==n||e[15]!==o||e[16]!==u||e[17]!==v||e[18]!==i||e[19]!==h ?(y=(x)=>{const{label:p,value:c,disabled:s}=x;return R(Z,{name:n,value:c,radioW:v,radioGap:u,style:{flexDirection:m==="left" ? "row-reverse":"row"},checkedColor:a,unCheckedColor:h,onChange:()=>o(c),checked:i+""==c+"",disabled:typeof s=="function" ? s(i):s||!1,children:p},p);},e[12]=a,e[13]=m,e[14]=n,e[15]=o,e[16]=u,e[17]=v,e[18]=i,e[19]=h,e[20]=y):y=e[20],r=f.map(y),e[2]=a,e[3]=m,e[4]=n,e[5]=o,e[6]=f,e[7]=u,e[8]=v,e[9]=i,e[10]=h,e[11]=r;}else r=e[11];return e[21]!==l||e[22]!==t||e[23]!==r ?(g=R("div",{className:t,style:l,children:r}),e[21]=l,e[22]=t,e[23]=r,e[24]=g):g=e[24],g;};export{Z as R,le as a};
@@ -1 +0,0 @@
1
- import{jsx as j}from "react/jsx-runtime";import{c as E}from "react/compiler-runtime";import{chainClassNames as R}from "./index.js";import{forwardRef as z,useState as B,useRef as D,useEffect as A}from "react";const F=(L)=>{const t=E(10),{children:e,disabled:r,className:o,style:d,onClick:n}=L;let c,l,s;return t[0]!==o ?(c=R("ono-scrollable-tab",o),t[0]=o,t[1]=c):c=t[1],t[2]!==r||t[3]!==n ?(l=(a)=>!r&&n?.(a),t[2]=r,t[3]=n,t[4]=l):l=t[4],t[5]!==e||t[6]!==d||t[7]!==c||t[8]!==l ?(s=j("li",{className:c,style:d,onClick:l,children:e}),t[5]=e,t[6]=d,t[7]=c,t[8]=l,t[9]=s):s=t[9],s;},M=z((L,t)=>{const e=E(26),{activeIndex:r,children:o,className:d,style:n,position:c,onChange:l}=L,s=c===void 0 ? "center":c,[a,I]=B(0),u=D(null);let g;e[0]!==l ?(g=(i)=>{u.current&&Array.from(u.current.children).some((x,f)=>{if(x.contains(i.target))return I(f),l?.(f),!0;});},e[0]=l,e[1]=g):g=e[1];const v=g;let y,b,C,k,N,S,m,h,W;return e[2]!==r||e[3]!==a||e[4]!==s||e[5]!==n?.gap ?(y=()=>{const i=u.current;if(!i||a<0)return;const x=i.offsetWidth,f=Array.from(i.children);if(a>=f.length)return;const w=parseInt((n?.gap||getComputedStyle(i).gap||"0").toString(),10)||0;let p=0;f.slice(0,a+1).forEach((q)=>(p+=q.offsetWidth+w,p));e:switch(s){case "start":i.scrollLeft=p-f[a].offsetWidth-w;break e;case "end":i.scrollLeft=p-x;break e;default:p-=f[a].offsetWidth/2+(r!==f.length-1 ? w:0),i.scrollLeft=p-x/2;}},e[2]=r,e[3]=a,e[4]=s,e[5]=n?.gap,e[6]=y):y=e[6],e[7]!==r||e[8]!==o||e[9]!==s ?(b=[u,o,r,s],e[7]=r,e[8]=o,e[9]=s,e[10]=b):b=e[10],A(y,b),e[11]!==r ?(C=()=>{I(r||0);},k=[r],e[11]=r,e[12]=C,e[13]=k):(C=e[12],k=e[13]),A(C,k),e[14]!==t ?(N=()=>{t&&(typeof t=="function" ? t(u.current):t.current=u.current);},S=[t],e[14]=t,e[15]=N,e[16]=S):(N=e[15],S=e[16]),A(N,S),e[17]!==d ?(m=R("ono-scrollable-tabs",d),e[17]=d,e[18]=m):m=e[18],e[19]!==o ?(h=o(F),e[19]=o,e[20]=h):h=e[20],e[21]!==v||e[22]!==n||e[23]!==h||e[24]!==m ?(W=j("ul",{ref:u,className:m,style:n,onClick:v,children:h}),e[21]=v,e[22]=n,e[23]=h,e[24]=m,e[25]=W):W=e[25],W;});export{M as S};
@@ -1 +0,0 @@
1
- import{jsx as d}from "react/jsx-runtime";import{c as w}from "react/compiler-runtime";import{chainClassNames as E}from "./index.js";import{useRef as P,useEffect as R}from "react";const A=(j)=>{const e=w(22),{w:p,h:v,src:h,clr:r,className:y,onClick:g}=j,c=P(null);let s,a,t,n;if(e[0]!==p ?(s={value:p,name:"w"},e[0]=p,e[1]=s):s=e[1],e[2]!==v ?(a={value:v,name:"h"},e[2]=v,e[3]=a):a=e[3],e[4]!==r ?(t={value:r,name:"clr"},e[4]=r,e[5]=t):t=e[5],e[6]!==s||e[7]!==a||e[8]!==t){const k=[s,a,t];n=()=>{c.current&&k.forEach((C)=>{var u,N,$;C.value&&(u=C.value,N=C.name,$=c.current,typeof u=="string" ? $.style.setProperty(`--${N}`,u):$.style.setProperty(`--${N}`,`${u}px`));});},e[6]=s,e[7]=a,e[8]=t,e[9]=n;}else n=e[9];const x=n;let m,i,l,o,f;return e[10]!==x ?(m=()=>{x();},e[10]=x,e[11]=m):m=e[11],e[12]!==r ?(i=[c,r],e[12]=r,e[13]=i):i=e[13],R(m,i),e[14]!==y ?(l=E("ono-svg-img",y),e[14]=y,e[15]=l):l=e[15],e[16]!==h ?(o=d("img",{src:h,alt:""}),e[16]=h,e[17]=o):o=e[17],e[18]!==g||e[19]!==l||e[20]!==o ?(f=d("div",{ref:c,className:l,onClick:g,children:o}),e[18]=g,e[19]=l,e[20]=o,e[21]=f):f=e[21],f;};export{A as S};
@@ -1 +0,0 @@
1
- import{jsx as k,jsxs as W}from "react/jsx-runtime";import{c as ce}from "react/compiler-runtime";import{chainClassNames as X,pureNumber as Y}from "./index.js";import{useRef as f,useEffect as Z}from "react";const le=(p)=>{const e=ce(50),{id:y,text:t,style:c,color:r,checked:i,onChange:z,name:L,className:n,disabled:M}=p,B=L===void 0 ? "":L,N=M!==void 0&&M,g=f(null),x=f(null),w=f(null),C=f(null),O=f(null),Q=f(null),D=typeof r=="string" ? r:r?.active;let s;e[0]!==D ?(s={value:D,name:"checkedClr"},e[0]=D,e[1]=s):s=e[1];const G=typeof r=="string" ? void 0:r?.inactive;let a,S;e[2]!==G ?(a={value:G,name:"uncheckedClr"},e[2]=G,e[3]=a):a=e[3],e[4]!==s||e[5]!==a ?(S=[s,a],e[4]=s,e[5]=a,e[6]=S):S=e[6];const H=S,ee=ne;let _;e[7]!==n||e[8]!==c||e[9]!==H ?(_=()=>{if(!x.current||!g.current)return;let b=60,U=32;if(n||c){const T=getComputedStyle(x.current);b=Y(T.width),U=Y(T.height);}[...H,{value:b,name:"w"},{value:U,name:"h"}].forEach((T)=>{const{value:V,name:te}=T;V&&ee(V,te,g.current);}),requestAnimationFrame(()=>{C.current&&(C.current.style.transition="translate 0.3s");});},e[7]=n,e[8]=c,e[9]=H,e[10]=_):_=e[10];const I=_;let j;e[11]!==N||e[12]!==z ?(j=(b)=>{N||z?.(b.currentTarget.checked,b);},e[11]=N,e[12]=z,e[13]=j):j=e[13];const J=j;let E,$,q,A;e[14]!==I ?(E=()=>{I();},e[14]=I,e[15]=E):E=e[15],e[16]!==n||e[17]!==r||e[18]!==c||e[19]!==t ?($=[x,g,C,n,c,r,t,O,Q],e[16]=n,e[17]=r,e[18]=c,e[19]=t,e[20]=$):$=e[20],Z(E,$),e[21]!==i ?(q=()=>{w.current&&(w.current.checked=i);},A=[w,i],e[21]=i,e[22]=q,e[23]=A):(q=e[22],A=e[23]),Z(q,A);const K=N ? "ono-switch-is-disabled":"";let l,o,m,F,h,P,u,d,v,R;return e[24]!==K ?(l=X("ono-switch",K),e[24]=K,e[25]=l):l=e[25],e[26]!==i||e[27]!==y||e[28]!==B||e[29]!==J ?(o=k("input",{id:y,name:B,role:"switch",ref:w,type:"checkbox",checked:i,onChange:J}),e[26]=i,e[27]=y,e[28]=B,e[29]=J,e[30]=o):o=e[30],e[31]!==n ?(m=X("ono-switch-box",n),e[31]=n,e[32]=m):m=e[32],e[33]===Symbol.for("react.memo_cache_sentinel")?(F=()=>w.current?.click(),e[33]=F):F=e[33],e[34]!==t?.active ?(h=t?.active&&k("div",{ref:O,className:"ono-switch-children",children:t?.active}),e[34]=t?.active,e[35]=h):h=e[35],e[36]===Symbol.for("react.memo_cache_sentinel")?(P=k("div",{className:"ono-switch-slider"}),e[36]=P):P=e[36],e[37]!==t?.inactive ?(u=t?.inactive&&k("div",{ref:Q,className:"ono-switch-children",children:t?.inactive}),e[37]=t?.inactive,e[38]=u):u=e[38],e[39]!==h||e[40]!==u ?(d=W("div",{ref:C,className:"ono-switch-children-bar",children:[h,P,u]}),e[39]=h,e[40]=u,e[41]=d):d=e[41],e[42]!==c||e[43]!==m||e[44]!==d ?(v=k("div",{ref:x,className:m,style:c,onClick:F,children:d}),e[42]=c,e[43]=m,e[44]=d,e[45]=v):v=e[45],e[46]!==l||e[47]!==o||e[48]!==v ?(R=W("div",{ref:g,className:l,children:[o,v]}),e[46]=l,e[47]=o,e[48]=v,e[49]=R):R=e[49],R;};function ne(p,e,y){const t=typeof p=="number";y.style.setProperty(`--${e}`,t ? `${p}px`:p);}export{le as S};
@@ -1 +0,0 @@
1
- import{jsx as x}from "react/jsx-runtime";import{throttle as $,useEventListener as k}from "./index.js";import{useState as L,useRef as E,useEffect as I}from "react";import{L as B}from "./List-ClfyFOXz.js";const K=({containerClassName:z,dataSource:c,containerStyle:w={},onEndCallback:p,refreshSpeed:N=50,wrapperClassName:b,wrapperStyle:A={},estimatedSize:g=35,updateDataSourceScroll2Top:C,direction:l="vertical"})=>{const [d,H]=L({viewSize:0,startIndex:0,listSize:0,renderCount:0,prevLen:0}),[a,M]=L([]),o=typeof g=="number" ? g:g(),T=Math.min(c.length,d.startIndex+d.renderCount),m=d.startIndex>0 ? a[d.startIndex-1]?.end:0,W=x(B,{list:c.slice(d.startIndex,T),children:({id:r,data:i})=>x("li",{"data-virtual-id":r,style:l==="vertical" ?{width:"100%"}:{height:"100%"},children:i},r)}),j={display:"flex",listStyle:"none",flexDirection:l==="vertical" ? "column":"row",height:l==="vertical" ? d.listSize-m+"px":"100%",width:l==="vertical" ? "auto":d.listSize-m+"px",translate:l==="vertical" ? `0 ${m}px 0`:`${m}px 0 0`},h=E(null),u=E(null),v=(r)=>H((i)=>({...i,...r})),D=$(()=>{const{scrollTop:r,clientHeight:i,scrollHeight:s,scrollLeft:n,clientWidth:t,scrollWidth:e}=h.current,f=l==="vertical" ? s-i-r:e-t-n;v({startIndex:R(a,l==="vertical" ? r:n)}),(l==="vertical" ? r===o/2:n===o/2)&&v({startIndex:0}),f<=20&&p&&p();},N),R=(r,i)=>{let s=0,n=r.length-1,t=-1;for(;s<=n;){const e=s+Math.floor((n-s)/2),f=r[e].end;if(f===i)return e+1;f<i ? s=e+1:((t===-1||t>e)&&(t=e),n=e-1);}return t;};return k("scroll",D,{target:h.current,deps:[a,l]}),I(()=>{(()=>{if(!h.current)return;const r=(l==="vertical" ? h.current.offsetHeight:h.current.offsetWidth)||0;v({viewSize:r,renderCount:Math.ceil(r/o)+1});})();},[h,l]),I(()=>{c.length&&u&&(()=>{const r=[],i=c.length-d.prevLen,s=i>0 ? a.length:0,n=s>0 ? a[s-1].end:0;for(let t=0;t<(i>0 ? i:c.length);t++){const e=c[(i>0 ? d.prevLen:0)+t];r.push({index:e.id,size:o,start:n ? n+t*o:e.id*o,end:n ? n+(t+1)*o:(e.id+1)*o,dSize:0});}M((t)=>[...i>0 ? t:[],...r]),v({prevLen:c.length}),C&&h.current?.scrollTo(0,0);})();},[u,c,C]),I(()=>{(()=>{if(!u.current||a.length===0)return;const r=Array.from(u.current.childNodes);if(!r.length)return;r.forEach((t)=>{const e=t.getBoundingClientRect(),f=+t.getAttribute("data-virtual-id"),S=a[f],y=S.size-(l==="vertical" ? e.height:e.width);y&&(S.size=l==="vertical" ? e.height:e.width,S.end=S.end-y,S.dSize=y);});const i=+r[0].getAttribute("data-virtual-id"),s=a.length;let n=a[i].dSize;a[i].dSize=0;for(let t=i+1;t<s;t++){const e=a[t];e.start=a[t-1].end,e.end=e.end-n,e.dSize&&(n+=e.dSize,e.dSize=0);}v({listSize:a[s-1].end});})();},[u,a,d.startIndex,l]),x("div",{ref:h,className:z,style:{width:"100%",height:"100%",overflow:"auto",...w},children:x("ul",{ref:u,className:b,style:{...j,...A},children:W})});},O=(z,c)=>z.map((w,p)=>({id:p,data:c(w,p)}));export{K as E,O as c};
@@ -1 +0,0 @@
1
- import{jsxs as R,jsx as m}from "react/jsx-runtime";import{throttle as k,useEventListener as B,chainClassNames as G}from "./index.js";import{useState as v,useRef as L,useEffect as $}from "react";import{L as I}from "./List-ClfyFOXz.js";const V=({options:t,pageSize:u,children:j,request:A,reloadData:o,className:S,style:H,updateData:N,loading:l=!0,bottomThreshold:O=50})=>{const [a,h]=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,D]=v([]),[x,E]=v([]),y=L(null),g=L(null),d=L(null),p=(i)=>h((e)=>({...e,...i})),w=async(i,e)=>{const s=o&&a.reloadData!==o;if(a.isFinish)return;p({loading:!0});const n=await A(i,e);q(n),p({isFinish:!n.length,imageList:s ? [...n]:[...a.imageList,...n],page:i+1,loading:!1});},q=(i)=>h((e)=>{const s=o&&a.reloadData!==o,n=s ? []:[...x],c=s ? Array(e.columns).fill(0):[...JSON.stringify(f)!=="[]" ? f:Array(e.columns).fill(0)];return i.forEach((T)=>{const r=((W)=>{let b=0,z=0;return b=W.indexOf(Math.min(...W)),z=W[b],{index:b,height:z};})(c),J=Math.floor(T.height*e.imageWidth/T.width);n.push({x:r.index%e.columns!==0 ? r.index*e.imageWidth+e.gap*r.index:r.index*e.imageWidth,y:r.height}),c[r.index]+=J+e.gap,D(c);}),E(n),e;}),F=()=>{if(!d.current)return;const i=d.current.clientWidth;let e=0,s=a.page;if(o&&a.reloadData!==o&&(h({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:[]}),D([]),E([]),s=1),typeof t=="number"){const n=Math.floor(i/a.imageWidth);e=n-1;const c=e ?(i-n*a.imageWidth)/e:0;p({columns:n,gap:c});}else{e=a.columns-1;const n=(i-e*a.gap)/a.columns;p({imageWidth:n});}w(s,u);},M=()=>{y.current&&clearTimeout(y.current),y.current=setTimeout(F,50);},C=k(()=>{const{scrollTop:i,clientHeight:e,scrollHeight:s}=g.current;s-e-i>O||!a.loading&&w(a.page,u);},50);return B("scroll",C,{target:g.current,deps:[a.loading,a.page]}),$(()=>(F(),window.addEventListener("resize",M),()=>{window.removeEventListener("resize",M);}),[d,o]),$(()=>{N&&w(a.page,u);},[N,a.loading,a.page,g.current]),R("div",{className:"ono-waterfall-container",children:[m("div",{ref:g,className:G(S,"ono-waterfall-content"),style:H,children:m("div",{ref:d,className:"ono-waterfall-wrapper",style:{height:Math.max(...f)-a.gap+"px"},children:m(I,{list:a.imageList,children:(i,e)=>m("div",{className:"ono-waterfall-item",style:{width:`${a.imageWidth}px`,translate:`${x[e].x}px ${x[e].y}px`},children:j(i,e)},i.id)})})}),a.loading&&(typeof l=="function" ? l():l&&typeof l=="boolean" ? m("div",{className:"ono-waterfall-loading",children:"loading..."}):l)]});};export{V as W};