@bikdotai/bik-component-library 0.0.732-beta.5 → 0.0.732-beta.6
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/ProductPickerModal.d.ts +3 -1
- package/dist/cjs/components/product-picker/ProductPickerModal.js +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/esm/components/product-picker/ProductPickerModal.d.ts +3 -1
- package/dist/esm/components/product-picker/ProductPickerModal.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ProductPickerProps } from "./type";
|
|
3
|
-
export declare const ProductPickerContent: React.FC<ProductPickerProps
|
|
3
|
+
export declare const ProductPickerContent: React.FC<ProductPickerProps & {
|
|
4
|
+
resetSearchFlag?: number;
|
|
5
|
+
}>;
|
|
4
6
|
export declare const PricePleaseProductPicker: React.FC<ProductPickerProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("../../node_modules/lodash.debounce/index.js"),s=require("react"),o=require("../bik-layout/PageLoader.js"),r=require("../checkBox/CheckBox.js"),n=require("../input/Input.js"),i=require("../modals/styledModal.js"),c=require("./ProductPicker.styled.js"),l=require("../TypographyStyle.js"),a=require("../../utils/DateUtils.js"),d=require("../../constants/Theme.js"),u=require("../../assets/icons/alert_triangle.svg.js"),x=require("../../assets/icons/search.svg.js");const p="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg",j=t=>{let{text:s,styleProps:o}=t;return e.jsxRuntimeExports.jsxs(c.StyledZeroState,{children:[e.jsxRuntimeExports.jsx("div",Object.assign({className:"icon__container",style:Object.assign({},o)},{children:e.jsxRuntimeExports.jsx(u.default,{width:24,height:24,color:d.DEFAULT_THEME.colorsV2.content.secondary})})),e.jsxRuntimeExports.jsx(l.TitleSmall,{children:"No results found"}),e.jsxRuntimeExports.jsx(l.BodySecondary,Object.assign({style:{color:d.DEFAULT_THEME.colorsV2.content.secondary,textAlign:"center"}},{children:`Sorry we could not find any results for "${s}"`}))]})},m=i=>{var u,m,h,E;const g=i.instaPost?a.default.dateFormat(new Date(i.instaPost.timestamp),"•",!0):"",[P,y]=s.useState(i.products),[v,_]=s.useState(!1),[b,f]=s.useState("");s.useEffect((()=>{
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("../../node_modules/lodash.debounce/index.js"),s=require("react"),o=require("../bik-layout/PageLoader.js"),r=require("../checkBox/CheckBox.js"),n=require("../input/Input.js"),i=require("../modals/styledModal.js"),c=require("./ProductPicker.styled.js"),l=require("../TypographyStyle.js"),a=require("../../utils/DateUtils.js"),d=require("../../constants/Theme.js"),u=require("../../assets/icons/alert_triangle.svg.js"),x=require("../../assets/icons/search.svg.js");const p="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg",j=t=>{let{text:s,styleProps:o}=t;return e.jsxRuntimeExports.jsxs(c.StyledZeroState,{children:[e.jsxRuntimeExports.jsx("div",Object.assign({className:"icon__container",style:Object.assign({},o)},{children:e.jsxRuntimeExports.jsx(u.default,{width:24,height:24,color:d.DEFAULT_THEME.colorsV2.content.secondary})})),e.jsxRuntimeExports.jsx(l.TitleSmall,{children:"No results found"}),e.jsxRuntimeExports.jsx(l.BodySecondary,Object.assign({style:{color:d.DEFAULT_THEME.colorsV2.content.secondary,textAlign:"center"}},{children:`Sorry we could not find any results for "${s}"`}))]})},m=i=>{var u,m,h,E;const g=i.instaPost?a.default.dateFormat(new Date(i.instaPost.timestamp),"•",!0):"",[P,y]=s.useState(i.products),[v,_]=s.useState(!1),[b,f]=s.useState("");s.useEffect((()=>{f(""),y(i.products),_(!1)}),[i.show,i.resetSearchFlag]);const R=s.useCallback(t.default((e=>{e?(y([]),i.onSearchKeyChange(e).then((e=>{y(e),_(!1)}))):(y(i.products),_(!1))}),700),[]);return e.jsxRuntimeExports.jsxs(c.StyledProductPickerContainer,{children:[i.instaPost&&e.jsxRuntimeExports.jsxs("div",Object.assign({className:"post__wrapper"},{children:[e.jsxRuntimeExports.jsx("img",{alt:"Ig Media",onError:e=>{e.target.onerror=null,e.target.src=p},src:null===(u=i.instaPost)||void 0===u?void 0:u.media_url,className:"post__thumbnail"}),e.jsxRuntimeExports.jsxs("div",Object.assign({className:"post__info-wrapper"},{children:[e.jsxRuntimeExports.jsx(l.BodyPrimary,Object.assign({style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",color:i.instaPost.caption?d.DEFAULT_THEME.colorsV2.content.primary:d.DEFAULT_THEME.colorsV2.content.secondary}},{children:(null===(m=i.instaPost)||void 0===m?void 0:m.caption)?null===(h=i.instaPost)||void 0===h?void 0:h.caption:"No caption"})),e.jsxRuntimeExports.jsx(l.Caption,Object.assign({style:{color:d.DEFAULT_THEME.colorsV2.content.placeholder}},{children:g}))]}))]})),e.jsxRuntimeExports.jsx("div",Object.assign({style:{borderTop:i.instaPost?`1px solid ${d.DEFAULT_THEME.colorsV2.stroke.primary}`:"none",borderBottom:`1px solid ${d.DEFAULT_THEME.colorsV2.stroke.primary}`,padding:i.instaPost?"16px 24px":"0px 24px 16px 24px"}},{children:e.jsxRuntimeExports.jsx(n.Input,{value:b,placeholder:null!==(E=i.searchPlaceholder)&&void 0!==E?E:"Search products..",onChangeText:e=>{var t;f(e),(null===(t=e.trim())||void 0===t?void 0:t.length)>0?(_(!0),R(e)):(_(!1),y(i.products))},rightIcon:{icon:x.default}})})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{maxHeight:350,overflowY:"scroll"}},{children:[v&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"loader__wrapper"},{children:e.jsxRuntimeExports.jsx(o.PageLoader,{})})),0!==P.length||v?P.map((t=>{var s;const o=i.selectedProducts.find((e=>e.id===t.id));return e.jsxRuntimeExports.jsxs("div",Object.assign({className:"product__wrapper"},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({className:"product__info-wrapper"},{children:[e.jsxRuntimeExports.jsx("img",{alt:"Product",onError:e=>{e.target.onerror=null,e.target.src=p},src:null!==(s=t.image)&&void 0!==s?s:p,className:"product__image"}),e.jsxRuntimeExports.jsx(l.TitleSmall,{children:t.name})]})),e.jsxRuntimeExports.jsx("div",Object.assign({style:{order:1}},{children:e.jsxRuntimeExports.jsx(r.CheckBox,{isChecked:void 0!==o,onValueChange:e=>{((e,t)=>{const s=i.selectedProducts.find((e=>e.id===t.id));if(e&&!s){const e=[...i.selectedProducts,t];i.setSelectedProducts(e)}else if(s){const e=[...i.selectedProducts];let s=-1;i.selectedProducts.forEach(((e,o)=>{e.id===t.id&&(s=o)})),e.splice(s,1),i.setSelectedProducts(e)}})(e,t)}})}))]}),t.id)})):e.jsxRuntimeExports.jsx(j,{text:b})]}))]})};exports.PricePleaseProductPicker=t=>{var o;const[r,n]=s.useState([]),[c,a]=s.useState(0);s.useEffect((()=>{var e;n(null!==(e=t.selectedProducts)&&void 0!==e?e:[])}),[null===(o=t.selectedProducts)||void 0===o?void 0:o.length]);return e.jsxRuntimeExports.jsx(i.StyledModal,Object.assign({open:t.show,onClose:()=>{t.onClose()},footerLeftCustomElement:r.length>10?e.jsxRuntimeExports.jsx(l.Caption,Object.assign({style:{color:d.DEFAULT_THEME.colorsV2.content.negative}},{children:"Can't add more than 10 products"})):e.jsxRuntimeExports.jsx(l.Caption,Object.assign({style:{color:d.DEFAULT_THEME.colorsV2.content.placeholder}},{children:r?`${r.length} selected`:""})),headingTitle:t.title,primaryButton:{disabled:r.length>10||0===r.length,buttonType:"primary",buttonText:"Select",size:"small",onClick:()=>{t.setSelectedProducts(r),a((e=>e+1)),t.onClose()}},secondaryButton:t.secondaryButtonProps,footerShadow:!0},{children:e.jsxRuntimeExports.jsx(m,Object.assign({},t,{selectedProducts:r,setSelectedProducts:n,resetSearchFlag:c}))}))},exports.ProductPickerContent=m;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ProductPickerProps } from "./type";
|
|
3
|
-
export declare const ProductPickerContent: React.FC<ProductPickerProps
|
|
3
|
+
export declare const ProductPickerContent: React.FC<ProductPickerProps & {
|
|
4
|
+
resetSearchFlag?: number;
|
|
5
|
+
}>;
|
|
4
6
|
export declare const PricePleaseProductPicker: React.FC<ProductPickerProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"../../node_modules/react/jsx-runtime.js";import s from"../../node_modules/lodash.debounce/index.js";import{useState as t,useEffect as o,useCallback as r}from"react";import{PageLoader as n}from"../bik-layout/PageLoader.js";import{CheckBox as c}from"../checkBox/CheckBox.js";import{Input as l}from"../input/Input.js";import{StyledModal as i}from"../modals/styledModal.js";import{StyledProductPickerContainer as
|
|
1
|
+
import{j as e}from"../../node_modules/react/jsx-runtime.js";import s from"../../node_modules/lodash.debounce/index.js";import{useState as t,useEffect as o,useCallback as r}from"react";import{PageLoader as n}from"../bik-layout/PageLoader.js";import{CheckBox as c}from"../checkBox/CheckBox.js";import{Input as l}from"../input/Input.js";import{StyledModal as i}from"../modals/styledModal.js";import{StyledProductPickerContainer as a,StyledZeroState as d}from"./ProductPicker.styled.js";import{BodyPrimary as p,Caption as m,TitleSmall as h,BodySecondary as u}from"../TypographyStyle.js";import j from"../../utils/DateUtils.js";import{DEFAULT_THEME as g}from"../../constants/Theme.js";import x from"../../assets/icons/alert_triangle.svg.js";import v from"../../assets/icons/search.svg.js";const f="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg",y=s=>{let{text:t,styleProps:o}=s;return e.jsxs(d,{children:[e.jsx("div",Object.assign({className:"icon__container",style:Object.assign({},o)},{children:e.jsx(x,{width:24,height:24,color:g.colorsV2.content.secondary})})),e.jsx(h,{children:"No results found"}),e.jsx(u,Object.assign({style:{color:g.colorsV2.content.secondary,textAlign:"center"}},{children:`Sorry we could not find any results for "${t}"`}))]})},P=i=>{var d,u,x,P;const b=i.instaPost?j.dateFormat(new Date(i.instaPost.timestamp),"•",!0):"",[_,O]=t(i.products),[w,S]=t(!1),[C,N]=t("");o((()=>{N(""),O(i.products),S(!1)}),[i.show,i.resetSearchFlag]);const V=r(s((e=>{e?(O([]),i.onSearchKeyChange(e).then((e=>{O(e),S(!1)}))):(O(i.products),S(!1))}),700),[]);return e.jsxs(a,{children:[i.instaPost&&e.jsxs("div",Object.assign({className:"post__wrapper"},{children:[e.jsx("img",{alt:"Ig Media",onError:e=>{e.target.onerror=null,e.target.src=f},src:null===(d=i.instaPost)||void 0===d?void 0:d.media_url,className:"post__thumbnail"}),e.jsxs("div",Object.assign({className:"post__info-wrapper"},{children:[e.jsx(p,Object.assign({style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",color:i.instaPost.caption?g.colorsV2.content.primary:g.colorsV2.content.secondary}},{children:(null===(u=i.instaPost)||void 0===u?void 0:u.caption)?null===(x=i.instaPost)||void 0===x?void 0:x.caption:"No caption"})),e.jsx(m,Object.assign({style:{color:g.colorsV2.content.placeholder}},{children:b}))]}))]})),e.jsx("div",Object.assign({style:{borderTop:i.instaPost?`1px solid ${g.colorsV2.stroke.primary}`:"none",borderBottom:`1px solid ${g.colorsV2.stroke.primary}`,padding:i.instaPost?"16px 24px":"0px 24px 16px 24px"}},{children:e.jsx(l,{value:C,placeholder:null!==(P=i.searchPlaceholder)&&void 0!==P?P:"Search products..",onChangeText:e=>{var s;N(e),(null===(s=e.trim())||void 0===s?void 0:s.length)>0?(S(!0),V(e)):(S(!1),O(i.products))},rightIcon:{icon:v}})})),e.jsxs("div",Object.assign({style:{maxHeight:350,overflowY:"scroll"}},{children:[w&&e.jsx("div",Object.assign({className:"loader__wrapper"},{children:e.jsx(n,{})})),0!==_.length||w?_.map((s=>{var t;const o=i.selectedProducts.find((e=>e.id===s.id));return e.jsxs("div",Object.assign({className:"product__wrapper"},{children:[e.jsxs("div",Object.assign({className:"product__info-wrapper"},{children:[e.jsx("img",{alt:"Product",onError:e=>{e.target.onerror=null,e.target.src=f},src:null!==(t=s.image)&&void 0!==t?t:f,className:"product__image"}),e.jsx(h,{children:s.name})]})),e.jsx("div",Object.assign({style:{order:1}},{children:e.jsx(c,{isChecked:void 0!==o,onValueChange:e=>{((e,s)=>{const t=i.selectedProducts.find((e=>e.id===s.id));if(e&&!t){const e=[...i.selectedProducts,s];i.setSelectedProducts(e)}else if(t){const e=[...i.selectedProducts];let t=-1;i.selectedProducts.forEach(((e,o)=>{e.id===s.id&&(t=o)})),e.splice(t,1),i.setSelectedProducts(e)}})(e,s)}})}))]}),s.id)})):e.jsx(y,{text:C})]}))]})},b=s=>{var r;const[n,c]=t([]),[l,a]=t(0);o((()=>{var e;c(null!==(e=s.selectedProducts)&&void 0!==e?e:[])}),[null===(r=s.selectedProducts)||void 0===r?void 0:r.length]);return e.jsx(i,Object.assign({open:s.show,onClose:()=>{s.onClose()},footerLeftCustomElement:n.length>10?e.jsx(m,Object.assign({style:{color:g.colorsV2.content.negative}},{children:"Can't add more than 10 products"})):e.jsx(m,Object.assign({style:{color:g.colorsV2.content.placeholder}},{children:n?`${n.length} selected`:""})),headingTitle:s.title,primaryButton:{disabled:n.length>10||0===n.length,buttonType:"primary",buttonText:"Select",size:"small",onClick:()=>{s.setSelectedProducts(n),a((e=>e+1)),s.onClose()}},secondaryButton:s.secondaryButtonProps,footerShadow:!0},{children:e.jsx(P,Object.assign({},s,{selectedProducts:n,setSelectedProducts:c,resetSearchFlag:l}))}))};export{b as PricePleaseProductPicker,P as ProductPickerContent};
|