@bikdotai/bik-component-library 0.0.435-0 → 0.0.435-1

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,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronRight.svg.js"),i=require("react"),s=require("../checkBox/CheckBox.js"),o=require("../icon-button/IconButton.js"),c=require("../shimmer/ShimmerComponent/BikShimmer.js"),l=require("../tag/Tag.js"),r=require("../tooltips/Tooltip.js"),n=require("../TypographyStyle.js"),a=require("./emptyState.js"),d=require("./style.js");const u=(e,t,i)=>{if(e.length<=t)return e;const s=e.slice(0,t-1);return(i?s.slice(0,s.lastIndexOf(" ")):s)+"..."},h=i=>{const{customCollectionRestriction:c,data:a,selectedCollectionsDispatch:h,setCollectionId:p,isPartiallyChecked:C,setScreen:j,id:x,isChecked:y,isDisabled:g,hideCollectionCheckbox:v,pickerType:m,selectedCollections:b}=i;return e.jsxs(d.CollectionCardStyle,Object.assign({isDisabled:g,onClick:e=>{if(!g){if("COLLECTION"===m)return e.stopPropagation(),h({type:"reset",data:{}}),h({type:"selected",data:{id:x,val:a,isRestricted:c}}),void p(x);p(x),j("products")}},isActive:!!b[x]},{children:[e.jsxs(d.CollectionCardInfoStyle,{children:[!v&&e.jsx(s.CheckBox,{isDisabled:g,isChecked:y,isPartiallyChecked:C,onValueChange:function(e,t,i){null==i||i.stopPropagation(),h(e?{type:"selected",data:{id:x,val:a,isRestricted:c}}:{type:"unselected",data:{id:x}}),p(e?x:"")}}),e.jsx(d.CollectionCardDetailStyle,{children:e.jsx(r.Tooltip,Object.assign({body:a.name,placement:"bottom",delay:400},{children:e.jsxs(d.CollectionNameHolder,{children:[e.jsx(n.TitleRegular,{children:u(a.name,40,!0)}),a.isSmartCollection?e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(l.Tag,{tagText:"Smart Collection",type:"warning"})})):e.jsx(e.Fragment,{})]})}))})]}),"COLLECTION"!==m&&e.jsx(o.IconButton,{height:12,width:12,disabled:g,Icon:t.default})]}))};exports.CollectionsScreen=t=>{const{customCollectionRestriction:s,dataLoading:o,collections:l,selectedCollectionsDispatch:r,setCollectionId:n,selectedCollections:d,setScreen:u,collectionFetcher:p,collectionsDispatch:C,pagingControls:j,storeId:x,setSaveDisabled:y,hideCollectionCheckbox:g,renderWithoutModal:v,pickerType:m}=t,b=i.useRef(null),k=i.useRef(j.curPage),f=!!s&&(null==d?void 0:d.isCustom),[O,S]=i.useState(!1);i.useEffect((()=>{k.current=j.curPage}),[j.curPage]),i.useEffect((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&k.current>0&&(y(!0),S(!0),p(k.current,x).then((e=>{C({type:"paged",data:(null==e?void 0:e.collections)||{}}),j.setCurPage(k.current+1),S(!1),y(!1)})).catch())}),{threshold:1});return b.current&&e.observe(b.current),()=>{b.current&&e.unobserve(b.current)}}),[b]);const E=e=>{var t,i;let s=0,o=0;if(d[e]){const c=null===(t=l[e])||void 0===t?void 0:t.products;c&&Object.keys(c).forEach((e=>{var t;const i=null===(t=c[e])||void 0===t?void 0:t.variants;i&&Object.keys(i).forEach((e=>s+=1))}));const r=null===(i=d[e])||void 0===i?void 0:i.products;return r&&Object.keys(r).forEach((e=>{var t;const i=null===(t=r[e])||void 0===t?void 0:t.variants;i&&Object.keys(i).forEach((e=>o+=1))})),!(s<=0&&o>0)&&(o>0&&s!==o)}return!1};return e.jsxs("div",{children:[Object.keys(l).length?Object.keys(l).map((t=>e.jsx(h,{customCollectionRestriction:s,data:l[t],isDisabled:f&&!(null==d?void 0:d[t]),isChecked:!!(null==d?void 0:d[t]),isPartiallyChecked:E(t),selectedCollectionsDispatch:r,setCollectionId:n,setScreen:u,id:t,hideCollectionCheckbox:g,selectedCollections:d,renderWithoutModal:v,pickerType:m},t))):o?[1,2,3,4,5,6,7,8,9,10].map(((t,i)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(c.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),i))):e.jsx(a.EmptyState,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),e.jsx("div",{ref:b}),O&&[1,2,3,4,5].map(((t,i)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(c.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),i)))]})},exports.truncate=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronRight.svg.js"),i=require("react"),s=require("../checkBox/CheckBox.js"),o=require("../icon-button/IconButton.js"),l=require("../shimmer/ShimmerComponent/BikShimmer.js"),c=require("../tag/Tag.js"),r=require("../tooltips/Tooltip.js"),n=require("../TypographyStyle.js"),a=require("./emptyState.js"),d=require("./style.js");const u=(e,t,i)=>{if(e.length<=t)return e;const s=e.slice(0,t-1);return(i?s.slice(0,s.lastIndexOf(" ")):s)+"..."},h=i=>{const{customCollectionRestriction:l,data:a,selectedCollectionsDispatch:h,setCollectionId:p,isPartiallyChecked:C,setScreen:j,id:x,isChecked:v,isDisabled:y,hideCollectionCheckbox:g,pickerType:m,selectedCollections:b}=i;return e.jsxs(d.CollectionCardStyle,Object.assign({isDisabled:y,onClick:e=>{if(!y){if("COLLECTION"===m)return e.stopPropagation(),h({type:"reset",data:{}}),h({type:"selected",data:{id:x,val:a,isRestricted:l}}),void p(x);p(x),j("products")}},isActive:!!b[x]},{children:[e.jsxs(d.CollectionCardInfoStyle,{children:[!g&&e.jsx(s.CheckBox,{isDisabled:y,isChecked:v,isPartiallyChecked:C,onValueChange:function(e,t,i){null==i||i.stopPropagation(),h(e?{type:"selected",data:{id:x,val:a,isRestricted:l}}:{type:"unselected",data:{id:x}}),p(e?x:"")}}),e.jsx(d.CollectionCardDetailStyle,{children:e.jsx(r.Tooltip,Object.assign({body:a.name,placement:"bottom",delay:400},{children:e.jsxs(d.CollectionNameHolder,{children:[a.name&&e.jsx(n.TitleRegular,{children:u(a.name,40,!0)}),a.isSmartCollection?e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(c.Tag,{tagText:"Smart Collection",type:"warning"})})):e.jsx(e.Fragment,{})]})}))})]}),"COLLECTION"!==m&&e.jsx(o.IconButton,{height:12,width:12,disabled:y,Icon:t.default})]}))};exports.CollectionsScreen=t=>{var s;const{customCollectionRestriction:o,dataLoading:c,collections:r,selectedCollectionsDispatch:n,setCollectionId:d,selectedCollections:u,setScreen:p,collectionFetcher:C,collectionsDispatch:j,pagingControls:x,storeId:v,setSaveDisabled:y,hideCollectionCheckbox:g,renderWithoutModal:m,pickerType:b}=t,k=i.useRef(null),f=i.useRef(x.curPage),O=!!o&&(null==u?void 0:u.isCustom),[S,E]=i.useState(!1);i.useEffect((()=>{f.current=x.curPage}),[x.curPage]),i.useEffect((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&f.current>0&&(y(!0),E(!0),C(f.current,v).then((e=>{j({type:"paged",data:(null==e?void 0:e.collections)||{}}),x.setCurPage(f.current+1),E(!1),y(!1)})).catch())}),{threshold:1});return k.current&&e.observe(k.current),()=>{k.current&&e.unobserve(k.current)}}),[k]);const T=e=>{var t,i;let s=0,o=0;if(u[e]){const l=null===(t=r[e])||void 0===t?void 0:t.products;l&&Object.keys(l).forEach((e=>{var t;const i=null===(t=l[e])||void 0===t?void 0:t.variants;i&&Object.keys(i).forEach((e=>s+=1))}));const c=null===(i=u[e])||void 0===i?void 0:i.products;return c&&Object.keys(c).forEach((e=>{var t;const i=null===(t=c[e])||void 0===t?void 0:t.variants;i&&Object.keys(i).forEach((e=>o+=1))})),!(s<=0&&o>0)&&(o>0&&s!==o)}return!1};return e.jsxs("div",{children:[(null===(s=Object.keys(null!=r?r:{}))||void 0===s?void 0:s.length)?Object.keys(r).map((t=>e.jsx(h,{customCollectionRestriction:o,data:r[t],isDisabled:O&&!(null==u?void 0:u[t]),isChecked:!!(null==u?void 0:u[t]),isPartiallyChecked:T(t),selectedCollectionsDispatch:n,setCollectionId:d,setScreen:p,id:t,hideCollectionCheckbox:g,selectedCollections:u,renderWithoutModal:m,pickerType:b},t))):c?[1,2,3,4,5,6,7,8,9,10].map(((t,i)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(l.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),i))):e.jsx(a.EmptyState,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),e.jsx("div",{ref:k}),S&&[1,2,3,4,5].map(((t,i)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(l.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),i)))]})},exports.truncate=u;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import i from"../../assets/icons/chevronRight.svg.js";import{useRef as c,useState as s,useEffect as r}from"react";import{CheckBox as l}from"../checkBox/CheckBox.js";import{IconButton as n}from"../icon-button/IconButton.js";import{BikShimmer as d}from"../shimmer/ShimmerComponent/BikShimmer.js";import{Tag as a}from"../tag/Tag.js";import{Tooltip as h}from"../tooltips/Tooltip.js";import{TitleRegular as p}from"../TypographyStyle.js";import{EmptyState as m}from"./emptyState.js";import{CollectionCardStyle as u,CollectionCardInfoStyle as C,CollectionCardDetailStyle as v,CollectionNameHolder as b}from"./style.js";const g=(e,t,o)=>{if(e.length<=t)return e;const i=e.slice(0,t-1);return(o?i.slice(0,i.lastIndexOf(" ")):i)+"..."},y=o=>{const{customCollectionRestriction:i,dataLoading:l,collections:n,selectedCollectionsDispatch:a,setCollectionId:h,selectedCollections:p,setScreen:u,collectionFetcher:C,collectionsDispatch:v,pagingControls:b,storeId:g,setSaveDisabled:y,hideCollectionCheckbox:k,renderWithoutModal:j,pickerType:x}=o,O=c(null),E=c(b.curPage),I=!!i&&(null==p?void 0:p.isCustom),[T,S]=s(!1);r((()=>{E.current=b.curPage}),[b.curPage]),r((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&E.current>0&&(y(!0),S(!0),C(E.current,g).then((e=>{v({type:"paged",data:(null==e?void 0:e.collections)||{}}),b.setCurPage(E.current+1),S(!1),y(!1)})).catch())}),{threshold:1});return O.current&&e.observe(O.current),()=>{O.current&&e.unobserve(O.current)}}),[O]);const D=e=>{var t,o;let i=0,c=0;if(p[e]){const s=null===(t=n[e])||void 0===t?void 0:t.products;s&&Object.keys(s).forEach((e=>{var t;const o=null===(t=s[e])||void 0===t?void 0:t.variants;o&&Object.keys(o).forEach((e=>i+=1))}));const r=null===(o=p[e])||void 0===o?void 0:o.products;return r&&Object.keys(r).forEach((e=>{var t;const o=null===(t=r[e])||void 0===t?void 0:t.variants;o&&Object.keys(o).forEach((e=>c+=1))})),!(i<=0&&c>0)&&(c>0&&i!==c)}return!1};return e("div",{children:[Object.keys(n).length?Object.keys(n).map((e=>t(f,{customCollectionRestriction:i,data:n[e],isDisabled:I&&!(null==p?void 0:p[e]),isChecked:!!(null==p?void 0:p[e]),isPartiallyChecked:D(e),selectedCollectionsDispatch:a,setCollectionId:h,setScreen:u,id:e,hideCollectionCheckbox:k,selectedCollections:p,renderWithoutModal:j,pickerType:x},e))):l?[1,2,3,4,5,6,7,8,9,10].map(((e,o)=>t("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:t(d,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),o))):t(m,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),t("div",{ref:O}),T&&[1,2,3,4,5].map(((e,o)=>t("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:t(d,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),o)))]})},f=c=>{const{customCollectionRestriction:s,data:r,selectedCollectionsDispatch:d,setCollectionId:m,isPartiallyChecked:y,setScreen:f,id:k,isChecked:j,isDisabled:x,hideCollectionCheckbox:O,pickerType:E,selectedCollections:I}=c;return e(u,Object.assign({isDisabled:x,onClick:e=>{if(!x){if("COLLECTION"===E)return e.stopPropagation(),d({type:"reset",data:{}}),d({type:"selected",data:{id:k,val:r,isRestricted:s}}),void m(k);m(k),f("products")}},isActive:!!I[k]},{children:[e(C,{children:[!O&&t(l,{isDisabled:x,isChecked:j,isPartiallyChecked:y,onValueChange:function(e,t,o){null==o||o.stopPropagation(),d(e?{type:"selected",data:{id:k,val:r,isRestricted:s}}:{type:"unselected",data:{id:k}}),m(e?k:"")}}),t(v,{children:t(h,Object.assign({body:r.name,placement:"bottom",delay:400},{children:e(b,{children:[t(p,{children:g(r.name,40,!0)}),r.isSmartCollection?t("div",Object.assign({style:{display:"flex"}},{children:t(a,{tagText:"Smart Collection",type:"warning"})})):t(o,{})]})}))})]}),"COLLECTION"!==E&&t(n,{height:12,width:12,disabled:x,Icon:i})]}))};export{y as CollectionsScreen,g as truncate};
1
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import i from"../../assets/icons/chevronRight.svg.js";import{useRef as c,useState as s,useEffect as l}from"react";import{CheckBox as r}from"../checkBox/CheckBox.js";import{IconButton as n}from"../icon-button/IconButton.js";import{BikShimmer as d}from"../shimmer/ShimmerComponent/BikShimmer.js";import{Tag as a}from"../tag/Tag.js";import{Tooltip as h}from"../tooltips/Tooltip.js";import{TitleRegular as p}from"../TypographyStyle.js";import{EmptyState as u}from"./emptyState.js";import{CollectionCardStyle as m,CollectionCardInfoStyle as C,CollectionCardDetailStyle as v,CollectionNameHolder as b}from"./style.js";const g=(e,t,o)=>{if(e.length<=t)return e;const i=e.slice(0,t-1);return(o?i.slice(0,i.lastIndexOf(" ")):i)+"..."},y=o=>{var i;const{customCollectionRestriction:r,dataLoading:n,collections:a,selectedCollectionsDispatch:h,setCollectionId:p,selectedCollections:m,setScreen:C,collectionFetcher:v,collectionsDispatch:b,pagingControls:g,storeId:y,setSaveDisabled:k,hideCollectionCheckbox:j,renderWithoutModal:x,pickerType:O}=o,E=c(null),I=c(g.curPage),T=!!r&&(null==m?void 0:m.isCustom),[S,D]=s(!1);l((()=>{I.current=g.curPage}),[g.curPage]),l((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&I.current>0&&(k(!0),D(!0),v(I.current,y).then((e=>{b({type:"paged",data:(null==e?void 0:e.collections)||{}}),g.setCurPage(I.current+1),D(!1),k(!1)})).catch())}),{threshold:1});return E.current&&e.observe(E.current),()=>{E.current&&e.unobserve(E.current)}}),[E]);const P=e=>{var t,o;let i=0,c=0;if(m[e]){const s=null===(t=a[e])||void 0===t?void 0:t.products;s&&Object.keys(s).forEach((e=>{var t;const o=null===(t=s[e])||void 0===t?void 0:t.variants;o&&Object.keys(o).forEach((e=>i+=1))}));const l=null===(o=m[e])||void 0===o?void 0:o.products;return l&&Object.keys(l).forEach((e=>{var t;const o=null===(t=l[e])||void 0===t?void 0:t.variants;o&&Object.keys(o).forEach((e=>c+=1))})),!(i<=0&&c>0)&&(c>0&&i!==c)}return!1};return e("div",{children:[(null===(i=Object.keys(null!=a?a:{}))||void 0===i?void 0:i.length)?Object.keys(a).map((e=>t(f,{customCollectionRestriction:r,data:a[e],isDisabled:T&&!(null==m?void 0:m[e]),isChecked:!!(null==m?void 0:m[e]),isPartiallyChecked:P(e),selectedCollectionsDispatch:h,setCollectionId:p,setScreen:C,id:e,hideCollectionCheckbox:j,selectedCollections:m,renderWithoutModal:x,pickerType:O},e))):n?[1,2,3,4,5,6,7,8,9,10].map(((e,o)=>t("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:t(d,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),o))):t(u,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),t("div",{ref:E}),S&&[1,2,3,4,5].map(((e,o)=>t("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:t(d,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),o)))]})},f=c=>{const{customCollectionRestriction:s,data:l,selectedCollectionsDispatch:d,setCollectionId:u,isPartiallyChecked:y,setScreen:f,id:k,isChecked:j,isDisabled:x,hideCollectionCheckbox:O,pickerType:E,selectedCollections:I}=c;return e(m,Object.assign({isDisabled:x,onClick:e=>{if(!x){if("COLLECTION"===E)return e.stopPropagation(),d({type:"reset",data:{}}),d({type:"selected",data:{id:k,val:l,isRestricted:s}}),void u(k);u(k),f("products")}},isActive:!!I[k]},{children:[e(C,{children:[!O&&t(r,{isDisabled:x,isChecked:j,isPartiallyChecked:y,onValueChange:function(e,t,o){null==o||o.stopPropagation(),d(e?{type:"selected",data:{id:k,val:l,isRestricted:s}}:{type:"unselected",data:{id:k}}),u(e?k:"")}}),t(v,{children:t(h,Object.assign({body:l.name,placement:"bottom",delay:400},{children:e(b,{children:[l.name&&t(p,{children:g(l.name,40,!0)}),l.isSmartCollection?t("div",Object.assign({style:{display:"flex"}},{children:t(a,{tagText:"Smart Collection",type:"warning"})})):t(o,{})]})}))})]}),"COLLECTION"!==E&&t(n,{height:12,width:12,disabled:x,Icon:i})]}))};export{y as CollectionsScreen,g as truncate};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.435-0",
3
+ "version": "0.0.435-1",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",