@qratilabs/qrati-connect 2.3.3 → 2.4.0
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/CHANGELOG.md +6 -0
- package/README.md +2 -2
- package/element/{AuthLayout-BQsxj8DA.js → AuthLayout-Cb29YL2A.js} +1 -1
- package/element/{ContentsPage-BswZWICC.js → ContentsPage-Dy9C3p31.js} +3 -3
- package/element/{CuratePage-l_53kq1u.js → CuratePage-BUmxwjzW.js} +1 -1
- package/element/{Dialog-xRPAHU1U.js → Dialog-Dv2w7GiN.js} +1 -1
- package/element/{DotLottiePlayer-DWbmlHl0.js → DotLottiePlayer-BM_SpbNm.js} +1 -1
- package/element/{EventHeaderAdminButtons-DpqqYPmp.js → EventHeaderAdminButtons-BjztFxCi.js} +1 -1
- package/element/{FolderBreadcrumb-DgOZR2JO.js → FolderBreadcrumb-D_vuN164.js} +1 -1
- package/element/{ForgotPasswordPage-CIz3_X-3.js → ForgotPasswordPage-CLTfCRSc.js} +1 -1
- package/element/{InputField-DybXE_Ab.js → InputField-Dpa6h5y6.js} +1 -1
- package/element/{LazyLoadImage-8X8b06AJ.js → LazyLoadImage-btDC6I6Y.js} +1 -1
- package/element/{LeaderboardPage-Bphjksy_.js → LeaderboardPage-C35B-9Gu.js} +1 -1
- package/element/LoginPage-r5G2G0oG.js +1 -0
- package/element/{NCMVHL6D-CBCgRwdZ.js → NCMVHL6D-2v69SxO0.js} +1 -1
- package/element/{PublicEvents-RN-_fsl2.js → PublicEvents-CKFcMhSD.js} +1 -1
- package/element/RegisterPage-DiL8319w.js +1 -0
- package/element/{SocialLoginButton-DpBl7dWg.js → SocialLoginButton-Cm1XFx8_.js} +1 -1
- package/element/{UploadPage-B7BieTEU.js → UploadPage-9jnk9Zmk.js} +1 -1
- package/element/{VideoPlayer-Bk8Hao3q.js → VideoPlayer-D9AI4cZc.js} +1 -1
- package/element/element.es.js +1 -1
- package/element/{heic2any-DLQd-wQs.js → heic2any-DQvpqzo3.js} +1 -1
- package/element/{index-DI8B7D73.js → index-BHVViZaJ.js} +1 -1
- package/element/{index-JyoNGo8S.js → index-BKOpkw1h.js} +9 -9
- package/element/{index.esm-CAQX5kI5.js → index.esm-Hfm1g5lN.js} +1 -1
- package/element/{photoswipe-Coj-X7bR.js → photoswipe-C58kAXHU.js} +1 -1
- package/element/{tslib.es6-C9bR68b3.js → tslib.es6-khl_spk_.js} +1 -1
- package/element/{useOrgAccess-CnN4aiYB.js → useOrgAccess-D2Xgijq3.js} +1 -1
- package/element/web.es.js +1 -1
- package/package.json +12 -11
- package/react/{IbMHxVCj.js → 7c7bXPlP.js} +1 -1
- package/react/B0dDfEtH.js +1 -0
- package/react/{CZp0lmKh.js → B1r-QO-6.js} +1 -1
- package/react/{Y9TU3Znq.js → BDG18AiE.js} +1 -1
- package/react/{DBnzOELO.js → BE5TseI4.js} +3 -3
- package/react/{CXu6PHUW.js → BUZRB64M.js} +1 -1
- package/react/{Ply2G2qz.js → BUkcR85F.js} +1 -1
- package/react/{Pcjql-py.js → Bdifa0jH.js} +1 -1
- package/react/{BO8jvMXn.js → Brhsb0-T.js} +1 -1
- package/react/{B1neVlFZ.js → C5-YA8nT.js} +1 -1
- package/react/{Gbk2zO2l.js → C92qhyHF.js} +1 -1
- package/react/{D6nR1wv_.js → CJ6agILN.js} +1 -1
- package/react/{fuEo08KS.js → Ck1QkDXW.js} +1 -1
- package/react/{Dwry3hNI.js → CyVAYliQ.js} +1 -1
- package/react/{rZy1FKOQ.js → D7D-fe1-.js} +1 -1
- package/react/{CfZ5_7x-.js → DGkkW9h-.js} +1 -1
- package/react/{DyklTvwE.js → DT_P8FaG.js} +1 -1
- package/react/{jRrpvD0D.js → DW2r0IAI.js} +1 -1
- package/react/DzJMp-c4.js +1 -0
- package/react/{DrqnWQLs.js → IujfE24r.js} +1 -1
- package/react/{D_imcCpv.js → Lyg2aTtz.js} +3 -3
- package/react/{DvDETl8u.js → Z6p4C64a.js} +1 -1
- package/react/{DvOl03h5.js → gTevyE5I.js} +1 -1
- package/react/index.es.js +1 -2
- package/react/styles.css +1 -0
- package/umd/web.umd.js +106 -106
- package/element/LoginPage-CHzBIQEq.js +0 -1
- package/element/RegisterPage-7WLryyTX.js +0 -1
- package/react/BbIY3X7C.js +0 -1
- package/react/CN2vdtYT.js +0 -1
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"React Component"
|
|
13
13
|
],
|
|
14
14
|
"author": "Qrati Labs LLC",
|
|
15
|
-
"version": "2.
|
|
15
|
+
"version": "2.4.0",
|
|
16
16
|
"type": "module",
|
|
17
17
|
"main": "./react.es.js",
|
|
18
18
|
"module": "./react.es.js",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"types": "./react/types/index.d.ts",
|
|
27
27
|
"import": "./react/index.es.js"
|
|
28
28
|
},
|
|
29
|
+
"./react/styles.css": "./react/styles.css",
|
|
29
30
|
"./element": {
|
|
30
31
|
"import": "./element.es.js"
|
|
31
32
|
},
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
"fast-array-diff": "^1.1.0",
|
|
76
77
|
"get-browser-fingerprint": "^4.1.1",
|
|
77
78
|
"heic2any": "^0.0.4",
|
|
78
|
-
"ky": "^1.
|
|
79
|
+
"ky": "^1.14.0",
|
|
79
80
|
"motion": "^12.23.24",
|
|
80
81
|
"queue": "^7.0.0",
|
|
81
82
|
"react-animate-height": "^3.2.3",
|
|
@@ -99,7 +100,7 @@
|
|
|
99
100
|
"devDependencies": {
|
|
100
101
|
"@babel/eslint-parser": "^7.28.5",
|
|
101
102
|
"@babel/plugin-syntax-jsx": "^7.27.1",
|
|
102
|
-
"@eslint/js": "^9.39.
|
|
103
|
+
"@eslint/js": "^9.39.1",
|
|
103
104
|
"@rollup/plugin-terser": "^0.4.4",
|
|
104
105
|
"@semantic-release/changelog": "^6.0.3",
|
|
105
106
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
@@ -107,24 +108,24 @@
|
|
|
107
108
|
"@semantic-release/github": "^12.0.1",
|
|
108
109
|
"@semantic-release/npm": "^13.1.1",
|
|
109
110
|
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
110
|
-
"@storybook/addon-a11y": "^10.0.
|
|
111
|
-
"@storybook/addon-docs": "^10.0.
|
|
112
|
-
"@storybook/addon-links": "^10.0.
|
|
113
|
-
"@storybook/react-vite": "^10.0.
|
|
111
|
+
"@storybook/addon-a11y": "^10.0.4",
|
|
112
|
+
"@storybook/addon-docs": "^10.0.4",
|
|
113
|
+
"@storybook/addon-links": "^10.0.4",
|
|
114
|
+
"@storybook/react-vite": "^10.0.4",
|
|
114
115
|
"@tailwindcss/vite": "^4.1.16",
|
|
115
116
|
"@tanstack/eslint-plugin-query": "^5.91.2",
|
|
116
117
|
"@tanstack/react-query-devtools": "^5.90.2",
|
|
117
|
-
"@trivago/prettier-plugin-sort-imports": "^
|
|
118
|
+
"@trivago/prettier-plugin-sort-imports": "^6.0.0",
|
|
118
119
|
"@vitejs/plugin-react": "^5.1.0",
|
|
119
120
|
"autoprefixer": "^10.4.21",
|
|
120
|
-
"eslint": "^9.39.
|
|
121
|
+
"eslint": "^9.39.1",
|
|
121
122
|
"eslint-config-prettier": "^10.1.8",
|
|
122
123
|
"eslint-config-standard": "^17.1.0",
|
|
123
124
|
"eslint-config-standard-react": "^13.0.0",
|
|
124
125
|
"eslint-plugin-import": "^2.32.0",
|
|
125
126
|
"eslint-plugin-promise": "^7.2.1",
|
|
126
127
|
"eslint-plugin-react": "^7.37.5",
|
|
127
|
-
"eslint-plugin-storybook": "^10.0.
|
|
128
|
+
"eslint-plugin-storybook": "^10.0.4",
|
|
128
129
|
"eslint-plugin-tailwindcss": "^4.0.0-beta.0",
|
|
129
130
|
"globals": "^16.5.0",
|
|
130
131
|
"jsdom": "^27.1.0",
|
|
@@ -133,7 +134,7 @@
|
|
|
133
134
|
"react": "19.2.0",
|
|
134
135
|
"react-dom": "19.2.0",
|
|
135
136
|
"semantic-release": "^25.0.1",
|
|
136
|
-
"storybook": "^10.0.
|
|
137
|
+
"storybook": "^10.0.4",
|
|
137
138
|
"tailwindcss": "^4.1.16",
|
|
138
139
|
"tailwindcss-debug-screens": "^3.0.1",
|
|
139
140
|
"tw-animate-css": "^1.4.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as t,j as r,c as e,O as a,A as c}from"./
|
|
1
|
+
import{u as t,j as r,c as e,O as a,A as c}from"./BE5TseI4.js";import{useState as n,useRef as o}from"react";function s({content:c,children:s,position:l="bottom",className:q,contentClassName:i}){const[p,b]=n(!1),d=o(null),{organization:u}=t();return r.jsxs("div",{className:e("qc:relative qc:inline-block",q),ref:d,onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),onClick:()=>b(!1),onBlur:()=>b(!1),children:[s,p&&r.jsxs("div",{className:e("qc:absolute qc:z-50 qc:whitespace-nowrap qc:rounded qc:bg-neutral-200 qc:px-2 qc:py-1 qc:text-sm qc:text-black",{top:"qc:bottom-full qc:left-1/2 qc:-translate-x-1/2 qc:mb-2",right:"qc:left-full qc:top-1/2 qc:-translate-y-1/2 qc:ml-2",bottom:"qc:top-full qc:left-1/2 qc:-translate-x-1/2 qc:mt-2",left:"qc:right-full qc:top-1/2 qc:-translate-y-1/2 qc:mr-2"}[l],i),style:a(u),role:"tooltip",children:[c,r.jsx("div",{className:e("qc:absolute qc:h-0 qc:w-0 qc:border-4",{top:"qc:top-full qc:left-1/2 qc:-translate-x-1/2 qc:border-l-transparent qc:border-r-transparent qc:border-b-transparent",right:"qc:right-full qc:top-1/2 qc:-translate-y-1/2 qc:border-t-transparent qc:border-b-transparent qc:border-l-transparent",bottom:"qc:bottom-full qc:left-1/2 qc:-translate-x-1/2 qc:border-l-transparent qc:border-r-transparent qc:border-t-transparent",left:"qc:left-full qc:top-1/2 qc:-translate-y-1/2 qc:border-t-transparent qc:border-b-transparent qc:border-r-transparent"}[l])})]})]})}const l=()=>{const{initializing:r,organization:e,user:a,loadingUser:n}=t(),o=e?.admins?.find(t=>t.email===a?.email)?.role;return{role:o,isSuper:a?.isSuper,loading:n||r,isOwner:o===c.OWNER,isAdmin:o===c.ADMIN,isModerator:o===c.MODERATOR}};export{s as T,l as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as e,u as a,j as s,J as l,T as o,g as r,P as i}from"./BE5TseI4.js";import{useState as t}from"react";import{I as n}from"./B1r-QO-6.js";import{S as c}from"./DT_P8FaG.js";import{u as d,C as m,o as p,c as g,a as u}from"./-74yB4f5.js";const h=g().shape({email:u().required("Please enter your email").email("Enter a valid email"),password:u().required("Please enter your password").min(8,"Min password length is 8")}),j=()=>{const[g,u]=t(!1),[j,f]=t(!1),[x,w]=t({google:!1,apple:!1}),[y,q]=t(null),v=e(),{control:b,handleSubmit:C,formState:{errors:N}}=d({defaultValues:{email:"",password:""},mode:"onSubmit",resolver:p(h)}),{loginUsingEmail:S,loginWithGoogle:P,loginWithApple:k}=a(),B=async(e,a)=>{w(a=>({...a,[e]:!0})),q(null);try{await a()}catch(a){q(a.message||`Failed to login with ${e.charAt(0).toUpperCase()+e.slice(1)}`)}finally{w(a=>({...a,[e]:!1}))}};return s.jsxs("div",{className:"qc:w-full qc:space-y-6 qc:bg-background",children:[s.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:C(async e=>{const{email:a,password:s}=e;f(!0);try{const e=await S(a.toLowerCase(),s);e?.error&&q(e.error)}catch(e){q(e)}finally{f(!1)}}),className:"qc:space-y-6",children:[s.jsxs("div",{className:"qc:space-y-9",children:[s.jsx(m,{name:"email",control:b,render:({field:{value:e,onChange:a,onBlur:l}})=>s.jsx(n,{label:"Email",disabled:j,type:"email",value:e,onChange:a,onBlur:l,autoComplete:"email",error:N.email?.message})}),s.jsx(m,{name:"password",control:b,render:({field:{value:e,onChange:a,onBlur:o}})=>s.jsxs("div",{className:"qc:relative",children:[s.jsx(n,{label:"Password",disabled:j,type:g?"text":"password",value:e,onChange:a,onBlur:o,autoComplete:"current-password",error:N.password?.message}),s.jsx(l,{variant:"ghost",color:"primary",className:"qc:absolute qc:right-0 qc:top-8",icon:g?"mdi:eye-outline":"mdi:eye-off-outline",onClick:()=>u(!g)})]})})]}),y&&s.jsx(o,{align:"center",weight:"medium",color:"error",children:y}),s.jsx("div",{className:"qc:flex qc:justify-end",children:s.jsx(r,{to:i.FORGOT_PASSWORD,state:v?.state,children:s.jsx(o,{variant:"h6",className:"qc:w-fit",children:"Forgot password?"})})}),s.jsx(l,{type:"submit",color:"primary",className:"qc:w-full",loading:j,disabled:j,children:"Login"})]}),s.jsxs("div",{className:"qc:grid qc:grid-cols-2 qc:gap-4",children:[s.jsx(c,{disabled:j||x.google||x.apple,loading:x.google,onClick:()=>B("google",P),provider:"google"}),s.jsx(c,{disabled:j||x.google||x.apple,loading:x.apple,onClick:()=>B("apple",k),provider:"apple"})]})]})};export{j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e,j as c,c as t}from"./
|
|
1
|
+
import{u as e,j as c,c as t}from"./BE5TseI4.js";const r=({label:r,type:s="text",step:o=1,disabled:q,error:a,info:d,iconSVG:i,className:l="",...n})=>{const{props:{textClassName:m}}=e();return c.jsxs("div",{className:"qc:relative",children:[r&&c.jsx("div",{className:"qc:mb-1 qc:flex qc:items-center qc:gap-1",children:c.jsx("label",{className:t("qc:select-none qc:text-sm qc:font-medium",m,q?"qc:text-muted":"qc:text-foreground"),children:r})}),c.jsx("input",{type:s,disabled:q,step:"number"===s?o:void 0,"aria-invalid":!!a,className:t("qc:text-foreground qc:border-border qc:shadow-outer qc:focus:border-primary qc:focus:ring-primary qc:peer qc:w-full qc:rounded qc:border qc:p-2 qc:focus:outline-none",q?"qc:text-muted qc:bg-transparent":"qc:text-foreground qc:bg-white",a?"qc:border-destructive":"qc:border-border",i?"qc:pl-9":"",m,l),...n}),c.jsx("div",{className:t("qc:text-destructive qc:absolute qc:left-0 qc:flex qc:items-center qc:gap-1 qc:text-xs qc:transition-all qc:duration-300 qc:md:text-sm",a?"qc:-bottom-5 qc:opacity-100":"qc:-bottom-1 qc:opacity-0",m),children:c.jsx("label",{children:a})})]})};export{r as I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,c as e}from"./
|
|
1
|
+
import{j as t,c as e}from"./BE5TseI4.js";import*as r from"react";import{useRef as i,useState as s}from"react";var o=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],n=t=>{let e=0;for(let r=0;r<t.length;r++){let i=t[r];e=83*e+o.indexOf(i)}return e},a=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},h=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},l=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),c=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},u=t=>{let e=t>>8&255,r=255&t;return[a(t>>16),a(e),a(r)]},p=(t,e)=>{let r=Math.floor(t/361),i=Math.floor(t/19)%19,s=t%19;return[l((r-9)/9,2)*e,l((i-9)/9,2)*e,l((s-9)/9,2)*e]},d=(t,e,r,i)=>{(t=>{if(!t||t.length<6)throw new c("The blurhash string must be at least 6 characters");let e=n(t[0]),r=Math.floor(e/9)+1,i=e%9+1;if(t.length!==4+2*i*r)throw new c(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*i*r}`)})(t),i|=1;let s=n(t[0]),o=Math.floor(s/9)+1,a=s%9+1,l=(n(t[1])+1)/166,d=new Array(a*o);for(let e=0;e<d.length;e++)if(0===e){let r=n(t.substring(2,6));d[e]=u(r)}else{let r=n(t.substring(4+2*e,6+2*e));d[e]=p(r,l*i)}let b=4*e,f=new Uint8ClampedArray(b*r);for(let t=0;t<r;t++)for(let i=0;i<e;i++){let s=0,n=0,l=0;for(let h=0;h<o;h++)for(let o=0;o<a;o++){let c=Math.cos(Math.PI*i*o/e)*Math.cos(Math.PI*t*h/r),u=d[o+h*a];s+=u[0]*c,n+=u[1]*c,l+=u[2]*c}let c=h(s),u=h(n),p=h(l);f[4*i+0+t*b]=c,f[4*i+1+t*b]=u,f[4*i+2+t*b]=p,f[4*i+3+t*b]=255}return f},b=Object.defineProperty,f=Object.defineProperties,g=Object.getOwnPropertyDescriptors,w=Object.getOwnPropertySymbols,m=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable,y=(t,e,r)=>e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,V=(t,e)=>{for(var r in e||(e={}))m.call(e,r)&&y(t,r,e[r]);if(w)for(var r of w(e))v.call(e,r)&&y(t,r,e[r]);return t},M=(t,e)=>f(t,g(e)),I=(t,e)=>{var r={};for(var i in t)m.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&w)for(var i of w(t))e.indexOf(i)<0&&v.call(t,i)&&(r[i]=t[i]);return r},q=class extends r.PureComponent{constructor(){super(...arguments),this.canvas=null,this.handleRef=t=>{this.canvas=t,this.draw()},this.draw=()=>{let{hash:t,height:e,punch:r,width:i}=this.props;if(this.canvas){let s=d(t,i,e,r),o=this.canvas.getContext("2d"),n=o.createImageData(i,e);n.data.set(s),o.putImageData(n,0,0)}}}componentDidUpdate(){this.draw()}render(){let t=this.props,{hash:e,height:i,width:s}=t,o=I(t,["hash","height","width"]);return r.createElement("canvas",M(V({},o),{height:i,width:s,ref:this.handleRef}))}};q.defaultProps={height:128,width:128};var C={position:"absolute",top:0,bottom:0,left:0,right:0,width:"100%",height:"100%"};(class extends r.PureComponent{componentDidUpdate(){if(this.props.resolutionX<=0)throw new Error("resolutionX must be larger than zero");if(this.props.resolutionY<=0)throw new Error("resolutionY must be larger than zero")}render(){let t=this.props,{hash:e,height:i,width:s,punch:o,resolutionX:n,resolutionY:a,style:h}=t,l=I(t,["hash","height","width","punch","resolutionX","resolutionY","style"]);return r.createElement("div",M(V({},l),{style:M(V({display:"inline-block",height:i,width:s},h),{position:"relative"})}),r.createElement(q,{hash:e,height:a,width:n,punch:o,style:C}))}}).defaultProps={height:128,width:128,resolutionX:32,resolutionY:32};var j=Object.defineProperty,k=(t,e,r)=>((t,e,r)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r),O=new Map,x=new WeakMap,E=0;function P(t){return Object.keys(t).sort().filter(e=>void 0!==t[e]).map(e=>`${e}_${"root"===e?function(t){return t?(x.has(t)||(E+=1,x.set(t,E.toString())),x.get(t)):"0"}(t.root):t[e]}`).toString()}function N(t,e,r={},i=undefined){if(typeof window.IntersectionObserver>"u"&&void 0!==i){const s=t.getBoundingClientRect();return e(i,{isIntersecting:i,target:t,intersectionRatio:"number"==typeof r.threshold?r.threshold:0,time:0,boundingClientRect:s,intersectionRect:s,rootBounds:s}),()=>{}}const{id:s,observer:o,elements:n}=function(t){const e=P(t);let r=O.get(e);if(!r){const i=new Map;let s;const o=new IntersectionObserver(e=>{e.forEach(e=>{var r;const o=e.isIntersecting&&s.some(t=>e.intersectionRatio>=t);t.trackVisibility&&typeof e.isVisible>"u"&&(e.isVisible=o),null==(r=i.get(e.target))||r.forEach(t=>{t(o,e)})})},t);s=o.thresholds||(Array.isArray(t.threshold)?t.threshold:[t.threshold||0]),r={id:e,observer:o,elements:i},O.set(e,r)}return r}(r),a=n.get(t)||[];return n.has(t)||n.set(t,a),a.push(e),o.observe(t),function(){a.splice(a.indexOf(e),1),0===a.length&&(n.delete(t),o.unobserve(t)),0===n.size&&(o.disconnect(),O.delete(s))}}var R=class extends r.Component{constructor(t){super(t),k(this,"node",null),k(this,"_unobserveCb",null),k(this,"lastInView"),k(this,"handleNode",t=>{this.node&&(this.unobserve(),!t&&!this.props.triggerOnce&&!this.props.skip&&(this.setState({inView:!!this.props.initialInView,entry:void 0}),this.lastInView=this.props.initialInView)),this.node=t||null,this.observeNode()}),k(this,"handleChange",(t,e)=>{const r=this.lastInView;this.lastInView=t,(void 0!==r||t)&&(t&&this.props.triggerOnce&&this.unobserve(),function(t){return"function"!=typeof t.children}(this.props)||this.setState({inView:t,entry:e}),this.props.onChange&&this.props.onChange(t,e))}),this.state={inView:!!t.initialInView,entry:void 0},this.lastInView=t.initialInView}componentDidMount(){this.unobserve(),this.observeNode()}componentDidUpdate(t){(t.rootMargin!==this.props.rootMargin||t.root!==this.props.root||t.threshold!==this.props.threshold||t.skip!==this.props.skip||t.trackVisibility!==this.props.trackVisibility||t.delay!==this.props.delay)&&(this.unobserve(),this.observeNode())}componentWillUnmount(){this.unobserve()}observeNode(){if(!this.node||this.props.skip)return;const{threshold:t,root:e,rootMargin:r,trackVisibility:i,delay:s,fallbackInView:o}=this.props;void 0===this.lastInView&&(this.lastInView=this.props.initialInView),this._unobserveCb=N(this.node,this.handleChange,{threshold:t,root:e,rootMargin:r,trackVisibility:i,delay:s},o)}unobserve(){this._unobserveCb&&(this._unobserveCb(),this._unobserveCb=null)}render(){const{children:t}=this.props;if("function"==typeof t){const{inView:e,entry:r}=this.state;return t({inView:e,entry:r,ref:this.handleNode})}const{as:e,triggerOnce:i,threshold:s,root:o,rootMargin:n,onChange:a,skip:h,trackVisibility:l,delay:c,initialInView:u,fallbackInView:p,...d}=this.props;return r.createElement(e||"div",{ref:this.handleNode,...d},t)}};const z=({src:r,alt:o,delayTime:n=0,threshold:a=.5,blurhash:h="LEHV6nWB2yk8pyo0adR*.7kCMdnj",wrapperClassName:l="qc:size-full",sizeMode:c="cover",position:u="center",onClick:p})=>{const d=i(null),b=i(null),[f,g]=s(!1),[w,m]=s(!1);return t.jsxs(R,{as:"div",className:e(l,"qc:relative qc:overflow-hidden"),threshold:a,onChange:t=>{t?b.current||(n<=0?g(!0):b.current=setTimeout(()=>g(!0),n)):b.current&&(clearTimeout(b.current),b.current=null)},children:[t.jsx(q,{className:"qc:size-full qc:blur-2xl",hash:h}),t.jsx("img",{alt:o,ref:d,src:f?r:null,onLoad:()=>m(!0),className:e("qc:bg-background qc:absolute qc:left-0 qc:top-0 qc:size-full qc:object-center qc:transition-all qc:duration-300",w?"qc:scale-100 qc:opacity-100":"qc:scale-95 qc:opacity-0","contain"===c?"qc:object-contain":"qc:object-cover","top"===u?"qc:object-top":"bottom"===u?"qc:object-bottom":"qc:object-center"),onClick:p})]})};export{R as I,z as L,d as j};
|