@solibo/solibo-ui 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index14.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index19.css +1 -1
- package/dist/assets/index20.css +1 -1
- package/dist/assets/index21.css +1 -1
- package/dist/assets/index22.css +1 -1
- package/dist/assets/index23.css +1 -1
- package/dist/assets/index24.css +1 -1
- package/dist/assets/index25.css +1 -1
- package/dist/assets/index26.css +1 -1
- package/dist/assets/index27.css +1 -1
- package/dist/assets/index28.css +1 -1
- package/dist/assets/index29.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index31.css +1 -1
- package/dist/assets/index32.css +1 -1
- package/dist/assets/index33.css +1 -1
- package/dist/assets/index34.css +1 -1
- package/dist/assets/index35.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/assets/index37.css +1 -1
- package/dist/assets/index38.css +1 -1
- package/dist/assets/index40.css +1 -1
- package/dist/assets/index44.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/assets/styles.css +1 -1
- package/dist/components/_avatar/index.cjs +1 -1
- package/dist/components/_avatar/index.js +1 -1
- package/dist/components/_card/index.cjs +1 -1
- package/dist/components/_card/index.cjs.map +1 -1
- package/dist/components/_card/index.js +40 -17
- package/dist/components/_card/index.js.map +1 -1
- package/dist/components/_collapsible/index.cjs +1 -1
- package/dist/components/_collapsible/index.js +2 -2
- package/dist/components/_croppable/index.cjs +1 -1
- package/dist/components/_croppable/index.js +123 -123
- package/dist/components/_dropdown/index.cjs +1 -1
- package/dist/components/_dropdown/index.js +4 -4
- package/dist/components/_dropzone/index.cjs +1 -1
- package/dist/components/_dropzone/index.js +1 -1
- package/dist/components/_editor/index.cjs +1 -1
- package/dist/components/_editor/index.js +1 -1
- package/dist/components/_messages/index.cjs +1 -1
- package/dist/components/_messages/index.js +1 -1
- package/dist/components/_portal/index.cjs +1 -1
- package/dist/components/_portal/index.js +1 -1
- package/dist/components/_sortable/index.cjs +1 -1
- package/dist/components/_sortable/index.cjs.map +1 -1
- package/dist/components/_sortable/index.js +55 -61
- package/dist/components/_sortable/index.js.map +1 -1
- package/dist/components/_toasts/index.cjs +1 -1
- package/dist/components/_toasts/index.js +1 -1
- package/dist/components/_widget/index.cjs +1 -1
- package/dist/components/_widget/index.js +1 -1
- package/dist/components/accordion/index.cjs +1 -1
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/app-link/index.cjs +1 -1
- package/dist/components/app-link/index.js +1 -1
- package/dist/components/aside/index.cjs +1 -1
- package/dist/components/aside/index.js +1 -1
- package/dist/components/badge/index.cjs +1 -1
- package/dist/components/badge/index.js +15 -15
- package/dist/components/banner/index.cjs +1 -1
- package/dist/components/banner/index.js +1 -1
- package/dist/components/branding/index.cjs +1 -1
- package/dist/components/branding/index.js +1 -1
- package/dist/components/button/index.cjs +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +4 -4
- package/dist/components/figure/index.cjs +1 -1
- package/dist/components/figure/index.js +2 -2
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.js +1 -1
- package/dist/components/header/index.cjs +1 -1
- package/dist/components/header/index.js +4 -4
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.js +2 -2
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +2 -2
- package/dist/components/link/index.cjs +1 -1
- package/dist/components/link/index.js +1 -1
- package/dist/components/list/index.cjs +1 -1
- package/dist/components/list/index.js +1 -1
- package/dist/components/loading/index.cjs +1 -1
- package/dist/components/loading/index.js +1 -1
- package/dist/components/nav/index.cjs +1 -1
- package/dist/components/nav/index.js +15 -15
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +2 -2
- package/dist/components/textarea/index.cjs +1 -1
- package/dist/components/textarea/index.js +1 -1
- package/dist/components/toolbar/index.cjs +1 -1
- package/dist/components/toolbar/index.js +6 -6
- package/dist/{icons-DfmpRbxE.js → icons-DkF2p6NO.js} +9 -5
- package/dist/{icons-DfmpRbxE.js.map → icons-DkF2p6NO.js.map} +1 -1
- package/dist/{icons-C_cX1FYp.cjs → icons-vqS7W0cD.cjs} +2 -2
- package/dist/{icons-C_cX1FYp.cjs.map → icons-vqS7W0cD.cjs.map} +1 -1
- package/dist/{index-ClrKYsAQ.cjs → index-908yg65J.cjs} +2 -2
- package/dist/{index-ClrKYsAQ.cjs.map → index-908yg65J.cjs.map} +1 -1
- package/dist/{index-CiEbbnD6.js → index-BGqIgxnV.js} +2 -2
- package/dist/{index-CiEbbnD6.js.map → index-BGqIgxnV.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +36 -14
- package/dist/index.js +1 -1
- package/dist/styles.module-BUYR37kC.js +9 -0
- package/dist/styles.module-BUYR37kC.js.map +1 -0
- package/dist/styles.module-DvIhipVo.cjs +2 -0
- package/dist/styles.module-DvIhipVo.cjs.map +1 -0
- package/dist/tokens.css +14 -7
- package/dist/tokens.json +111 -32
- package/package.json +1 -1
- package/dist/styles.module-BOTEBJ0C.js +0 -9
- package/dist/styles.module-BOTEBJ0C.js.map +0 -1
- package/dist/styles.module-BPvMQa_x.cjs +0 -2
- package/dist/styles.module-BPvMQa_x.cjs.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index18.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_1yvyu_1",St="_empty_1yvyu_14",Ut="_media_1yvyu_22",It="_overlay_1yvyu_33",Pt="_viewport_1yvyu_41",Yt="_draggable_1yvyu_53",Xt="_dragging_1yvyu_57",At="_inner_1yvyu_61",Dt="_standalone_1yvyu_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),u=new globalThis.Image;u.onload=()=>{URL.revokeObjectURL(f),x(u)},u.onerror=()=>{URL.revokeObjectURL(f),R(new Error("croppable-image-load-failed"))},u.src=f}),kt=async({file:h,fill:x,transform:R,viewport:f})=>{const u=await Zt(h),U=f.width/u.naturalWidth,M=f.height/u.naturalHeight,w=Math.max(U,M),H=u.naturalWidth*w,v=u.naturalHeight*w,Q=x==="width"?Math.max(W,U/w):x==="height"?Math.max(W,M/w):W,E=m(R.zoom,Q,S),y=w*E,b=H*E,N=v*E,p=(f.width-b)/2+R.offset.x,j=(f.height-N)/2+R.offset.y,I=m((0-p)/y,0,u.naturalWidth),L=m((0-j)/y,0,u.naturalHeight),T=m(f.width/y,1,Math.max(1,u.naturalWidth-I)),s=m(f.height/y,1,Math.max(1,u.naturalHeight-L)),_=document.createElement("canvas"),a=_.getContext("2d");if(!a)throw new Error("croppable-image-context-missing");_.width=Math.max(1,Math.round(T)),_.height=Math.max(1,Math.round(s)),a.drawImage(u,I,L,T,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:u,onCroppableChange:U,onFileChange:M,onImageChange:w,onTransformChange:H,transform:v,standalone:Q})=>{const E=c.useRef(null),y=c.useRef(null),b=c.useRef(null),N=c.useRef(null),p=c.useRef(w),j=c.useRef(null),I=c.useRef(null),L=c.useRef(null),T=c.useRef(new Map),s=c.useRef(B),_=c.useRef(null),[a,P]=c.useState(null),[Y,q]=c.useState(null),[et,V]=c.useState(!1),[yt,nt]=c.useState(B),[F,rt]=c.useState(null),[g,wt]=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(!a)return{width:t,height:n,minZoom:W};const r=t/a.width,e=n/a.height,o=Math.max(r,e),i=x==="width"?r/o:x==="height"?e/o:0;return{width:a.width*o,height:a.height*o,minZoom:Math.max(W,i)}})(),X=Z.minZoom,k=v??yt,A=m(k.zoom,X,S),$=Y??f??null,ot=!h&&!!f&&!Y&&!F,G=!ot,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: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,X,S),i=m(r,X,S);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,X,S),i=s.current.offset,l=r?bt(i,e,o,r):n,O=J(l,o);s.current={zoom:o,offset:O},v||nt({zoom:o,offset:O}),H==null||H({zoom:o,offset:O})},K=(t,n,r)=>{I.current={zoom:t,offset:n,anchor:r??null},y.current==null&&(y.current=window.requestAnimationFrame(()=>{y.current=null;const e=I.current;I.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(D||!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,X,S),o=Z.width*e,i=Z.height*e,l=Math.max(0,(o-n)/2),O=Math.max(0,(i-r)/2);return{maxX:l,maxY:O}},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),P(null),rt(r),K(B.zoom,B.offset),s.current=B,M==null||M(r),n.value=""},Mt=t=>{if(!(D||!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}}},vt=t=>{if(D||!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()),O=i.x-l.x,Et=i.y-l.y,ht=Math.hypot(O,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})},ut=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(!v)return;const t=m(v.zoom,X,S);s.current={zoom:t,offset:J(v.offset,t)}},[v,g.width,g.height,a==null?void 0:a.width,a==null?void 0:a.height]),c.useEffect(()=>()=>{j.current&&URL.revokeObjectURL(j.current)},[]),c.useEffect(()=>{const t=_.current;if(!t)return;const n=()=>{const o=t.getBoundingClientRect();wt(i=>i.width===o.width&&i.height===o.height?i:{width:o.width,height:o.height}),U&&U(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)}},[U]),c.useEffect(()=>{if(v)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(r=>({...r,offset:n})))},[A,a,g.width,g.height]),c.useEffect(()=>{$||P(null)},[$]),c.useEffect(()=>{p.current=w},[w]),c.useEffect(()=>{var r;if(!w)return;if(!F||!g.width||!g.height||h){(r=p.current)==null||r.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 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,A,k.offset,x,F,g]),c.useEffect(()=>()=>{y.current!=null&&(window.cancelAnimationFrame(y.current),y.current=null)},[]);const at=it(A),C=!D&&G&&(at.maxX>0||at.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&<()},"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:vt,onPointerUp:ut,onPointerCancel:ut,onWheel:zt,style:{"--croppable-height":`${R??Wt}px`,"--croppable-zoom":A,"--croppable-x":`${k.offset.x}px`,"--croppable-y":`${k.offset.y}px`,...a?{"--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:u??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:u??xt})]})})]})})]})};exports.Croppable=Bt;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as J, jsx as
|
|
2
|
-
import { t as
|
|
1
|
+
import { jsxs as J, jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import { t as rt } from "../../classix-DG18itHa.js";
|
|
3
3
|
import { useRef as w, useState as Z, useEffect as U } from "react";
|
|
4
|
-
import { Button as
|
|
4
|
+
import { Button as yt } from "../button/index.js";
|
|
5
5
|
import { Figure as wt } from "../figure/index.js";
|
|
6
|
-
import { Icon as
|
|
7
|
-
import '../../assets/
|
|
6
|
+
import { Icon as xt } from "../icon/index.js";
|
|
7
|
+
import '../../assets/index18.css';const Yt = "_croppable_1yvyu_1", Xt = "_empty_1yvyu_14", At = "_media_1yvyu_22", Dt = "_overlay_1yvyu_33", Wt = "_viewport_1yvyu_41", Ht = "_draggable_1yvyu_53", St = "_dragging_1yvyu_57", Zt = "_inner_1yvyu_61", jt = "_standalone_1yvyu_77", M = {
|
|
8
8
|
croppable: Yt,
|
|
9
9
|
empty: Xt,
|
|
10
10
|
media: At,
|
|
@@ -33,7 +33,7 @@ import '../../assets/index21.css';const Yt = "_croppable_oxo39_1", Xt = "_empty_
|
|
|
33
33
|
transform: _,
|
|
34
34
|
viewport: h
|
|
35
35
|
}) => {
|
|
36
|
-
const s = await Nt(u), Y = h.width / s.naturalWidth,
|
|
36
|
+
const s = await Nt(u), Y = h.width / s.naturalWidth, v = h.height / s.naturalHeight, x = Math.max(Y, v), k = s.naturalWidth * x, R = s.naturalHeight * x, C = p === "width" ? Math.max(j, Y / x) : p === "height" ? Math.max(j, v / x) : j, L = d(_.zoom, C, P), g = x * L, b = k * L, F = R * L, m = (h.width - b) / 2 + _.offset.x, T = (h.height - F) / 2 + _.offset.y, X = d((0 - m) / g, 0, s.naturalWidth), E = d((0 - T) / 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
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);
|
|
@@ -53,127 +53,127 @@ import '../../assets/index21.css';const Yt = "_croppable_oxo39_1", Xt = "_empty_
|
|
|
53
53
|
image: h,
|
|
54
54
|
label: s,
|
|
55
55
|
onCroppableChange: Y,
|
|
56
|
-
onFileChange:
|
|
57
|
-
onImageChange:
|
|
56
|
+
onFileChange: v,
|
|
57
|
+
onImageChange: x,
|
|
58
58
|
onTransformChange: k,
|
|
59
|
-
transform:
|
|
59
|
+
transform: R,
|
|
60
60
|
standalone: C
|
|
61
61
|
}) => {
|
|
62
|
-
const
|
|
62
|
+
const L = w(null), g = w(null), b = w(null), F = w(null), m = w(x), T = 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), [ot, 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,
|
|
67
|
-
if (!t || !
|
|
66
|
+
const t = f.width, n = f.height;
|
|
67
|
+
if (!t || !n) return {
|
|
68
68
|
width: 0,
|
|
69
69
|
height: 0,
|
|
70
70
|
minZoom: j
|
|
71
71
|
};
|
|
72
72
|
if (!a) return {
|
|
73
73
|
width: t,
|
|
74
|
-
height:
|
|
74
|
+
height: n,
|
|
75
75
|
minZoom: j
|
|
76
76
|
};
|
|
77
|
-
const
|
|
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;
|
|
78
78
|
return {
|
|
79
|
-
width: a.width *
|
|
80
|
-
height: a.height *
|
|
79
|
+
width: a.width * o,
|
|
80
|
+
height: a.height * o,
|
|
81
81
|
minZoom: Math.max(j, i)
|
|
82
82
|
};
|
|
83
|
-
})(), W = B.minZoom, N =
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
width:
|
|
87
|
-
height:
|
|
83
|
+
})(), W = B.minZoom, N = R ?? zt, H = d(N.zoom, W, P), K = D ?? h ?? null, st = !u && !!h && !D && !q, Q = !st, at = u ?? (K ? /* @__PURE__ */ y("img", { alt: "", draggable: !1, onLoad: (t) => {
|
|
84
|
+
const n = t.currentTarget;
|
|
85
|
+
n.naturalWidth && n.naturalHeight && A({
|
|
86
|
+
width: n.naturalWidth,
|
|
87
|
+
height: n.naturalHeight
|
|
88
88
|
});
|
|
89
|
-
}, src: K }) : null), S = at == null, et = (t,
|
|
89
|
+
}, src: K }) : null), S = at == null, et = (t, n) => {
|
|
90
90
|
const {
|
|
91
|
-
maxX:
|
|
91
|
+
maxX: r,
|
|
92
92
|
maxY: e
|
|
93
|
-
} = ut(
|
|
93
|
+
} = ut(n);
|
|
94
94
|
return {
|
|
95
|
-
x: d(t.x, -
|
|
95
|
+
x: d(t.x, -r, r),
|
|
96
96
|
y: d(t.y, -e, e)
|
|
97
97
|
};
|
|
98
|
-
}, lt = (t,
|
|
99
|
-
const
|
|
100
|
-
if (!
|
|
101
|
-
const e =
|
|
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;
|
|
102
102
|
return {
|
|
103
|
-
x:
|
|
103
|
+
x: o,
|
|
104
104
|
y: i
|
|
105
105
|
};
|
|
106
|
-
}, _t = (t,
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
109
|
-
const l = i /
|
|
106
|
+
}, _t = (t, n, r, e) => {
|
|
107
|
+
const o = d(n, W, P), i = d(r, W, P);
|
|
108
|
+
if (o === 0) return t;
|
|
109
|
+
const l = i / o;
|
|
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
|
-
},
|
|
115
|
-
const e = c.current.zoom,
|
|
114
|
+
}, vt = (t, n, r) => {
|
|
115
|
+
const e = c.current.zoom, o = d(t, W, P), i = c.current.offset, l = r ? _t(i, e, o, r) : n, I = et(l, o);
|
|
116
116
|
c.current = {
|
|
117
|
-
zoom:
|
|
117
|
+
zoom: o,
|
|
118
118
|
offset: I
|
|
119
|
-
},
|
|
120
|
-
zoom:
|
|
119
|
+
}, R || ct({
|
|
120
|
+
zoom: o,
|
|
121
121
|
offset: I
|
|
122
122
|
}), k == null || k({
|
|
123
|
-
zoom:
|
|
123
|
+
zoom: o,
|
|
124
124
|
offset: I
|
|
125
125
|
});
|
|
126
|
-
}, V = (t,
|
|
126
|
+
}, V = (t, n, r) => {
|
|
127
127
|
X.current = {
|
|
128
128
|
zoom: t,
|
|
129
|
-
offset:
|
|
130
|
-
anchor:
|
|
129
|
+
offset: n,
|
|
130
|
+
anchor: r ?? null
|
|
131
131
|
}, g.current == null && (g.current = window.requestAnimationFrame(() => {
|
|
132
132
|
g.current = null;
|
|
133
133
|
const e = X.current;
|
|
134
134
|
X.current = null;
|
|
135
|
-
const
|
|
136
|
-
|
|
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
|
+
vt(o, i, l);
|
|
137
137
|
}));
|
|
138
|
-
},
|
|
138
|
+
}, Rt = (t) => {
|
|
139
139
|
if (S || !Q) return;
|
|
140
|
-
const
|
|
141
|
-
V(
|
|
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);
|
|
142
142
|
}, ut = (t) => {
|
|
143
|
-
const
|
|
144
|
-
if (!
|
|
143
|
+
const n = f.width, r = f.height;
|
|
144
|
+
if (!n || !r) return {
|
|
145
145
|
maxX: 0,
|
|
146
146
|
maxY: 0
|
|
147
147
|
};
|
|
148
|
-
const e = d(t, W, P),
|
|
148
|
+
const e = d(t, W, P), o = B.width * e, i = B.height * e, l = Math.max(0, (o - n) / 2), I = Math.max(0, (i - r) / 2);
|
|
149
149
|
return {
|
|
150
150
|
maxX: l,
|
|
151
151
|
maxY: I
|
|
152
152
|
};
|
|
153
|
-
},
|
|
154
|
-
var
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
157
|
-
G(null), it(null),
|
|
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), v == null || v(null), n.value = "";
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
-
const e = URL.createObjectURL(
|
|
161
|
-
|
|
162
|
-
},
|
|
160
|
+
const e = URL.createObjectURL(r);
|
|
161
|
+
T.current = e, G(e), A(null), it(r), V($.zoom, $.offset), c.current = $, v == null || v(r), n.value = "";
|
|
162
|
+
}, Tt = (t) => {
|
|
163
163
|
if (!(S || !Q || t.pointerType === "mouse" && t.button !== 0)) {
|
|
164
164
|
if (t.currentTarget.setPointerCapture(t.pointerId), t.pointerType === "touch") {
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
165
|
+
const n = O.current;
|
|
166
|
+
if (n.set(t.pointerId, {
|
|
167
167
|
x: t.clientX,
|
|
168
168
|
y: t.clientY
|
|
169
|
-
}),
|
|
170
|
-
b.current = null,
|
|
171
|
-
const [
|
|
172
|
-
E.current = Math.hypot(
|
|
169
|
+
}), n.size === 2) {
|
|
170
|
+
b.current = null, L.current = null, tt(!1);
|
|
171
|
+
const [r, e] = Array.from(n.values());
|
|
172
|
+
E.current = Math.hypot(r.x - e.x, r.y - e.y);
|
|
173
173
|
return;
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
|
|
176
|
+
L.current = t.pointerId, b.current = {
|
|
177
177
|
x: t.clientX,
|
|
178
178
|
y: t.clientY,
|
|
179
179
|
originX: c.current.offset.x,
|
|
@@ -183,13 +183,13 @@ import '../../assets/index21.css';const Yt = "_croppable_oxo39_1", Xt = "_empty_
|
|
|
183
183
|
}, Et = (t) => {
|
|
184
184
|
if (S || !Q) return;
|
|
185
185
|
if (t.pointerType === "touch") {
|
|
186
|
-
const
|
|
187
|
-
if (!
|
|
188
|
-
if (
|
|
186
|
+
const o = O.current;
|
|
187
|
+
if (!o.has(t.pointerId)) return;
|
|
188
|
+
if (o.set(t.pointerId, {
|
|
189
189
|
x: t.clientX,
|
|
190
190
|
y: t.clientY
|
|
191
|
-
}),
|
|
192
|
-
const [i, l] = Array.from(
|
|
191
|
+
}), o.size === 2) {
|
|
192
|
+
const [i, l] = Array.from(o.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
|
};
|
|
@@ -201,69 +201,69 @@ import '../../assets/index21.css';const Yt = "_croppable_oxo39_1", Xt = "_empty_
|
|
|
201
201
|
return;
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
if (
|
|
205
|
-
const
|
|
206
|
-
!
|
|
207
|
-
x: b.current.originX +
|
|
208
|
-
y: b.current.originY +
|
|
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
|
|
209
209
|
});
|
|
210
210
|
}, ht = (t) => {
|
|
211
|
-
t.pointerType === "touch" && (O.current.delete(t.pointerId), O.current.size < 2 && (E.current = null)),
|
|
211
|
+
t.pointerType === "touch" && (O.current.delete(t.pointerId), O.current.size < 2 && (E.current = null)), L.current === t.pointerId && (L.current = null, b.current = null, tt(!1));
|
|
212
212
|
};
|
|
213
213
|
U(() => {
|
|
214
|
-
if (!
|
|
215
|
-
const t = d(
|
|
214
|
+
if (!R) return;
|
|
215
|
+
const t = d(R.zoom, W, P);
|
|
216
216
|
c.current = {
|
|
217
217
|
zoom: t,
|
|
218
|
-
offset: et(
|
|
218
|
+
offset: et(R.offset, t)
|
|
219
219
|
};
|
|
220
|
-
}, [
|
|
221
|
-
|
|
220
|
+
}, [R, f.width, f.height, a == null ? void 0 : a.width, a == null ? void 0 : a.height]), U(() => () => {
|
|
221
|
+
T.current && URL.revokeObjectURL(T.current);
|
|
222
222
|
}, []), U(() => {
|
|
223
223
|
const t = z.current;
|
|
224
224
|
if (!t) return;
|
|
225
|
-
const
|
|
226
|
-
const
|
|
227
|
-
Mt((i) => i.width ===
|
|
228
|
-
width:
|
|
229
|
-
height:
|
|
230
|
-
}), Y && Y(
|
|
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
|
+
}), Y && Y(o);
|
|
231
231
|
};
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
if (window.addEventListener("scroll",
|
|
235
|
-
const
|
|
236
|
-
return window.addEventListener("resize",
|
|
237
|
-
window.removeEventListener("resize",
|
|
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);
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
|
-
const e = new ResizeObserver(() =>
|
|
240
|
+
const e = new ResizeObserver(() => n());
|
|
241
241
|
return e.observe(t), () => {
|
|
242
|
-
e.disconnect(), window.removeEventListener("scroll",
|
|
242
|
+
e.disconnect(), window.removeEventListener("scroll", r, !0);
|
|
243
243
|
};
|
|
244
244
|
}, [Y]), U(() => {
|
|
245
|
-
if (
|
|
246
|
-
const t = c.current.offset,
|
|
247
|
-
t.x ===
|
|
245
|
+
if (R) return;
|
|
246
|
+
const t = c.current.offset, n = et(t, H);
|
|
247
|
+
t.x === n.x && t.y === n.y || (c.current = {
|
|
248
248
|
zoom: c.current.zoom,
|
|
249
|
-
offset:
|
|
250
|
-
}, ct((
|
|
251
|
-
...
|
|
252
|
-
offset:
|
|
249
|
+
offset: n
|
|
250
|
+
}, ct((r) => ({
|
|
251
|
+
...r,
|
|
252
|
+
offset: n
|
|
253
253
|
})));
|
|
254
254
|
}, [H, a, f.width, f.height]), U(() => {
|
|
255
255
|
K || A(null);
|
|
256
256
|
}, [K]), U(() => {
|
|
257
|
-
m.current =
|
|
258
|
-
}, [
|
|
259
|
-
var
|
|
260
|
-
if (!
|
|
257
|
+
m.current = x;
|
|
258
|
+
}, [x]), U(() => {
|
|
259
|
+
var r;
|
|
260
|
+
if (!x) return;
|
|
261
261
|
if (!q || !f.width || !f.height || u) {
|
|
262
|
-
(
|
|
262
|
+
(r = m.current) == null || r.call(m, null);
|
|
263
263
|
return;
|
|
264
264
|
}
|
|
265
265
|
let t = !0;
|
|
266
|
-
const
|
|
266
|
+
const n = window.setTimeout(() => {
|
|
267
267
|
$t({
|
|
268
268
|
file: q,
|
|
269
269
|
fill: p,
|
|
@@ -273,30 +273,30 @@ import '../../assets/index21.css';const Yt = "_croppable_oxo39_1", Xt = "_empty_
|
|
|
273
273
|
},
|
|
274
274
|
viewport: f
|
|
275
275
|
}).then((e) => {
|
|
276
|
-
var
|
|
277
|
-
t && ((
|
|
276
|
+
var o;
|
|
277
|
+
t && ((o = m.current) == null || o.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(
|
|
284
|
+
t = !1, window.clearTimeout(n);
|
|
285
285
|
};
|
|
286
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(H),
|
|
289
|
+
const dt = ut(H), nt = !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:
|
|
295
|
+
return /* @__PURE__ */ J("div", { className: rt(M.croppable, C && M.standalone), onClick: () => {
|
|
296
296
|
S && mt();
|
|
297
297
|
}, "data-component": "croppable", children: [
|
|
298
|
-
/* @__PURE__ */
|
|
299
|
-
/* @__PURE__ */
|
|
298
|
+
/* @__PURE__ */ y("input", { accept: "image/*", onChange: Lt, ref: F, type: "file" }),
|
|
299
|
+
/* @__PURE__ */ y("div", { className: M.viewport, ref: z, onDragStart: (t) => t.preventDefault(), onPointerDown: Tt, onPointerMove: Et, onPointerUp: ht, onPointerCancel: ht, onWheel: Rt, style: {
|
|
300
300
|
"--croppable-height": `${_ ?? kt}px`,
|
|
301
301
|
"--croppable-zoom": H,
|
|
302
302
|
"--croppable-x": `${N.offset.x}px`,
|
|
@@ -306,13 +306,13 @@ import '../../assets/index21.css';const Yt = "_croppable_oxo39_1", Xt = "_empty_
|
|
|
306
306
|
"--croppable-image-height": `${B.height}px`
|
|
307
307
|
} : null
|
|
308
308
|
}, children: S ? /* @__PURE__ */ J("div", { className: M.empty, children: [
|
|
309
|
-
/* @__PURE__ */
|
|
310
|
-
/* @__PURE__ */
|
|
311
|
-
] }) : /* @__PURE__ */ J("div", { className:
|
|
312
|
-
/* @__PURE__ */
|
|
313
|
-
st && /* @__PURE__ */
|
|
314
|
-
/* @__PURE__ */
|
|
315
|
-
/* @__PURE__ */
|
|
309
|
+
/* @__PURE__ */ y(wt, { children: /* @__PURE__ */ y(xt, { name: "image", size: "large" }) }),
|
|
310
|
+
/* @__PURE__ */ y(yt, { onClick: ft, children: s ?? bt })
|
|
311
|
+
] }) : /* @__PURE__ */ J("div", { className: rt(M.media, nt && M.draggable, nt && ot && M.dragging), children: [
|
|
312
|
+
/* @__PURE__ */ y("div", { className: rt(M.inner), children: at }),
|
|
313
|
+
st && /* @__PURE__ */ y("div", { className: M.overlay, children: /* @__PURE__ */ J("div", { className: M.empty, children: [
|
|
314
|
+
/* @__PURE__ */ y(wt, { children: /* @__PURE__ */ y(xt, { name: "image", size: "large" }) }),
|
|
315
|
+
/* @__PURE__ */ y(yt, { 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/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index19.css');const i=require("react/jsx-runtime"),E=require("../../classix-5H4IWnMA.cjs"),o=require("react"),W=require("../button/index.cjs"),U=require("../../icons-vqS7W0cD.cjs"),X=require("../input/index.cjs"),Y=require("../../styles.module-DvIhipVo.cjs"),Z=require("../list/index.cjs"),k=require("../../index-908yg65J.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
|
|
@@ -2,13 +2,13 @@ import { jsxs as _, jsx as i, Fragment as Z } from "react/jsx-runtime";
|
|
|
2
2
|
import { t as V } from "../../classix-DG18itHa.js";
|
|
3
3
|
import ee, { useRef as g, useState as O, useEffect as P, Children as te, isValidElement as x } from "react";
|
|
4
4
|
import { Button as A } from "../button/index.js";
|
|
5
|
-
import { i as ne } from "../../icons-
|
|
5
|
+
import { i as ne } from "../../icons-DkF2p6NO.js";
|
|
6
6
|
import { Input as re } from "../input/index.js";
|
|
7
|
-
import { i as oe } from "../../styles.module-
|
|
7
|
+
import { i as oe } from "../../styles.module-BUYR37kC.js";
|
|
8
8
|
import { List as se } from "../list/index.js";
|
|
9
|
-
import { s as le, S as ie } from "../../index-
|
|
9
|
+
import { s as le, S as ie } from "../../index-BGqIgxnV.js";
|
|
10
10
|
import { r as G } from "../../utils--n2yqjCy.js";
|
|
11
|
-
import '../../assets/
|
|
11
|
+
import '../../assets/index19.css';const ae = "_dropdown_1dsxx_1", ce = "_empty_1dsxx_4", pe = "_group_1dsxx_5", ue = "_placeholder_1dsxx_6", de = "_filter_1dsxx_14", fe = "_native_1dsxx_25", me = "_option_1dsxx_35", he = "_options_1dsxx_57", xe = "_panel_1dsxx_81", ge = "_selected_1dsxx_104", _e = "_text_1dsxx_108", ve = "_trigger_1dsxx_117", ye = "_minimal_1dsxx_133", l = {
|
|
12
12
|
dropdown: ae,
|
|
13
13
|
empty: ce,
|
|
14
14
|
group: pe,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index20.css');const i=require("react/jsx-runtime"),b=require("../../classix-5H4IWnMA.cjs"),z=require("react"),q=require("../button/index.cjs"),I=require("../icon/index.cjs"),R="_dropzone_1rpsf_1",T="_dragging_1rpsf_19",S="_minimal_1rpsf_23",g={dropzone:R,dragging:T,minimal:S},k=({accepts:F,label:D="Select files",maxFileSize:m,multiple:d=!1,onChange:n,onValidation:a,variant:p="default",...y})=>{const f=z.useRef(null),[x,l]=z.useState(!1),c=e=>{e.preventDefault(),e.stopPropagation()},_=e=>{const t=f.current;if(!t)return;const s=new DataTransfer;for(const r of e)s.items.add(r);t.files=s.files,n==null||n({target:t,currentTarget:t})},v=e=>{const{validFiles:t,emptyFiles:s,oversizedFiles:r}=e.reduce((u,o)=>(o.size===0?u.emptyFiles.push(o):m&&o.size>m?u.oversizedFiles.push(o):u.validFiles.push(o),u),{validFiles:[],emptyFiles:[],oversizedFiles:[]});return(s.length>0||r.length>0)&&(a==null||a(s,r)),t},j=e=>{c(e),l(!1);const t=Array.from(e.dataTransfer.files??[]),s=v(t);if(s.length===0)return;const r=d?s:s.slice(0,1);_(r)},h=e=>{const t=Array.from(e.target.files??[]),s=v(t);if(s.length===t.length){n==null||n(e);return}const r=d?s:s.slice(0,1);_(r)};return i.jsx("div",{className:b.t(g.dropzone,g[p],x&&g.dragging),onDragEnter:e=>{c(e),l(!0)},onDragOver:e=>{c(e),l(!0)},onDragLeave:e=>{c(e),l(!1)},onDrop:j,...y,"data-component":"dropzone",children:i.jsxs("label",{children:[i.jsx("input",{accept:F,hidden:!0,multiple:d,onChange:h,ref:f,type:"file"}),i.jsx(I.Icon,{name:"upload",size:p==="minimal"?"medium":"large"}),i.jsx("br",{}),p!=="minimal"&&i.jsx(q.Button,{onClick:()=>{var e;return(e=f.current)==null?void 0:e.click()},type:"button",children:D})]})})};exports.Dropzone=k;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -3,7 +3,7 @@ import { t as T } from "../../classix-DG18itHa.js";
|
|
|
3
3
|
import { useRef as j, useState as k } from "react";
|
|
4
4
|
import { Button as x } from "../button/index.js";
|
|
5
5
|
import { Icon as A } from "../icon/index.js";
|
|
6
|
-
import '../../assets/
|
|
6
|
+
import '../../assets/index20.css';const R = "_dropzone_1rpsf_1", w = "_dragging_1rpsf_19", B = "_minimal_1rpsf_23", m = {
|
|
7
7
|
dropzone: R,
|
|
8
8
|
dragging: w,
|
|
9
9
|
minimal: B
|