kwant-ui 3.38.1-dev.8 → 3.38.2
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.
|
@@ -7,7 +7,9 @@ export declare const OptionsContainer: import("styled-components").StyledCompone
|
|
|
7
7
|
showScrollbar?: boolean;
|
|
8
8
|
}, never>;
|
|
9
9
|
export declare const Option: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
|
-
export declare const CustomOption: import("styled-components").StyledComponent<"div", any, {
|
|
10
|
+
export declare const CustomOption: import("styled-components").StyledComponent<"div", any, {
|
|
11
|
+
isSelected?: boolean;
|
|
12
|
+
}, never>;
|
|
11
13
|
export declare const EmptyResultContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
12
14
|
export declare const AddOptionContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
13
15
|
export declare const CustomImageOption: import("styled-components").StyledComponent<"div", any, {
|
package/dist/index.es.js
CHANGED
|
@@ -1358,7 +1358,11 @@ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import n,{css as
|
|
|
1358
1358
|
background-color: ${e=>e.theme.blue.blue5};
|
|
1359
1359
|
cursor: pointer;
|
|
1360
1360
|
}
|
|
1361
|
-
`,Tt=n.div
|
|
1361
|
+
`,Tt=n.div`
|
|
1362
|
+
${({isSelected:e})=>e&&a`
|
|
1363
|
+
display: none;
|
|
1364
|
+
`}
|
|
1365
|
+
`,Nt=n.div`
|
|
1362
1366
|
padding: 12px;
|
|
1363
1367
|
`,Ft=n.div`
|
|
1364
1368
|
display: flex;
|
|
@@ -1412,7 +1416,7 @@ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import n,{css as
|
|
|
1412
1416
|
position: absolute;
|
|
1413
1417
|
bottom: ${e=>e.bottomOffset};
|
|
1414
1418
|
right: ${e=>e.rightOffset};
|
|
1415
|
-
`,qt={xxs:{avatarSize:24,fontSize:10},xs:{avatarSize:32,fontSize:14},sm:{avatarSize:48,fontSize:18},md:{avatarSize:64,fontSize:22},lg:{avatarSize:88,fontSize:26},xl:{avatarSize:128,fontSize:30},xxl:{avatarSize:180,fontSize:60}},Gt=r=>{const{src:n,alt:a,size:c="md",fontSize:i,backgroundColor:o="random",fontColor:s="white",objectFit:h="cover",avatarButton:v,avatarButtonBottomOffset:u=0,avatarButtonRightOffset:g=0,onClick:m}=r,[d,f]=p(null),[_,w]=p(!1),b=((e="")=>{const t=e?.trim()?.split(" ");if(t.length>1){const[e,...r]=t;return`${e[0]}${r?.pop()?.[0]}`.toUpperCase()}const r=t[0];return r[0]?.toUpperCase()||""})(a),y="random"!==o?o:function(e){let t=0;for(let r=0;r<e.length;r++)t=e.charCodeAt(r)+((t<<5)-t);let r="#";for(let e=0;e<3;e++)r+=("00"+(t>>8*e&255).toString(16)).substr(-2);return r}(a),x=c in qt?qt[c]:{avatarSize:c,fontSize:i},Z=()=>w(!0),O=()=>w(!1);return l((()=>{if(n){const e=new Image;e.src=n,e.onload=Z,e.onerror=O,f(e)}else O()}),[n]),t(Yt,{children:[e(Ut,{background:y,size:ke(x.avatarSize),onClick:()=>{m?.(r)},children:_?e(Wt,{src:d?.currentSrc,alt:a,objectFit:h,loading:"lazy"}):e(Xt,{fontSize:ke(i||x.fontSize),fontColor:s,children:b})}),e(Kt,{rightOffset:ke(g,"0px"),bottomOffset:ke(u,"0px"),children:v})]})},Jt=r=>{const{label:n="",image:a="",selected:c,avatarProps:i}=r;return t(Qt,{selected:c,children:[e(Gt,{src:a,alt:n,size:"xs",...i}),e($t,{category:"body2",weight:"medium",color:A.grey.grey900,children:r.label}),c&&e(nt,{icon:"check",width:20,height:20,fill:A.green.green400})]})},er=r=>{const{maxHeight:n=350,width:a=350,offsetTop:c="60px",offsetLeft:i,offsetRight:o,offsetBottom:s,zIndex:h,opened:v,onChange:g,onDropdownVisibilityChange:m,data:d=[],onSelect:_,itemComponent:w,showSeparator:b=!0,collapseOnSelect:y=!0,inputLeftSection:x,inputRightSection:Z,searchPlaceholder:O="Search",searchable:M=!0,showScrollbar:E=!0,targetRef:P,onMouseEnter:j,onMouseLeave:V,onClose:C,searchAutofocus:A=!0,addable:L,selectInputValue:z,avatarProps:B,selectedValue:k,withInput:S}=r,[R,D]=p(""),[I,T]=p([]),N=Vt(R,400),F=u(null),Q=R?I:d,$=R&&0===I.length,Y=Q.some((e=>"image"in e)),U={select:(e,t)=>()=>{_?.(e,t),y&&C?.()},searchQueryChange:e=>{D(e.target.value)}};l((()=>{const e=R.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&");const t=new RegExp(e,"ig"),r=d?.filter((({label:e,value:r})=>e.match(t)||r?.match(t)));T(r)}),[N,d]),l((()=>{g?.(v),m?.(),D("")}),[v]);const W=(e,t)=>M||S?{onMouseDown:U.select(e,t)}:{onClick:U.select(e,t)};return e(kt,{opened:v,onClose:C,width:ke(a),offsetTop:c,offsetLeft:i,offsetRight:o,offsetBottom:s,zIndex:h,targetRef:P,onMouseEnter:j,onMouseLeave:V,children:t(St,{expandedHeight:n,children:[M&&e(Rt,{children:e(at,{placeholder:O,value:R,onChange:U.searchQueryChange,leftSection:x,rightSection:Z,autoFocus:A})}),$?e(Nt,{children:e(Oe,{category:"body1",children:"Sorry, no results were found matching your search criteria."})}):t(Dt,{separator:b,showScrollbar:E,ref:F,children:[e(H,{viewportRef:F,items:Q,children:(t,r)=>w?e(Tt,{
|
|
1419
|
+
`,qt={xxs:{avatarSize:24,fontSize:10},xs:{avatarSize:32,fontSize:14},sm:{avatarSize:48,fontSize:18},md:{avatarSize:64,fontSize:22},lg:{avatarSize:88,fontSize:26},xl:{avatarSize:128,fontSize:30},xxl:{avatarSize:180,fontSize:60}},Gt=r=>{const{src:n,alt:a,size:c="md",fontSize:i,backgroundColor:o="random",fontColor:s="white",objectFit:h="cover",avatarButton:v,avatarButtonBottomOffset:u=0,avatarButtonRightOffset:g=0,onClick:m}=r,[d,f]=p(null),[_,w]=p(!1),b=((e="")=>{const t=e?.trim()?.split(" ");if(t.length>1){const[e,...r]=t;return`${e[0]}${r?.pop()?.[0]}`.toUpperCase()}const r=t[0];return r[0]?.toUpperCase()||""})(a),y="random"!==o?o:function(e){let t=0;for(let r=0;r<e.length;r++)t=e.charCodeAt(r)+((t<<5)-t);let r="#";for(let e=0;e<3;e++)r+=("00"+(t>>8*e&255).toString(16)).substr(-2);return r}(a),x=c in qt?qt[c]:{avatarSize:c,fontSize:i},Z=()=>w(!0),O=()=>w(!1);return l((()=>{if(n){const e=new Image;e.src=n,e.onload=Z,e.onerror=O,f(e)}else O()}),[n]),t(Yt,{children:[e(Ut,{background:y,size:ke(x.avatarSize),onClick:()=>{m?.(r)},children:_?e(Wt,{src:d?.currentSrc,alt:a,objectFit:h,loading:"lazy"}):e(Xt,{fontSize:ke(i||x.fontSize),fontColor:s,children:b})}),e(Kt,{rightOffset:ke(g,"0px"),bottomOffset:ke(u,"0px"),children:v})]})},Jt=r=>{const{label:n="",image:a="",selected:c,avatarProps:i}=r;return t(Qt,{selected:c,children:[e(Gt,{src:a,alt:n,size:"xs",...i}),e($t,{category:"body2",weight:"medium",color:A.grey.grey900,children:r.label}),c&&e(nt,{icon:"check",width:20,height:20,fill:A.green.green400})]})},er=r=>{const{maxHeight:n=350,width:a=350,offsetTop:c="60px",offsetLeft:i,offsetRight:o,offsetBottom:s,zIndex:h,opened:v,onChange:g,onDropdownVisibilityChange:m,data:d=[],onSelect:_,itemComponent:w,showSeparator:b=!0,collapseOnSelect:y=!0,inputLeftSection:x,inputRightSection:Z,searchPlaceholder:O="Search",searchable:M=!0,showScrollbar:E=!0,targetRef:P,onMouseEnter:j,onMouseLeave:V,onClose:C,searchAutofocus:A=!0,addable:L,selectInputValue:z,avatarProps:B,selectedValue:k,withInput:S}=r,[R,D]=p(""),[I,T]=p([]),N=Vt(R,400),F=u(null),Q=R?I:d,$=R&&0===I.length,Y=Q.some((e=>"image"in e)),U={select:(e,t)=>()=>{_?.(e,t),y&&C?.()},searchQueryChange:e=>{D(e.target.value)}};l((()=>{const e=R.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&");const t=new RegExp(e,"ig"),r=d?.filter((({label:e,value:r})=>e.match(t)||r?.match(t)));T(r)}),[N,d]),l((()=>{g?.(v),m?.(),D("")}),[v]);const W=(e,t)=>M||S?{onMouseDown:U.select(e,t)}:{onClick:U.select(e,t)};return e(kt,{opened:v,onClose:C,width:ke(a),offsetTop:c,offsetLeft:i,offsetRight:o,offsetBottom:s,zIndex:h,targetRef:P,onMouseEnter:j,onMouseLeave:V,children:t(St,{expandedHeight:n,children:[M&&e(Rt,{children:e(at,{placeholder:O,value:R,onChange:U.searchQueryChange,leftSection:x,rightSection:Z,autoFocus:A})}),$?e(Nt,{children:e(Oe,{category:"body1",children:"Sorry, no results were found matching your search criteria."})}):t(Dt,{className:"select_item_container",separator:b,showScrollbar:E,ref:F,children:[e(H,{viewportRef:F,items:Q,itemMargin:10,itemSize:Q.length,children:(t,r)=>w?e(Tt,{isSelected:t?.isSelected,...W(t,r),children:f(w,{...t,label:t.label,value:t.value,index:r,key:`${t.label}${t.value}`})},`${t.label}${t.value}+${r}`):Y?e(Tt,{...W(t,r),children:e(Jt,{...t,avatarProps:B,selected:t.value===k})},`${t.label}${t.value}+${r}`):e(It,{...W(t,r),role:"button",children:t.label},`${t.label}${t.value}+${r}`)}),L&&0===Q.length&&e(It,{...M||S?{onMouseDown:U.select({label:z,value:null},0)}:{onClick:U.select({label:z,value:null},0)},role:"button",children:t(Ft,{children:[e(Oe,{category:"body1",weight:"semiBold",children:"Add:"}),t(Oe,{children:[" ",z]})]})})]})]})})},tr=n.div`
|
|
1416
1420
|
position: relative;
|
|
1417
1421
|
`,rr=n.div`
|
|
1418
1422
|
width: 100%;
|
package/dist/index.js
CHANGED
|
@@ -1358,7 +1358,11 @@
|
|
|
1358
1358
|
background-color: ${e=>e.theme.blue.blue5};
|
|
1359
1359
|
cursor: pointer;
|
|
1360
1360
|
}
|
|
1361
|
-
`,pt=t.div
|
|
1361
|
+
`,pt=t.div`
|
|
1362
|
+
${({isSelected:e})=>e&&t.css`
|
|
1363
|
+
display: none;
|
|
1364
|
+
`}
|
|
1365
|
+
`,ut=t.div`
|
|
1362
1366
|
padding: 12px;
|
|
1363
1367
|
`,gt=t.div`
|
|
1364
1368
|
display: flex;
|
|
@@ -1412,7 +1416,7 @@
|
|
|
1412
1416
|
position: absolute;
|
|
1413
1417
|
bottom: ${e=>e.bottomOffset};
|
|
1414
1418
|
right: ${e=>e.rightOffset};
|
|
1415
|
-
`,xt={xxs:{avatarSize:24,fontSize:10},xs:{avatarSize:32,fontSize:14},sm:{avatarSize:48,fontSize:18},md:{avatarSize:64,fontSize:22},lg:{avatarSize:88,fontSize:26},xl:{avatarSize:128,fontSize:30},xxl:{avatarSize:180,fontSize:60}},Zt=t=>{const{src:n,alt:a,size:c="md",fontSize:i,backgroundColor:o="random",fontColor:s="white",objectFit:l="cover",avatarButton:h,avatarButtonBottomOffset:v=0,avatarButtonRightOffset:p=0,onClick:u}=t,[g,m]=r.useState(null),[d,f]=r.useState(!1),_=((e="")=>{const t=e?.trim()?.split(" ");if(t.length>1){const[e,...r]=t;return`${e[0]}${r?.pop()?.[0]}`.toUpperCase()}const r=t[0];return r[0]?.toUpperCase()||""})(a),w="random"!==o?o:function(e){let t=0;for(let r=0;r<e.length;r++)t=e.charCodeAt(r)+((t<<5)-t);let r="#";for(let e=0;e<3;e++)r+=("00"+(t>>8*e&255).toString(16)).substr(-2);return r}(a),b=c in xt?xt[c]:{avatarSize:c,fontSize:i},y=()=>f(!0),x=()=>f(!1);return r.useEffect((()=>{if(n){const e=new Image;e.src=n,e.onload=y,e.onerror=x,m(e)}else x()}),[n]),e.jsxs(ft,{children:[e.jsx(_t,{background:w,size:ue(b.avatarSize),onClick:()=>{u?.(t)},children:d?e.jsx(wt,{src:g?.currentSrc,alt:a,objectFit:l,loading:"lazy"}):e.jsx(bt,{fontSize:ue(i||b.fontSize),fontColor:s,children:_})}),e.jsx(yt,{rightOffset:ue(p,"0px"),bottomOffset:ue(v,"0px"),children:h})]})},Ot=t=>{const{label:r="",image:n="",selected:a,avatarProps:c}=t;return e.jsxs(mt,{selected:a,children:[e.jsx(Zt,{src:n,alt:r,size:"xs",...c}),e.jsx(dt,{category:"body2",weight:"medium",color:v.grey.grey900,children:t.label}),a&&e.jsx(Le,{icon:"check",width:20,height:20,fill:v.green.green400})]})},Mt=t=>{const{maxHeight:n=350,width:c=350,offsetTop:i="60px",offsetLeft:o,offsetRight:s,offsetBottom:l,zIndex:h,opened:v,onChange:p,onDropdownVisibilityChange:u,data:g=[],onSelect:m,itemComponent:d,showSeparator:f=!0,collapseOnSelect:_=!0,inputLeftSection:w,inputRightSection:b,searchPlaceholder:y="Search",searchable:x=!0,showScrollbar:Z=!0,targetRef:O,onMouseEnter:M,onMouseLeave:E,onClose:H,searchAutofocus:P=!0,addable:j,selectInputValue:V,avatarProps:C,selectedValue:A,withInput:L}=t,[z,B]=r.useState(""),[k,S]=r.useState([]),R=rt(z,400),D=r.useRef(null),I=z?k:g,T=z&&0===k.length,N=I.some((e=>"image"in e)),F={select:(e,t)=>()=>{m?.(e,t),_&&H?.()},searchQueryChange:e=>{B(e.target.value)}};r.useEffect((()=>{const e=z.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&");const t=new RegExp(e,"ig"),r=g?.filter((({label:e,value:r})=>e.match(t)||r?.match(t)));S(r)}),[R,g]),r.useEffect((()=>{p?.(v),u?.(),B("")}),[v]);const Q=(e,t)=>x||L?{onMouseDown:F.select(e,t)}:{onClick:F.select(e,t)};return e.jsx(ot,{opened:v,onClose:H,width:ue(c),offsetTop:i,offsetLeft:o,offsetRight:s,offsetBottom:l,zIndex:h,targetRef:O,onMouseEnter:M,onMouseLeave:E,children:e.jsxs(st,{expandedHeight:n,children:[x&&e.jsx(lt,{children:e.jsx(ze,{placeholder:y,value:z,onChange:F.searchQueryChange,leftSection:w,rightSection:b,autoFocus:P})}),T?e.jsx(ut,{children:e.jsx(re,{category:"body1",children:"Sorry, no results were found matching your search criteria."})}):e.jsxs(ht,{separator:f,showScrollbar:Z,ref:D,children:[e.jsx(a.ViewportList,{viewportRef:D,items:I,children:(t,n)=>d?e.jsx(pt,{
|
|
1419
|
+
`,xt={xxs:{avatarSize:24,fontSize:10},xs:{avatarSize:32,fontSize:14},sm:{avatarSize:48,fontSize:18},md:{avatarSize:64,fontSize:22},lg:{avatarSize:88,fontSize:26},xl:{avatarSize:128,fontSize:30},xxl:{avatarSize:180,fontSize:60}},Zt=t=>{const{src:n,alt:a,size:c="md",fontSize:i,backgroundColor:o="random",fontColor:s="white",objectFit:l="cover",avatarButton:h,avatarButtonBottomOffset:v=0,avatarButtonRightOffset:p=0,onClick:u}=t,[g,m]=r.useState(null),[d,f]=r.useState(!1),_=((e="")=>{const t=e?.trim()?.split(" ");if(t.length>1){const[e,...r]=t;return`${e[0]}${r?.pop()?.[0]}`.toUpperCase()}const r=t[0];return r[0]?.toUpperCase()||""})(a),w="random"!==o?o:function(e){let t=0;for(let r=0;r<e.length;r++)t=e.charCodeAt(r)+((t<<5)-t);let r="#";for(let e=0;e<3;e++)r+=("00"+(t>>8*e&255).toString(16)).substr(-2);return r}(a),b=c in xt?xt[c]:{avatarSize:c,fontSize:i},y=()=>f(!0),x=()=>f(!1);return r.useEffect((()=>{if(n){const e=new Image;e.src=n,e.onload=y,e.onerror=x,m(e)}else x()}),[n]),e.jsxs(ft,{children:[e.jsx(_t,{background:w,size:ue(b.avatarSize),onClick:()=>{u?.(t)},children:d?e.jsx(wt,{src:g?.currentSrc,alt:a,objectFit:l,loading:"lazy"}):e.jsx(bt,{fontSize:ue(i||b.fontSize),fontColor:s,children:_})}),e.jsx(yt,{rightOffset:ue(p,"0px"),bottomOffset:ue(v,"0px"),children:h})]})},Ot=t=>{const{label:r="",image:n="",selected:a,avatarProps:c}=t;return e.jsxs(mt,{selected:a,children:[e.jsx(Zt,{src:n,alt:r,size:"xs",...c}),e.jsx(dt,{category:"body2",weight:"medium",color:v.grey.grey900,children:t.label}),a&&e.jsx(Le,{icon:"check",width:20,height:20,fill:v.green.green400})]})},Mt=t=>{const{maxHeight:n=350,width:c=350,offsetTop:i="60px",offsetLeft:o,offsetRight:s,offsetBottom:l,zIndex:h,opened:v,onChange:p,onDropdownVisibilityChange:u,data:g=[],onSelect:m,itemComponent:d,showSeparator:f=!0,collapseOnSelect:_=!0,inputLeftSection:w,inputRightSection:b,searchPlaceholder:y="Search",searchable:x=!0,showScrollbar:Z=!0,targetRef:O,onMouseEnter:M,onMouseLeave:E,onClose:H,searchAutofocus:P=!0,addable:j,selectInputValue:V,avatarProps:C,selectedValue:A,withInput:L}=t,[z,B]=r.useState(""),[k,S]=r.useState([]),R=rt(z,400),D=r.useRef(null),I=z?k:g,T=z&&0===k.length,N=I.some((e=>"image"in e)),F={select:(e,t)=>()=>{m?.(e,t),_&&H?.()},searchQueryChange:e=>{B(e.target.value)}};r.useEffect((()=>{const e=z.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&");const t=new RegExp(e,"ig"),r=g?.filter((({label:e,value:r})=>e.match(t)||r?.match(t)));S(r)}),[R,g]),r.useEffect((()=>{p?.(v),u?.(),B("")}),[v]);const Q=(e,t)=>x||L?{onMouseDown:F.select(e,t)}:{onClick:F.select(e,t)};return e.jsx(ot,{opened:v,onClose:H,width:ue(c),offsetTop:i,offsetLeft:o,offsetRight:s,offsetBottom:l,zIndex:h,targetRef:O,onMouseEnter:M,onMouseLeave:E,children:e.jsxs(st,{expandedHeight:n,children:[x&&e.jsx(lt,{children:e.jsx(ze,{placeholder:y,value:z,onChange:F.searchQueryChange,leftSection:w,rightSection:b,autoFocus:P})}),T?e.jsx(ut,{children:e.jsx(re,{category:"body1",children:"Sorry, no results were found matching your search criteria."})}):e.jsxs(ht,{className:"select_item_container",separator:f,showScrollbar:Z,ref:D,children:[e.jsx(a.ViewportList,{viewportRef:D,items:I,itemMargin:10,itemSize:I.length,children:(t,n)=>d?e.jsx(pt,{isSelected:t?.isSelected,...Q(t,n),children:r.createElement(d,{...t,label:t.label,value:t.value,index:n,key:`${t.label}${t.value}`})},`${t.label}${t.value}+${n}`):N?e.jsx(pt,{...Q(t,n),children:e.jsx(Ot,{...t,avatarProps:C,selected:t.value===A})},`${t.label}${t.value}+${n}`):e.jsx(vt,{...Q(t,n),role:"button",children:t.label},`${t.label}${t.value}+${n}`)}),j&&0===I.length&&e.jsx(vt,{...x||L?{onMouseDown:F.select({label:V,value:null},0)}:{onClick:F.select({label:V,value:null},0)},role:"button",children:e.jsxs(gt,{children:[e.jsx(re,{category:"body1",weight:"semiBold",children:"Add:"}),e.jsxs(re,{children:[" ",V]})]})})]})]})})},Et=t.div`
|
|
1416
1420
|
position: relative;
|
|
1417
1421
|
`,Ht=t.div`
|
|
1418
1422
|
width: 100%;
|
package/dist/package.json
CHANGED