@bikdotai/bik-component-library 0.0.212-beta.5 → 0.0.212
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/accordion/Accordion.d.ts +0 -2
- package/dist/cjs/components/accordion/Accordion.js +1 -1
- package/dist/cjs/components/accordion/Accordion.style.d.ts +0 -2
- package/dist/cjs/components/accordion/Accordion.style.js +4 -8
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/stepper/WorkingStepper.d.ts +0 -1
- package/dist/esm/components/accordion/Accordion.d.ts +0 -2
- package/dist/esm/components/accordion/Accordion.js +1 -1
- package/dist/esm/components/accordion/Accordion.style.d.ts +0 -2
- package/dist/esm/components/accordion/Accordion.style.js +4 -8
- package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/stepper/WorkingStepper.d.ts +0 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../TypographyStyle.js"),n=require("./Accordion.style.js"),i=require("./AccordionArrow.js");exports.BikAccordion=s=>{const[
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../TypographyStyle.js"),n=require("./Accordion.style.js"),i=require("./AccordionArrow.js");exports.BikAccordion=s=>{const[a,c]=r.useState(!1),o=r.useRef(null),d=r.useRef(null),l=(e,r)=>{var t;d.current&&o.current&&("keydown"===r.type&&"Enter"!==r.key||(c(e),d.current.style.maxHeight?(d.current.style.maxHeight="",o.current.style.transform="rotate(0deg)",o.current.style.transition="transform 0.25s ease-in-out",d.current.style.padding="0",d.current.style.transition=" padding 0s"):(d.current.style.maxHeight=d.current.scrollHeight+"px",o.current.style.transform="rotate(180deg)",d.current.style.padding=null!==(t=s.childrenPadding)&&void 0!==t?t:"0px 24px 24px 24px",o.current.style.transition="transform 0.25s ease-in-out",d.current.style.transition="max-height 0.25s ease-in-out")))};return e.jsxs(n.default,Object.assign({className:"accordion",isActive:a,width:null==s?void 0:s.width,contentMargin:null==s?void 0:s.contentMargin,headerPadding:s.headerPadding,skipHoverState:s.skipHoverHeader},{children:[e.jsxs("div",Object.assign({className:"accordion__overview "+(a?"active":""),onClick:e=>l(!a,e),onKeyDown:e=>l(!a,e),role:"button",tabIndex:0},{children:[!s.rightActionComponent&&e.jsxs("div",Object.assign({className:"accordion__overview__header"},{children:["string"==typeof s.header?e.jsx(t.TitleRegular,{children:null==s?void 0:s.header}):s.header,e.jsx(i.default,{isNewIcon:!1,ref:o})]})),s.rightActionComponent&&e.jsxs("div",Object.assign({className:"accordion__overview__header"},{children:[e.jsxs("div",Object.assign({className:"accordion__overview__title-wrapper"},{children:[e.jsx(i.default,{isNewIcon:!0,ref:o}),"string"==typeof s.header?e.jsx(t.TitleRegular,{children:null==s?void 0:s.header}):s.header]})),s.rightActionComponent]})),(null==s?void 0:s.caption)&&e.jsx("div",Object.assign({className:"accordion__overview__caption"},{children:e.jsx(t.BodySecondary,{children:s.caption})}))]})),e.jsx("div",Object.assign({ref:d,className:"accordion__content"},{children:s.children}))]}))};
|
|
@@ -4,7 +4,5 @@ declare const AccordionStyle: import("styled-components").StyledComponent<"div",
|
|
|
4
4
|
contentMargin?: string | undefined;
|
|
5
5
|
skipHoverState?: boolean | undefined;
|
|
6
6
|
headerPadding?: string | undefined;
|
|
7
|
-
showBorders?: boolean | undefined;
|
|
8
|
-
backgroundColor?: string | undefined;
|
|
9
7
|
}, never>;
|
|
10
8
|
export default AccordionStyle;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const d=i(e).default.div`
|
|
2
2
|
width: ${e=>(null==e?void 0:e.width)||"100%"};
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
|
-
border: ${e=>e.showBorders?"1px solid "+r.COLORS.stroke.primary:""};
|
|
6
|
-
border-radius: ${e=>e.showBorders?"4px":""};
|
|
7
|
-
background: ${e=>e.backgroundColor||"transparent"};
|
|
8
5
|
.accordion {
|
|
9
6
|
&__overview {
|
|
10
7
|
display: flex;
|
|
11
8
|
flex-direction: column;
|
|
12
9
|
gap: 4px;
|
|
13
10
|
padding: ${e=>e.headerPadding?e.headerPadding:"24px"};
|
|
14
|
-
border-bottom: ${e=>e.showBorders&&e.isActive?"1px solid "+r.COLORS.stroke.primary:""};
|
|
15
11
|
&__header {
|
|
16
12
|
display: flex;
|
|
17
13
|
flex-direction: row;
|
|
@@ -23,8 +19,8 @@
|
|
|
23
19
|
gap: 8px;
|
|
24
20
|
}
|
|
25
21
|
:hover {
|
|
26
|
-
background: ${e=>e.skipHoverState?null:
|
|
27
|
-
border-radius:
|
|
22
|
+
background: ${e=>e.skipHoverState?null:t.COLORS.surface.subdued};
|
|
23
|
+
border-radius: 4px;
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
26
|
&__content {
|
|
@@ -33,4 +29,4 @@
|
|
|
33
29
|
max-height: 0;
|
|
34
30
|
}
|
|
35
31
|
}
|
|
36
|
-
`;exports.default=
|
|
32
|
+
`;exports.default=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../button/Button.js"),r=require("../../../../TypographyStyle.js"),s=require("../../../../../constants/Theme.js"),n=require("./MultiSelectDropdownBottomBar.styled.js");exports.default=o=>{let{onApply:l,onClear:i,list:a}=o;const c=a.reduce(((e,t)=>{if(t.options){return e+t.options.filter((e=>!0===e.selected)).length}return t.selected?e+1:e}),0);return e.jsxs(n.BottomBarContainer,Object.assign({style:{justifyContent:"space-between"}},{children:[e.jsx(r.BodySecondary,Object.assign({style:{flex:1,color:s.COLORS.content.primary}},{children:c?`${c} selected`:""})),e.jsxs("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12}},{children:[e.jsx(t.Button,{size:"small",buttonType:"tertiaryGray",buttonText:"Clear",onClick:i}),e.jsx(t.Button,{size:"small",buttonText:"Apply",onClick:l})]}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../button/Button.js"),r=require("../../../../TypographyStyle.js"),s=require("../../../../../constants/Theme.js"),n=require("./MultiSelectDropdownBottomBar.styled.js");exports.default=o=>{let{onApply:l,onClear:i,list:a}=o;const c=a.reduce(((e,t)=>{if(t.options){return e+t.options.filter((e=>!0===e.selected)).length}return t.selected?e+1:e}),0);return e.jsxs(n.BottomBarContainer,Object.assign({style:{justifyContent:"space-between"}},{children:[e.jsx(r.BodySecondary,Object.assign({style:{flex:1,color:s.COLORS.content.primary}},{children:c?`${c} selected`:""})),e.jsxs("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12}},{children:[e.jsx(t.Button,{size:"small",buttonType:"tertiaryGray",buttonText:"Clear",onClick:i}),e.jsx(t.Button,{size:"small",buttonText:"Apply",onClick:()=>{l()}})]}))]}))};
|
|
@@ -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: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
|
+
"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||k<1||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 r}from"react/jsx-runtime";import{useState as n,useRef as t}from"react";import{TitleRegular as
|
|
1
|
+
import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useState as n,useRef as t}from"react";import{TitleRegular as i,BodySecondary as o}from"../TypographyStyle.js";import c from"./Accordion.style.js";import a from"./AccordionArrow.js";const s=s=>{const[d,l]=n(!1),h=t(null),m=t(null),p=(e,r)=>{var n;m.current&&h.current&&("keydown"===r.type&&"Enter"!==r.key||(l(e),m.current.style.maxHeight?(m.current.style.maxHeight="",h.current.style.transform="rotate(0deg)",h.current.style.transition="transform 0.25s ease-in-out",m.current.style.padding="0",m.current.style.transition=" padding 0s"):(m.current.style.maxHeight=m.current.scrollHeight+"px",h.current.style.transform="rotate(180deg)",m.current.style.padding=null!==(n=s.childrenPadding)&&void 0!==n?n:"0px 24px 24px 24px",h.current.style.transition="transform 0.25s ease-in-out",m.current.style.transition="max-height 0.25s ease-in-out")))};return e(c,Object.assign({className:"accordion",isActive:d,width:null==s?void 0:s.width,contentMargin:null==s?void 0:s.contentMargin,headerPadding:s.headerPadding,skipHoverState:s.skipHoverHeader},{children:[e("div",Object.assign({className:"accordion__overview "+(d?"active":""),onClick:e=>p(!d,e),onKeyDown:e=>p(!d,e),role:"button",tabIndex:0},{children:[!s.rightActionComponent&&e("div",Object.assign({className:"accordion__overview__header"},{children:["string"==typeof s.header?r(i,{children:null==s?void 0:s.header}):s.header,r(a,{isNewIcon:!1,ref:h})]})),s.rightActionComponent&&e("div",Object.assign({className:"accordion__overview__header"},{children:[e("div",Object.assign({className:"accordion__overview__title-wrapper"},{children:[r(a,{isNewIcon:!0,ref:h}),"string"==typeof s.header?r(i,{children:null==s?void 0:s.header}):s.header]})),s.rightActionComponent]})),(null==s?void 0:s.caption)&&r("div",Object.assign({className:"accordion__overview__caption"},{children:r(o,{children:s.caption})}))]})),r("div",Object.assign({ref:m,className:"accordion__content"},{children:s.children}))]}))};export{s as BikAccordion};
|
|
@@ -4,7 +4,5 @@ declare const AccordionStyle: import("styled-components").StyledComponent<"div",
|
|
|
4
4
|
contentMargin?: string | undefined;
|
|
5
5
|
skipHoverState?: boolean | undefined;
|
|
6
6
|
headerPadding?: string | undefined;
|
|
7
|
-
showBorders?: boolean | undefined;
|
|
8
|
-
backgroundColor?: string | undefined;
|
|
9
7
|
}, never>;
|
|
10
8
|
export default AccordionStyle;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import e from"styled-components";import{COLORS as
|
|
1
|
+
import e from"styled-components";import{COLORS as i}from"../../constants/Theme.js";const d=e.div`
|
|
2
2
|
width: ${e=>(null==e?void 0:e.width)||"100%"};
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
|
-
border: ${e=>e.showBorders?"1px solid "+r.stroke.primary:""};
|
|
6
|
-
border-radius: ${e=>e.showBorders?"4px":""};
|
|
7
|
-
background: ${e=>e.backgroundColor||"transparent"};
|
|
8
5
|
.accordion {
|
|
9
6
|
&__overview {
|
|
10
7
|
display: flex;
|
|
11
8
|
flex-direction: column;
|
|
12
9
|
gap: 4px;
|
|
13
10
|
padding: ${e=>e.headerPadding?e.headerPadding:"24px"};
|
|
14
|
-
border-bottom: ${e=>e.showBorders&&e.isActive?"1px solid "+r.stroke.primary:""};
|
|
15
11
|
&__header {
|
|
16
12
|
display: flex;
|
|
17
13
|
flex-direction: row;
|
|
@@ -23,8 +19,8 @@ import e from"styled-components";import{COLORS as r}from"../../constants/Theme.j
|
|
|
23
19
|
gap: 8px;
|
|
24
20
|
}
|
|
25
21
|
:hover {
|
|
26
|
-
background: ${e=>e.skipHoverState?null:
|
|
27
|
-
border-radius:
|
|
22
|
+
background: ${e=>e.skipHoverState?null:i.surface.subdued};
|
|
23
|
+
border-radius: 4px;
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
26
|
&__content {
|
|
@@ -33,4 +29,4 @@ import e from"styled-components";import{COLORS as r}from"../../constants/Theme.j
|
|
|
33
29
|
max-height: 0;
|
|
34
30
|
}
|
|
35
31
|
}
|
|
36
|
-
`;export{
|
|
32
|
+
`;export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{Button as o}from"../../../../button/Button.js";import{BodySecondary as r}from"../../../../TypographyStyle.js";import{COLORS as l}from"../../../../../constants/Theme.js";import{BottomBarContainer as n}from"./MultiSelectDropdownBottomBar.styled.js";const s=s=>{let{onApply:i,onClear:c,list:p}=s;const a=p.reduce(((t,e)=>{if(e.options){return t+e.options.filter((t=>!0===t.selected)).length}return e.selected?t+1:t}),0);return t(n,Object.assign({style:{justifyContent:"space-between"}},{children:[e(r,Object.assign({style:{flex:1,color:l.content.primary}},{children:a?`${a} selected`:""})),t("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12}},{children:[e(o,{size:"small",buttonType:"tertiaryGray",buttonText:"Clear",onClick:c}),e(o,{size:"small",buttonText:"Apply",onClick:i})]}))]}))};export{s as default};
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{Button as o}from"../../../../button/Button.js";import{BodySecondary as r}from"../../../../TypographyStyle.js";import{COLORS as l}from"../../../../../constants/Theme.js";import{BottomBarContainer as n}from"./MultiSelectDropdownBottomBar.styled.js";const s=s=>{let{onApply:i,onClear:c,list:p}=s;const a=p.reduce(((t,e)=>{if(e.options){return t+e.options.filter((t=>!0===t.selected)).length}return e.selected?t+1:t}),0);return t(n,Object.assign({style:{justifyContent:"space-between"}},{children:[e(r,Object.assign({style:{flex:1,color:l.content.primary}},{children:a?`${a} selected`:""})),t("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12}},{children:[e(o,{size:"small",buttonType:"tertiaryGray",buttonText:"Clear",onClick:c}),e(o,{size:"small",buttonText:"Apply",onClick:()=>{i()}})]}))]}))};export{s as default};
|
|
@@ -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: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};
|
|
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||A<1||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};
|