@verifiedinc-public/shared-ui-elements 9.5.1 → 9.5.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.
@@ -1 +1 @@
1
- "use strict";import{useMemo as c,useEffect as v}from"react";import i from"lodash";const p=e=>i.chain(e).mapValues(r=>({name:r.brandName,value:r.brandUuid,_raw:r})).toArray().value();function f({value:e,multiple:r=!1,onChange:n,brands:s,maximumSelectedBrands:o,defaultBrandUuids:d}){const m=c(()=>(s??[]).map(a=>a),[s]),t=c(()=>i.sortBy(p(m),[a=>!a._raw.isLiveBrand]),[m]);return v(()=>{if(!t.length)return;const a=d?t.filter(l=>d.includes(l.value)):[];if(r&&Array.isArray(e)){if(!e.length&&a.length)return n?.(a.slice(0,o));const l=i.map(t,"value");!e.every(u=>l.includes(u.value))&&a.length&&n?.(a.slice(0,o))}else{const l=a[0];if(!Array.isArray(e)){if(!e&&l)return n?.(l);const u=i.map(t,"value");!(e&&u.includes(e.value))&&l&&n?.(l)}}},[t]),{brandOptions:t}}export{p as toOption,f as useBrandFilterInput};
1
+ "use strict";import{useMemo as m,useEffect as v}from"react";import f from"lodash/map";import p from"lodash/sortBy";const c=e=>e.map(r=>({name:r.brandName,value:r.brandUuid,_raw:r}));function y({value:e,multiple:r=!1,onChange:a,brands:u,maximumSelectedBrands:t,defaultBrandUuids:o}){const d=m(()=>(u??[]).map(n=>n),[u]),i=m(()=>p(c(d),[n=>!n._raw.isLiveBrand]),[d]);return v(()=>{if(!i.length)return;const n=o?i.filter(l=>o.includes(l.value)):[];if(r&&Array.isArray(e)){if(!e.length&&n.length)return a?.(n.slice(0,t));const l=f(i,"value");!e.every(s=>l.includes(s.value))&&n.length&&a?.(n.slice(0,t))}else{const l=n[0];if(!Array.isArray(e)){if(!e&&l)return a?.(l);const s=f(i,"value");!(e&&s.includes(e.value))&&l&&a?.(l)}}},[i]),{brandOptions:i}}export{c as toOption,y as useBrandFilterInput};
@@ -1 +1 @@
1
- "use strict";import t from"lodash";import{MandatoryEnum as l}from"../types/mandatoryEnum.mjs";import{fields as p}from"../../form/NewOneClickForm/core/fields/index.mjs";function d(r){return t.upperFirst(t.camelCase(o(r)))+"Credential"}function o(r){const n=r.replace("Credential","");return t.lowerFirst(t.camelCase(n))}function u(r){const n=o(r),a=d(r),e=p[n];if(!e)return{type:r,mandatory:l.NO,description:"",allowUserInput:!0,multi:!1};if("children"in e&&e.children){const s=e.children,c=Object.keys(s).map(i=>u(i)).filter(i=>i!==null);return{type:a,mandatory:l.NO,description:"",allowUserInput:!0,multi:!1,children:c}}return{type:a,mandatory:l.NO,description:"",allowUserInput:!0,multi:!1}}export{u as buildDataFieldValue};
1
+ "use strict";import l from"lodash/camelCase";import d from"lodash/lowerFirst";import c from"lodash/upperFirst";import{MandatoryEnum as i}from"../types/mandatoryEnum.mjs";import{fields as s}from"../../form/NewOneClickForm/core/fields/index.mjs";function f(t){return c(l(a(t)))+"Credential"}function a(t){const e=t.replace("Credential","");return d(l(e))}function m(t){const e=a(t),o=f(t),r=s[e];if(!r)return{type:t,mandatory:i.NO,description:"",allowUserInput:!0,multi:!1};if("children"in r&&r.children){const u=r.children,p=Object.keys(u).map(n=>m(n)).filter(n=>n!==null);return{type:o,mandatory:i.NO,description:"",allowUserInput:!0,multi:!1,children:p}}return{type:o,mandatory:i.NO,description:"",allowUserInput:!0,multi:!1}}export{m as buildDataFieldValue};
@@ -1 +1 @@
1
- "use strict";import g from"lodash";import{stringToHashedColor as m}from"../../../utils/uuidColor.mjs";function v(s){const{brands:y,colorMap:l,data:c,keyValue:p}=s,o=new Map;y.forEach(({_raw:a})=>{(c?.filter(r=>r.brandUuid===a.brandUuid)??[]).forEach(r=>{const d=r.keyword??r.brandUuid;if(!d)return;const i=(r.interval??[]).map(t=>({date:+new Date(t.date),value:Number(t[p]||0)})).filter(t=>s.filterOutZeroValues?t.value>0:!0);if(o.has(d)){const t=o.get(d);if(!t)return;const u=[...t.chartData,...i],b=new Map;u.forEach(({date:n,value:e})=>{b.set(n,(b.get(n)??0)+e)});const w=Array.from(b.entries()).map(([n,e])=>({date:n,value:e})).sort((n,e)=>n.date-e.date);o.set(d,{keyword:r.keyword,brandUuid:a.brandUuid,brandName:a.brandName,brandColor:l.get(a.brandUuid),brandIntegrationType:a.integrationType,chartData:w})}else o.set(d,{keyword:r.keyword,brandUuid:a.brandUuid,brandName:a.brandName,brandColor:l.get(a.brandUuid),brandIntegrationType:a.integrationType,chartData:i})})});const f=a=>a==="hosted"||a==="sdk"?"SDK":a==="non-hosted"||a==="api"?"API":a,h=({keyword:a,brandColor:r,brandUuid:d})=>a?m(a):r??m(d),U=Array.from(o.values()).map(({keyword:a,brandUuid:r,brandName:d,brandColor:i,brandIntegrationType:t,chartData:u})=>({uuid:a??r,name:a??d,description:a?"":f(t),color:h({keyword:a,brandColor:i,brandUuid:r}),chartData:u,brandUuid:a?r:void 0,brandName:a?d:void 0}));return g.chain(U).sortBy(a=>a.name).toArray().value()}export{v as mapSeriesTimeSeriesData};
1
+ "use strict";import g from"lodash/sortBy";import{stringToHashedColor as m}from"../../../utils/uuidColor.mjs";function k(s){const{brands:p,colorMap:l,data:c,keyValue:y}=s,e=new Map;p.forEach(({_raw:a})=>{(c?.filter(r=>r.brandUuid===a.brandUuid)??[]).forEach(r=>{const d=r.keyword??r.brandUuid;if(!d)return;const i=(r.interval??[]).map(t=>({date:+new Date(t.date),value:Number(t[y]||0)})).filter(t=>s.filterOutZeroValues?t.value>0:!0);if(e.has(d)){const t=e.get(d);if(!t)return;const b=[...t.chartData,...i],u=new Map;b.forEach(({date:n,value:o})=>{u.set(n,(u.get(n)??0)+o)});const w=Array.from(u.entries()).map(([n,o])=>({date:n,value:o})).sort((n,o)=>n.date-o.date);e.set(d,{keyword:r.keyword,brandUuid:a.brandUuid,brandName:a.brandName,brandColor:l.get(a.brandUuid),brandIntegrationType:a.integrationType,chartData:w})}else e.set(d,{keyword:r.keyword,brandUuid:a.brandUuid,brandName:a.brandName,brandColor:l.get(a.brandUuid),brandIntegrationType:a.integrationType,chartData:i})})});const f=a=>a==="hosted"||a==="sdk"?"SDK":a==="non-hosted"||a==="api"?"API":a,U=({keyword:a,brandColor:r,brandUuid:d})=>a?m(a):r??m(d),h=Array.from(e.values()).map(({keyword:a,brandUuid:r,brandName:d,brandColor:i,brandIntegrationType:t,chartData:b})=>({uuid:a??r,name:a??d,description:a?"":f(t),color:U({keyword:a,brandColor:i,brandUuid:r}),chartData:b,brandUuid:a?r:void 0,brandName:a?d:void 0}));return g(h,a=>a.name)}export{k as mapSeriesTimeSeriesData};
@@ -1 +1 @@
1
- "use strict";var y=Object.defineProperty,b=(n,e,t)=>e in n?y(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,l=(n,e,t)=>b(n,typeof e!="symbol"?e+"":e,t);import{z as v}from"zod";import{isEqual as g,cloneDeep as m}from"lodash";class f{constructor(e,t,s,i,r={}){if(l(this,"id"),l(this,"_defaultValue"),l(this,"_value"),l(this,"schema"),l(this,"children"),l(this,"touched"),l(this,"allowUserInput"),l(this,"mandatory"),l(this,"multi"),l(this,"variants"),l(this,"description"),this.id=e,this._defaultValue=t,this._value=s,this.children=r.children,this.touched=!1,this.allowUserInput=r.allowUserInput??!0,this.mandatory=r.mandatory??"no",this.multi=r.multi??!1,this.variants=r.variants,this.description=r.description,i.characteristics.inputType==="composite"&&r.children)if("_def"in i.zodSchema&&i.zodSchema._def.typeName==="ZodEffects")this.schema=i;else{let a;if("shape"in i.zodSchema)a=i.zodSchema;else throw new Error("Composite field could not be modified.");const h=a.shape,o={};Object.entries(r.children).forEach(([c,u])=>{if(h[c]){const d=h[c];u.isRequired?d instanceof v.ZodString?o[c]=d.refine(p=>!u.isRequired&&u.isEmpty?!0:p!==""&&p!==null&&p!==void 0,`${u.schema.characteristics.label} is required`):o[c]=d:o[c]=d.optional()}}),this.schema={...i,zodSchema:v.object(o)}}else this.schema={...i,zodSchema:i.zodSchema.refine(a=>!this.isRequired&&this.isEmpty?!0:a!==""&&a!==null&&a!==void 0,`${i.characteristics.label} is required`)}}get defaultValue(){if(this.schema.characteristics.inputType==="composite"&&this.children){const e={};return Object.entries(this.children).forEach(([t,s])=>{e[t]=s.defaultValue}),Object.keys(e).length>0?e:void 0}return this._defaultValue}get value(){if(this.schema.characteristics.inputType==="composite"&&this.children){const e={};return Object.entries(this.children).forEach(([t,s])=>{s.schema.characteristics.inputType==="composite"?e[t]=s.value:e[t]=s.isEmpty?"":s.value}),Object.keys(e).length>0?e:void 0}return this._value}set value(e){this._value=e}get hasVariants(){return this.variants?this.variants.length>1:!1}get isValid(){return this.errors===null}get isRequired(){return this.mandatory==="yes"||this.mandatory==="if_available"}get isDisabled(){return!this.allowUserInput}get isEmpty(){const e=t=>t==null||t===""?!0:typeof t=="object"&&t!==null?Object.values(t).every(e):!1;return e(this.value)}get isDirty(){return this.schema.characteristics.inputType==="composite"&&this.children?Object.values(this.children).some(e=>e.isDirty):!g(this._value,this._defaultValue)}get errors(){let e=null;const t={};if(this.schema.characteristics.inputType==="composite"&&this.children){const s={};Object.entries(this.children).forEach(([r,a])=>{a.isEmpty&&!a.isRequired?s[r]=void 0:s[r]=a.value});const i=this.schema.zodSchema.safeParse(s);e=i.success?null:i.error,e!=null&&e.issues&&e.issues.length>0||Object.entries(this.children).forEach(([r,a])=>{const h=a.errors;h&&(t[r]=h)})}else if(!this.isRequired&&this.isEmpty)e=null;else{const s=this.schema.zodSchema.safeParse(this.value);e=s.success?null:s.error}return!e&&Object.keys(t).length===0?null:{error:e,childrenErrors:t}}get errorMessage(){var e,t,s,i;return((i=(s=(t=(e=this.errors)==null?void 0:e.error)==null?void 0:t.issues)==null?void 0:s.find(r=>typeof r.message=="string"))==null?void 0:i.message)??null}get displayValue(){if(typeof this.schema.format=="function")if(this.schema.characteristics.inputType==="composite"&&this.children){const e={};return Object.entries(this.children).forEach(([t,s])=>{e[t]=s.value}),this.schema.format(e)??null}else return this.isEmpty?null:this.schema.format(this.value)??this.value;return this.value}replaceWithVariant(e){if(!this.variants){console.warn(`Field ${this.id} has no variants`);return}const t=this.variants.find(i=>i.id===e);if(!t){console.warn(`Variant ${e} not found for field ${this.id}`);return}const s=this.variants;this.id=t.id,this.schema=t.schema,this.description=t.description,this.allowUserInput=t.allowUserInput,this.mandatory=t.mandatory,this.multi=t.multi,this._value=t.value&&typeof t.value=="object"?m(t.value):t.value,this._defaultValue=t.defaultValue&&typeof t.defaultValue=="object"?m(t.defaultValue):t.defaultValue,this.variants=s,t.children?(this.children={},Object.entries(t.children).forEach(([i,r])=>{this.children&&(this.children[i]=this.deepCloneFormField(r))})):this.children=void 0}deepCloneFormField(e){const t=e._value&&typeof e._value=="object"?m(e._value):e._value,s=e._defaultValue&&typeof e._defaultValue=="object"?m(e._defaultValue):e._defaultValue;let i;return e.children&&(i={},Object.entries(e.children).forEach(([r,a])=>{i&&(i[r]=this.deepCloneFormField(a))})),new f(e.id,s,t,e.schema,{children:i,allowUserInput:e.allowUserInput,mandatory:e.mandatory,multi:e.multi,variants:e.variants,description:e.description})}}export{f as FormField};
1
+ "use strict";var y=Object.defineProperty,b=(n,e,t)=>e in n?y(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,l=(n,e,t)=>b(n,typeof e!="symbol"?e+"":e,t);import{z as v}from"zod";import m from"lodash/cloneDeep";import g from"lodash/isEqual";class p{constructor(e,t,s,i,r={}){if(l(this,"id"),l(this,"_defaultValue"),l(this,"_value"),l(this,"schema"),l(this,"children"),l(this,"touched"),l(this,"allowUserInput"),l(this,"mandatory"),l(this,"multi"),l(this,"variants"),l(this,"description"),this.id=e,this._defaultValue=t,this._value=s,this.children=r.children,this.touched=!1,this.allowUserInput=r.allowUserInput??!0,this.mandatory=r.mandatory??"no",this.multi=r.multi??!1,this.variants=r.variants,this.description=r.description,i.characteristics.inputType==="composite"&&r.children)if("_def"in i.zodSchema&&i.zodSchema._def.typeName==="ZodEffects")this.schema=i;else{let a;if("shape"in i.zodSchema)a=i.zodSchema;else throw new Error("Composite field could not be modified.");const h=a.shape,o={};Object.entries(r.children).forEach(([c,u])=>{if(h[c]){const d=h[c];u.isRequired?d instanceof v.ZodString?o[c]=d.refine(f=>!u.isRequired&&u.isEmpty?!0:f!==""&&f!==null&&f!==void 0,`${u.schema.characteristics.label} is required`):o[c]=d:o[c]=d.optional()}}),this.schema={...i,zodSchema:v.object(o)}}else this.schema={...i,zodSchema:i.zodSchema.refine(a=>!this.isRequired&&this.isEmpty?!0:a!==""&&a!==null&&a!==void 0,`${i.characteristics.label} is required`)}}get defaultValue(){if(this.schema.characteristics.inputType==="composite"&&this.children){const e={};return Object.entries(this.children).forEach(([t,s])=>{e[t]=s.defaultValue}),Object.keys(e).length>0?e:void 0}return this._defaultValue}get value(){if(this.schema.characteristics.inputType==="composite"&&this.children){const e={};return Object.entries(this.children).forEach(([t,s])=>{s.schema.characteristics.inputType==="composite"?e[t]=s.value:e[t]=s.isEmpty?"":s.value}),Object.keys(e).length>0?e:void 0}return this._value}set value(e){this._value=e}get hasVariants(){return this.variants?this.variants.length>1:!1}get isValid(){return this.errors===null}get isRequired(){return this.mandatory==="yes"||this.mandatory==="if_available"}get isDisabled(){return!this.allowUserInput}get isEmpty(){const e=t=>t==null||t===""?!0:typeof t=="object"&&t!==null?Object.values(t).every(e):!1;return e(this.value)}get isDirty(){return this.schema.characteristics.inputType==="composite"&&this.children?Object.values(this.children).some(e=>e.isDirty):!g(this._value,this._defaultValue)}get errors(){let e=null;const t={};if(this.schema.characteristics.inputType==="composite"&&this.children){const s={};Object.entries(this.children).forEach(([r,a])=>{a.isEmpty&&!a.isRequired?s[r]=void 0:s[r]=a.value});const i=this.schema.zodSchema.safeParse(s);e=i.success?null:i.error,e!=null&&e.issues&&e.issues.length>0||Object.entries(this.children).forEach(([r,a])=>{const h=a.errors;h&&(t[r]=h)})}else if(!this.isRequired&&this.isEmpty)e=null;else{const s=this.schema.zodSchema.safeParse(this.value);e=s.success?null:s.error}return!e&&Object.keys(t).length===0?null:{error:e,childrenErrors:t}}get errorMessage(){var e,t,s,i;return((i=(s=(t=(e=this.errors)==null?void 0:e.error)==null?void 0:t.issues)==null?void 0:s.find(r=>typeof r.message=="string"))==null?void 0:i.message)??null}get displayValue(){if(typeof this.schema.format=="function")if(this.schema.characteristics.inputType==="composite"&&this.children){const e={};return Object.entries(this.children).forEach(([t,s])=>{e[t]=s.value}),this.schema.format(e)??null}else return this.isEmpty?null:this.schema.format(this.value)??this.value;return this.value}replaceWithVariant(e){if(!this.variants){console.warn(`Field ${this.id} has no variants`);return}const t=this.variants.find(i=>i.id===e);if(!t){console.warn(`Variant ${e} not found for field ${this.id}`);return}const s=this.variants;this.id=t.id,this.schema=t.schema,this.description=t.description,this.allowUserInput=t.allowUserInput,this.mandatory=t.mandatory,this.multi=t.multi,this._value=t.value&&typeof t.value=="object"?m(t.value):t.value,this._defaultValue=t.defaultValue&&typeof t.defaultValue=="object"?m(t.defaultValue):t.defaultValue,this.variants=s,t.children?(this.children={},Object.entries(t.children).forEach(([i,r])=>{this.children&&(this.children[i]=this.deepCloneFormField(r))})):this.children=void 0}deepCloneFormField(e){const t=e._value&&typeof e._value=="object"?m(e._value):e._value,s=e._defaultValue&&typeof e._defaultValue=="object"?m(e._defaultValue):e._defaultValue;let i;return e.children&&(i={},Object.entries(e.children).forEach(([r,a])=>{i&&(i[r]=this.deepCloneFormField(a))})),new p(e.id,s,t,e.schema,{children:i,allowUserInput:e.allowUserInput,mandatory:e.mandatory,multi:e.multi,variants:e.variants,description:e.description})}}export{p as FormField};
@@ -1 +1 @@
1
- "use strict";import{cloneDeep as y}from"lodash";import{fields as p}from"../fields/index.mjs";import{FormField as u}from"./formField.mjs";import{normalizeCredentialType as f}from"./utils.mjs";import{fieldInputTypes as d}from"../fields/constants.mjs";class v{createFromCredential(i,o,e,r){var n;const a=p[i.type];if(!a)throw new Error(`Invalid credential type: ${i.type}`);const l=a.key;let t;if(a.characteristics.inputType===d.composite)if(i.value&&Object.keys(i.value).length>0)if(o&&Object.keys(o).length>0){const s={};Object.keys(o).forEach(c=>{c in i.value&&(s[c]=i.value[c])}),t=Object.keys(s).length>0?s:void 0}else t=i.value;else t=void 0;else t=(n=i.value)==null?void 0:n[l];return new u(i.uuid,t,t,a,{children:o,allowUserInput:e?.allowUserInput??!0,mandatory:e?.mandatory??"no",multi:e?.multi??!1,variants:r,description:e?.description})}createFromSchema(i,o){let e,r;const n={allowUserInput:i.allowUserInput??!0,mandatory:i.mandatory??"no",multi:i.multi??!1,description:i.description};if(o.characteristics.inputType===d.composite&&i.children){const l={};for(const t of i.children){const s=f(t.type),c=p[s];if(c){const m=this.createFromSchema(t,c);l[c.key]=m}}r=Object.keys(l).length>0?l:void 0}if(o.characteristics.inputType===d.composite)if(r&&Object.keys(r).length>0){const l={};Object.entries(r).forEach(([t,s])=>{l[t]=s.defaultValue}),e=l}else e=void 0;else e="";const a=typeof e=="object"&&e!==null?y(e):e;return new u(void 0,e,a,o,{children:r,allowUserInput:n.allowUserInput,mandatory:n.mandatory,multi:n.multi,variants:void 0,description:n.description})}}export{v as FormFieldBuilder};
1
+ "use strict";import y from"lodash/cloneDeep";import{fields as u}from"../fields/index.mjs";import{FormField as p}from"./formField.mjs";import{normalizeCredentialType as f}from"./utils.mjs";import{fieldInputTypes as d}from"../fields/constants.mjs";class v{createFromCredential(i,o,e,l){var n;const a=u[i.type];if(!a)throw new Error(`Invalid credential type: ${i.type}`);const r=a.key;let t;if(a.characteristics.inputType===d.composite)if(i.value&&Object.keys(i.value).length>0)if(o&&Object.keys(o).length>0){const s={};Object.keys(o).forEach(c=>{c in i.value&&(s[c]=i.value[c])}),t=Object.keys(s).length>0?s:void 0}else t=i.value;else t=void 0;else t=(n=i.value)==null?void 0:n[r];return new p(i.uuid,t,t,a,{children:o,allowUserInput:e?.allowUserInput??!0,mandatory:e?.mandatory??"no",multi:e?.multi??!1,variants:l,description:e?.description})}createFromSchema(i,o){let e,l;const n={allowUserInput:i.allowUserInput??!0,mandatory:i.mandatory??"no",multi:i.multi??!1,description:i.description};if(o.characteristics.inputType===d.composite&&i.children){const r={};for(const t of i.children){const s=f(t.type),c=u[s];if(c){const m=this.createFromSchema(t,c);r[c.key]=m}}l=Object.keys(r).length>0?r:void 0}if(o.characteristics.inputType===d.composite)if(l&&Object.keys(l).length>0){const r={};Object.entries(l).forEach(([t,s])=>{r[t]=s.defaultValue}),e=r}else e=void 0;else e="";const a=typeof e=="object"&&e!==null?y(e):e;return new p(void 0,e,a,o,{children:l,allowUserInput:n.allowUserInput,mandatory:n.mandatory,multi:n.multi,variants:void 0,description:n.description})}}export{v as FormFieldBuilder};
@@ -1 +1 @@
1
- "use strict";import{useRef as e,useEffect as m,useLayoutEffect as D}from"react";import{debounce as S}from"lodash";function F({scrollContainerRef:t,virtualizer:L,rowCount:q,hasNewer:w,hasOlder:H,isLoadingNewer:n,isLoadingOlder:T,onLoadNewer:v,onLoadOlder:O,debounceMs:s=300,rearmDistance:i=100,resetKey:z}){const l=e(null),a=e(!1),u=e(!1);m(()=>{const r=t.current;r&&(r.scrollTop=0),l.current=null,a.current=!1,u.current=!1},[z,t]),m(()=>{if(n&&!a.current){const r=t.current;r&&(l.current={scrollHeight:r.scrollHeight,scrollTop:r.scrollTop})}a.current=!!n},[n,t]),D(()=>{const r=t.current,c=l.current;if(r&&c){const o=r.scrollHeight-c.scrollHeight;o>0&&(r.scrollTop=c.scrollTop+o),l.current=null,L.measure()}},[q,L,t]);const d=e(H),g=e(w),p=e(T),f=e(n),y=e(O),E=e(v);d.current=H,g.current=w,p.current=T,f.current=n,y.current=O,E.current=v,m(()=>{const r=t.current;if(!r)return;let c=!1;const o=S(()=>{g.current&&!f.current&&E.current()},s,{leading:!0,trailing:!1}),N=S(()=>{d.current&&!p.current&&y.current()},s,{leading:!0,trailing:!1}),b=()=>{const{scrollTop:h,scrollHeight:x,clientHeight:B}=r,C=x-h-B;x<=B||(h>i&&(c=!0),C>i&&(u.current=!0),c&&g.current&&!f.current&&h<=1&&(c=!1,o()),u.current&&d.current&&!p.current&&C<=1&&(u.current=!1,N()))};return r.addEventListener("scroll",b,{passive:!0}),()=>{r.removeEventListener("scroll",b),o.cancel(),N.cancel()}},[t,s,i])}export{F as useBidirectionalScroll};
1
+ "use strict";import{useRef as e,useEffect as m,useLayoutEffect as D}from"react";import b from"lodash/debounce";function F({scrollContainerRef:t,virtualizer:L,rowCount:q,hasNewer:w,hasOlder:H,isLoadingNewer:n,isLoadingOlder:T,onLoadNewer:v,onLoadOlder:O,debounceMs:s=300,rearmDistance:i=100,resetKey:z}){const o=e(null),a=e(!1),u=e(!1);m(()=>{const r=t.current;r&&(r.scrollTop=0),o.current=null,a.current=!1,u.current=!1},[z,t]),m(()=>{if(n&&!a.current){const r=t.current;r&&(o.current={scrollHeight:r.scrollHeight,scrollTop:r.scrollTop})}a.current=!!n},[n,t]),D(()=>{const r=t.current,c=o.current;if(r&&c){const l=r.scrollHeight-c.scrollHeight;l>0&&(r.scrollTop=c.scrollTop+l),o.current=null,L.measure()}},[q,L,t]);const d=e(H),g=e(w),p=e(T),f=e(n),y=e(O),E=e(v);d.current=H,g.current=w,p.current=T,f.current=n,y.current=O,E.current=v,m(()=>{const r=t.current;if(!r)return;let c=!1;const l=b(()=>{g.current&&!f.current&&E.current()},s,{leading:!0,trailing:!1}),N=b(()=>{d.current&&!p.current&&y.current()},s,{leading:!0,trailing:!1}),x=()=>{const{scrollTop:h,scrollHeight:B,clientHeight:C}=r,S=B-h-C;B<=C||(h>i&&(c=!0),S>i&&(u.current=!0),c&&g.current&&!f.current&&h<=1&&(c=!1,l()),u.current&&d.current&&!p.current&&S<=1&&(u.current=!1,N()))};return r.addEventListener("scroll",x,{passive:!0}),()=>{r.removeEventListener("scroll",x),l.cancel(),N.cancel()}},[t,s,i])}export{F as useBidirectionalScroll};
@@ -1 +1 @@
1
- "use strict";import e from"lodash";function m(r,i){if(e.isArray(r))return r.map(t=>m(t,i));if(e.isObject(r)){let t=e.omit(r,i);return t=e.mapValues(t,o=>m(o,i)),t}else return r}export{m as omitProperties};
1
+ "use strict";import f from"lodash/isArray";import e from"lodash/isObject";import p from"lodash/mapValues";import n from"lodash/omit";function m(o,t){if(f(o))return o.map(r=>m(r,t));if(e(o)){let r=n(o,t);return r=p(r,i=>m(i,t)),r}else return o}export{m as omitProperties};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verifiedinc-public/shared-ui-elements",
3
- "version": "9.5.1",
3
+ "version": "9.5.2",
4
4
  "description": "A set of UI components, utilities that is shareable with the core apps.",
5
5
  "private": false,
6
6
  "sideEffects": false,