@bikdotai/bik-component-library 0.0.204 → 0.0.205
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/dist/cjs/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/cjs/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/style.js +1 -0
- package/dist/cjs/components/stepper/WorkingStepper.d.ts +1 -0
- package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/style.js +1 -0
- package/dist/esm/components/stepper/WorkingStepper.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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"),i=require("../checkBox/CheckBox.js"),o=require("../icon-button/IconButton.js"),r=require("../shimmer/ShimmerComponent/BikShimmer.js"),c=require("../tag/Tag.js"),l=require("../TypographyStyle.js"),n=require("./emptyState.js"),a=require("./style.js");const d=(e,t,s)=>{if(e.length<=t)return e;const i=e.slice(0,t-1);return(s?i.slice(0,i.lastIndexOf(" ")):i)+"..."},u=s=>{const{customCollectionRestriction:r,data:n,selectedCollectionsDispatch:u,setCollectionId:h,isPartiallyChecked:j,setScreen:x,id:C,isChecked:p,isDisabled:
|
|
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"),i=require("../checkBox/CheckBox.js"),o=require("../icon-button/IconButton.js"),r=require("../shimmer/ShimmerComponent/BikShimmer.js"),c=require("../tag/Tag.js"),l=require("../TypographyStyle.js"),n=require("./emptyState.js"),a=require("./style.js");const d=(e,t,s)=>{if(e.length<=t)return e;const i=e.slice(0,t-1);return(s?i.slice(0,i.lastIndexOf(" ")):i)+"..."},u=s=>{const{customCollectionRestriction:r,data:n,selectedCollectionsDispatch:u,setCollectionId:h,isPartiallyChecked:j,setScreen:x,id:C,isChecked:p,isDisabled:g}=s;return e.jsxs(a.CollectionCardStyle,Object.assign({isDisabled:g},{children:[e.jsxs(a.CollectionCardInfoStyle,{children:[e.jsx(i.CheckBox,{isDisabled:g,isChecked:p,isPartiallyChecked:j,onValueChange:function(e){u(e?{type:"selected",data:{id:C,val:n,isRestricted:r}}:{type:"unselected",data:{id:C}}),h(e?C:"")}}),e.jsx(a.CollectionCardDetailStyle,{children:e.jsxs(a.CollectionNameHolder,{children:[e.jsx(l.TitleRegular,{children:d(n.name,40,!0)}),n.isSmartCollection?e.jsx(c.Tag,{tagText:"Smart Collection",type:"warning"}):e.jsx(e.Fragment,{})]})})]}),e.jsx(o.IconButton,{height:12,width:12,disabled:g,onClick:()=>{g||(h(C),x("products"))},Icon:t.default})]}))};exports.CollectionsScreen=t=>{const{customCollectionRestriction:i,dataLoading:o,collections:c,selectedCollectionsDispatch:l,setCollectionId:a,selectedCollections:d,setScreen:h,collectionFetcher:j,collectionsDispatch:x,pagingControls:C,storeId:p,setSaveDisabled:g}=t,m=s.useRef(null),v=s.useRef(C.curPage),y=!!i&&(null==d?void 0:d.isCustom),[b,f]=s.useState(!1);s.useEffect((()=>{v.current=C.curPage}),[C.curPage]),s.useEffect((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&v.current>0&&(g(!0),f(!0),j(v.current,p).then((e=>{x({type:"paged",data:(null==e?void 0:e.collections)||{}}),C.setCurPage(v.current+1),f(!1),g(!1)})).catch())}),{threshold:1});return m.current&&e.observe(m.current),()=>{m.current&&e.unobserve(m.current)}}),[m]);const k=e=>{var t,s;let i=0,o=0;if(d[e]){const r=null===(t=c[e])||void 0===t?void 0:t.products;r&&Object.keys(r).forEach((e=>{var t;const s=null===(t=r[e])||void 0===t?void 0:t.variants;s&&Object.keys(s).forEach((e=>i+=1))}));const l=null===(s=d[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=>o+=1))})),!(i<=0&&o>0)&&(o>0&&i!==o)}return!1};return e.jsxs("div",{children:[Object.keys(c).length?Object.keys(c).map((t=>e.jsx(u,{customCollectionRestriction:i,data:c[t],isDisabled:y&&!(null==d?void 0:d[t]),isChecked:!!(null==d?void 0:d[t]),isPartiallyChecked:k(t),selectedCollectionsDispatch:l,setCollectionId:a,setScreen:h,id:t},t))):o?[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(r.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),s))):e.jsx(n.EmptyState,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),e.jsx("div",{ref:m}),b&&[1,2,3,4,5].map(((t,s)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(r.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),s)))]})},exports.truncate=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/search.svg.js"),c=require("react"),o=require("../../constants/Theme.js"),s=require("../button/Button.js"),r=require("../input/Input.js"),l=require("../modals/styledModal.js"),n=require("../spinner/Spinner.js"),i=require("../tag/Tag.js"),d=require("./collectionScreen.js"),a=require("./productScreen.js"),u=require("./reducers.js"),h=require("./searchScreen.js"),p=require("./selectedScreen.js"),S=require("./style.js");exports.ProductPickerModal=j=>{const{storeId:C,selectedItems:x,onClose:v,visible:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/search.svg.js"),c=require("react"),o=require("../../constants/Theme.js"),s=require("../button/Button.js"),r=require("../input/Input.js"),l=require("../modals/styledModal.js"),n=require("../spinner/Spinner.js"),i=require("../tag/Tag.js"),d=require("./collectionScreen.js"),a=require("./productScreen.js"),u=require("./reducers.js"),h=require("./searchScreen.js"),p=require("./selectedScreen.js"),S=require("./style.js");exports.ProductPickerModal=j=>{const{storeId:C,selectedItems:x,onClose:v,visible:y,zIndex:g,limit:b}=j,[m,f]=c.useReducer(u.collectionsReducer,{}),[I,q]=c.useState("collections"),[P,T]=c.useState(""),[E,F]=c.useState(0),[O,R]=c.useState(!1),[k,D]=c.useState(0),[B,w]=c.useState(""),[L,M]=c.useState(!1),[z,G]=c.useState(!1),[$,A]=c.useState(),[_,H]=c.useReducer(u.selectedColectionsReducer,Object.keys(x).length>0?x:{});c.useEffect((()=>{R(!0),G(!0),j.collectionFetcher(E,C).then((e=>{f({type:"fetched",data:(null==e?void 0:e.collections)||{}}),R(!1),F((e=>e+1)),G(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;Object.keys(_||[]).forEach((t=>{var c;Object.keys((null===(c=_[t])||void 0===c?void 0:c.products)||[]).forEach((c=>{var o,s;Object.keys((null===(s=null===(o=_[t].products)||void 0===o?void 0:o[c])||void 0===s?void 0:s.variants)||[]).forEach((()=>{e+=1}))}))})),D(e)})),c.useEffect((()=>{var e;P&&!(null===(e=null==m?void 0:m[P])||void 0===e?void 0:e.products)&&(R(!0),j.productFetcher(P,C).then((e=>{Object.keys(e).length&&f({type:"productsFetched",data:{collectionId:P,products:e}}),R(!1)})).catch())}),[P]),c.useEffect((()=>{const e=setTimeout((()=>{B.length&&(M(!0),j.searchFetcher(C,B).then((e=>{A(e),q("searchProducts"),R(!1),M(!1)})))}),800);return()=>clearTimeout(e)}),[B]);const Y=()=>{H({type:"reset",data:{}})};return e.jsx(l.StyledModal,Object.assign({zIndex:g,open:y,onClose:()=>{v(),Y()},headingTitle:"collections"===I||"products"===I?"Select Products":"view"===I?"Selected Products":"searchProducts"===I?"Searched Products":void 0,footerShadow:!0,centralContainerStyles:{width:"480px"},primaryButton:{buttonText:O?"Loading...":"Add",disabled:O||b&&k>b||!1,onClick:()=>{j.onAdd(_,k),Y()}},footerLeftCustomElement:b&&k>b?e.jsx(i.Tag,{tagText:`You can only select ${b} products`,type:"negative"}):k>0?e.jsx(s.Button,{onClick:()=>{q("view")},buttonText:`${k} products selected`,buttonType:"tertiaryGray"}):e.jsx(s.Button,{disabled:!0,buttonText:`${k} products selected`,buttonType:"tertiaryGray"})},{children:e.jsxs(S.ContainerStyle,{children:[!j.hideGlobalSearch&&e.jsx(e.Fragment,{children:("collections"===I||"searchProducts"===I)&&e.jsx("div",Object.assign({style:{padding:"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(r.Input,{noErrorHint:!0,rightIcon:{icon:()=>L?e.jsx(n.Spinner,{size:"small",color:o.COLORS.content.primary}):e.jsx(t.default,{})},id:"listInput",height:"24px",type:"text",value:B,onChangeText:e=>{e.length&&e.trim().length&&w(e)},placeholder:"Search products..."})}))}),e.jsxs(S.ScrollContainerStyle,{children:["collections"===I&&e.jsx(d.CollectionsScreen,{customCollectionRestriction:j.customCollectionRestriction,dataLoading:z,collections:m,selectedCollectionsDispatch:H,setCollectionId:T,setScreen:q,selectedCollections:_,collectionFetcher:j.collectionFetcher,storeId:C,collectionsDispatch:f,setSaveDisabled:R,pagingControls:{curPage:E,setCurPage:F}}),"products"===I&&P&&e.jsx(u.CollectionIdContext.Provider,Object.assign({value:P},{children:e.jsx(a.ProductsScreen,{hideInCollectionSearch:j.hideInCollectionSearch,customCollectionRestriction:j.customCollectionRestriction,productFetcher:j.productFetcher,setScreen:q,storeId:C,data:m[P],collectionsDispatch:f,selectedCollectionsDispatch:H,selectedData:_,setSaveDisabled:R,searchInCollectionFetcher:j.searchInCollectionFetcher})})),"view"===I&&e.jsx(p.SelectedScreen,{selectedCollections:_||{},selectedCollectionsDispatch:H,setScreen:q,collections:m}),"searchProducts"===I&&e.jsx(h.SearchScreen,{customCollectionRestriction:j.customCollectionRestriction,selectedCollections:_||{},searchedCollections:$||{},selectedCollectionsDispatch:H,setScreen:q,collections:m,onBackPress:()=>{w(""),A({})}})]})]})}))};
|
|
@@ -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 s,useState as c,useEffect as r}from"react";import{CheckBox as n}from"../checkBox/CheckBox.js";import{IconButton as l}from"../icon-button/IconButton.js";import{BikShimmer as
|
|
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 s,useState as c,useEffect as r}from"react";import{CheckBox as n}from"../checkBox/CheckBox.js";import{IconButton as l}from"../icon-button/IconButton.js";import{BikShimmer as d}from"../shimmer/ShimmerComponent/BikShimmer.js";import{Tag as a}from"../tag/Tag.js";import{TitleRegular as h}from"../TypographyStyle.js";import{EmptyState as u}from"./emptyState.js";import{CollectionCardStyle as m,CollectionCardInfoStyle as p,CollectionCardDetailStyle as v,CollectionNameHolder as g}from"./style.js";const C=(e,t,o)=>{if(e.length<=t)return e;const i=e.slice(0,t-1);return(o?i.slice(0,i.lastIndexOf(" ")):i)+"..."},b=o=>{const{customCollectionRestriction:i,dataLoading:n,collections:l,selectedCollectionsDispatch:a,setCollectionId:h,selectedCollections:m,setScreen:p,collectionFetcher:v,collectionsDispatch:g,pagingControls:C,storeId:b,setSaveDisabled:f}=o,j=s(null),k=s(C.curPage),x=!!i&&(null==m?void 0:m.isCustom),[O,E]=c(!1);r((()=>{k.current=C.curPage}),[C.curPage]),r((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&k.current>0&&(f(!0),E(!0),v(k.current,b).then((e=>{g({type:"paged",data:(null==e?void 0:e.collections)||{}}),C.setCurPage(k.current+1),E(!1),f(!1)})).catch())}),{threshold:1});return j.current&&e.observe(j.current),()=>{j.current&&e.unobserve(j.current)}}),[j]);const S=e=>{var t,o;let i=0,s=0;if(m[e]){const c=null===(t=l[e])||void 0===t?void 0:t.products;c&&Object.keys(c).forEach((e=>{var t;const o=null===(t=c[e])||void 0===t?void 0:t.variants;o&&Object.keys(o).forEach((e=>i+=1))}));const r=null===(o=m[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=>s+=1))})),!(i<=0&&s>0)&&(s>0&&i!==s)}return!1};return e("div",{children:[Object.keys(l).length?Object.keys(l).map((e=>t(y,{customCollectionRestriction:i,data:l[e],isDisabled:x&&!(null==m?void 0:m[e]),isChecked:!!(null==m?void 0:m[e]),isPartiallyChecked:S(e),selectedCollectionsDispatch:a,setCollectionId:h,setScreen:p,id:e},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:j}),O&&[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)))]})},y=s=>{const{customCollectionRestriction:c,data:r,selectedCollectionsDispatch:d,setCollectionId:u,isPartiallyChecked:b,setScreen:y,id:f,isChecked:j,isDisabled:k}=s;return e(m,Object.assign({isDisabled:k},{children:[e(p,{children:[t(n,{isDisabled:k,isChecked:j,isPartiallyChecked:b,onValueChange:function(e){d(e?{type:"selected",data:{id:f,val:r,isRestricted:c}}:{type:"unselected",data:{id:f}}),u(e?f:"")}}),t(v,{children:e(g,{children:[t(h,{children:C(r.name,40,!0)}),r.isSmartCollection?t(a,{tagText:"Smart Collection",type:"warning"}):t(o,{})]})})]}),t(l,{height:12,width:12,disabled:k,onClick:()=>{k||(u(f),y("products"))},Icon:i})]}))};export{b as CollectionsScreen,C as truncate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import c from"../../assets/icons/search.svg.js";import{useReducer as s,useState as r,useEffect as l}from"react";import{COLORS as i}from"../../constants/Theme.js";import{Button as n}from"../button/Button.js";import{Input as d}from"../input/Input.js";import{StyledModal as a}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as u}from"./collectionScreen.js";import{ProductsScreen as m}from"./productScreen.js";import{collectionsReducer as C,selectedColectionsReducer as v,CollectionIdContext as g}from"./reducers.js";import{SearchScreen as y}from"./searchScreen.js";import{SelectedScreen as f}from"./selectedScreen.js";import{ContainerStyle as j,ScrollContainerStyle as b}from"./style.js";const S=S=>{const{storeId:
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import c from"../../assets/icons/search.svg.js";import{useReducer as s,useState as r,useEffect as l}from"react";import{COLORS as i}from"../../constants/Theme.js";import{Button as n}from"../button/Button.js";import{Input as d}from"../input/Input.js";import{StyledModal as a}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as u}from"./collectionScreen.js";import{ProductsScreen as m}from"./productScreen.js";import{collectionsReducer as C,selectedColectionsReducer as v,CollectionIdContext as g}from"./reducers.js";import{SearchScreen as y}from"./searchScreen.js";import{SelectedScreen as f}from"./selectedScreen.js";import{ContainerStyle as j,ScrollContainerStyle as b}from"./style.js";const S=S=>{const{storeId:x,selectedItems:I,onClose:T,visible:P,zIndex:F,limit:D}=S,[k,E]=s(C,{}),[O,R]=r("collections"),[w,B]=r(""),[z,G]=r(0),[L,$]=r(!1),[A,H]=r(0),[M,Y]=r(""),[q,J]=r(!1),[K,N]=r(!1),[Q,U]=r(),[V,W]=s(v,Object.keys(I).length>0?I:{});l((()=>{$(!0),N(!0),S.collectionFetcher(z,x).then((e=>{E({type:"fetched",data:(null==e?void 0:e.collections)||{}}),$(!1),G((e=>e+1)),N(!1)})).catch()}),[]),l((()=>{let e=0;Object.keys(V||[]).forEach((t=>{var o;Object.keys((null===(o=V[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,s;Object.keys((null===(s=null===(c=V[t].products)||void 0===c?void 0:c[o])||void 0===s?void 0:s.variants)||[]).forEach((()=>{e+=1}))}))})),H(e)})),l((()=>{var e;w&&!(null===(e=null==k?void 0:k[w])||void 0===e?void 0:e.products)&&($(!0),S.productFetcher(w,x).then((e=>{Object.keys(e).length&&E({type:"productsFetched",data:{collectionId:w,products:e}}),$(!1)})).catch())}),[w]),l((()=>{const e=setTimeout((()=>{M.length&&(J(!0),S.searchFetcher(x,M).then((e=>{U(e),R("searchProducts"),$(!1),J(!1)})))}),800);return()=>clearTimeout(e)}),[M]);const X=()=>{W({type:"reset",data:{}})};return e(a,Object.assign({zIndex:F,open:P,onClose:()=>{T(),X()},headingTitle:"collections"===O||"products"===O?"Select Products":"view"===O?"Selected Products":"searchProducts"===O?"Searched Products":void 0,footerShadow:!0,centralContainerStyles:{width:"480px"},primaryButton:{buttonText:L?"Loading...":"Add",disabled:L||D&&A>D||!1,onClick:()=>{S.onAdd(V,A),X()}},footerLeftCustomElement:D&&A>D?e(p,{tagText:`You can only select ${D} products`,type:"negative"}):e(n,A>0?{onClick:()=>{R("view")},buttonText:`${A} products selected`,buttonType:"tertiaryGray"}:{disabled:!0,buttonText:`${A} products selected`,buttonType:"tertiaryGray"})},{children:t(j,{children:[!S.hideGlobalSearch&&e(o,{children:("collections"===O||"searchProducts"===O)&&e("div",Object.assign({style:{padding:"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e(d,{noErrorHint:!0,rightIcon:{icon:()=>q?e(h,{size:"small",color:i.content.primary}):e(c,{})},id:"listInput",height:"24px",type:"text",value:M,onChangeText:e=>{e.length&&e.trim().length&&Y(e)},placeholder:"Search products..."})}))}),t(b,{children:["collections"===O&&e(u,{customCollectionRestriction:S.customCollectionRestriction,dataLoading:K,collections:k,selectedCollectionsDispatch:W,setCollectionId:B,setScreen:R,selectedCollections:V,collectionFetcher:S.collectionFetcher,storeId:x,collectionsDispatch:E,setSaveDisabled:$,pagingControls:{curPage:z,setCurPage:G}}),"products"===O&&w&&e(g.Provider,Object.assign({value:w},{children:e(m,{hideInCollectionSearch:S.hideInCollectionSearch,customCollectionRestriction:S.customCollectionRestriction,productFetcher:S.productFetcher,setScreen:R,storeId:x,data:k[w],collectionsDispatch:E,selectedCollectionsDispatch:W,selectedData:V,setSaveDisabled:$,searchInCollectionFetcher:S.searchInCollectionFetcher})})),"view"===O&&e(f,{selectedCollections:V||{},selectedCollectionsDispatch:W,setScreen:R,collections:k}),"searchProducts"===O&&e(y,{customCollectionRestriction:S.customCollectionRestriction,selectedCollections:V||{},searchedCollections:Q||{},selectedCollectionsDispatch:W,setScreen:R,collections:k,onBackPress:()=>{Y(""),U({})}})]})]})}))};export{S as ProductPickerModal};
|