@bikdotai/bik-component-library 0.0.153-beta0.7 → 0.0.153-beta0.8

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.
@@ -12,6 +12,7 @@ export interface Product {
12
12
  };
13
13
  }
14
14
  export interface Collection {
15
+ id: string;
15
16
  name: string;
16
17
  image: string;
17
18
  isSmartCollection: boolean;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronRight.svg.js"),s=require("react"),r=require("../../constants/Theme.js"),c=require("../checkBox/CheckBox.js"),i=require("../icon-button/IconButton.js"),o=require("../shimmer/ShimmerComponent/BikShimmer.js"),n=require("../TypographyStyle.js"),l=require("./style.js");const d=(e,t,s)=>{if(e.length<=t)return e;const r=e.slice(0,t-1);return(s?r.slice(0,r.lastIndexOf(" ")):r)+"..."},a=s=>{const{data:o,selectedCollectionsDispatch:a,setCollectionId:u,isPartiallyChecked:h,setScreen:j,id:p,isChecked:x,isDisabled:C}=s;return e.jsxs(l.CollectionCardStyle,Object.assign({isDisabled:C},{children:[e.jsxs(l.CollectionCardInfoStyle,{children:[e.jsx(c.CheckBox,{isDisabled:C,isChecked:x,isPartiallyChecked:h,onValueChange:function(e,t){a(e?{type:"selected",data:{id:p,val:o}}:{type:"unselected",data:{id:p}}),u(e?p:"")}}),e.jsx(l.CollectionCardDetailStyle,{children:e.jsxs(l.CollectionNameHolder,{children:[e.jsx(n.TitleRegular,{children:d(o.name,40,!0)}),Object.keys(o.products||{}).length?e.jsxs(n.BodyCaption,Object.assign({color:r.COLORS.content.placeholder},{children:[Object.keys(o.products||{}).length," products"]})):e.jsx(e.Fragment,{})]})})]}),e.jsx(i.IconButton,{onClick:()=>{C||(u(p),j("products"))},Icon:t.default})]}))};exports.CollectionsScreen=t=>{const{collections:r,selectedCollectionsDispatch:c,setCollectionId:i,selectedCollections:n,setScreen:l,collectionFetcher:d,collectionsDispatch:u,pagingControls:h,storeId:j,setSaveDisabled:p}=t,x=s.useRef(null),C=s.useRef(h.curPage),v=(null==n?void 0:n.isCustom)||!1,[b,g]=s.useState(!1);s.useEffect((()=>{C.current=h.curPage}),[h.curPage]),s.useEffect((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&C.current>0&&(p(!0),g(!0),d(C.current,j).then((e=>{u({type:"paged",data:(null==e?void 0:e.collections)||{}}),h.setCurPage(C.current+1),g(!1),p(!1)})).catch())}),{threshold:1});return x.current&&e.observe(x.current),()=>{x.current&&e.unobserve(x.current)}}),[x]);const y=e=>{var t,s;let c=0,i=0;if(n[e]){const o=null===(t=r[e])||void 0===t?void 0:t.products;o&&Object.keys(o).forEach((e=>{var t;const s=null===(t=o[e])||void 0===t?void 0:t.variants;s&&Object.keys(s).forEach((e=>c+=1))}));const l=null===(s=n[e])||void 0===s?void 0:s.products;return l&&Object.keys(l).forEach((e=>{var t;const s=null===(t=l[e])||void 0===t?void 0:t.variants;s&&Object.keys(s).forEach((e=>i+=1))})),!(c<=0&&i>0)&&(i>0&&c!==i)}return!1};return e.jsxs("div",{children:[Object.keys(r).length?Object.keys(r).map((t=>e.jsx(a,{data:r[t],isDisabled:v&&!(null==n?void 0:n[t]),isChecked:!!(null==n?void 0:n[t]),isPartiallyChecked:y(t),selectedCollectionsDispatch:c,setCollectionId:i,setScreen:l,id:t},t))):[1,2,3,4,5,6,7,8,9,10].map(((t,s)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(o.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),s))),e.jsx("div",{ref:x}),b&&[1,2,3,4,5].map(((t,s)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(o.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),s)))]})},exports.truncate=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronRight.svg.js"),s=require("react"),r=require("../../constants/Theme.js"),c=require("../checkBox/CheckBox.js"),i=require("../icon-button/IconButton.js"),o=require("../shimmer/ShimmerComponent/BikShimmer.js"),n=require("../TypographyStyle.js"),l=require("./style.js");const d=(e,t,s)=>{if(e.length<=t)return e;const r=e.slice(0,t-1);return(s?r.slice(0,r.lastIndexOf(" ")):r)+"..."},a=s=>{const{data:o,selectedCollectionsDispatch:a,setCollectionId:u,isPartiallyChecked:h,setScreen:j,id:p,isChecked:x,isDisabled:C}=s;return e.jsxs(l.CollectionCardStyle,Object.assign({isDisabled:C},{children:[e.jsxs(l.CollectionCardInfoStyle,{children:[e.jsx(c.CheckBox,{isDisabled:C,isChecked:x,isPartiallyChecked:h,onValueChange:function(e,t){a(e?{type:"selected",data:{id:p,val:o}}:{type:"unselected",data:{id:p}}),u(e?p:"")}}),e.jsx(l.CollectionCardDetailStyle,{children:e.jsxs(l.CollectionNameHolder,{children:[e.jsx(n.TitleRegular,{children:d(o.name,40,!0)}),Object.keys(o.products||{}).length?e.jsxs(n.BodyCaption,Object.assign({color:r.COLORS.content.placeholder},{children:[Object.keys(o.products||{}).length," products"]})):e.jsx(e.Fragment,{})]})})]}),e.jsx(i.IconButton,{onClick:()=>{C||(u(p),j("products"))},Icon:t.default})]}))};exports.CollectionsScreen=t=>{const{collections:r,selectedCollectionsDispatch:c,setCollectionId:i,selectedCollections:n,setScreen:l,collectionFetcher:d,collectionsDispatch:u,pagingControls:h,storeId:j,setSaveDisabled:p}=t,x=s.useRef(null),C=s.useRef(h.curPage),v=(null==n?void 0:n.isCustom)||!1,[b,g]=s.useState(!1);s.useEffect((()=>{C.current=h.curPage}),[h.curPage]),s.useEffect((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&C.current>0&&(p(!0),g(!0),d(C.current,j).then((e=>{u({type:"paged",data:(null==e?void 0:e.collections)||{}}),h.setCurPage(C.current+1),g(!1),p(!1)})).catch())}),{threshold:1});return x.current&&e.observe(x.current),()=>{x.current&&e.unobserve(x.current)}}),[x]);const y=e=>{var t,s;let c=0,i=0;if(n[e]){const o=null===(t=r[e])||void 0===t?void 0:t.products;o&&Object.keys(o).forEach((e=>{var t;const s=null===(t=o[e])||void 0===t?void 0:t.variants;s&&Object.keys(s).forEach((e=>c+=1))}));const l=null===(s=n[e])||void 0===s?void 0:s.products;return l&&Object.keys(l).forEach((e=>{var t;const s=null===(t=l[e])||void 0===t?void 0:t.variants;s&&Object.keys(s).forEach((e=>i+=1))})),!(c<=0&&i>0)&&(i>0&&c!==i)}return!1};return e.jsxs("div",{children:[Object.keys(r).length?Object.keys(r).map((t=>e.jsx(a,{data:r[t],isDisabled:v&&!(null==n?void 0:n[t]),isChecked:!!(null==n?void 0:n[t]),isPartiallyChecked:y(t),selectedCollectionsDispatch:c,setCollectionId:i,setScreen:l,id:r[t].id},t))):[1,2,3,4,5,6,7,8,9,10].map(((t,s)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(o.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),s))),e.jsx("div",{ref:x}),b&&[1,2,3,4,5].map(((t,s)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(o.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),s)))]})},exports.truncate=d;
@@ -12,6 +12,7 @@ export interface Product {
12
12
  };
13
13
  }
14
14
  export interface Collection {
15
+ id: string;
15
16
  name: string;
16
17
  image: string;
17
18
  isSmartCollection: boolean;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import s from"../../assets/icons/chevronRight.svg.js";import{useRef as r,useState as c,useEffect as i}from"react";import{COLORS as n}from"../../constants/Theme.js";import{CheckBox as l}from"../checkBox/CheckBox.js";import{IconButton as d}from"../icon-button/IconButton.js";import{BikShimmer as a}from"../shimmer/ShimmerComponent/BikShimmer.js";import{TitleRegular as h,BodyCaption as u}from"../TypographyStyle.js";import{CollectionCardStyle as p,CollectionCardInfoStyle as m,CollectionCardDetailStyle as v,CollectionNameHolder as b}from"./style.js";const g=(e,t,o)=>{if(e.length<=t)return e;const s=e.slice(0,t-1);return(o?s.slice(0,s.lastIndexOf(" ")):s)+"..."},j=o=>{const{collections:s,selectedCollectionsDispatch:n,setCollectionId:l,selectedCollections:d,setScreen:h,collectionFetcher:u,collectionsDispatch:p,pagingControls:m,storeId:v,setSaveDisabled:b}=o,g=r(null),j=r(m.curPage),C=(null==d?void 0:d.isCustom)||!1,[f,k]=c(!1);i((()=>{j.current=m.curPage}),[m.curPage]),i((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&j.current>0&&(b(!0),k(!0),u(j.current,v).then((e=>{p({type:"paged",data:(null==e?void 0:e.collections)||{}}),m.setCurPage(j.current+1),k(!1),b(!1)})).catch())}),{threshold:1});return g.current&&e.observe(g.current),()=>{g.current&&e.unobserve(g.current)}}),[g]);const O=e=>{var t,o;let r=0,c=0;if(d[e]){const i=null===(t=s[e])||void 0===t?void 0:t.products;i&&Object.keys(i).forEach((e=>{var t;const o=null===(t=i[e])||void 0===t?void 0:t.variants;o&&Object.keys(o).forEach((e=>r+=1))}));const n=null===(o=d[e])||void 0===o?void 0:o.products;return n&&Object.keys(n).forEach((e=>{var t;const o=null===(t=n[e])||void 0===t?void 0:t.variants;o&&Object.keys(o).forEach((e=>c+=1))})),!(r<=0&&c>0)&&(c>0&&r!==c)}return!1};return e("div",{children:[Object.keys(s).length?Object.keys(s).map((e=>t(y,{data:s[e],isDisabled:C&&!(null==d?void 0:d[e]),isChecked:!!(null==d?void 0:d[e]),isPartiallyChecked:O(e),selectedCollectionsDispatch:n,setCollectionId:l,setScreen:h,id:e},e))):[1,2,3,4,5,6,7,8,9,10].map(((e,o)=>t("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:t(a,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),o))),t("div",{ref:g}),f&&[1,2,3,4,5].map(((e,o)=>t("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:t(a,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),o)))]})},y=r=>{const{data:c,selectedCollectionsDispatch:i,setCollectionId:a,isPartiallyChecked:j,setScreen:y,id:C,isChecked:f,isDisabled:k}=r;return e(p,Object.assign({isDisabled:k},{children:[e(m,{children:[t(l,{isDisabled:k,isChecked:f,isPartiallyChecked:j,onValueChange:function(e,t){i(e?{type:"selected",data:{id:C,val:c}}:{type:"unselected",data:{id:C}}),a(e?C:"")}}),t(v,{children:e(b,{children:[t(h,{children:g(c.name,40,!0)}),Object.keys(c.products||{}).length?e(u,Object.assign({color:n.content.placeholder},{children:[Object.keys(c.products||{}).length," products"]})):t(o,{})]})})]}),t(d,{onClick:()=>{k||(a(C),y("products"))},Icon:s})]}))};export{j as CollectionsScreen,g as truncate};
1
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import s from"../../assets/icons/chevronRight.svg.js";import{useRef as r,useState as c,useEffect as i}from"react";import{COLORS as n}from"../../constants/Theme.js";import{CheckBox as l}from"../checkBox/CheckBox.js";import{IconButton as d}from"../icon-button/IconButton.js";import{BikShimmer as a}from"../shimmer/ShimmerComponent/BikShimmer.js";import{TitleRegular as h,BodyCaption as u}from"../TypographyStyle.js";import{CollectionCardStyle as p,CollectionCardInfoStyle as m,CollectionCardDetailStyle as v,CollectionNameHolder as b}from"./style.js";const g=(e,t,o)=>{if(e.length<=t)return e;const s=e.slice(0,t-1);return(o?s.slice(0,s.lastIndexOf(" ")):s)+"..."},j=o=>{const{collections:s,selectedCollectionsDispatch:n,setCollectionId:l,selectedCollections:d,setScreen:h,collectionFetcher:u,collectionsDispatch:p,pagingControls:m,storeId:v,setSaveDisabled:b}=o,g=r(null),j=r(m.curPage),C=(null==d?void 0:d.isCustom)||!1,[f,k]=c(!1);i((()=>{j.current=m.curPage}),[m.curPage]),i((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&j.current>0&&(b(!0),k(!0),u(j.current,v).then((e=>{p({type:"paged",data:(null==e?void 0:e.collections)||{}}),m.setCurPage(j.current+1),k(!1),b(!1)})).catch())}),{threshold:1});return g.current&&e.observe(g.current),()=>{g.current&&e.unobserve(g.current)}}),[g]);const O=e=>{var t,o;let r=0,c=0;if(d[e]){const i=null===(t=s[e])||void 0===t?void 0:t.products;i&&Object.keys(i).forEach((e=>{var t;const o=null===(t=i[e])||void 0===t?void 0:t.variants;o&&Object.keys(o).forEach((e=>r+=1))}));const n=null===(o=d[e])||void 0===o?void 0:o.products;return n&&Object.keys(n).forEach((e=>{var t;const o=null===(t=n[e])||void 0===t?void 0:t.variants;o&&Object.keys(o).forEach((e=>c+=1))})),!(r<=0&&c>0)&&(c>0&&r!==c)}return!1};return e("div",{children:[Object.keys(s).length?Object.keys(s).map((e=>t(y,{data:s[e],isDisabled:C&&!(null==d?void 0:d[e]),isChecked:!!(null==d?void 0:d[e]),isPartiallyChecked:O(e),selectedCollectionsDispatch:n,setCollectionId:l,setScreen:h,id:s[e].id},e))):[1,2,3,4,5,6,7,8,9,10].map(((e,o)=>t("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:t(a,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),o))),t("div",{ref:g}),f&&[1,2,3,4,5].map(((e,o)=>t("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:t(a,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),o)))]})},y=r=>{const{data:c,selectedCollectionsDispatch:i,setCollectionId:a,isPartiallyChecked:j,setScreen:y,id:C,isChecked:f,isDisabled:k}=r;return e(p,Object.assign({isDisabled:k},{children:[e(m,{children:[t(l,{isDisabled:k,isChecked:f,isPartiallyChecked:j,onValueChange:function(e,t){i(e?{type:"selected",data:{id:C,val:c}}:{type:"unselected",data:{id:C}}),a(e?C:"")}}),t(v,{children:e(b,{children:[t(h,{children:g(c.name,40,!0)}),Object.keys(c.products||{}).length?e(u,Object.assign({color:n.content.placeholder},{children:[Object.keys(c.products||{}).length," products"]})):t(o,{})]})})]}),t(d,{onClick:()=>{k||(a(C),y("products"))},Icon:s})]}))};export{j 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.153-beta0.7",
3
+ "version": "0.0.153-beta0.8",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",