@bikdotai/bik-component-library 0.0.485 → 0.0.487
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/avatar/Avatar.d.ts +1 -0
- package/dist/cjs/components/avatar/Avatar.js +1 -1
- package/dist/cjs/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/esm/components/avatar/Avatar.d.ts +1 -0
- package/dist/esm/components/avatar/Avatar.js +1 -1
- package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("./Avatar.styled.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),t=require("./Avatar.styled.js"),r=require("./AvatarHelper.js"),i=require("../TypographyStyle.js"),A=require("../../constants/Theme.js");const a={[r.SIZE.SMALL]:16,[r.SIZE.MEDIUM]:20,[r.SIZE.LARGE]:32},o={[r.AVATAR_BACKGROUND.LIGHT]:A.COLORS.content.secondary,[r.AVATAR_BACKGROUND.DARK]:A.COLORS.surface.standard};exports.AVATAR_SIZE_VS_ICON_SIZE_MAP=a,exports.Avatar=A=>{const[c,n]=s.useState(!1),l=()=>{const s=(A.name||"").split(".").join(" ").split(" ").map((e=>e.charAt(0).toUpperCase())).slice(0,2).join("");return A.size===r.SIZE.SMALL?e.jsx(i.BodyTiny,Object.assign({style:{color:o[A.background]}},{children:s})):A.size===r.SIZE.MEDIUM?e.jsx(i.TitleSmall,Object.assign({style:{color:o[A.background]}},{children:s})):A.size===r.SIZE.LARGE?e.jsx(i.TitleMedium,Object.assign({style:{color:o[A.background]}},{children:s})):void 0};return e.jsxs(t.AvatarStyle,Object.assign({type:A.type,size:A.size,background:A.background},{children:[A.type===r.AVATAR_TYPES.IMAGE&&(A.useNameFallback&&!c?e.jsx("img",{alt:"",width:r.AVATAR_SIZE_MAP[A.size],height:r.AVATAR_SIZE_MAP[A.size],style:{borderRadius:"50%",objectFit:"contain"},src:A.photoUrl,onError:()=>{n(!0)}}):A.useNameFallback&&c&&A.name?e.jsx("div",{children:l()}):e.jsx("img",{alt:"",width:r.AVATAR_SIZE_MAP[A.size],height:r.AVATAR_SIZE_MAP[A.size],style:{borderRadius:"50%",objectFit:"contain"},src:A.photoUrl})),A.type===r.AVATAR_TYPES.INITIALS&&e.jsx("div",{children:l()}),A.type===r.AVATAR_TYPES.ICON&&A.icon&&e.jsx(A.icon,{width:a[A.size],height:a[A.size],color:o[A.background]})]}))},exports.BACKGROUND_VS_TEXT_COLOR_MAP=o;
|
|
@@ -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
|
|
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}from"react/jsx-runtime";import{
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as r}from"react";import{AvatarStyle as i}from"./Avatar.styled.js";import{SIZE as o,AVATAR_BACKGROUND as s,AVATAR_TYPES as c,AVATAR_SIZE_MAP as a}from"./AvatarHelper.js";import{BodyTiny as n,TitleSmall as l,TitleMedium as d}from"../TypographyStyle.js";import{COLORS as p}from"../../constants/Theme.js";const m={[o.SMALL]:16,[o.MEDIUM]:20,[o.LARGE]:32},h={[s.LIGHT]:p.content.secondary,[s.DARK]:p.surface.standard},b=s=>{const[p,b]=r(!1),g=()=>{const e=(s.name||"").split(".").join(" ").split(" ").map((e=>e.charAt(0).toUpperCase())).slice(0,2).join("");return s.size===o.SMALL?t(n,Object.assign({style:{color:h[s.background]}},{children:e})):s.size===o.MEDIUM?t(l,Object.assign({style:{color:h[s.background]}},{children:e})):s.size===o.LARGE?t(d,Object.assign({style:{color:h[s.background]}},{children:e})):void 0};return e(i,Object.assign({type:s.type,size:s.size,background:s.background},{children:[s.type===c.IMAGE&&(s.useNameFallback&&!p?t("img",{alt:"",width:a[s.size],height:a[s.size],style:{borderRadius:"50%",objectFit:"contain"},src:s.photoUrl,onError:()=>{b(!0)}}):s.useNameFallback&&p&&s.name?t("div",{children:g()}):t("img",{alt:"",width:a[s.size],height:a[s.size],style:{borderRadius:"50%",objectFit:"contain"},src:s.photoUrl})),s.type===c.INITIALS&&t("div",{children:g()}),s.type===c.ICON&&s.icon&&t(s.icon,{width:m[s.size],height:m[s.size],color:h[s.background]})]}))};export{m as AVATAR_SIZE_VS_ICON_SIZE_MAP,b as Avatar,h as BACKGROUND_VS_TEXT_COLOR_MAP};
|
|
@@ -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
|
|
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};
|