@bikdotai/bik-component-library 0.0.485 → 0.0.486

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