@solibo/solibo-ui 0.4.10 → 0.5.3

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 (192) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/index.css +1 -1
  3. package/dist/assets/index10.css +1 -1
  4. package/dist/assets/index11.css +1 -1
  5. package/dist/assets/index12.css +1 -1
  6. package/dist/assets/index13.css +1 -1
  7. package/dist/assets/index14.css +1 -1
  8. package/dist/assets/index15.css +1 -1
  9. package/dist/assets/index16.css +1 -1
  10. package/dist/assets/index17.css +1 -1
  11. package/dist/assets/index18.css +1 -1
  12. package/dist/assets/index19.css +1 -1
  13. package/dist/assets/index2.css +1 -1
  14. package/dist/assets/index20.css +1 -1
  15. package/dist/assets/index21.css +1 -1
  16. package/dist/assets/index22.css +1 -1
  17. package/dist/assets/index23.css +1 -1
  18. package/dist/assets/index24.css +1 -1
  19. package/dist/assets/index25.css +1 -1
  20. package/dist/assets/index26.css +1 -1
  21. package/dist/assets/index27.css +1 -1
  22. package/dist/assets/index29.css +1 -1
  23. package/dist/assets/index3.css +1 -1
  24. package/dist/assets/index30.css +1 -1
  25. package/dist/assets/index31.css +1 -1
  26. package/dist/assets/index32.css +1 -1
  27. package/dist/assets/index33.css +1 -1
  28. package/dist/assets/index34.css +1 -1
  29. package/dist/assets/index35.css +1 -1
  30. package/dist/assets/index36.css +1 -1
  31. package/dist/assets/index37.css +1 -1
  32. package/dist/assets/index38.css +1 -1
  33. package/dist/assets/index39.css +1 -1
  34. package/dist/assets/index4.css +1 -1
  35. package/dist/assets/index40.css +1 -1
  36. package/dist/assets/index41.css +1 -1
  37. package/dist/assets/index42.css +1 -1
  38. package/dist/assets/index43.css +1 -1
  39. package/dist/assets/index44.css +1 -1
  40. package/dist/assets/index5.css +1 -1
  41. package/dist/assets/index6.css +1 -1
  42. package/dist/assets/index8.css +1 -1
  43. package/dist/assets/index9.css +1 -1
  44. package/dist/assets/styles.css +1 -1
  45. package/dist/components/_avatar/index.cjs +1 -1
  46. package/dist/components/_avatar/index.cjs.map +1 -1
  47. package/dist/components/_avatar/index.js +9 -9
  48. package/dist/components/_avatar/index.js.map +1 -1
  49. package/dist/components/_card/index.cjs +1 -1
  50. package/dist/components/_card/index.js +12 -12
  51. package/dist/components/_collapsible/index.cjs +1 -1
  52. package/dist/components/_collapsible/index.js +1 -1
  53. package/dist/components/_croppable/index.cjs +1 -1
  54. package/dist/components/_croppable/index.js +175 -175
  55. package/dist/components/_dropdown/index.cjs +1 -1
  56. package/dist/components/_dropdown/index.cjs.map +1 -1
  57. package/dist/components/_dropdown/index.js +87 -87
  58. package/dist/components/_dropdown/index.js.map +1 -1
  59. package/dist/components/_dropzone/index.cjs +1 -1
  60. package/dist/components/_dropzone/index.js +34 -34
  61. package/dist/components/_editor/index.cjs +16 -16
  62. package/dist/components/_editor/index.cjs.map +1 -1
  63. package/dist/components/_editor/index.js +19 -19
  64. package/dist/components/_editor/index.js.map +1 -1
  65. package/dist/components/_messages/index.cjs +1 -1
  66. package/dist/components/_messages/index.cjs.map +1 -1
  67. package/dist/components/_messages/index.js +15 -15
  68. package/dist/components/_messages/index.js.map +1 -1
  69. package/dist/components/_portal/index.cjs +1 -1
  70. package/dist/components/_portal/index.cjs.map +1 -1
  71. package/dist/components/_portal/index.js +17 -16
  72. package/dist/components/_portal/index.js.map +1 -1
  73. package/dist/components/_sortable/index.cjs +1 -1
  74. package/dist/components/_sortable/index.cjs.map +1 -1
  75. package/dist/components/_sortable/index.js +64 -33
  76. package/dist/components/_sortable/index.js.map +1 -1
  77. package/dist/components/_widget/index.cjs +1 -1
  78. package/dist/components/_widget/index.js +3 -3
  79. package/dist/components/accordion/index.cjs +1 -1
  80. package/dist/components/accordion/index.cjs.map +1 -1
  81. package/dist/components/accordion/index.js +16 -10
  82. package/dist/components/accordion/index.js.map +1 -1
  83. package/dist/components/app-link/index.cjs +1 -1
  84. package/dist/components/app-link/index.cjs.map +1 -1
  85. package/dist/components/app-link/index.js +9 -9
  86. package/dist/components/app-link/index.js.map +1 -1
  87. package/dist/components/aside/index.cjs +1 -1
  88. package/dist/components/aside/index.js +6 -6
  89. package/dist/components/badge/index.cjs +1 -1
  90. package/dist/components/badge/index.cjs.map +1 -1
  91. package/dist/components/badge/index.js +19 -18
  92. package/dist/components/badge/index.js.map +1 -1
  93. package/dist/components/banner/index.cjs +1 -1
  94. package/dist/components/banner/index.js +9 -9
  95. package/dist/components/branding/index.cjs +1 -1
  96. package/dist/components/branding/index.js +12 -12
  97. package/dist/components/button/index.cjs +1 -1
  98. package/dist/components/button/index.js +12 -12
  99. package/dist/components/checkbox/index.cjs +1 -1
  100. package/dist/components/checkbox/index.js +7 -7
  101. package/dist/components/controls/index.cjs +1 -1
  102. package/dist/components/controls/index.cjs.map +1 -1
  103. package/dist/components/controls/index.js +21 -10
  104. package/dist/components/controls/index.js.map +1 -1
  105. package/dist/components/dialog/index.cjs +1 -1
  106. package/dist/components/dialog/index.js +3 -3
  107. package/dist/components/figure/index.cjs +1 -1
  108. package/dist/components/figure/index.cjs.map +1 -1
  109. package/dist/components/figure/index.js +11 -11
  110. package/dist/components/figure/index.js.map +1 -1
  111. package/dist/components/file/index.cjs +1 -1
  112. package/dist/components/file/index.cjs.map +1 -1
  113. package/dist/components/file/index.js +14 -13
  114. package/dist/components/file/index.js.map +1 -1
  115. package/dist/components/footer/index.cjs +1 -1
  116. package/dist/components/footer/index.js +3 -3
  117. package/dist/components/form/index.cjs +1 -1
  118. package/dist/components/form/index.js +11 -11
  119. package/dist/components/graph/index.cjs +1 -1
  120. package/dist/components/graph/index.cjs.map +1 -1
  121. package/dist/components/graph/index.js +31 -31
  122. package/dist/components/graph/index.js.map +1 -1
  123. package/dist/components/header/index.cjs +1 -1
  124. package/dist/components/header/index.js +3 -3
  125. package/dist/components/icon/index.cjs +1 -1
  126. package/dist/components/icon/index.cjs.map +1 -1
  127. package/dist/components/icon/index.js +26 -26
  128. package/dist/components/icon/index.js.map +1 -1
  129. package/dist/components/image/index.cjs +1 -1
  130. package/dist/components/image/index.js +9 -9
  131. package/dist/components/input/index.cjs +1 -1
  132. package/dist/components/input/index.cjs.map +1 -1
  133. package/dist/components/input/index.js +34 -33
  134. package/dist/components/input/index.js.map +1 -1
  135. package/dist/components/link/index.cjs +1 -1
  136. package/dist/components/link/index.js +11 -11
  137. package/dist/components/list/index.cjs +1 -1
  138. package/dist/components/list/index.js +7 -7
  139. package/dist/components/loading/index.cjs +1 -1
  140. package/dist/components/loading/index.js +13 -13
  141. package/dist/components/message/index.cjs +1 -1
  142. package/dist/components/message/index.js +7 -7
  143. package/dist/components/nav/index.cjs +1 -1
  144. package/dist/components/nav/index.js +23 -23
  145. package/dist/components/object/index.cjs +2 -0
  146. package/dist/components/object/index.cjs.map +1 -0
  147. package/dist/components/object/index.js +16 -0
  148. package/dist/components/object/index.js.map +1 -0
  149. package/dist/components/select/index.cjs +1 -1
  150. package/dist/components/select/index.js +1 -1
  151. package/dist/components/table/index.cjs +1 -1
  152. package/dist/components/table/index.cjs.map +1 -1
  153. package/dist/components/table/index.js +22 -22
  154. package/dist/components/table/index.js.map +1 -1
  155. package/dist/components/textarea/index.cjs +1 -1
  156. package/dist/components/textarea/index.cjs.map +1 -1
  157. package/dist/components/textarea/index.js +23 -23
  158. package/dist/components/textarea/index.js.map +1 -1
  159. package/dist/components/toast/index.cjs +1 -1
  160. package/dist/components/toast/index.cjs.map +1 -1
  161. package/dist/components/toast/index.js +23 -24
  162. package/dist/components/toast/index.js.map +1 -1
  163. package/dist/components/toggle/index.cjs +1 -1
  164. package/dist/components/toggle/index.js +1 -1
  165. package/dist/components/toolbar/index.cjs +1 -1
  166. package/dist/components/toolbar/index.js +9 -9
  167. package/dist/index-CiEbbnD6.js +42 -0
  168. package/dist/index-CiEbbnD6.js.map +1 -0
  169. package/dist/index-ClrKYsAQ.cjs +2 -0
  170. package/dist/index-ClrKYsAQ.cjs.map +1 -0
  171. package/dist/index.cjs +1 -1
  172. package/dist/index.d.ts +28 -22
  173. package/dist/index.js +33 -33
  174. package/dist/styles.module-BOTEBJ0C.js +9 -0
  175. package/dist/styles.module-BOTEBJ0C.js.map +1 -0
  176. package/dist/styles.module-BPvMQa_x.cjs +2 -0
  177. package/dist/styles.module-BPvMQa_x.cjs.map +1 -0
  178. package/dist/tokens.css +44 -12
  179. package/dist/tokens.json +541 -68
  180. package/package.json +1 -1
  181. package/dist/components/layout/index.cjs +0 -2
  182. package/dist/components/layout/index.cjs.map +0 -1
  183. package/dist/components/layout/index.js +0 -18
  184. package/dist/components/layout/index.js.map +0 -1
  185. package/dist/index-BpUboRfJ.cjs +0 -2
  186. package/dist/index-BpUboRfJ.cjs.map +0 -1
  187. package/dist/index-ChKhFyp8.js +0 -40
  188. package/dist/index-ChKhFyp8.js.map +0 -1
  189. package/dist/styles.module-DZXAP_eP.js +0 -8
  190. package/dist/styles.module-DZXAP_eP.js.map +0 -1
  191. package/dist/styles.module-Vt6mmlsz.cjs +0 -2
  192. package/dist/styles.module-Vt6mmlsz.cjs.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index21.css');const d=require("react/jsx-runtime"),tt=require("../../classix-5H4IWnMA.cjs"),c=require("react"),mt=require("../button/index.cjs"),pt=require("../figure/index.cjs"),gt=require("../icon/index.cjs"),vt="_croppable_1ykk4_1",Ot="_empty_1ykk4_14",St="_media_1ykk4_22",Ut="_overlay_1ykk4_33",It="_viewport_1ykk4_41",Pt="_draggable_1ykk4_53",Yt="_dragging_1ykk4_57",Xt="_inner_1ykk4_61",At="_standalone_1ykk4_77",z={croppable:vt,empty:Ot,media:St,overlay:Ut,viewport:It,draggable:Pt,dragging:Yt,inner:Xt,standalone:At},Dt=192,B={offset:{x:0,y:0},zoom:1},xt="Select image",O=10,D=.1,Wt=.92,m=(h,x,R)=>Math.min(R,Math.max(x,h)),Ht=h=>new Promise((x,R)=>{const f=URL.createObjectURL(h),a=new globalThis.Image;a.onload=()=>{URL.revokeObjectURL(f),x(a)},a.onerror=()=>{URL.revokeObjectURL(f),R(new Error("croppable-image-load-failed"))},a.src=f}),Zt=async({file:h,fill:x,transform:R,viewport:f})=>{const a=await Ht(h),S=f.width/a.naturalWidth,M=f.height/a.naturalHeight,y=Math.max(S,M),W=a.naturalWidth*y,k=a.naturalHeight*y,Q=x==="width"?Math.max(D,S/y):x==="height"?Math.max(D,M/y):D,E=m(R.zoom,Q,O),w=y*E,b=W*E,N=k*E,p=(f.width-b)/2+R.offset.x,j=(f.height-N)/2+R.offset.y,U=m((0-p)/w,0,a.naturalWidth),L=m((0-j)/w,0,a.naturalHeight),T=m(f.width/w,1,Math.max(1,a.naturalWidth-U)),s=m(f.height/w,1,Math.max(1,a.naturalHeight-L)),_=document.createElement("canvas"),u=_.getContext("2d");if(!u)throw new Error("croppable-image-context-missing");_.width=Math.max(1,Math.round(T)),_.height=Math.max(1,Math.round(s)),u.drawImage(a,U,L,T,s,0,0,_.width,_.height);const I=h.type.startsWith("image/")?h.type:"image/jpeg",P=await new Promise(q=>{_.toBlob(q,I,Wt)});if(!P)throw new Error("croppable-image-export-failed");return new globalThis.File([P],h.name,{lastModified:Date.now(),type:P.type||I})},Bt=({children:h,fill:x="none",height:R,image:f,label:a,onCroppableChange:S,onFileChange:M,onImageChange:y,onTransformChange:W,transform:k,standalone:Q})=>{const E=c.useRef(null),w=c.useRef(null),b=c.useRef(null),N=c.useRef(null),p=c.useRef(y),j=c.useRef(null),U=c.useRef(null),L=c.useRef(null),T=c.useRef(new Map),s=c.useRef(B),_=c.useRef(null),[u,I]=c.useState(null),[P,q]=c.useState(null),[et,V]=c.useState(!1),[wt,nt]=c.useState(B),[F,rt]=c.useState(null),[g,yt]=c.useState({width:0,height:0}),H=(()=>{const t=g.width,n=g.height;if(!t||!n)return{width:0,height:0,minZoom:D};if(!u)return{width:t,height:n,minZoom:D};const r=t/u.width,e=n/u.height,o=Math.max(r,e),i=x==="width"?r/o:x==="height"?e/o:0;return{width:u.width*o,height:u.height*o,minZoom:Math.max(D,i)}})(),Y=H.minZoom,Z=k??wt,X=m(Z.zoom,Y,O),$=P??f??null,ot=!h&&!!f&&!P&&!F,G=!ot,ct=h??($?d.jsx("img",{alt:"",draggable:!1,onLoad:t=>{const n=t.currentTarget;n.naturalWidth&&n.naturalHeight&&I({width:n.naturalWidth,height:n.naturalHeight})},src:$}):null),A=ct==null,J=(t,n)=>{const{maxX:r,maxY:e}=it(n);return{x:m(t.x,-r,r),y:m(t.y,-e,e)}},st=(t,n)=>{const r=_.current;if(!r)return null;const e=r.getBoundingClientRect(),o=t-e.left-e.width/2,i=n-e.top-e.height/2;return{x:o,y:i}},bt=(t,n,r,e)=>{const o=m(n,Y,O),i=m(r,Y,O);if(o===0)return t;const l=i/o;return{x:(1-l)*e.x+l*t.x,y:(1-l)*e.y+l*t.y}},_t=(t,n,r)=>{const e=s.current.zoom,o=m(t,Y,O),i=s.current.offset,l=r?bt(i,e,o,r):n,v=J(l,o);s.current={zoom:o,offset:v},k||nt({zoom:o,offset:v}),W==null||W({zoom:o,offset:v})},K=(t,n,r)=>{U.current={zoom:t,offset:n,anchor:r??null},w.current==null&&(w.current=window.requestAnimationFrame(()=>{w.current=null;const e=U.current;U.current=null;const o=(e==null?void 0:e.zoom)??s.current.zoom,i=(e==null?void 0:e.offset)??s.current.offset,l=(e==null?void 0:e.anchor)??null;_t(o,i,l)}))},zt=t=>{if(A||!G)return;const n=t.ctrlKey?.001:25e-5,r=s.current.zoom*Math.exp(-t.deltaY*n),e=st(t.clientX,t.clientY);K(r,s.current.offset,e)},it=t=>{const n=g.width,r=g.height;if(!n||!r)return{maxX:0,maxY:0};const e=m(t,Y,O),o=H.width*e,i=H.height*e,l=Math.max(0,(o-n)/2),v=Math.max(0,(i-r)/2);return{maxX:l,maxY:v}},Rt=t=>{var o;const n=t.target,r=((o=n.files)==null?void 0:o[0])??null;if(j.current&&(URL.revokeObjectURL(j.current),j.current=null),!r){q(null),rt(null),M==null||M(null),n.value="";return}const e=URL.createObjectURL(r);j.current=e,q(e),I(null),rt(r),K(B.zoom,B.offset),s.current=B,M==null||M(r),n.value=""},Mt=t=>{if(!(A||!G||t.pointerType==="mouse"&&t.button!==0)){if(t.currentTarget.setPointerCapture(t.pointerId),t.pointerType==="touch"){const n=T.current;if(n.set(t.pointerId,{x:t.clientX,y:t.clientY}),n.size===2){b.current=null,E.current=null,V(!1);const[r,e]=Array.from(n.values());L.current=Math.hypot(r.x-e.x,r.y-e.y);return}}E.current=t.pointerId,b.current={x:t.clientX,y:t.clientY,originX:s.current.offset.x,originY:s.current.offset.y}}},kt=t=>{if(A||!G)return;if(t.pointerType==="touch"){const o=T.current;if(!o.has(t.pointerId))return;if(o.set(t.pointerId,{x:t.clientX,y:t.clientY}),o.size===2){const[i,l]=Array.from(o.values()),v=i.x-l.x,Et=i.y-l.y,ht=Math.hypot(v,Et),ft={x:(i.x+l.x)/2,y:(i.y+l.y)/2};if(L.current){const jt=ht/L.current,Lt=s.current.zoom*jt,Tt=st(ft.x,ft.y);K(Lt,s.current.offset,Tt)}L.current=ht;return}}if(E.current!==t.pointerId||!b.current||!C)return;const n=t.clientX-b.current.x,r=t.clientY-b.current.y,e=Math.abs(n)+Math.abs(r);!et&&e>2&&V(!0),!(e<=1)&&K(s.current.zoom,{x:b.current.originX+n,y:b.current.originY+r})},at=t=>{t.pointerType==="touch"&&(T.current.delete(t.pointerId),T.current.size<2&&(L.current=null)),E.current===t.pointerId&&(E.current=null,b.current=null,V(!1))};c.useEffect(()=>{if(!k)return;const t=m(k.zoom,Y,O);s.current={zoom:t,offset:J(k.offset,t)}},[k,g.width,g.height,u==null?void 0:u.width,u==null?void 0:u.height]),c.useEffect(()=>()=>{j.current&&URL.revokeObjectURL(j.current)},[]),c.useEffect(()=>{const t=_.current;if(!t)return;const n=()=>{const o=t.getBoundingClientRect();yt(i=>i.width===o.width&&i.height===o.height?i:{width:o.width,height:o.height}),S&&S(o)};n();const r=()=>n();if(window.addEventListener("scroll",r,!0),typeof ResizeObserver>"u"){const o=()=>n();return window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",r,!0)}}const e=new ResizeObserver(()=>n());return e.observe(t),()=>{e.disconnect(),window.removeEventListener("scroll",r,!0)}},[S]),c.useEffect(()=>{if(k)return;const t=s.current.offset,n=J(t,X);t.x===n.x&&t.y===n.y||(s.current={zoom:s.current.zoom,offset:n},nt(r=>({...r,offset:n})))},[X,u,g.width,g.height]),c.useEffect(()=>{$||I(null)},[$]),c.useEffect(()=>{p.current=y},[y]),c.useEffect(()=>{var r;if(!y)return;if(!F||!g.width||!g.height||h){(r=p.current)==null||r.call(p,null);return}let t=!0;const n=window.setTimeout(()=>{Zt({file:F,fill:x,transform:{zoom:X,offset:Z.offset},viewport:g}).then(e=>{var o;t&&((o=p.current)==null||o.call(p,e))}).catch(()=>{var e;t&&((e=p.current)==null||e.call(p,null))})},75);return()=>{t=!1,window.clearTimeout(n)}},[h,X,Z.offset,x,F,g]),c.useEffect(()=>()=>{w.current!=null&&(window.cancelAnimationFrame(w.current),w.current=null)},[]);const ut=it(X),C=!A&&G&&(ut.maxX>0||ut.maxY>0),lt=()=>{var t;return(t=N.current)==null?void 0:t.click()},dt=t=>{t.preventDefault(),t.stopPropagation(),lt()};return d.jsxs("div",{className:tt.t(z.croppable,Q&&z.standalone),onClick:()=>{A&&lt()},"data-component":"croppable",children:[d.jsx("input",{accept:"image/*",onChange:Rt,ref:N,type:"file"}),d.jsx("div",{className:z.viewport,ref:_,onDragStart:t=>t.preventDefault(),onPointerDown:Mt,onPointerMove:kt,onPointerUp:at,onPointerCancel:at,onWheel:zt,style:{"--croppable-height":`${R??Dt}px`,"--croppable-zoom":X,"--croppable-x":`${Z.offset.x}px`,"--croppable-y":`${Z.offset.y}px`,...u?{"--croppable-image-width":`${H.width}px`,"--croppable-image-height":`${H.height}px`}:null},children:A?d.jsxs("div",{className:z.empty,children:[d.jsx(pt.Figure,{children:d.jsx(gt.Icon,{name:"image",size:"large"})}),d.jsx(mt.Button,{onClick:dt,children:a??xt})]}):d.jsxs("div",{className:tt.t(z.media,C&&z.draggable,C&&et&&z.dragging),children:[d.jsx("div",{className:tt.t(z.inner),children:ct}),ot&&d.jsx("div",{className:z.overlay,children:d.jsxs("div",{className:z.empty,children:[d.jsx(pt.Figure,{children:d.jsx(gt.Icon,{name:"image",size:"large"})}),d.jsx(mt.Button,{onClick:dt,children:a??xt})]})})]})})]})};exports.Croppable=Bt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index21.css');const d=require("react/jsx-runtime"),tt=require("../../classix-5H4IWnMA.cjs"),c=require("react"),mt=require("../button/index.cjs"),pt=require("../figure/index.cjs"),gt=require("../icon/index.cjs"),Ot="_croppable_oxo39_1",St="_empty_oxo39_14",Ut="_media_oxo39_22",It="_overlay_oxo39_33",Pt="_viewport_oxo39_41",Yt="_draggable_oxo39_53",Xt="_dragging_oxo39_57",At="_inner_oxo39_61",Dt="_standalone_oxo39_77",z={croppable:Ot,empty:St,media:Ut,overlay:It,viewport:Pt,draggable:Yt,dragging:Xt,inner:At,standalone:Dt},Wt=192,B={offset:{x:0,y:0},zoom:1},xt="Select image",S=10,W=.1,Ht=.92,m=(h,x,R)=>Math.min(R,Math.max(x,h)),Zt=h=>new Promise((x,R)=>{const f=URL.createObjectURL(h),a=new globalThis.Image;a.onload=()=>{URL.revokeObjectURL(f),x(a)},a.onerror=()=>{URL.revokeObjectURL(f),R(new Error("croppable-image-load-failed"))},a.src=f}),kt=async({file:h,fill:x,transform:R,viewport:f})=>{const a=await Zt(h),U=f.width/a.naturalWidth,M=f.height/a.naturalHeight,y=Math.max(U,M),H=a.naturalWidth*y,E=a.naturalHeight*y,Q=x==="width"?Math.max(W,U/y):x==="height"?Math.max(W,M/y):W,j=m(R.zoom,Q,S),w=y*j,b=H*j,N=E*j,p=(f.width-b)/2+R.offset.x,L=(f.height-N)/2+R.offset.y,I=m((0-p)/w,0,a.naturalWidth),T=m((0-L)/w,0,a.naturalHeight),v=m(f.width/w,1,Math.max(1,a.naturalWidth-I)),s=m(f.height/w,1,Math.max(1,a.naturalHeight-T)),_=document.createElement("canvas"),u=_.getContext("2d");if(!u)throw new Error("croppable-image-context-missing");_.width=Math.max(1,Math.round(v)),_.height=Math.max(1,Math.round(s)),u.drawImage(a,I,T,v,s,0,0,_.width,_.height);const P=h.type.startsWith("image/")?h.type:"image/jpeg",Y=await new Promise(q=>{_.toBlob(q,P,Ht)});if(!Y)throw new Error("croppable-image-export-failed");return new globalThis.File([Y],h.name,{lastModified:Date.now(),type:Y.type||P})},Bt=({children:h,fill:x="none",height:R,image:f,label:a,onCroppableChange:U,onFileChange:M,onImageChange:y,onTransformChange:H,transform:E,standalone:Q})=>{const j=c.useRef(null),w=c.useRef(null),b=c.useRef(null),N=c.useRef(null),p=c.useRef(y),L=c.useRef(null),I=c.useRef(null),T=c.useRef(null),v=c.useRef(new Map),s=c.useRef(B),_=c.useRef(null),[u,P]=c.useState(null),[Y,q]=c.useState(null),[et,V]=c.useState(!1),[wt,nt]=c.useState(B),[F,ot]=c.useState(null),[g,yt]=c.useState({width:0,height:0}),Z=(()=>{const t=g.width,n=g.height;if(!t||!n)return{width:0,height:0,minZoom:W};if(!u)return{width:t,height:n,minZoom:W};const o=t/u.width,e=n/u.height,r=Math.max(o,e),i=x==="width"?o/r:x==="height"?e/r:0;return{width:u.width*r,height:u.height*r,minZoom:Math.max(W,i)}})(),X=Z.minZoom,k=E??wt,A=m(k.zoom,X,S),$=Y??f??null,rt=!h&&!!f&&!Y&&!F,G=!rt,ct=h??($?d.jsx("img",{alt:"",draggable:!1,onLoad:t=>{const n=t.currentTarget;n.naturalWidth&&n.naturalHeight&&P({width:n.naturalWidth,height:n.naturalHeight})},src:$}):null),D=ct==null,J=(t,n)=>{const{maxX:o,maxY:e}=it(n);return{x:m(t.x,-o,o),y:m(t.y,-e,e)}},st=(t,n)=>{const o=_.current;if(!o)return null;const e=o.getBoundingClientRect(),r=t-e.left-e.width/2,i=n-e.top-e.height/2;return{x:r,y:i}},bt=(t,n,o,e)=>{const r=m(n,X,S),i=m(o,X,S);if(r===0)return t;const l=i/r;return{x:(1-l)*e.x+l*t.x,y:(1-l)*e.y+l*t.y}},_t=(t,n,o)=>{const e=s.current.zoom,r=m(t,X,S),i=s.current.offset,l=o?bt(i,e,r,o):n,O=J(l,r);s.current={zoom:r,offset:O},E||nt({zoom:r,offset:O}),H==null||H({zoom:r,offset:O})},K=(t,n,o)=>{I.current={zoom:t,offset:n,anchor:o??null},w.current==null&&(w.current=window.requestAnimationFrame(()=>{w.current=null;const e=I.current;I.current=null;const r=(e==null?void 0:e.zoom)??s.current.zoom,i=(e==null?void 0:e.offset)??s.current.offset,l=(e==null?void 0:e.anchor)??null;_t(r,i,l)}))},zt=t=>{if(D||!G)return;const n=t.ctrlKey?.001:25e-5,o=s.current.zoom*Math.exp(-t.deltaY*n),e=st(t.clientX,t.clientY);K(o,s.current.offset,e)},it=t=>{const n=g.width,o=g.height;if(!n||!o)return{maxX:0,maxY:0};const e=m(t,X,S),r=Z.width*e,i=Z.height*e,l=Math.max(0,(r-n)/2),O=Math.max(0,(i-o)/2);return{maxX:l,maxY:O}},Rt=t=>{var r;const n=t.target,o=((r=n.files)==null?void 0:r[0])??null;if(L.current&&(URL.revokeObjectURL(L.current),L.current=null),!o){q(null),ot(null),M==null||M(null),n.value="";return}const e=URL.createObjectURL(o);L.current=e,q(e),P(null),ot(o),K(B.zoom,B.offset),s.current=B,M==null||M(o),n.value=""},Mt=t=>{if(!(D||!G||t.pointerType==="mouse"&&t.button!==0)){if(t.currentTarget.setPointerCapture(t.pointerId),t.pointerType==="touch"){const n=v.current;if(n.set(t.pointerId,{x:t.clientX,y:t.clientY}),n.size===2){b.current=null,j.current=null,V(!1);const[o,e]=Array.from(n.values());T.current=Math.hypot(o.x-e.x,o.y-e.y);return}}j.current=t.pointerId,b.current={x:t.clientX,y:t.clientY,originX:s.current.offset.x,originY:s.current.offset.y}}},Et=t=>{if(D||!G)return;if(t.pointerType==="touch"){const r=v.current;if(!r.has(t.pointerId))return;if(r.set(t.pointerId,{x:t.clientX,y:t.clientY}),r.size===2){const[i,l]=Array.from(r.values()),O=i.x-l.x,jt=i.y-l.y,ht=Math.hypot(O,jt),ft={x:(i.x+l.x)/2,y:(i.y+l.y)/2};if(T.current){const Lt=ht/T.current,Tt=s.current.zoom*Lt,vt=st(ft.x,ft.y);K(Tt,s.current.offset,vt)}T.current=ht;return}}if(j.current!==t.pointerId||!b.current||!C)return;const n=t.clientX-b.current.x,o=t.clientY-b.current.y,e=Math.abs(n)+Math.abs(o);!et&&e>2&&V(!0),!(e<=1)&&K(s.current.zoom,{x:b.current.originX+n,y:b.current.originY+o})},at=t=>{t.pointerType==="touch"&&(v.current.delete(t.pointerId),v.current.size<2&&(T.current=null)),j.current===t.pointerId&&(j.current=null,b.current=null,V(!1))};c.useEffect(()=>{if(!E)return;const t=m(E.zoom,X,S);s.current={zoom:t,offset:J(E.offset,t)}},[E,g.width,g.height,u==null?void 0:u.width,u==null?void 0:u.height]),c.useEffect(()=>()=>{L.current&&URL.revokeObjectURL(L.current)},[]),c.useEffect(()=>{const t=_.current;if(!t)return;const n=()=>{const r=t.getBoundingClientRect();yt(i=>i.width===r.width&&i.height===r.height?i:{width:r.width,height:r.height}),U&&U(r)};n();const o=()=>n();if(window.addEventListener("scroll",o,!0),typeof ResizeObserver>"u"){const r=()=>n();return window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r),window.removeEventListener("scroll",o,!0)}}const e=new ResizeObserver(()=>n());return e.observe(t),()=>{e.disconnect(),window.removeEventListener("scroll",o,!0)}},[U]),c.useEffect(()=>{if(E)return;const t=s.current.offset,n=J(t,A);t.x===n.x&&t.y===n.y||(s.current={zoom:s.current.zoom,offset:n},nt(o=>({...o,offset:n})))},[A,u,g.width,g.height]),c.useEffect(()=>{$||P(null)},[$]),c.useEffect(()=>{p.current=y},[y]),c.useEffect(()=>{var o;if(!y)return;if(!F||!g.width||!g.height||h){(o=p.current)==null||o.call(p,null);return}let t=!0;const n=window.setTimeout(()=>{kt({file:F,fill:x,transform:{zoom:A,offset:k.offset},viewport:g}).then(e=>{var r;t&&((r=p.current)==null||r.call(p,e))}).catch(()=>{var e;t&&((e=p.current)==null||e.call(p,null))})},75);return()=>{t=!1,window.clearTimeout(n)}},[h,A,k.offset,x,F,g]),c.useEffect(()=>()=>{w.current!=null&&(window.cancelAnimationFrame(w.current),w.current=null)},[]);const ut=it(A),C=!D&&G&&(ut.maxX>0||ut.maxY>0),lt=()=>{var t;return(t=N.current)==null?void 0:t.click()},dt=t=>{t.preventDefault(),t.stopPropagation(),lt()};return d.jsxs("div",{className:tt.t(z.croppable,Q&&z.standalone),onClick:()=>{D&&lt()},"data-component":"croppable",children:[d.jsx("input",{accept:"image/*",onChange:Rt,ref:N,type:"file"}),d.jsx("div",{className:z.viewport,ref:_,onDragStart:t=>t.preventDefault(),onPointerDown:Mt,onPointerMove:Et,onPointerUp:at,onPointerCancel:at,onWheel:zt,style:{"--croppable-height":`${R??Wt}px`,"--croppable-zoom":A,"--croppable-x":`${k.offset.x}px`,"--croppable-y":`${k.offset.y}px`,...u?{"--croppable-image-width":`${Z.width}px`,"--croppable-image-height":`${Z.height}px`}:null},children:D?d.jsxs("div",{className:z.empty,children:[d.jsx(pt.Figure,{children:d.jsx(gt.Icon,{name:"image",size:"large"})}),d.jsx(mt.Button,{onClick:dt,children:a??xt})]}):d.jsxs("div",{className:tt.t(z.media,C&&z.draggable,C&&et&&z.dragging),children:[d.jsx("div",{className:tt.t(z.inner),children:ct}),rt&&d.jsx("div",{className:z.overlay,children:d.jsxs("div",{className:z.empty,children:[d.jsx(pt.Figure,{children:d.jsx(gt.Icon,{name:"image",size:"large"})}),d.jsx(mt.Button,{onClick:dt,children:a??xt})]})})]})})]})};exports.Croppable=Bt;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,26 +1,26 @@
1
- import { jsxs as J, jsx as w } from "react/jsx-runtime";
2
- import { t as rt } from "../../classix-DG18itHa.js";
3
- import { useRef as y, useState as S, useEffect as E } from "react";
4
- import { Button as wt } from "../button/index.js";
5
- import { Figure as yt } from "../figure/index.js";
6
- import { Icon as xt } from "../icon/index.js";
7
- import '../../assets/index21.css';const Pt = "_croppable_1ykk4_1", Yt = "_empty_1ykk4_14", Xt = "_media_1ykk4_22", At = "_overlay_1ykk4_33", Dt = "_viewport_1ykk4_41", Wt = "_draggable_1ykk4_53", Ht = "_dragging_1ykk4_57", St = "_inner_1ykk4_61", Zt = "_standalone_1ykk4_77", M = {
8
- croppable: Pt,
9
- empty: Yt,
10
- media: Xt,
11
- overlay: At,
12
- viewport: Dt,
13
- draggable: Wt,
14
- dragging: Ht,
15
- inner: St,
16
- standalone: Zt
17
- }, jt = 192, $ = {
1
+ import { jsxs as J, jsx as x } from "react/jsx-runtime";
2
+ import { t as nt } from "../../classix-DG18itHa.js";
3
+ import { useRef as w, useState as Z, useEffect as U } from "react";
4
+ import { Button as xt } from "../button/index.js";
5
+ import { Figure as wt } from "../figure/index.js";
6
+ import { Icon as yt } from "../icon/index.js";
7
+ import '../../assets/index21.css';const Yt = "_croppable_oxo39_1", Xt = "_empty_oxo39_14", At = "_media_oxo39_22", Dt = "_overlay_oxo39_33", Wt = "_viewport_oxo39_41", Ht = "_draggable_oxo39_53", St = "_dragging_oxo39_57", Zt = "_inner_oxo39_61", jt = "_standalone_oxo39_77", M = {
8
+ croppable: Yt,
9
+ empty: Xt,
10
+ media: At,
11
+ overlay: Dt,
12
+ viewport: Wt,
13
+ draggable: Ht,
14
+ dragging: St,
15
+ inner: Zt,
16
+ standalone: jt
17
+ }, kt = 192, $ = {
18
18
  offset: {
19
19
  x: 0,
20
20
  y: 0
21
21
  },
22
22
  zoom: 1
23
- }, bt = "Select image", I = 10, Z = 0.1, Bt = 0.92, d = (u, p, _) => Math.min(_, Math.max(p, u)), Nt = (u) => new Promise((p, _) => {
23
+ }, bt = "Select image", P = 10, j = 0.1, Bt = 0.92, d = (u, p, _) => Math.min(_, Math.max(p, u)), Nt = (u) => new Promise((p, _) => {
24
24
  const h = URL.createObjectURL(u), s = new globalThis.Image();
25
25
  s.onload = () => {
26
26
  URL.revokeObjectURL(h), p(s);
@@ -33,18 +33,18 @@ import '../../assets/index21.css';const Pt = "_croppable_1ykk4_1", Yt = "_empty_
33
33
  transform: _,
34
34
  viewport: h
35
35
  }) => {
36
- const s = await Nt(u), P = h.width / s.naturalWidth, k = h.height / s.naturalHeight, x = Math.max(P, k), j = s.naturalWidth * x, R = s.naturalHeight * x, C = p === "width" ? Math.max(Z, P / x) : p === "height" ? Math.max(Z, k / x) : Z, L = d(_.zoom, C, I), g = x * L, b = j * L, F = R * L, m = (h.width - b) / 2 + _.offset.x, T = (h.height - F) / 2 + _.offset.y, Y = d((0 - m) / g, 0, s.naturalWidth), v = d((0 - T) / g, 0, s.naturalHeight), U = d(h.width / g, 1, Math.max(1, s.naturalWidth - Y)), c = d(h.height / g, 1, Math.max(1, s.naturalHeight - v)), z = document.createElement("canvas"), a = z.getContext("2d");
36
+ const s = await Nt(u), Y = h.width / s.naturalWidth, R = h.height / s.naturalHeight, y = Math.max(Y, R), k = s.naturalWidth * y, L = s.naturalHeight * y, C = p === "width" ? Math.max(j, Y / y) : p === "height" ? Math.max(j, R / y) : j, T = d(_.zoom, C, P), g = y * T, b = k * T, F = L * T, m = (h.width - b) / 2 + _.offset.x, v = (h.height - F) / 2 + _.offset.y, X = d((0 - m) / g, 0, s.naturalWidth), E = d((0 - v) / g, 0, s.naturalHeight), O = d(h.width / g, 1, Math.max(1, s.naturalWidth - X)), c = d(h.height / g, 1, Math.max(1, s.naturalHeight - E)), z = document.createElement("canvas"), a = z.getContext("2d");
37
37
  if (!a)
38
38
  throw new Error("croppable-image-context-missing");
39
- z.width = Math.max(1, Math.round(U)), z.height = Math.max(1, Math.round(c)), a.drawImage(s, Y, v, U, c, 0, 0, z.width, z.height);
40
- const X = u.type.startsWith("image/") ? u.type : "image/jpeg", A = await new Promise((G) => {
41
- z.toBlob(G, X, Bt);
39
+ z.width = Math.max(1, Math.round(O)), z.height = Math.max(1, Math.round(c)), a.drawImage(s, X, E, O, c, 0, 0, z.width, z.height);
40
+ const A = u.type.startsWith("image/") ? u.type : "image/jpeg", D = await new Promise((G) => {
41
+ z.toBlob(G, A, Bt);
42
42
  });
43
- if (!A)
43
+ if (!D)
44
44
  throw new Error("croppable-image-export-failed");
45
- return new globalThis.File([A], u.name, {
45
+ return new globalThis.File([D], u.name, {
46
46
  lastModified: Date.now(),
47
- type: A.type || X
47
+ type: D.type || A
48
48
  });
49
49
  }, Ct = ({
50
50
  children: u,
@@ -52,267 +52,267 @@ import '../../assets/index21.css';const Pt = "_croppable_1ykk4_1", Yt = "_empty_
52
52
  height: _,
53
53
  image: h,
54
54
  label: s,
55
- onCroppableChange: P,
56
- onFileChange: k,
57
- onImageChange: x,
58
- onTransformChange: j,
59
- transform: R,
55
+ onCroppableChange: Y,
56
+ onFileChange: R,
57
+ onImageChange: y,
58
+ onTransformChange: k,
59
+ transform: L,
60
60
  standalone: C
61
61
  }) => {
62
- const L = y(null), g = y(null), b = y(null), F = y(null), m = y(x), T = y(null), Y = y(null), v = y(null), U = y(/* @__PURE__ */ new Map()), c = y($), z = y(null), [a, X] = S(null), [A, G] = S(null), [ot, tt] = S(!1), [zt, ct] = S($), [q, it] = S(null), [f, Mt] = S({
62
+ const T = w(null), g = w(null), b = w(null), F = w(null), m = w(y), v = w(null), X = w(null), E = w(null), O = w(/* @__PURE__ */ new Map()), c = w($), z = w(null), [a, A] = Z(null), [D, G] = Z(null), [rt, tt] = Z(!1), [zt, ct] = Z($), [q, it] = Z(null), [f, Mt] = Z({
63
63
  width: 0,
64
64
  height: 0
65
65
  }), B = (() => {
66
- const t = f.width, n = f.height;
67
- if (!t || !n) return {
66
+ const t = f.width, o = f.height;
67
+ if (!t || !o) return {
68
68
  width: 0,
69
69
  height: 0,
70
- minZoom: Z
70
+ minZoom: j
71
71
  };
72
72
  if (!a) return {
73
73
  width: t,
74
- height: n,
75
- minZoom: Z
74
+ height: o,
75
+ minZoom: j
76
76
  };
77
- const r = t / a.width, e = n / a.height, o = Math.max(r, e), i = p === "width" ? r / o : p === "height" ? e / o : 0;
77
+ const n = t / a.width, e = o / a.height, r = Math.max(n, e), i = p === "width" ? n / r : p === "height" ? e / r : 0;
78
78
  return {
79
- width: a.width * o,
80
- height: a.height * o,
81
- minZoom: Math.max(Z, i)
79
+ width: a.width * r,
80
+ height: a.height * r,
81
+ minZoom: Math.max(j, i)
82
82
  };
83
- })(), D = B.minZoom, N = R ?? zt, W = d(N.zoom, D, I), K = A ?? h ?? null, st = !u && !!h && !A && !q, Q = !st, at = u ?? (K ? /* @__PURE__ */ w("img", { alt: "", draggable: !1, onLoad: (t) => {
84
- const n = t.currentTarget;
85
- n.naturalWidth && n.naturalHeight && X({
86
- width: n.naturalWidth,
87
- height: n.naturalHeight
83
+ })(), W = B.minZoom, N = L ?? zt, H = d(N.zoom, W, P), K = D ?? h ?? null, st = !u && !!h && !D && !q, Q = !st, at = u ?? (K ? /* @__PURE__ */ x("img", { alt: "", draggable: !1, onLoad: (t) => {
84
+ const o = t.currentTarget;
85
+ o.naturalWidth && o.naturalHeight && A({
86
+ width: o.naturalWidth,
87
+ height: o.naturalHeight
88
88
  });
89
- }, src: K }) : null), H = at == null, et = (t, n) => {
89
+ }, src: K }) : null), S = at == null, et = (t, o) => {
90
90
  const {
91
- maxX: r,
91
+ maxX: n,
92
92
  maxY: e
93
- } = ut(n);
93
+ } = ut(o);
94
94
  return {
95
- x: d(t.x, -r, r),
95
+ x: d(t.x, -n, n),
96
96
  y: d(t.y, -e, e)
97
97
  };
98
- }, lt = (t, n) => {
99
- const r = z.current;
100
- if (!r) return null;
101
- const e = r.getBoundingClientRect(), o = t - e.left - e.width / 2, i = n - e.top - e.height / 2;
98
+ }, lt = (t, o) => {
99
+ const n = z.current;
100
+ if (!n) return null;
101
+ const e = n.getBoundingClientRect(), r = t - e.left - e.width / 2, i = o - e.top - e.height / 2;
102
102
  return {
103
- x: o,
103
+ x: r,
104
104
  y: i
105
105
  };
106
- }, _t = (t, n, r, e) => {
107
- const o = d(n, D, I), i = d(r, D, I);
108
- if (o === 0) return t;
109
- const l = i / o;
106
+ }, _t = (t, o, n, e) => {
107
+ const r = d(o, W, P), i = d(n, W, P);
108
+ if (r === 0) return t;
109
+ const l = i / r;
110
110
  return {
111
111
  x: (1 - l) * e.x + l * t.x,
112
112
  y: (1 - l) * e.y + l * t.y
113
113
  };
114
- }, kt = (t, n, r) => {
115
- const e = c.current.zoom, o = d(t, D, I), i = c.current.offset, l = r ? _t(i, e, o, r) : n, O = et(l, o);
114
+ }, Rt = (t, o, n) => {
115
+ const e = c.current.zoom, r = d(t, W, P), i = c.current.offset, l = n ? _t(i, e, r, n) : o, I = et(l, r);
116
116
  c.current = {
117
- zoom: o,
118
- offset: O
119
- }, R || ct({
120
- zoom: o,
121
- offset: O
122
- }), j == null || j({
123
- zoom: o,
124
- offset: O
117
+ zoom: r,
118
+ offset: I
119
+ }, L || ct({
120
+ zoom: r,
121
+ offset: I
122
+ }), k == null || k({
123
+ zoom: r,
124
+ offset: I
125
125
  });
126
- }, V = (t, n, r) => {
127
- Y.current = {
126
+ }, V = (t, o, n) => {
127
+ X.current = {
128
128
  zoom: t,
129
- offset: n,
130
- anchor: r ?? null
129
+ offset: o,
130
+ anchor: n ?? null
131
131
  }, g.current == null && (g.current = window.requestAnimationFrame(() => {
132
132
  g.current = null;
133
- const e = Y.current;
134
- Y.current = null;
135
- const o = (e == null ? void 0 : e.zoom) ?? c.current.zoom, i = (e == null ? void 0 : e.offset) ?? c.current.offset, l = (e == null ? void 0 : e.anchor) ?? null;
136
- kt(o, i, l);
133
+ const e = X.current;
134
+ X.current = null;
135
+ const r = (e == null ? void 0 : e.zoom) ?? c.current.zoom, i = (e == null ? void 0 : e.offset) ?? c.current.offset, l = (e == null ? void 0 : e.anchor) ?? null;
136
+ Rt(r, i, l);
137
137
  }));
138
- }, Rt = (t) => {
139
- if (H || !Q) return;
140
- const n = t.ctrlKey ? 1e-3 : 25e-5, r = c.current.zoom * Math.exp(-t.deltaY * n), e = lt(t.clientX, t.clientY);
141
- V(r, c.current.offset, e);
138
+ }, Lt = (t) => {
139
+ if (S || !Q) return;
140
+ const o = t.ctrlKey ? 1e-3 : 25e-5, n = c.current.zoom * Math.exp(-t.deltaY * o), e = lt(t.clientX, t.clientY);
141
+ V(n, c.current.offset, e);
142
142
  }, ut = (t) => {
143
- const n = f.width, r = f.height;
144
- if (!n || !r) return {
143
+ const o = f.width, n = f.height;
144
+ if (!o || !n) return {
145
145
  maxX: 0,
146
146
  maxY: 0
147
147
  };
148
- const e = d(t, D, I), o = B.width * e, i = B.height * e, l = Math.max(0, (o - n) / 2), O = Math.max(0, (i - r) / 2);
148
+ const e = d(t, W, P), r = B.width * e, i = B.height * e, l = Math.max(0, (r - o) / 2), I = Math.max(0, (i - n) / 2);
149
149
  return {
150
150
  maxX: l,
151
- maxY: O
151
+ maxY: I
152
152
  };
153
- }, Lt = (t) => {
154
- var o;
155
- const n = t.target, r = ((o = n.files) == null ? void 0 : o[0]) ?? null;
156
- if (T.current && (URL.revokeObjectURL(T.current), T.current = null), !r) {
157
- G(null), it(null), k == null || k(null), n.value = "";
153
+ }, Tt = (t) => {
154
+ var r;
155
+ const o = t.target, n = ((r = o.files) == null ? void 0 : r[0]) ?? null;
156
+ if (v.current && (URL.revokeObjectURL(v.current), v.current = null), !n) {
157
+ G(null), it(null), R == null || R(null), o.value = "";
158
158
  return;
159
159
  }
160
- const e = URL.createObjectURL(r);
161
- T.current = e, G(e), X(null), it(r), V($.zoom, $.offset), c.current = $, k == null || k(r), n.value = "";
162
- }, Tt = (t) => {
163
- if (!(H || !Q || t.pointerType === "mouse" && t.button !== 0)) {
160
+ const e = URL.createObjectURL(n);
161
+ v.current = e, G(e), A(null), it(n), V($.zoom, $.offset), c.current = $, R == null || R(n), o.value = "";
162
+ }, vt = (t) => {
163
+ if (!(S || !Q || t.pointerType === "mouse" && t.button !== 0)) {
164
164
  if (t.currentTarget.setPointerCapture(t.pointerId), t.pointerType === "touch") {
165
- const n = U.current;
166
- if (n.set(t.pointerId, {
165
+ const o = O.current;
166
+ if (o.set(t.pointerId, {
167
167
  x: t.clientX,
168
168
  y: t.clientY
169
- }), n.size === 2) {
170
- b.current = null, L.current = null, tt(!1);
171
- const [r, e] = Array.from(n.values());
172
- v.current = Math.hypot(r.x - e.x, r.y - e.y);
169
+ }), o.size === 2) {
170
+ b.current = null, T.current = null, tt(!1);
171
+ const [n, e] = Array.from(o.values());
172
+ E.current = Math.hypot(n.x - e.x, n.y - e.y);
173
173
  return;
174
174
  }
175
175
  }
176
- L.current = t.pointerId, b.current = {
176
+ T.current = t.pointerId, b.current = {
177
177
  x: t.clientX,
178
178
  y: t.clientY,
179
179
  originX: c.current.offset.x,
180
180
  originY: c.current.offset.y
181
181
  };
182
182
  }
183
- }, vt = (t) => {
184
- if (H || !Q) return;
183
+ }, Et = (t) => {
184
+ if (S || !Q) return;
185
185
  if (t.pointerType === "touch") {
186
- const o = U.current;
187
- if (!o.has(t.pointerId)) return;
188
- if (o.set(t.pointerId, {
186
+ const r = O.current;
187
+ if (!r.has(t.pointerId)) return;
188
+ if (r.set(t.pointerId, {
189
189
  x: t.clientX,
190
190
  y: t.clientY
191
- }), o.size === 2) {
192
- const [i, l] = Array.from(o.values()), O = i.x - l.x, Et = i.y - l.y, pt = Math.hypot(O, Et), gt = {
191
+ }), r.size === 2) {
192
+ const [i, l] = Array.from(r.values()), I = i.x - l.x, Ut = i.y - l.y, pt = Math.hypot(I, Ut), gt = {
193
193
  x: (i.x + l.x) / 2,
194
194
  y: (i.y + l.y) / 2
195
195
  };
196
- if (v.current) {
197
- const Ut = pt / v.current, Ot = c.current.zoom * Ut, It = lt(gt.x, gt.y);
198
- V(Ot, c.current.offset, It);
196
+ if (E.current) {
197
+ const Ot = pt / E.current, It = c.current.zoom * Ot, Pt = lt(gt.x, gt.y);
198
+ V(It, c.current.offset, Pt);
199
199
  }
200
- v.current = pt;
200
+ E.current = pt;
201
201
  return;
202
202
  }
203
203
  }
204
- if (L.current !== t.pointerId || !b.current || !nt) return;
205
- const n = t.clientX - b.current.x, r = t.clientY - b.current.y, e = Math.abs(n) + Math.abs(r);
206
- !ot && e > 2 && tt(!0), !(e <= 1) && V(c.current.zoom, {
207
- x: b.current.originX + n,
208
- y: b.current.originY + r
204
+ if (T.current !== t.pointerId || !b.current || !ot) return;
205
+ const o = t.clientX - b.current.x, n = t.clientY - b.current.y, e = Math.abs(o) + Math.abs(n);
206
+ !rt && e > 2 && tt(!0), !(e <= 1) && V(c.current.zoom, {
207
+ x: b.current.originX + o,
208
+ y: b.current.originY + n
209
209
  });
210
210
  }, ht = (t) => {
211
- t.pointerType === "touch" && (U.current.delete(t.pointerId), U.current.size < 2 && (v.current = null)), L.current === t.pointerId && (L.current = null, b.current = null, tt(!1));
211
+ t.pointerType === "touch" && (O.current.delete(t.pointerId), O.current.size < 2 && (E.current = null)), T.current === t.pointerId && (T.current = null, b.current = null, tt(!1));
212
212
  };
213
- E(() => {
214
- if (!R) return;
215
- const t = d(R.zoom, D, I);
213
+ U(() => {
214
+ if (!L) return;
215
+ const t = d(L.zoom, W, P);
216
216
  c.current = {
217
217
  zoom: t,
218
- offset: et(R.offset, t)
218
+ offset: et(L.offset, t)
219
219
  };
220
- }, [R, f.width, f.height, a == null ? void 0 : a.width, a == null ? void 0 : a.height]), E(() => () => {
221
- T.current && URL.revokeObjectURL(T.current);
222
- }, []), E(() => {
220
+ }, [L, f.width, f.height, a == null ? void 0 : a.width, a == null ? void 0 : a.height]), U(() => () => {
221
+ v.current && URL.revokeObjectURL(v.current);
222
+ }, []), U(() => {
223
223
  const t = z.current;
224
224
  if (!t) return;
225
- const n = () => {
226
- const o = t.getBoundingClientRect();
227
- Mt((i) => i.width === o.width && i.height === o.height ? i : {
228
- width: o.width,
229
- height: o.height
230
- }), P && P(o);
225
+ const o = () => {
226
+ const r = t.getBoundingClientRect();
227
+ Mt((i) => i.width === r.width && i.height === r.height ? i : {
228
+ width: r.width,
229
+ height: r.height
230
+ }), Y && Y(r);
231
231
  };
232
- n();
233
- const r = () => n();
234
- if (window.addEventListener("scroll", r, !0), typeof ResizeObserver > "u") {
235
- const o = () => n();
236
- return window.addEventListener("resize", o), () => {
237
- window.removeEventListener("resize", o), window.removeEventListener("scroll", r, !0);
232
+ o();
233
+ const n = () => o();
234
+ if (window.addEventListener("scroll", n, !0), typeof ResizeObserver > "u") {
235
+ const r = () => o();
236
+ return window.addEventListener("resize", r), () => {
237
+ window.removeEventListener("resize", r), window.removeEventListener("scroll", n, !0);
238
238
  };
239
239
  }
240
- const e = new ResizeObserver(() => n());
240
+ const e = new ResizeObserver(() => o());
241
241
  return e.observe(t), () => {
242
- e.disconnect(), window.removeEventListener("scroll", r, !0);
242
+ e.disconnect(), window.removeEventListener("scroll", n, !0);
243
243
  };
244
- }, [P]), E(() => {
245
- if (R) return;
246
- const t = c.current.offset, n = et(t, W);
247
- t.x === n.x && t.y === n.y || (c.current = {
244
+ }, [Y]), U(() => {
245
+ if (L) return;
246
+ const t = c.current.offset, o = et(t, H);
247
+ t.x === o.x && t.y === o.y || (c.current = {
248
248
  zoom: c.current.zoom,
249
- offset: n
250
- }, ct((r) => ({
251
- ...r,
252
- offset: n
249
+ offset: o
250
+ }, ct((n) => ({
251
+ ...n,
252
+ offset: o
253
253
  })));
254
- }, [W, a, f.width, f.height]), E(() => {
255
- K || X(null);
256
- }, [K]), E(() => {
257
- m.current = x;
258
- }, [x]), E(() => {
259
- var r;
260
- if (!x) return;
254
+ }, [H, a, f.width, f.height]), U(() => {
255
+ K || A(null);
256
+ }, [K]), U(() => {
257
+ m.current = y;
258
+ }, [y]), U(() => {
259
+ var n;
260
+ if (!y) return;
261
261
  if (!q || !f.width || !f.height || u) {
262
- (r = m.current) == null || r.call(m, null);
262
+ (n = m.current) == null || n.call(m, null);
263
263
  return;
264
264
  }
265
265
  let t = !0;
266
- const n = window.setTimeout(() => {
266
+ const o = window.setTimeout(() => {
267
267
  $t({
268
268
  file: q,
269
269
  fill: p,
270
270
  transform: {
271
- zoom: W,
271
+ zoom: H,
272
272
  offset: N.offset
273
273
  },
274
274
  viewport: f
275
275
  }).then((e) => {
276
- var o;
277
- t && ((o = m.current) == null || o.call(m, e));
276
+ var r;
277
+ t && ((r = m.current) == null || r.call(m, e));
278
278
  }).catch(() => {
279
279
  var e;
280
280
  t && ((e = m.current) == null || e.call(m, null));
281
281
  });
282
282
  }, 75);
283
283
  return () => {
284
- t = !1, window.clearTimeout(n);
284
+ t = !1, window.clearTimeout(o);
285
285
  };
286
- }, [u, W, N.offset, p, q, f]), E(() => () => {
286
+ }, [u, H, N.offset, p, q, f]), U(() => () => {
287
287
  g.current != null && (window.cancelAnimationFrame(g.current), g.current = null);
288
288
  }, []);
289
- const dt = ut(W), nt = !H && Q && (dt.maxX > 0 || dt.maxY > 0), mt = () => {
289
+ const dt = ut(H), ot = !S && Q && (dt.maxX > 0 || dt.maxY > 0), mt = () => {
290
290
  var t;
291
291
  return (t = F.current) == null ? void 0 : t.click();
292
292
  }, ft = (t) => {
293
293
  t.preventDefault(), t.stopPropagation(), mt();
294
294
  };
295
- return /* @__PURE__ */ J("div", { className: rt(M.croppable, C && M.standalone), onClick: () => {
296
- H && mt();
295
+ return /* @__PURE__ */ J("div", { className: nt(M.croppable, C && M.standalone), onClick: () => {
296
+ S && mt();
297
297
  }, "data-component": "croppable", children: [
298
- /* @__PURE__ */ w("input", { accept: "image/*", onChange: Lt, ref: F, type: "file" }),
299
- /* @__PURE__ */ w("div", { className: M.viewport, ref: z, onDragStart: (t) => t.preventDefault(), onPointerDown: Tt, onPointerMove: vt, onPointerUp: ht, onPointerCancel: ht, onWheel: Rt, style: {
300
- "--croppable-height": `${_ ?? jt}px`,
301
- "--croppable-zoom": W,
298
+ /* @__PURE__ */ x("input", { accept: "image/*", onChange: Tt, ref: F, type: "file" }),
299
+ /* @__PURE__ */ x("div", { className: M.viewport, ref: z, onDragStart: (t) => t.preventDefault(), onPointerDown: vt, onPointerMove: Et, onPointerUp: ht, onPointerCancel: ht, onWheel: Lt, style: {
300
+ "--croppable-height": `${_ ?? kt}px`,
301
+ "--croppable-zoom": H,
302
302
  "--croppable-x": `${N.offset.x}px`,
303
303
  "--croppable-y": `${N.offset.y}px`,
304
304
  ...a ? {
305
305
  "--croppable-image-width": `${B.width}px`,
306
306
  "--croppable-image-height": `${B.height}px`
307
307
  } : null
308
- }, children: H ? /* @__PURE__ */ J("div", { className: M.empty, children: [
309
- /* @__PURE__ */ w(yt, { children: /* @__PURE__ */ w(xt, { name: "image", size: "large" }) }),
310
- /* @__PURE__ */ w(wt, { onClick: ft, children: s ?? bt })
311
- ] }) : /* @__PURE__ */ J("div", { className: rt(M.media, nt && M.draggable, nt && ot && M.dragging), children: [
312
- /* @__PURE__ */ w("div", { className: rt(M.inner), children: at }),
313
- st && /* @__PURE__ */ w("div", { className: M.overlay, children: /* @__PURE__ */ J("div", { className: M.empty, children: [
314
- /* @__PURE__ */ w(yt, { children: /* @__PURE__ */ w(xt, { name: "image", size: "large" }) }),
315
- /* @__PURE__ */ w(wt, { onClick: ft, children: s ?? bt })
308
+ }, children: S ? /* @__PURE__ */ J("div", { className: M.empty, children: [
309
+ /* @__PURE__ */ x(wt, { children: /* @__PURE__ */ x(yt, { name: "image", size: "large" }) }),
310
+ /* @__PURE__ */ x(xt, { onClick: ft, children: s ?? bt })
311
+ ] }) : /* @__PURE__ */ J("div", { className: nt(M.media, ot && M.draggable, ot && rt && M.dragging), children: [
312
+ /* @__PURE__ */ x("div", { className: nt(M.inner), children: at }),
313
+ st && /* @__PURE__ */ x("div", { className: M.overlay, children: /* @__PURE__ */ J("div", { className: M.empty, children: [
314
+ /* @__PURE__ */ x(wt, { children: /* @__PURE__ */ x(yt, { name: "image", size: "large" }) }),
315
+ /* @__PURE__ */ x(xt, { onClick: ft, children: s ?? bt })
316
316
  ] }) })
317
317
  ] }) })
318
318
  ] });
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index22.css');const i=require("react/jsx-runtime"),E=require("../../classix-5H4IWnMA.cjs"),o=require("react"),W=require("../button/index.cjs"),U=require("../../icons-C_cX1FYp.cjs"),X=require("../input/index.cjs"),Y=require("../../styles.module-Vt6mmlsz.cjs"),Z=require("../list/index.cjs"),k=require("../../index-BpUboRfJ.cjs"),M=require("../../utils-DBzf7CFq.cjs"),ee="_dropdown_ruf4w_1",te="_empty_ruf4w_4",ne="_group_ruf4w_5",re="_placeholder_ruf4w_6",se="_filter_ruf4w_14",oe="_native_ruf4w_25",le="_option_ruf4w_35",ie="_options_ruf4w_57",ce="_panel_ruf4w_81",ae="_selected_ruf4w_102",ue="_text_ruf4w_106",pe="_trigger_ruf4w_114",de="_minimal_ruf4w_130",c={dropdown:ee,empty:te,group:ne,placeholder:re,filter:se,native:oe,option:le,options:ie,panel:ce,selected:ae,text:ue,trigger:pe,minimal:de};function Q(e,r){return{"--icon-svg":U.iconSVG(e).replace("currentColor",r)}}function N(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(N).join(" "):o.isValidElement(e)?N(e.props.children):""}function fe(e){return o.isValidElement(e)&&e.type==="option"}function me(e){return o.isValidElement(e)&&e.type==="optgroup"}function he(e){return o.isValidElement(e)&&e.type===o.Fragment}function _e(e){return o.isValidElement(e)&&e.type===k.Select}function V(e,r,s=!1){const l=[];return o.Children.forEach(e,t=>{if(he(t)){l.push(...V(t.props.children,r,s));return}if(fe(t)){const p=N(t.props.children).trim(),d=t.props.value!=null?String(t.props.value):p;l.push({disabled:s||!!t.props.disabled,groupLabel:r,hidden:!!t.props.hidden,isPlaceholder:!!(t.props.hidden&&d===""),label:t.props.children,selected:!!t.props.selected,text:p,value:d});return}me(t)&&l.push(...V(t.props.children,t.props.label,s||!!t.props.disabled))}),l}function ge(e){const r=e.trim();if(!r)return null;const l=[.../[*?]/.test(r)?r:`*${r}*`].map(t=>t==="*"?".*":t==="?"?".":t.replace(/[|\\{}()[\]^$+.,]/g,"\\$&")).join("");return new RegExp(`^${l}$`,"i")}function we(e,r){const s=ge(r),l=e.filter(t=>!t.hidden&&!t.isPlaceholder);return s?l.filter(t=>s.test([t.groupLabel,t.text,t.value].filter(Boolean).join(" "))):l}function ve(e,r){return e.find(s=>s.value===r)??e.find(s=>s.isPlaceholder)??e[0]}function xe(e,r,s){var t;if(r!=null)return String(r);if(s!=null)return String(s);const l=e.find(p=>p.selected);return l?l.value:((t=e[0])==null?void 0:t.value)??""}function ye(e){if(_e(e)){const{children:r,placeholder:s,...l}=e.props;return{children:i.jsxs(i.Fragment,{children:[s&&i.jsx("option",{hidden:!0,value:"",children:s}),r]}),props:l}}return{children:e.props.children,props:e.props}}const be=({children:e,className:r,emptyLabel:s="No matches found",searchPlaceholder:l="Filter",variant:t="default",...p})=>{const d=ye(e),{defaultValue:z,onChange:g,value:w,...T}=d.props,q=k.sanitizeSelectProps(T),C=o.useRef(null),R=o.useRef(null),O=o.useRef(null),P=o.useRef(null),h=V(d.children),_=w!=null,v=xe(h,w,z),[x,y]=o.useState(()=>v),[u,b]=o.useState(!1),[B,$]=o.useState(""),S=_?String(w):x,I={default:M.resolveColor("--color-icon"),white:M.resolveColor("--color-white","white")},L=t==="minimal"?I.white:I.default,f=ve(h,S),A=Q("chevron",L),G=Q("search",L),D=we(h,B);o.useEffect(()=>{!_&&!h.some(n=>n.value===x)&&y(v)},[v,x,_,h]),o.useEffect(()=>{var n;if(!u){$("");return}(n=P.current)==null||n.focus()},[u]),o.useEffect(()=>{if(!u)return;const n=a=>{var m;(m=R.current)!=null&&m.contains(a.target)||b(!1)};return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[u]);const K=n=>{_||y(n.target.value),g==null||g(n)},j=()=>{var n;b(!1),(n=C.current)==null||n.focus()},H=n=>{var F;_||y(n);const a=O.current;if(!a){j();return}const m=(F=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value"))==null?void 0:F.set;m==null||m.call(a,n),a.dispatchEvent(new Event("change",{bubbles:!0})),j()},J=n=>{n.key==="Escape"&&j()};return i.jsxs("div",{className:E.t(c.dropdown,t==="minimal"&&c.minimal,r),onKeyDown:J,ref:R,...p,"data-component":"dropdown",children:[i.jsx("select",{...q,"aria-hidden":"true",className:c.native,onChange:K,ref:O,tabIndex:-1,value:S,children:d.children}),i.jsx(W.Button,{"aria-expanded":u,"aria-haspopup":"dialog",className:E.t(t==="default"&&Y.inputStyles.input,c.trigger,(f==null?void 0:f.isPlaceholder)&&c.placeholder),"data-open":u?"true":void 0,disabled:q.disabled,onClick:()=>b(n=>!n),ref:C,style:A,variant:"minimal",children:i.jsx("span",{className:c.text,children:(f==null?void 0:f.label)??"Select an option"})}),u&&i.jsxs("div",{className:c.panel,children:[i.jsx(X.Input,{"aria-label":"Filter",className:c.filter,icon:"search",onChange:n=>$(n.target.value),placeholder:l,ref:P,style:G,type:"search",value:B}),i.jsx(Z.List,{"aria-label":"Dropdown",className:c.options,children:D.length>0?D.map(n=>{const a=n.value===S;return i.jsx("li",{"data-component":"dropdown",children:i.jsxs(W.Button,{"aria-label":a?`${n.text}, selected`:n.text,className:E.t(c.option,a&&c.selected),disabled:n.disabled,onClick:()=>H(n.value),variant:"minimal",children:[i.jsx("span",{className:c.text,children:n.label}),n.groupLabel&&i.jsx("small",{className:c.group,children:n.groupLabel})]})},`${n.groupLabel??"root"}-${n.value}`)}):i.jsx("li",{className:c.empty,children:s})})]})]})};exports.Dropdown=be;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index22.css');const i=require("react/jsx-runtime"),E=require("../../classix-5H4IWnMA.cjs"),o=require("react"),W=require("../button/index.cjs"),U=require("../../icons-C_cX1FYp.cjs"),X=require("../input/index.cjs"),Y=require("../../styles.module-BPvMQa_x.cjs"),Z=require("../list/index.cjs"),k=require("../../index-ClrKYsAQ.cjs"),M=require("../../utils-DBzf7CFq.cjs"),ee="_dropdown_1dsxx_1",te="_empty_1dsxx_4",ne="_group_1dsxx_5",re="_placeholder_1dsxx_6",se="_filter_1dsxx_14",oe="_native_1dsxx_25",le="_option_1dsxx_35",ie="_options_1dsxx_57",ce="_panel_1dsxx_81",ae="_selected_1dsxx_104",ue="_text_1dsxx_108",de="_trigger_1dsxx_117",pe="_minimal_1dsxx_133",c={dropdown:ee,empty:te,group:ne,placeholder:re,filter:se,native:oe,option:le,options:ie,panel:ce,selected:ae,text:ue,trigger:de,minimal:pe};function Q(e,r){return{"--icon-svg":U.iconSVG(e).replace("currentColor",r)}}function N(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(N).join(" "):o.isValidElement(e)?N(e.props.children):""}function fe(e){return o.isValidElement(e)&&e.type==="option"}function me(e){return o.isValidElement(e)&&e.type==="optgroup"}function xe(e){return o.isValidElement(e)&&e.type===o.Fragment}function he(e){return o.isValidElement(e)&&e.type===k.Select}function V(e,r,s=!1){const l=[];return o.Children.forEach(e,t=>{if(xe(t)){l.push(...V(t.props.children,r,s));return}if(fe(t)){const d=N(t.props.children).trim(),p=t.props.value!=null?String(t.props.value):d;l.push({disabled:s||!!t.props.disabled,groupLabel:r,hidden:!!t.props.hidden,isPlaceholder:!!(t.props.hidden&&p===""),label:t.props.children,selected:!!t.props.selected,text:d,value:p});return}me(t)&&l.push(...V(t.props.children,t.props.label,s||!!t.props.disabled))}),l}function _e(e){const r=e.trim();if(!r)return null;const l=[.../[*?]/.test(r)?r:`*${r}*`].map(t=>t==="*"?".*":t==="?"?".":t.replace(/[|\\{}()[\]^$+.,]/g,"\\$&")).join("");return new RegExp(`^${l}$`,"i")}function ge(e,r){const s=_e(r),l=e.filter(t=>!t.hidden&&!t.isPlaceholder);return s?l.filter(t=>s.test([t.groupLabel,t.text,t.value].filter(Boolean).join(" "))):l}function ve(e,r){return e.find(s=>s.value===r)??e.find(s=>s.isPlaceholder)??e[0]}function ye(e,r,s){var t;if(r!=null)return String(r);if(s!=null)return String(s);const l=e.find(d=>d.selected);return l?l.value:((t=e[0])==null?void 0:t.value)??""}function be(e){if(he(e)){const{children:r,placeholder:s,...l}=e.props;return{children:i.jsxs(i.Fragment,{children:[s&&i.jsx("option",{hidden:!0,value:"",children:s}),r]}),props:l}}return{children:e.props.children,props:e.props}}const we=({children:e,className:r,emptyLabel:s="No matches found",searchPlaceholder:l="Filter",variant:t="default",...d})=>{const p=be(e),{defaultValue:z,onChange:_,value:g,...T}=p.props,q=k.sanitizeSelectProps(T),C=o.useRef(null),R=o.useRef(null),O=o.useRef(null),P=o.useRef(null),x=V(p.children),h=g!=null,v=ye(x,g,z),[y,b]=o.useState(()=>v),[u,w]=o.useState(!1),[B,$]=o.useState(""),S=h?String(g):y,I={default:M.resolveColor("--colors-semantic-content-secondary"),white:M.resolveColor("--color-white","white")},L=t==="minimal"?I.white:I.default,f=ve(x,S),A=Q("chevron",L),G=Q("search",L),D=ge(x,B);o.useEffect(()=>{!h&&!x.some(n=>n.value===y)&&b(v)},[v,y,h,x]),o.useEffect(()=>{var n;if(!u){$("");return}(n=P.current)==null||n.focus()},[u]),o.useEffect(()=>{if(!u)return;const n=a=>{var m;(m=R.current)!=null&&m.contains(a.target)||w(!1)};return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[u]);const K=n=>{h||b(n.target.value),_==null||_(n)},j=()=>{var n;w(!1),(n=C.current)==null||n.focus()},H=n=>{var F;h||b(n);const a=O.current;if(!a){j();return}const m=(F=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value"))==null?void 0:F.set;m==null||m.call(a,n),a.dispatchEvent(new Event("change",{bubbles:!0})),j()},J=n=>{n.key==="Escape"&&j()};return i.jsxs("div",{className:E.t(c.dropdown,t==="minimal"&&c.minimal,r),onKeyDown:J,ref:R,...d,"data-component":"dropdown",children:[i.jsx("select",{...q,"aria-hidden":"true",className:c.native,onChange:K,ref:O,tabIndex:-1,value:S,children:p.children}),i.jsx(W.Button,{"aria-expanded":u,"aria-haspopup":"dialog",className:E.t(t==="default"&&Y.inputStyles.input,c.trigger,(f==null?void 0:f.isPlaceholder)&&c.placeholder),"data-open":u?"true":void 0,disabled:q.disabled,onClick:()=>w(n=>!n),ref:C,style:A,variant:"minimal",children:i.jsx("span",{className:c.text,children:(f==null?void 0:f.label)??"Select an option"})}),u&&i.jsxs("div",{className:c.panel,children:[i.jsx(X.Input,{"aria-label":"Filter",className:c.filter,icon:"search",onChange:n=>$(n.target.value),placeholder:l,ref:P,style:G,type:"search",value:B}),i.jsx(Z.List,{"aria-label":"Dropdown",className:c.options,children:D.length>0?D.map(n=>{const a=n.value===S;return i.jsx("li",{"data-component":"dropdown",children:i.jsxs(W.Button,{"aria-label":a?`${n.text}, selected`:n.text,className:E.t(c.option,a&&c.selected),disabled:n.disabled,onClick:()=>H(n.value),variant:"minimal",children:[i.jsx("span",{className:c.text,children:n.label}),n.groupLabel&&i.jsx("small",{className:c.group,children:n.groupLabel})]})},`${n.groupLabel??"root"}-${n.value}`)}):i.jsx("li",{className:c.empty,children:s})})]})]})};exports.Dropdown=we;
2
2
  //# sourceMappingURL=index.cjs.map