@bikdotai/bik-component-library 0.0.625 → 0.0.627-beta-tp.0
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/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/cjs/components/checkBox/CheckBox.d.ts +1 -0
- package/dist/cjs/components/checkBox/CheckBox.js +1 -1
- package/dist/cjs/components/dropdown/Dropdown.d.ts +1 -0
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +1 -1
- package/dist/cjs/components/dropdown/type.d.ts +1 -0
- package/dist/cjs/components/product-picker/ProductPickerModal.js +1 -1
- package/dist/cjs/components/product-picker-v2/ProductPickerTag.d.ts +5 -2
- package/dist/cjs/components/product-picker-v2/ProductPickerTag.js +1 -1
- package/dist/cjs/components/product-picker-v2/constants.d.ts +27 -0
- package/dist/cjs/components/product-picker-v2/constants.js +1 -0
- package/dist/cjs/components/product-picker-v2/helpers/ProductHelper.d.ts +6 -0
- package/dist/cjs/components/product-picker-v2/helpers/ProductHelper.js +1 -1
- package/dist/cjs/components/product-picker-v2/modal.d.ts +1 -0
- package/dist/cjs/components/product-picker-v2/product.d.ts +1 -0
- package/dist/cjs/components/product-picker-v2/product.js +1 -1
- package/dist/cjs/components/product-picker-v2/productInfoOverlay.js +7 -7
- package/dist/cjs/components/product-picker-v2/style.d.ts +3 -1
- package/dist/cjs/components/product-picker-v2/style.js +4 -4
- package/dist/cjs/components/product-picker-v2/variant.js +1 -1
- package/dist/cjs/components/radioButton/RadioButton.d.ts +1 -0
- package/dist/cjs/components/radioButton/RadioButton.js +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/esm/components/checkBox/CheckBox.d.ts +1 -0
- package/dist/esm/components/checkBox/CheckBox.js +1 -1
- package/dist/esm/components/dropdown/Dropdown.d.ts +1 -0
- package/dist/esm/components/dropdown/Dropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +1 -1
- package/dist/esm/components/dropdown/type.d.ts +1 -0
- package/dist/esm/components/product-picker/ProductPickerModal.js +1 -1
- package/dist/esm/components/product-picker-v2/ProductPickerTag.d.ts +5 -2
- package/dist/esm/components/product-picker-v2/ProductPickerTag.js +1 -1
- package/dist/esm/components/product-picker-v2/constants.d.ts +27 -0
- package/dist/esm/components/product-picker-v2/constants.js +1 -0
- package/dist/esm/components/product-picker-v2/helpers/ProductHelper.d.ts +6 -0
- package/dist/esm/components/product-picker-v2/helpers/ProductHelper.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.d.ts +1 -0
- package/dist/esm/components/product-picker-v2/product.d.ts +1 -0
- package/dist/esm/components/product-picker-v2/product.js +1 -1
- package/dist/esm/components/product-picker-v2/productInfoOverlay.js +8 -8
- package/dist/esm/components/product-picker-v2/style.d.ts +3 -1
- package/dist/esm/components/product-picker-v2/style.js +3 -3
- package/dist/esm/components/product-picker-v2/variant.js +1 -1
- package/dist/esm/components/radioButton/RadioButton.d.ts +1 -0
- package/dist/esm/components/radioButton/RadioButton.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default EventsTrigger;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default IGTrigger;
|
package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownOption } from "../../../dropdown/type";
|
|
3
|
-
import { QueryBuilderProperty } from "../../
|
|
4
|
-
import { QueryBuilderNodeProps } from "../../
|
|
3
|
+
import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
|
|
4
|
+
import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
|
|
5
5
|
declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
|
|
6
6
|
cacheKey: string;
|
|
7
7
|
propertyAddBtnText: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("./CheckBox.styled.js"),l=require("../TypographyStyle.js"),t=require("../../constants/Theme.js");const a=i=>e.jsxs("svg",Object.assign({width:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("./CheckBox.styled.js"),l=require("../TypographyStyle.js"),t=require("../../constants/Theme.js");const a=s=>{const l=i.useMemo((()=>s.activeColor||t.COLORS.background.positive.vibrant),[s.activeColor]);return e.jsxs("svg",Object.assign({width:s.isSmall?"16":"18",height:s.isSmall?"16":"18",viewBox:s.isSmall?"0 0 16 16":"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx("rect",{x:"0",y:"0",width:s.isSmall?"16":"18",height:s.isSmall?"16":"18",rx:"4",fill:s.isDisabled?t.COLORS.content.inactive:l}),!s.isPartial&&e.jsx("svg",Object.assign({width:s.isSmall?"8":"10",height:s.isSmall?"7":"9",x:"4",y:"4",viewBox:"0 0 10 9",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.68189 1.06043C10.0724 1.45096 10.0724 2.08412 9.68189 2.47464L4.02501 8.13152C3.63449 8.52205 3.00132 8.52205 2.6108 8.13152L0.489684 6.01041C0.0991601 5.61988 0.0991598 4.98672 0.489684 4.59619C0.880209 4.20567 1.51337 4.20567 1.9039 4.59619L3.31791 6.0102L8.26768 1.06043C8.6582 0.669907 9.29137 0.669907 9.68189 1.06043Z",fill:"white"})})),s.isPartial&&e.jsx("rect",{x:"5",y:s.isSmall?"7":"8",width:s.isSmall?"6":"8",height:"2",rx:"1",fill:t.COLORS.surface.standard})]}))};exports.CheckBox=r=>{var o;const[c,d]=i.useState(r.isChecked||!1),[n,h]=i.useState(r.isPartiallyChecked||!1),[b,x]=i.useState(r.isDisabled||!1),[C,S]=i.useState(!1),[u,O]=i.useState(!1);i.useEffect((()=>{d(r.isChecked)}),[r.isChecked]),i.useEffect((()=>{x(r.isDisabled||!1)}),[r.isDisabled]),i.useEffect((()=>{h(r.isPartiallyChecked||!1)}),[r.isPartiallyChecked]);return e.jsxs(s.CheckboxContainer,Object.assign({onClick:e=>{var i;if(!r.isDisabled){const s=!c;n?h(!n):d(s),null===(i=r.onValueChange)||void 0===i||i.call(r,s,r.value,e)}},onMouseEnter:()=>S(!r.skipHoverState),onMouseLeave:()=>S(!1),onMouseDown:()=>O(!r.skipHoverState),onMouseUp:()=>O(!1),isDisabled:b,enableHover:r.enableHover,style:null!==(o=r.style)&&void 0!==o?o:{}},{children:[e.jsx(s.CheckboxIcon,Object.assign({checked:c,hovered:C,clicked:u,isDisabled:b,size:r.size,borderColor:r.checkboxBorderColor},{children:c&&e.jsx(a,{isPartial:n||!1,isDisabled:b,isSmall:"SMALL"===r.size,activeColor:null==r?void 0:r.activeColor})})),r.label?r.boldOnChecked&&c?"DEFAULT"===r.labelSize?e.jsx(l.TitleRegular,Object.assign({color:r.isDisabled?t.COLORS.text.disabled:t.COLORS.text.primary},{children:r.label})):e.jsx(l.TitleSmall,Object.assign({color:r.isDisabled?t.COLORS.text.disabled:t.COLORS.text.primary},{children:r.label})):"SMALL"===r.size||"SMALL"===r.labelSize?e.jsx(l.BodySecondary,Object.assign({color:r.isDisabled?t.COLORS.text.disabled:t.COLORS.text.primary},{children:r.label})):e.jsx(l.BodyPrimary,Object.assign({color:r.isDisabled?t.COLORS.text.disabled:t.COLORS.text.primary},{children:r.label})):e.jsx(e.Fragment,{}),r.rightComponent]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),o=require("../../constants/Theme.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),o=require("../../constants/Theme.js"),i=require("../../assets/icons/chevronDown.svg.js"),r=require("../input/Input.js"),l=require("../input/context/InputStyleProvider.js"),s=require("./ChipInput.js"),d=require("./DropdownPopover/index.js"),a=require("./OpenedDropdown/utils/iterationOnOptions.js");function u(){}const c=c=>{var p,h,v,g,j,{placeHolder:f,size:x,onSelect:w,defaultOptions:S,disabled:b,noErrorHint:I,placeHolderHeight:O,showPlaceholderWhenSelected:y=!1,inputStyle:D={},inputType:m="default",onDeleteChip:q,truncatedText:H,showLeadingIconInPlaceholder:C=!1}=c,P=e.__rest(c,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder"]);const[T,E]=n.useState(!1),_=null!=x?x:"default",z=n.useRef(),[W,A]=n.useState(null!=S?S:[]);n.useEffect((()=>{var e;const t=[];null===(e=null==P?void 0:P.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&t.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&t.push(e)})),A([...t])}),[P.options]),n.useEffect((()=>{S&&A([...S])}),[S]);const L=a.getSelectedOptionsAsText(W);return t.jsx(l.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign({height:O||("small"===_?32:48),width:null!==(h=null!==(p=P.buttonWidth)&&void 0!==p?p:P.width)&&void 0!==h?h:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},D),input:{minHeight:"100%"}}},{children:t.jsxs(d.DropdownPopover,Object.assign({"data-test":P["data-test"],ref:z,onSelect:function(e){Array.isArray(e)?A([...e]):A([e]),null==w||w(e)},disabled:b,onDropdownVisbilityChange:e=>E(e)},P,{children:["default"==m&&t.jsx(r.Input,{version:P.version,noErrorHint:I,state:b?"disabled":"none",value:y?f:null!=L?L:"",errorMessage:P.error,variant:_,placeholder:null!=f?f:"Select an option",width:null!==(v=P.width)&&void 0!==v?v:"100%",onChangeText:u,leftIcon:C&&(null===(g=W[0])||void 0===g?void 0:g.leadingIcon)?{icon:()=>{var e;return t.jsx(t.Fragment,{children:null===(e=W[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>t.jsx(i.default,{style:{transform:T?"rotate(180deg)":"rotate(0deg)"},onClick:u,width:"small"===_?20:24,height:"small"===_?20:24,color:o.COLORS.content.primary})},truncateText:null==H||H}),"chip"==m&&t.jsx(s.default,{placeholder:null!=f?f:"Select options",chips:W,onDeleteChip:e=>{null==q||q(e)},isDropdownOpened:T,sizeToUse:_,containerStyle:{width:null!==(j=P.width)&&void 0!==j?j:"100%",cursor:"pointer"}})]}))}))};c.displayName="Dropdown",exports.Dropdown=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../../../zeroState/ZeroState.js"),r=require("../../../../hooks/useOutside.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../../../zeroState/ZeroState.js"),r=require("../../../../hooks/useOutside.js"),s=require("../../hooks/useDropdown.js"),o=require("./description/Description.js"),i=require("./menu/FreeFormMenu.js"),l=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),a=require("./multiSelect/MultiSelectDropdownBottomBar.js"),c=require("./OpennedDropdown.styled.js"),d=require("./searchbox/SearchBox.js"),p=require("./searchbox/SearchZeroState.js");const h=304,S=290;exports.OpenedDropdown=f=>{let{options:j,isSearchable:x,isMultiSelect:g,width:b,allowFreeForm:w,height:v,onClose:O,onSelect:m,onSearch:y,version:C,skipSorting:D,headerRef:M,hideSelectAll:q,primaryButtonText:L,onInfiniteScroll:F,onMultiSelectClear:k,onDropdownItemClick:A,buttonOptions:B,isSearchLoading:I,disableSearchOptions:H,disableSearchedOptionExcept:R,useDefaultCursor:Z,containerStyle:T={}}=f;const{dropdownOptions:E,search:P,searchedString:_,searchedOptions:z,onApplyHandler:K,selectAllHandler:N,onMultiSelectClear:W,onFreeFormSelect:G,onMultiSelectApply:J,latestDropdownOptionsRef:Q,getSelectedOptions:U}=s.useDropdown(C,j,m,D,g,y,H,R),[V,X]=t.useState(null!=b?b:S),[Y,$]=t.useState(null),ee=t.useRef(null),te=t.useRef([]);r.useOutside(ee,(()=>{if($(null),g&&"2.0"===C){const e=U(Q.current);null==O||O(e)}else null==O||O(E)}),[M,te]);const ne=null!=v?v:h,re="number"==typeof ne?x&&g?ne-96:x&&!g||!x&&g?ne-48:ne:ne;t.useEffect((()=>{const e=null!=b?b:S;if(null===Y)X(e);else if("number"==typeof e)X(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));X(t)}}),[Y]);const se=[],oe=(_&&y?z:E).map((e=>{var t,n;if(_&&!y){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(_.toLowerCase()))&&(se.push(!_||e.label===_),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(_.toLowerCase()))||(null===(n=e.searchKey)||void 0===n?void 0:n.toLowerCase().includes(_.toLowerCase()))?(se.push(!_||e.label===_),e):null}return e})).filter((e=>null!==e)),ie=!!x&&_&&0===oe.length;return e.jsxs(c.OpennedDropdownContainer,Object.assign({version:C,ref:ee,style:Object.assign({width:V},T)},{children:[e.jsxs("div",Object.assign({style:{width:Y?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!x&&e.jsx(d.SearchBox,{onSearch:P,version:C}),oe.length||_?e.jsxs(c.MenuListContainer,Object.assign({minHeight:ne,maxHeight:re},{children:[!!g&&!ie&&!q&&e.jsx(u.SelectAllMenu,{version:C,options:_&&y?z:E,onSelect:N}),!w&&ie&&e.jsx(p.SearchZeroState,{isLoading:I,height:re,searchedString:_}),w&&(ie||!!se.length&&se.every((e=>!1===e)))&&e.jsx(i.FreeFormMenu,{version:C,isMultiSelect:g,onSelect:G,searchedString:_}),e.jsx(l.MenuList,{onInfiniteScroll:F,onDropdownItemClick:A,version:C,onSelect:K,showDescription:function(e,t){$(e&&t?{title:e,description:t}:null)},isMultiSelect:g,options:oe,useDefaultCursor:Z,ref:te})]})):e.jsx("div",Object.assign({style:{height:ne,display:"flex"}},{children:e.jsx(n.ZeroState,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!g&&!(!oe.length&&!_)&&"2.0"!==C&&e.jsx(a.default,{onClear:()=>{W(),null==k||k()},onApply:J,list:_&&y?z:E,buttonText:L,buttonOptions:B})]})),!!Y&&e.jsx(o.Description,{title:Y.title,description:Y.description,version:C})]}))};
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
border: ${e=>{let{version:t}=e;return"1.0"===t?`1px solid ${a.DEFAULT_THEME.colorsV2.stroke.primary}`:"none"}};
|
|
11
11
|
max-height: 248px;
|
|
12
12
|
overflow-y: auto;
|
|
13
|
-
`,x=n.forwardRef(((i,s)=>{let{option:d,isMultiSelect:u,showDescription:x,onSelect:v,last:j,version:b,onDropdownItemClick:h,useDefaultCursor:m}=i;var f;const[y,C]=n.useState(d.selected),I=(e,t)=>{if(!e.children){O(!e.selected);const n=t?Object.assign(Object.assign({},e),{parent:t}):e;null==h||h(n)}},O=e=>{d.disabled||v(Object.assign(Object.assign({},d),{selected:e}))},F=m?{cursor:"default"}:{};return e.jsx(e.Fragment,{children:e.jsx(o.Tooltip,Object.assign({body:"",tooltipContent:d.children?e.jsx("div",Object.assign({style:{backgroundColor:a.DEFAULT_THEME.colorsV2.surface.standard},ref:s,onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1)},{children:e.jsx(g,Object.assign({version:null!=b?b:"2.0"},{children:d.children.map((t=>{var n;return e.jsx(p,{version:b,style:(null!==(n=null==d?void 0:d.children)&&void 0!==n?n:[]).length-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),I(t,d)},listItem:{value:t.value,label:t.label},subText:t.subText,leadingIcon:t.leadingIcon||void 0,customComponent:t.customComponent,trailingIcon:t.trailingIcon||void 0,variant:d.disabled?"inactive":t.selected?"selected":"default"},t.value)}))}))})):e.jsx(e.Fragment,{}),placement:"right-start",hideArrow:!0},{children:e.jsx(p,{version:b,style:j?Object.assign({borderBottom:0},F):Object.assign({},F),onClick:e=>{e.preventDefault(),I(d)},onMouseOver:()=>{d.description?x(d.label,d.description):x()},listItem:{value:d.value,label:d.label},subText:d.subText,leadingIcon:u?e.jsxs("div",Object.assign({style:{display:"flex",alignContent:"center",justifyContent:"center",gap:8}},{children:[e.jsx(r.CheckBox,{size:"2.0"===b?"SMALL":"DEFAULT",isDisabled:null!==(f=d.disabled)&&void 0!==f&&f,isChecked:!!d.selected,onValueChange:O}),e.jsx("div",Object.assign({style:{marginRight:"-4px"}},{children:d.leadingIcon}))]})):d.leadingIcon?e.jsx(e.Fragment,{children:d.leadingIcon}):void 0,customComponent:d.customComponent,trailingIcon:d.isFreeForm?e.jsx(c.FreeFormContainer,{children:e.jsx(l.BodyCaption,Object.assign({style:{color:a.COLORS.content.secondary}},{children:"Freeform"}))}):d.children?e.jsx(t.default,{width:12,height:12}):d.trailingIcon?e.jsx(e.Fragment,{children:d.trailingIcon}):void 0,variant:d.disabled?"inactive":d.selected||!u&&y?"selected":"default"})}))})}));exports.MenuItem=x;
|
|
13
|
+
`,x=n.forwardRef(((i,s)=>{let{option:d,isMultiSelect:u,showDescription:x,onSelect:v,last:j,version:b,onDropdownItemClick:h,useDefaultCursor:m}=i;var f;const[y,C]=n.useState(d.selected),I=(e,t)=>{if(!e.children){O(!e.selected);const n=t?Object.assign(Object.assign({},e),{parent:t}):e;null==h||h(n)}},O=e=>{d.disabled||v(Object.assign(Object.assign({},d),{selected:e}))},F=m?{cursor:"default"}:{};return e.jsx(e.Fragment,{children:e.jsx(o.Tooltip,Object.assign({body:"",tooltipContent:d.children?e.jsx("div",Object.assign({style:{backgroundColor:a.DEFAULT_THEME.colorsV2.surface.standard},ref:s,onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1)},{children:e.jsx(g,Object.assign({version:null!=b?b:"2.0"},{children:d.children.map((t=>{var n;return e.jsx(p,{version:b,style:"1.0"!==b&&(null!==(n=null==d?void 0:d.children)&&void 0!==n?n:[]).length-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),I(t,d)},listItem:{value:t.value,label:t.label},subText:t.subText,leadingIcon:t.leadingIcon||void 0,customComponent:t.customComponent,trailingIcon:t.trailingIcon||void 0,variant:d.disabled?"inactive":t.selected?"selected":"default"},t.value)}))}))})):e.jsx(e.Fragment,{}),placement:"right-start",hideArrow:!0},{children:e.jsx(p,{version:b,style:j?Object.assign({borderBottom:0},F):Object.assign({},F),onClick:e=>{e.preventDefault(),I(d)},onMouseOver:()=>{d.description?x(d.label,d.description):x()},listItem:{value:d.value,label:d.label},subText:d.subText,leadingIcon:u?e.jsxs("div",Object.assign({style:{display:"flex",alignContent:"center",justifyContent:"center",gap:8}},{children:[e.jsx(r.CheckBox,{size:"2.0"===b?"SMALL":"DEFAULT",isDisabled:null!==(f=d.disabled)&&void 0!==f&&f,isChecked:!!d.selected,onValueChange:O}),e.jsx("div",Object.assign({style:{marginRight:"-4px"}},{children:d.leadingIcon}))]})):d.leadingIcon?e.jsx(e.Fragment,{children:d.leadingIcon}):void 0,customComponent:d.customComponent,trailingIcon:d.isFreeForm?e.jsx(c.FreeFormContainer,{children:e.jsx(l.BodyCaption,Object.assign({style:{color:a.COLORS.content.secondary}},{children:"Freeform"}))}):d.children?e.jsx(t.default,{width:12,height:12}):d.trailingIcon?e.jsx(e.Fragment,{children:d.trailingIcon}):void 0,variant:d.disabled?"inactive":d.selected||!u&&y?"selected":"default"})}))})}));exports.MenuItem=x;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),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"),c=require("../modals/styledModal.js"),l=require("./ProductPicker.styled.js"),i=require("../TypographyStyle.js"),a=require("../../utils/DateUtils.js"),d=require("../../constants/Theme.js"),u=require("../../assets/icons/alert_triangle.svg.js"),p=require("../../assets/icons/search.svg.js");const h="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg",j=t=>{let{text:s,styleProps:o}=t;return e.jsxs(l.StyledZeroState,{children:[e.jsx("div",Object.assign({className:"icon__container",style:Object.assign({},o)},{children:e.jsx(u.default,{width:24,height:24,color:d.DEFAULT_THEME.colorsV2.content.secondary})})),e.jsx(i.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),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"),c=require("../modals/styledModal.js"),l=require("./ProductPicker.styled.js"),i=require("../TypographyStyle.js"),a=require("../../utils/DateUtils.js"),d=require("../../constants/Theme.js"),u=require("../../assets/icons/alert_triangle.svg.js"),p=require("../../assets/icons/search.svg.js");const h="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg",j=t=>{let{text:s,styleProps:o}=t;return e.jsxs(l.StyledZeroState,{children:[e.jsx("div",Object.assign({className:"icon__container",style:Object.assign({},o)},{children:e.jsx(u.default,{width:24,height:24,color:d.DEFAULT_THEME.colorsV2.content.secondary})})),e.jsx(i.TitleSmall,{children:"No results found"}),e.jsx(i.BodySecondary,Object.assign({style:{color:d.DEFAULT_THEME.colorsV2.content.secondary,textAlign:"center"}},{children:`Sorry we could not find any results for "${s}"`}))]})},g=c=>{var u,g,x,m;const P=c.instaPost?a.default.dateFormat(new Date(c.instaPost.timestamp),"•",!0):"",[y,v]=s.useState(c.products),[E,_]=s.useState(!1),[b,T]=s.useState(""),f=s.useCallback(t.default((e=>{e?(v([]),c.onSearchKeyChange(e).then((e=>{v(e),_(!1)}))):(v(c.products),_(!1))}),700),[]);return e.jsxs(l.StyledProductPickerContainer,{children:[c.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=h},src:null===(u=c.instaPost)||void 0===u?void 0:u.media_url,className:"post__thumbnail"}),e.jsxs("div",Object.assign({className:"post__info-wrapper"},{children:[e.jsx(i.BodyPrimary,Object.assign({style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",color:c.instaPost.caption?d.DEFAULT_THEME.colorsV2.content.primary:d.DEFAULT_THEME.colorsV2.content.secondary}},{children:(null===(g=c.instaPost)||void 0===g?void 0:g.caption)?null===(x=c.instaPost)||void 0===x?void 0:x.caption:"No caption"})),e.jsx(i.Caption,Object.assign({style:{color:d.DEFAULT_THEME.colorsV2.content.placeholder}},{children:P}))]}))]})),e.jsx("div",Object.assign({style:{borderTop:c.instaPost?`1px solid ${d.DEFAULT_THEME.colorsV2.stroke.primary}`:"none",borderBottom:`1px solid ${d.DEFAULT_THEME.colorsV2.stroke.primary}`,padding:c.instaPost?"16px 24px":"0px 24px 16px 24px"}},{children:e.jsx(n.Input,{placeholder:null!==(m=c.searchPlaceholder)&&void 0!==m?m:"Search products..",onChangeText:e=>{var t;T(e),(null===(t=e.trim())||void 0===t?void 0:t.length)>0?(_(!0),f(e)):(_(!1),v(c.products))},rightIcon:{icon:p.default}})})),e.jsxs("div",Object.assign({style:{maxHeight:350,overflowY:"scroll"}},{children:[E&&e.jsx("div",Object.assign({className:"loader__wrapper"},{children:e.jsx(o.PageLoader,{})})),0!==y.length||E?y.map((t=>{var s;const o=c.selectedProducts.find((e=>e.id===t.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=h},src:null!==(s=t.image)&&void 0!==s?s:h,className:"product__image"}),e.jsx(i.TitleSmall,{children:t.name})]})),e.jsx("div",Object.assign({style:{order:1}},{children:e.jsx(r.CheckBox,{isChecked:void 0!==o,onValueChange:e=>{((e,t)=>{const s=c.selectedProducts.find((e=>e.id===t.id));if(e&&!s){const e=[...c.selectedProducts,t];c.setSelectedProducts(e)}else if(s){const e=[...c.selectedProducts];let s=-1;c.selectedProducts.forEach(((e,o)=>{e.id===t.id&&(s=o)})),e.splice(s,1),c.setSelectedProducts(e)}})(e,t)}})}))]}),t.id)})):e.jsx(j,{text:b})]}))]})};exports.PricePleaseProductPicker=t=>{var o;const[r,n]=s.useState([]);return s.useEffect((()=>{var e;n(null!==(e=t.selectedProducts)&&void 0!==e?e:[])}),[null===(o=t.selectedProducts)||void 0===o?void 0:o.length]),e.jsx(c.StyledModal,Object.assign({open:t.show,onClose:()=>{t.onClose()},footerLeftCustomElement:r.length>10?e.jsx(i.Caption,Object.assign({style:{color:d.DEFAULT_THEME.colorsV2.content.negative}},{children:"Can't add more than 10 products"})):e.jsx(i.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),t.onClose()}},secondaryButton:t.secondaryButtonProps,footerShadow:!0},{children:e.jsx(g,Object.assign({},t,{selectedProducts:r,setSelectedProducts:n}))}))},exports.ProductPickerContent=g;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { TagType } from '../tag/model';
|
|
1
2
|
import { Product, ProductVariant } from './modal';
|
|
2
|
-
import { OUT_OF_STOCK_ACTION } from './type';
|
|
3
3
|
export type ProductPickerTagType = {
|
|
4
4
|
isVariant: boolean;
|
|
5
5
|
data: Product | ProductVariant;
|
|
6
|
-
|
|
6
|
+
tagText?: string;
|
|
7
|
+
tagType?: TagType;
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
9
10
|
* Used in Product Screen, Search Screen, Selected Screen and Rearrange Screen.
|
|
@@ -12,6 +13,8 @@ export type ProductPickerTagType = {
|
|
|
12
13
|
* New logic: When product has only one variant and variant name is same as product name,
|
|
13
14
|
* we consider that a variant and do operations as variant.
|
|
14
15
|
*
|
|
16
|
+
* The logic for showing tag is moved to ProductHelper.tsx.
|
|
17
|
+
*
|
|
15
18
|
* Note: If there is no Fb rejected tag in the variant, we show a shimmer,
|
|
16
19
|
* meanwhile hit the API to get FB status.
|
|
17
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../shimmer/ShimmerComponent/BikShimmer.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../shimmer/ShimmerComponent/BikShimmer.js"),i=require("../tag/Tag.js");exports.ProductPickerTag=r=>{const{isVariant:s,data:a,tagText:x,tagType:n}=r;return e.jsx("div",Object.assign({style:{display:"flex"}},{children:!(null==a?void 0:a.fbStatus)&&s?e.jsx(t.BikShimmer,{boxes:[{height:"24px",width:"100px",marginTop:"0px"}]}):x?e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(i.Tag,{tagText:x,type:n,theme:"light"})})):e.jsx(e.Fragment,{})}))};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const CurrencySymbols: {
|
|
2
|
+
USD: string;
|
|
3
|
+
GBP: string;
|
|
4
|
+
CAD: string;
|
|
5
|
+
AUD: string;
|
|
6
|
+
DKK: string;
|
|
7
|
+
SEK: string;
|
|
8
|
+
EUR: string;
|
|
9
|
+
BRL: string;
|
|
10
|
+
TRY: string;
|
|
11
|
+
JPY: string;
|
|
12
|
+
SAR: string;
|
|
13
|
+
AED: string;
|
|
14
|
+
EGP: string;
|
|
15
|
+
MAD: string;
|
|
16
|
+
INR: string;
|
|
17
|
+
CHF: string;
|
|
18
|
+
CNY: string;
|
|
19
|
+
NZD: string;
|
|
20
|
+
MXN: string;
|
|
21
|
+
ZAR: string;
|
|
22
|
+
RUB: string;
|
|
23
|
+
KRW: string;
|
|
24
|
+
SGD: string;
|
|
25
|
+
PKR: string;
|
|
26
|
+
RO: string;
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.CurrencySymbols={USD:"$",GBP:"£",CAD:"C$",AUD:"A$",DKK:"DKK",SEK:"SEK",EUR:"€",BRL:"R$",TRY:"₺",JPY:"¥",SAR:"ر.س",AED:"د.إ",EGP:"E£",MAD:"د.م.",INR:"₹",CHF:"Fr",CNY:"¥",NZD:"NZ$",MXN:"Mex$",ZAR:"R",RUB:"₽",KRW:"₩",SGD:"S$",PKR:"Rs",RO:"lei"};
|
|
@@ -36,6 +36,12 @@ export declare class ProductHelper {
|
|
|
36
36
|
* For FB Rejected returns 'negative', for rest returns 'warning'
|
|
37
37
|
*/
|
|
38
38
|
static getTagType: (tagText: string) => TagType;
|
|
39
|
+
static getDataForProductPickerTag: (data: Product | ProductVariant, isVariant: boolean, outOfStockAction: OUT_OF_STOCK_ACTION | undefined) => {
|
|
40
|
+
isVariantForProductPickerTag: boolean;
|
|
41
|
+
dataForProductPickerTag: Product | ProductVariant;
|
|
42
|
+
tagText: string | undefined;
|
|
43
|
+
tagType: TagType;
|
|
44
|
+
};
|
|
39
45
|
}
|
|
40
46
|
/**
|
|
41
47
|
* Loops through each collection, each product, each variant.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../type.js");const n={NORMAL:null,NOT_SYNCED:"Hidden",OUT_OF_STOCK:"Out of Stock",FB_REJECTED:"Rejected on FB catalog"};class l{static getProductLabels(l){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.OUT_OF_STOCK_ACTION.NORMAL,u="NORMAL";if(l.variants)return n[u];const e=l;return"REJECTED"===(null==e?void 0:e.fbStatus)?n.FB_REJECTED:(i===t.OUT_OF_STOCK_ACTION.HIDE&&(!e.skipSync||0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)||(u="NOT_SYNCED"),e.skipSync&&0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)&&(u="NOT_SYNCED"),e.skipSync||0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)||(u="NOT_SYNCED"),e.skipSync||0===(null==e?void 0:e.quantity)||-2===(null==e?void 0:e.quantity)||(u="NORMAL")),i===t.OUT_OF_STOCK_ACTION.BLUR&&(!e.skipSync||0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)||(u="NOT_SYNCED"),e.skipSync&&0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)&&(u="NOT_SYNCED"),e.skipSync||0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)||(u="OUT_OF_STOCK"),e.skipSync||0===(null==e?void 0:e.quantity)||-2===(null==e?void 0:e.quantity)||(u="NORMAL")),i===t.OUT_OF_STOCK_ACTION.NORMAL&&(!e.skipSync||0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)||(u="NOT_SYNCED"),e.skipSync&&0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)&&(u="NOT_SYNCED"),e.skipSync||0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)||(u="NORMAL"),e.skipSync||0===(null==e?void 0:e.quantity)||-2===(null==e?void 0:e.quantity)||(u="NORMAL")),n[u])}}Object.defineProperty(l,"getTagType",{enumerable:!0,configurable:!0,writable:!0,value:t=>n.FB_REJECTED===t?"negative":"warning"});exports.ProductHelper=l,exports.parseSelectedVariantsToArray=t=>{let n=[];Object.keys(t).forEach((l=>{var i;return Object.keys((null===(i=null==t?void 0:t[l])||void 0===i?void 0:i.products)||[]).forEach((i=>{var u,e;const a=null!==(u=t[l].products)&&void 0!==u?u:[],
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../type.js");const n={NORMAL:null,NOT_SYNCED:"Hidden",OUT_OF_STOCK:"Out of Stock",FB_REJECTED:"Rejected on FB catalog"};class l{static getProductLabels(l){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.OUT_OF_STOCK_ACTION.NORMAL,u="NORMAL";if(l.variants)return n[u];const e=l;return"REJECTED"===(null==e?void 0:e.fbStatus)?n.FB_REJECTED:(i===t.OUT_OF_STOCK_ACTION.HIDE&&(!e.skipSync||0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)||(u="NOT_SYNCED"),e.skipSync&&0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)&&(u="NOT_SYNCED"),e.skipSync||0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)||(u="NOT_SYNCED"),e.skipSync||0===(null==e?void 0:e.quantity)||-2===(null==e?void 0:e.quantity)||(u="NORMAL")),i===t.OUT_OF_STOCK_ACTION.BLUR&&(!e.skipSync||0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)||(u="NOT_SYNCED"),e.skipSync&&0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)&&(u="NOT_SYNCED"),e.skipSync||0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)||(u="OUT_OF_STOCK"),e.skipSync||0===(null==e?void 0:e.quantity)||-2===(null==e?void 0:e.quantity)||(u="NORMAL")),i===t.OUT_OF_STOCK_ACTION.NORMAL&&(!e.skipSync||0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)||(u="NOT_SYNCED"),e.skipSync&&0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)&&(u="NOT_SYNCED"),e.skipSync||0!==(null==e?void 0:e.quantity)&&-2!==(null==e?void 0:e.quantity)||(u="NORMAL"),e.skipSync||0===(null==e?void 0:e.quantity)||-2===(null==e?void 0:e.quantity)||(u="NORMAL")),n[u])}}Object.defineProperty(l,"getTagType",{enumerable:!0,configurable:!0,writable:!0,value:t=>n.FB_REJECTED===t?"negative":"warning"}),Object.defineProperty(l,"getDataForProductPickerTag",{enumerable:!0,configurable:!0,writable:!0,value:(t,n,i)=>{var u,e;let a=t,r=n;1===Object.keys(null!==(u=null==t?void 0:t.variants)&&void 0!==u?u:{}).length&&(a=Object.values(null!==(e=null==t?void 0:t.variants)&&void 0!==e?e:{})[0],r=!0);const o=l.getProductLabels(a,i);return{isVariantForProductPickerTag:r,dataForProductPickerTag:a,tagText:null!=o?o:void 0,tagType:l.getTagType(null!=o?o:"")}}});exports.ProductHelper=l,exports.parseSelectedVariantsToArray=t=>{let n=[];Object.keys(t).forEach((l=>{var i;return Object.keys((null===(i=null==t?void 0:t[l])||void 0===i?void 0:i.products)||[]).forEach((i=>{var u,e;const a=null!==(u=t[l].products)&&void 0!==u?u:[],r=null!==(e=a[i].variants)&&void 0!==e?e:[];return Object.keys(r).map((t=>{const n=r[t];n.currency=a[i].currency,n.variantId=t,n.productId=i,n.collectionId=l,n.productName=a[i].name})),n=[...n,...Object.values(r)],n}))}));const l=n.sort(((t,n)=>null==t.displayOrder&&null==n.displayOrder?0:null==t.displayOrder?1:null==n.displayOrder?-1:t.displayOrder-n.displayOrder));return l.forEach(((t,n)=>{t.displayOrder=n})),l};
|
|
@@ -38,6 +38,7 @@ interface ProductCardInterface {
|
|
|
38
38
|
showProductDetailInfoIcon?: boolean;
|
|
39
39
|
pickerType?: 'COLLECTION' | 'PRODUCT';
|
|
40
40
|
onProductDetailClick?: (productData: Product | ProductVariant) => void;
|
|
41
|
+
currencyAndPrice?: string;
|
|
41
42
|
}
|
|
42
43
|
export declare const ProductCard: (props: ProductCardInterface) => import("react/jsx-runtime").JSX.Element;
|
|
43
44
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../constants/Theme.js"),i=require("../../assets/icons/info.svg.js"),o=require("../checkBox/CheckBox.js"),c=require("../icon-button/IconButton.js"),r=require("../shimmer-image/ShimmerImage.js"),d=require("../tooltips/Tooltip.js"),n=require("../TypographyStyle.js"),l=require("./constants.js"),a=require("./helpers/ProductHelper.js"),s=require("./ProductPickerTag.js"),u=require("./style.js"),v=require("./utility.js");const p=l=>{const{isVariant:v,data:p,productId:h,collectionId:y,variantId:I,isSelected:P,selectedCollectionsDispatch:j,viewOnly:x,upliftAdditions:k,isPartiallyChecked:C,hideProductCheckbox:g,outOfStockAction:b,hideVariantCheckbox:O,hideProductVariants:m,pickerType:f="PRODUCT",onProductDetailClick:S,showProductDetailInfoIcon:T,currencyAndPrice:D}=l,{isVariantForProductPickerTag:V,dataForProductPickerTag:q,tagText:w,tagType:A}=a.ProductHelper.getDataForProductPickerTag(p,v,b);return e.jsxs(u.ProductCardStyle,Object.assign({isVariant:v,onClick:e=>{if(e.stopPropagation(),"PRODUCT"===f&&(g||O)){const e=Object.keys(p.variants);m?P?j({type:"productUnselected",data:{productId:h,collectionId:y}}):k("productSelected",{productId:h,variantId:I,collectionId:y,product:p}):P?j({type:"variantUnselected",data:{productId:h,variantId:I,collectionId:y}}):k("variantSelected",{productId:h,variantId:I||e[0],collectionId:y,variant:p})}},isActive:P},{children:[v&&!x&&!O||!v&&!x&&!g?e.jsx(o.CheckBox,{isChecked:P,isPartiallyChecked:C||!1,onValueChange:function(e,t,i){null==i||i.stopPropagation(),v?e?k(m?"productSelected":"variantSelected",{productId:h,variantId:I,collectionId:y,variant:p}):j({type:m?"productUnselected":"variantUnselected",data:{productId:h,variantId:I,collectionId:y}}):e?k("productSelected",{productId:h,collectionId:y,product:p}):j({type:"productUnselected",data:{productId:h,collectionId:y}})}}):e.jsx(e.Fragment,{}),e.jsx("div",{children:e.jsx(r.ShimmerImage,{width:40,height:40,imageUrl:p.image,alt:"Item",borderRadius:4})}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[e.jsx(d.Tooltip,Object.assign({variant:"light",body:p.name,placement:"bottom",delay:400},{children:e.jsx(n.TitleSmall,Object.assign({numberOfLines:1},{children:p.name}))})),T&&e.jsx(c.IconButton,{onClick:()=>{null==S||S(p)},Icon:()=>e.jsx(i.default,{width:20,height:20,color:t.COLORS.content.placeholder})})]})),e.jsx(s.ProductPickerTag,{isVariant:V,data:q,tagText:w,tagType:A}),e.jsx(n.BodyCaption,Object.assign({color:t.COLORS.content.secondary},{children:!(null==q?void 0:q.fbStatus)&&V||w?null:D}))]}))]}))};exports.ProductCard=p,exports.ProductGroup=t=>{var i,o,c,r,d,n,a,s,u;const{collectionId:h,productId:y,data:I,selectedData:P,selectedCollectionsDispatch:j,viewOnly:x,upliftAdditions:k,isProductPartiallyChecked:C,hideProductCheckbox:g,outOfStockAction:b,hideVariantCheckbox:O,hideProductVariants:m,pickerType:f,onProductDetailClick:S,showProductDetailInfoIcon:T}=t,D=e=>{var t,i,o,c,r,d;if(!(null===(i=null===(t=null==P?void 0:P[h])||void 0===t?void 0:t.products)||void 0===i?void 0:i[y]))return!1;return!!(null===(d=null===(r=null===(c=null===(o=null==P?void 0:P[h])||void 0===o?void 0:o.products)||void 0===c?void 0:c[y])||void 0===r?void 0:r.variants)||void 0===d?void 0:d[e])},V=m||!v.shouldShowVariant(I)?`${I.currency&&null!==(i=l.CurrencySymbols[I.currency])&&void 0!==i?i:""}${null!==(u=null!==(d=null===(r=null===(c=Object.values(null!==(o=I.variants)&&void 0!==o?o:{}))||void 0===c?void 0:c[0])||void 0===r?void 0:r.price)&&void 0!==d?d:null===(s=null===(a=Object.values(null!==(n=I.variants)&&void 0!==n?n:{}))||void 0===a?void 0:a[0])||void 0===s?void 0:s.actualPrice)&&void 0!==u?u:""}`:"";return e.jsxs("div",{children:[e.jsx(p,{isVariant:!1,data:I,productId:y,collectionId:h,isSelected:(()=>{var e,t;return!!(null===(t=null===(e=null==P?void 0:P[h])||void 0===e?void 0:e.products)||void 0===t?void 0:t[y])})(),isPartiallyChecked:C,selectedCollectionsDispatch:j,upliftAdditions:k,viewOnly:x,hideProductCheckbox:g,hideVariantCheckbox:O,hideProductVariants:m,pickerType:f,outOfStockAction:b,onProductDetailClick:S,showProductDetailInfoIcon:T,currencyAndPrice:V},y),m?null:v.shouldShowVariant(I)&&Object.keys(I.variants||[]).map((t=>{var i,o,c,r,d,n,a;const s=`${I.currency&&null!==(i=l.CurrencySymbols[I.currency])&&void 0!==i?i:""}${null!==(a=null!==(r=null===(c=null===(o=I.variants)||void 0===o?void 0:o[t])||void 0===c?void 0:c.price)&&void 0!==r?r:null===(n=null===(d=I.variants)||void 0===d?void 0:d[t])||void 0===n?void 0:n.actualPrice)&&void 0!==a?a:""}`;return e.jsx(p,{isVariant:!0,hideVariantCheckbox:O,data:Object.assign(Object.assign({},I.variants[t]),{currency:I.currency}),variantId:t,productId:y,viewOnly:x,upliftAdditions:k,collectionId:h,isSelected:D(t),selectedCollectionsDispatch:j,outOfStockAction:b,onProductDetailClick:S,showProductDetailInfoIcon:T,currencyAndPrice:s},t)}))]})};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("styled-components"),o=require("../../constants/Theme.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("styled-components"),o=require("../../constants/Theme.js"),r=require("../../assets/icons/cross.svg.js"),i=require("../icon-button/IconButton.js"),a=require("../shimmer-image/ShimmerImage.js"),n=require("../TypographyStyle.js"),d=require("./constants.js"),c=require("./helpers/ProductHelper.js"),l=require("./ProductPickerTag.js"),u=require("./utility.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=s(t);const x=t=>{var r,i,s,p,x,v,g,f,h,b,D,P,I,S,O,k;const T=void 0===t.productData.variants;let q;if(T)q=`${t.productData.currency&&null!==(r=d.CurrencySymbols[t.productData.currency])&&void 0!==r?r:""}${null!==(x=null!==(s=null===(i=t.productData)||void 0===i?void 0:i.price)&&void 0!==s?s:null===(p=t.productData)||void 0===p?void 0:p.actualPrice)&&void 0!==x?x:""}`;else{const e=null===(v=t.productData)||void 0===v?void 0:v.currency;q=`${e&&null!==(g=d.CurrencySymbols[e])&&void 0!==g?g:""}${null!==(O=null!==(D=null===(b=null===(h=Object.values(null!==(f=t.productData.variants)&&void 0!==f?f:{}))||void 0===h?void 0:h[0])||void 0===b?void 0:b.price)&&void 0!==D?D:null===(S=null===(I=Object.values(null!==(P=t.productData.variants)&&void 0!==P?P:{}))||void 0===I?void 0:I[0])||void 0===S?void 0:S.actualPrice)&&void 0!==O?O:""}`}const{isVariantForProductPickerTag:C,dataForProductPickerTag:w,tagText:$,tagType:z}=c.ProductHelper.getDataForProductPickerTag(t.productData,T,t.outOfStockAction);return e.jsxs(m,{children:[e.jsx(y,{children:e.jsx(a.ShimmerImage,{useDynamicInfoImageSize:t.useDynamicInfoImageSize,imageUrl:t.productData.image,width:200,height:200,borderRadius:4})}),e.jsxs(j,{children:[e.jsx(n.TitleRegular,Object.assign({style:{display:"flex"}},{children:t.productData.name})),e.jsx(n.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:`Product ID: ${t.productData.id}`})),e.jsx(n.BodyCaption,{className:"overlay-description",dangerouslySetInnerHTML:{__html:null!==(k=t.productData.description)&&void 0!==k?k:""}}),e.jsx(n.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:T?q:u.shouldShowVariant(t.productData)?null:q})),e.jsx(l.ProductPickerTag,{isVariant:C,data:w,tagText:$,tagType:z})]})]})},v=p.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1;
|
|
4
4
|
background: rgba(0, 0, 0, 0.5);
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
word-break: break-word;
|
|
18
18
|
margin-top: 8px;
|
|
19
19
|
}
|
|
20
|
-
`,p
|
|
20
|
+
`,g=p.default.div`
|
|
21
21
|
display: flex;
|
|
22
22
|
flex: 1;
|
|
23
23
|
background: rgba(0, 0, 0, 0.5);
|
|
24
|
-
`,
|
|
24
|
+
`,f=p.default.div`
|
|
25
25
|
position: relative;
|
|
26
26
|
|
|
27
27
|
.close-button {
|
|
@@ -32,21 +32,21 @@
|
|
|
32
32
|
background: ${o.COLORS.surface.standard};
|
|
33
33
|
border-radius: 50%;
|
|
34
34
|
}
|
|
35
|
-
`,
|
|
35
|
+
`,m=p.default.div`
|
|
36
36
|
display: flex;
|
|
37
37
|
background: white;
|
|
38
38
|
padding: 24px;
|
|
39
39
|
gap: 24px;
|
|
40
40
|
border-radius: 8px 8px 0px 0px;
|
|
41
|
-
`,
|
|
41
|
+
`,y=p.default.div`
|
|
42
42
|
display: flex;
|
|
43
43
|
max-width: min(50%, 200px);
|
|
44
44
|
flex-direction: column;
|
|
45
45
|
justify-content: center;
|
|
46
46
|
align-items: center;
|
|
47
|
-
`,
|
|
47
|
+
`,j=p.default.div`
|
|
48
48
|
display: flex;
|
|
49
49
|
flex: 1;
|
|
50
50
|
flex-direction: column;
|
|
51
51
|
gap: 4px;
|
|
52
|
-
`;exports.ProductInfoCard=
|
|
52
|
+
`;exports.ProductInfoCard=x,exports.ProductInfoOverlay=t=>e.jsxs(v,{children:[e.jsx(g,{}),e.jsx(f,{children:e.jsx(i.IconButton,{className:"close-button",onClick:t.onClose,Icon:r.default,width:20,height:20})}),e.jsx(x,{productData:t.productData,outOfStockAction:t.outOfStockAction,useDynamicInfoImageSize:t.useDynamicInfoImageSize})]});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export declare const ContainerStyle: import("styled-components").StyledComponent<"div", any, {
|
|
1
|
+
export declare const ContainerStyle: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
renderWithoutModal?: boolean | undefined;
|
|
3
|
+
}, never>;
|
|
2
4
|
export declare const ScrollContainerStyle: import("styled-components").StyledComponent<"div", any, {
|
|
3
5
|
screenName: string;
|
|
4
6
|
}, never>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js"),i=require("./modal.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=o(e);const n=r.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
background-color: white;
|
|
4
|
-
height: 75vh;
|
|
4
|
+
height: ${e=>e.renderWithoutModal?"90%":"75vh"};
|
|
5
5
|
flex-direction: column;
|
|
6
6
|
`,l=r.default.div`
|
|
7
7
|
overflow-y: scroll;
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
cursor: pointer;
|
|
76
76
|
background-color: ${t.COLORS.surface.hovered};
|
|
77
77
|
}
|
|
78
|
-
`,
|
|
78
|
+
`,u=r.default.div`
|
|
79
79
|
display: flex;
|
|
80
80
|
flex-direction: row;
|
|
81
81
|
max-height: 32px;
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
position: sticky;
|
|
88
88
|
top: 0;
|
|
89
89
|
z-index: 10;
|
|
90
|
-
`,
|
|
90
|
+
`,f=r.default.div`
|
|
91
91
|
display: flex;
|
|
92
92
|
flex-direction: column;
|
|
93
93
|
`,g=r.default.div`
|
|
@@ -134,4 +134,4 @@
|
|
|
134
134
|
justify-content: space-between;
|
|
135
135
|
margin-top: auto;
|
|
136
136
|
width: 100%;
|
|
137
|
-
`;exports.CollectionCardDetailStyle=p,exports.CollectionCardInfoStyle=a,exports.CollectionCardStyle=d,exports.CollectionNameHolder=
|
|
137
|
+
`;exports.CollectionCardDetailStyle=p,exports.CollectionCardInfoStyle=a,exports.CollectionCardStyle=d,exports.CollectionNameHolder=f,exports.ContainerStyle=n,exports.ProductCardStyle=x,exports.ProductScreenCollectionCardStyle=s,exports.ProductScreenHeader=c,exports.ScrollContainerStyle=l,exports.SelectedScreenHeader=u,exports.StyledFooterForNonModal=h,exports.VariantCardGridStyle=y,exports.VariantCardListStyle=g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/delete.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/delete.svg.js"),r=require("../../assets/icons/drag_handle.svg.js"),a=require("../../constants/Theme.js"),i=require("../icon-button/IconButton.js"),s=require("../shimmer-image/ShimmerImage.js"),n=require("../TypographyStyle.js"),o=require("./constants.js"),c=require("./helpers/ProductHelper.js"),l=require("./ProductPickerTag.js"),d=require("./style.js"),u=require("../tooltips/Tooltip.js");exports.VariantCardGridView=t=>{const{data:r}=t;return e.jsx(d.VariantCardGridStyle,{children:e.jsx(u.Tooltip,Object.assign({body:r.name,alwaysVisible:!1,variant:"dark",placement:"bottom"},{children:e.jsx(s.ShimmerImage,{width:72,height:72,imageUrl:r.image,alt:"Item",borderRadius:4})}))})},exports.VariantCardListView=m=>{var j,g,h;const{data:p,selectedCollectionsDispatch:x,outOfStockAction:y}=m,b=()=>{let e;return e=p.name.includes(p.productName)?p.name:`${p.productName} ${p.name}`,e},{dataForProductPickerTag:v,tagText:I,tagType:O}=c.ProductHelper.getDataForProductPickerTag(p,!0,y),T=`${p.currency&&null!==(j=o.CurrencySymbols[p.currency])&&void 0!==j?j:""}${null!==(h=null!==(g=p.price)&&void 0!==g?g:p.actualPrice)&&void 0!==h?h:""}`;return e.jsxs(d.VariantCardListStyle,{children:[e.jsxs("div",Object.assign({className:"text-container"},{children:[e.jsx(r.default,{width:24,height:24,color:a.COLORS.content.placeholder}),e.jsx("div",{children:e.jsx(s.ShimmerImage,{width:40,height:40,imageUrl:p.image,alt:"Item",borderRadius:4},p.variantId)}),e.jsxs("div",Object.assign({className:"tooltip-title-tag"},{children:[e.jsx(u.Tooltip,Object.assign({body:b(),placement:"bottom",delay:400,variant:"light"},{children:e.jsx(n.TitleSmall,Object.assign({numberOfLines:1},{children:b()}))})),e.jsx(l.ProductPickerTag,{isVariant:!0,data:v,tagText:I,tagType:O}),e.jsx(n.BodyCaption,Object.assign({color:a.COLORS.content.secondary},{children:!(null==v?void 0:v.fbStatus)||I?null:T}))]}))]})),e.jsx(i.IconButton,{Icon:()=>e.jsx(t.default,{width:24,height:24,color:a.COLORS.content.placeholder}),onClick:()=>{x&&x({type:"variantUnselected",data:{productId:p.productId,variantId:p.variantId,collectionId:p.collectionId}}),m.onDelete&&m.onDelete()}})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("./RadioButton.styled.js"),t=require("../TypographyStyle.js"),l=require("../../constants/Theme.js");const a=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("./RadioButton.styled.js"),t=require("../TypographyStyle.js"),l=require("../../constants/Theme.js");const a=s=>{const t=i.useMemo((()=>(null==s?void 0:s.activeColor)||l.COLORS.background.positive.vibrant),[s.activeColor]),a=i.useMemo((()=>s.isDisabled?l.COLORS.content.inactive:s.isActive?t:l.COLORS.content.primary),[s.isDisabled,s.isActive,t]);return e.jsxs("svg",Object.assign({width:s.isSmall?"16":"20",height:s.isSmall?"16":"20",viewBox:s.isSmall?"0 0 16 16":"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?6:9,stroke:a,strokeWidth:s.isSmall?1.5:2}),s.isActive&&e.jsx("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?3:5,fill:s.isDisabled?l.COLORS.content.inactive:t})]}))};exports.RadioButton=o=>{const[r,c]=i.useState(o.isActive||!1),[n,d]=i.useState(!1),[O,S]=i.useState(!1);i.useEffect((()=>{c(o.isActive)}),[o.isActive]);return e.jsxs(s.RadioButtonContainer,Object.assign({onClick:()=>{var e;if(!o.skipSelectingOff&&!o.isDisabled){const i=!r;c(i),null===(e=o.onValueChange)||void 0===e||e.call(o,i,o.value)}},onMouseEnter:()=>d(!o.skipHoverState),onMouseLeave:()=>d(!1),onMouseDown:()=>S(!o.skipHoverState),onMouseUp:()=>S(!1),style:o.caption?{alignItems:"flex-start"}:{}},{children:[e.jsx(s.RadioButtonIcon,Object.assign({checked:r,hovered:n,clicked:O,isDisabled:o.isDisabled||!1,size:o.size,style:o.caption?{margin:"2px 0"}:{}},{children:e.jsx(a,{isSmall:"SMALL"===o.size,isActive:r,isDisabled:o.isDisabled||!1,activeColor:o.activeColor})})),e.jsxs("div",{children:[o.label?o.boldOnChecked&&r||o.alwaysBold?e.jsx(t.TitleSmall,Object.assign({color:o.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:o.label})):"SMALL"===o.size?e.jsx(t.BodyCaption,Object.assign({color:o.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:o.label})):"MEDIUM"===o.labelSize?e.jsx(t.BodySecondary,Object.assign({color:o.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:o.label})):e.jsx(t.BodyPrimary,Object.assign({color:o.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:o.label})):e.jsx(e.Fragment,{}),o.caption&&e.jsx(t.BodyCaption,Object.assign({color:o.isDisabled?l.COLORS.text.disabled:l.COLORS.text.secondary},{children:o.caption}))]})]}))};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default EventsTrigger;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default IGTrigger;
|
package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownOption } from "../../../dropdown/type";
|
|
3
|
-
import { QueryBuilderProperty } from "../../
|
|
4
|
-
import { QueryBuilderNodeProps } from "../../
|
|
3
|
+
import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
|
|
4
|
+
import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
|
|
5
5
|
declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
|
|
6
6
|
cacheKey: string;
|
|
7
7
|
propertyAddBtnText: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as i,Fragment as l}from"react/jsx-runtime";import{useState as s,useEffect as a}from"react";import{CheckboxContainer as
|
|
1
|
+
import{jsxs as e,jsx as i,Fragment as l}from"react/jsx-runtime";import{useState as s,useEffect as t,useMemo as a}from"react";import{CheckboxContainer as o,CheckboxIcon as r}from"./CheckBox.styled.js";import{TitleRegular as d,TitleSmall as n,BodySecondary as c,BodyPrimary as h}from"../TypographyStyle.js";import{COLORS as b}from"../../constants/Theme.js";const m=l=>{const s=a((()=>l.activeColor||b.background.positive.vibrant),[l.activeColor]);return e("svg",Object.assign({width:l.isSmall?"16":"18",height:l.isSmall?"16":"18",viewBox:l.isSmall?"0 0 16 16":"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[i("rect",{x:"0",y:"0",width:l.isSmall?"16":"18",height:l.isSmall?"16":"18",rx:"4",fill:l.isDisabled?b.content.inactive:s}),!l.isPartial&&i("svg",Object.assign({width:l.isSmall?"8":"10",height:l.isSmall?"7":"9",x:"4",y:"4",viewBox:"0 0 10 9",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.68189 1.06043C10.0724 1.45096 10.0724 2.08412 9.68189 2.47464L4.02501 8.13152C3.63449 8.52205 3.00132 8.52205 2.6108 8.13152L0.489684 6.01041C0.0991601 5.61988 0.0991598 4.98672 0.489684 4.59619C0.880209 4.20567 1.51337 4.20567 1.9039 4.59619L3.31791 6.0102L8.26768 1.06043C8.6582 0.669907 9.29137 0.669907 9.68189 1.06043Z",fill:"white"})})),l.isPartial&&i("rect",{x:"5",y:l.isSmall?"7":"8",width:l.isSmall?"6":"8",height:"2",rx:"1",fill:b.surface.standard})]}))},v=a=>{var v;const[g,C]=s(a.isChecked||!1),[p,x]=s(a.isPartiallyChecked||!1),[S,u]=s(a.isDisabled||!1),[w,y]=s(!1),[k,D]=s(!1);t((()=>{C(a.isChecked)}),[a.isChecked]),t((()=>{u(a.isDisabled||!1)}),[a.isDisabled]),t((()=>{x(a.isPartiallyChecked||!1)}),[a.isPartiallyChecked]);return e(o,Object.assign({onClick:e=>{var i;if(!a.isDisabled){const l=!g;p?x(!p):C(l),null===(i=a.onValueChange)||void 0===i||i.call(a,l,a.value,e)}},onMouseEnter:()=>y(!a.skipHoverState),onMouseLeave:()=>y(!1),onMouseDown:()=>D(!a.skipHoverState),onMouseUp:()=>D(!1),isDisabled:S,enableHover:a.enableHover,style:null!==(v=a.style)&&void 0!==v?v:{}},{children:[i(r,Object.assign({checked:g,hovered:w,clicked:k,isDisabled:S,size:a.size,borderColor:a.checkboxBorderColor},{children:g&&i(m,{isPartial:p||!1,isDisabled:S,isSmall:"SMALL"===a.size,activeColor:null==a?void 0:a.activeColor})})),a.label?a.boldOnChecked&&g?"DEFAULT"===a.labelSize?i(d,Object.assign({color:a.isDisabled?b.text.disabled:b.text.primary},{children:a.label})):i(n,Object.assign({color:a.isDisabled?b.text.disabled:b.text.primary},{children:a.label})):"SMALL"===a.size||"SMALL"===a.labelSize?i(c,Object.assign({color:a.isDisabled?b.text.disabled:b.text.primary},{children:a.label})):i(h,Object.assign({color:a.isDisabled?b.text.disabled:b.text.primary},{children:a.label})):i(l,{}),a.rightComponent]}))};export{v as CheckBox};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as
|
|
1
|
+
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useState as i,useRef as l,useEffect as r}from"react";import{COLORS as s}from"../../constants/Theme.js";import d from"../../assets/icons/chevronDown.svg.js";import{Input as a}from"../input/Input.js";import{InputStyleContext as p}from"../input/context/InputStyleProvider.js";import c from"./ChipInput.js";import{DropdownPopover as u}from"./DropdownPopover/index.js";import{getSelectedOptionsAsText as h}from"./OpenedDropdown/utils/iterationOnOptions.js";function m(){}const v=v=>{var f,g,w,b,j,{placeHolder:I,size:y,onSelect:x,defaultOptions:O,disabled:S,noErrorHint:H,placeHolderHeight:D,showPlaceholderWhenSelected:T=!1,inputStyle:C={},inputType:P="default",onDeleteChip:E,truncatedText:z,showLeadingIconInPlaceholder:W=!1}=v,A=e(v,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder"]);const[L,_]=i(!1),k=null!=y?y:"default",M=l(),[N,U]=i(null!=O?O:[]);r((()=>{var e;const o=[];null===(e=null==A?void 0:A.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&o.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&o.push(e)})),U([...o])}),[A.options]),r((()=>{O&&U([...O])}),[O]);const V=h(N);return o(p.Provider,Object.assign({value:{InputWrapper:Object.assign({height:D||("small"===k?32:48),width:null!==(g=null!==(f=A.buttonWidth)&&void 0!==f?f:A.width)&&void 0!==g?g:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},C),input:{minHeight:"100%"}}},{children:t(u,Object.assign({"data-test":A["data-test"],ref:M,onSelect:function(e){Array.isArray(e)?U([...e]):U([e]),null==x||x(e)},disabled:S,onDropdownVisbilityChange:e=>_(e)},A,{children:["default"==P&&o(a,{version:A.version,noErrorHint:H,state:S?"disabled":"none",value:T?I:null!=V?V:"",errorMessage:A.error,variant:k,placeholder:null!=I?I:"Select an option",width:null!==(w=A.width)&&void 0!==w?w:"100%",onChangeText:m,leftIcon:W&&(null===(b=N[0])||void 0===b?void 0:b.leadingIcon)?{icon:()=>{var e;return o(n,{children:null===(e=N[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>o(d,{style:{transform:L?"rotate(180deg)":"rotate(0deg)"},onClick:m,width:"small"===k?20:24,height:"small"===k?20:24,color:s.content.primary})},truncateText:null==z||z}),"chip"==P&&o(c,{placeholder:null!=I?I:"Select options",chips:N,onDeleteChip:e=>{null==E||E(e)},isDropdownOpened:L,sizeToUse:k,containerStyle:{width:null!==(j=A.width)&&void 0!==j?j:"100%",cursor:"pointer"}})]}))}))};v.displayName="Dropdown";export{v as Dropdown};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as n,useEffect as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as n,useEffect as i}from"react";import{ZeroState as r}from"../../../zeroState/ZeroState.js";import{useOutside as l}from"../../../../hooks/useOutside.js";import{useDropdown as s}from"../../hooks/useDropdown.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as a}from"./menu/FreeFormMenu.js";import{MenuList as u}from"./menu/MenuList.js";import{SelectAllMenu as p}from"./menu/SelectAllMenu.js";import d from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as h,MenuListContainer as m}from"./OpennedDropdown.styled.js";import{SearchBox as f}from"./searchbox/SearchBox.js";import{SearchZeroState as S}from"./searchbox/SearchZeroState.js";const g=304,b=290,w=w=>{let{options:j,isSearchable:v,isMultiSelect:y,width:O,allowFreeForm:x,height:C,onClose:D,onSelect:M,onSearch:L,version:k,skipSorting:A,headerRef:F,hideSelectAll:I,primaryButtonText:B,onInfiniteScroll:H,onMultiSelectClear:T,onDropdownItemClick:R,buttonOptions:Z,isSearchLoading:q,disableSearchOptions:z,disableSearchedOptionExcept:E,useDefaultCursor:K,containerStyle:N={}}=w;const{dropdownOptions:P,search:W,searchedString:G,searchedOptions:J,onApplyHandler:Q,selectAllHandler:U,onMultiSelectClear:V,onFreeFormSelect:X,onMultiSelectApply:Y,latestDropdownOptionsRef:$,getSelectedOptions:_}=s(k,j,M,A,y,L,z,E),[ee,te]=o(null!=O?O:b),[oe,ne]=o(null),ie=n(null),re=n([]);l(ie,(()=>{if(ne(null),y&&"2.0"===k){const e=_($.current);null==D||D(e)}else null==D||D(P)}),[F,re]);const le=null!=C?C:g,se="number"==typeof le?v&&y?le-96:v&&!y||!v&&y?le-48:le:le;i((()=>{const e=null!=O?O:b;if(null===oe)te(e);else if("number"==typeof e)te(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));te(t)}}),[oe]);const ce=[],ae=(G&&L?J:P).map((e=>{var t,o;if(G&&!L){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(G.toLowerCase()))&&(ce.push(!G||e.label===G),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(G.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(G.toLowerCase()))?(ce.push(!G||e.label===G),e):null}return e})).filter((e=>null!==e)),ue=!!v&&G&&0===ae.length;return e(h,Object.assign({version:k,ref:ie,style:Object.assign({width:ee},N)},{children:[e("div",Object.assign({style:{width:oe?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!v&&t(f,{onSearch:W,version:k}),ae.length||G?e(m,Object.assign({minHeight:le,maxHeight:se},{children:[!!y&&!ue&&!I&&t(p,{version:k,options:G&&L?J:P,onSelect:U}),!x&&ue&&t(S,{isLoading:q,height:se,searchedString:G}),x&&(ue||!!ce.length&&ce.every((e=>!1===e)))&&t(a,{version:k,isMultiSelect:y,onSelect:X,searchedString:G}),t(u,{onInfiniteScroll:H,onDropdownItemClick:R,version:k,onSelect:Q,showDescription:function(e,t){ne(e&&t?{title:e,description:t}:null)},isMultiSelect:y,options:ae,useDefaultCursor:K,ref:re})]})):t("div",Object.assign({style:{height:le,display:"flex"}},{children:t(r,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!y&&!(!ae.length&&!G)&&"2.0"!==k&&t(d,{onClear:()=>{V(),null==T||T()},onApply:Y,list:G&&L?J:P,buttonText:B,buttonOptions:Z})]})),!!oe&&t(c,{title:oe.title,description:oe.description,version:k})]}))};export{w as OpenedDropdown};
|
|
@@ -10,4 +10,4 @@ import{jsx as e,Fragment as t,jsxs as o}from"react/jsx-runtime";import n from"..
|
|
|
10
10
|
border: ${e=>{let{version:t}=e;return"1.0"===t?`1px solid ${p.colorsV2.stroke.primary}`:"none"}};
|
|
11
11
|
max-height: 248px;
|
|
12
12
|
overflow-y: auto;
|
|
13
|
-
`,h=i(((i,s)=>{let{option:c,isMultiSelect:h,showDescription:b,onSelect:x,last:f,version:j,onDropdownItemClick:y,useDefaultCursor:C}=i;var I;const[O,k]=r(c.selected),T=(e,t)=>{if(!e.children){w(!e.selected);const o=t?Object.assign(Object.assign({},e),{parent:t}):e;null==y||y(o)}},w=e=>{c.disabled||x(Object.assign(Object.assign({},c),{selected:e}))},D=C?{cursor:"default"}:{};return e(t,{children:e(a,Object.assign({body:"",tooltipContent:c.children?e("div",Object.assign({style:{backgroundColor:p.colorsV2.surface.standard},ref:s,onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1)},{children:e(v,Object.assign({version:null!=j?j:"2.0"},{children:c.children.map((t=>{var o;return e(g,{version:j,style:(null!==(o=null==c?void 0:c.children)&&void 0!==o?o:[]).length-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),T(t,c)},listItem:{value:t.value,label:t.label},subText:t.subText,leadingIcon:t.leadingIcon||void 0,customComponent:t.customComponent,trailingIcon:t.trailingIcon||void 0,variant:c.disabled?"inactive":t.selected?"selected":"default"},t.value)}))}))})):e(t,{}),placement:"right-start",hideArrow:!0},{children:e(g,{version:j,style:f?Object.assign({borderBottom:0},D):Object.assign({},D),onClick:e=>{e.preventDefault(),T(c)},onMouseOver:()=>{c.description?b(c.label,c.description):b()},listItem:{value:c.value,label:c.label},subText:c.subText,leadingIcon:h?o("div",Object.assign({style:{display:"flex",alignContent:"center",justifyContent:"center",gap:8}},{children:[e(l,{size:"2.0"===j?"SMALL":"DEFAULT",isDisabled:null!==(I=c.disabled)&&void 0!==I&&I,isChecked:!!c.selected,onValueChange:w}),e("div",Object.assign({style:{marginRight:"-4px"}},{children:c.leadingIcon}))]})):c.leadingIcon?e(t,{children:c.leadingIcon}):void 0,customComponent:c.customComponent,trailingIcon:c.isFreeForm?e(u,{children:e(d,Object.assign({style:{color:m.content.secondary}},{children:"Freeform"}))}):c.children?e(n,{width:12,height:12}):c.trailingIcon?e(t,{children:c.trailingIcon}):void 0,variant:c.disabled?"inactive":c.selected||!h&&O?"selected":"default"})}))})}));export{h as MenuItem};
|
|
13
|
+
`,h=i(((i,s)=>{let{option:c,isMultiSelect:h,showDescription:b,onSelect:x,last:f,version:j,onDropdownItemClick:y,useDefaultCursor:C}=i;var I;const[O,k]=r(c.selected),T=(e,t)=>{if(!e.children){w(!e.selected);const o=t?Object.assign(Object.assign({},e),{parent:t}):e;null==y||y(o)}},w=e=>{c.disabled||x(Object.assign(Object.assign({},c),{selected:e}))},D=C?{cursor:"default"}:{};return e(t,{children:e(a,Object.assign({body:"",tooltipContent:c.children?e("div",Object.assign({style:{backgroundColor:p.colorsV2.surface.standard},ref:s,onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1)},{children:e(v,Object.assign({version:null!=j?j:"2.0"},{children:c.children.map((t=>{var o;return e(g,{version:j,style:"1.0"!==j&&(null!==(o=null==c?void 0:c.children)&&void 0!==o?o:[]).length-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),T(t,c)},listItem:{value:t.value,label:t.label},subText:t.subText,leadingIcon:t.leadingIcon||void 0,customComponent:t.customComponent,trailingIcon:t.trailingIcon||void 0,variant:c.disabled?"inactive":t.selected?"selected":"default"},t.value)}))}))})):e(t,{}),placement:"right-start",hideArrow:!0},{children:e(g,{version:j,style:f?Object.assign({borderBottom:0},D):Object.assign({},D),onClick:e=>{e.preventDefault(),T(c)},onMouseOver:()=>{c.description?b(c.label,c.description):b()},listItem:{value:c.value,label:c.label},subText:c.subText,leadingIcon:h?o("div",Object.assign({style:{display:"flex",alignContent:"center",justifyContent:"center",gap:8}},{children:[e(l,{size:"2.0"===j?"SMALL":"DEFAULT",isDisabled:null!==(I=c.disabled)&&void 0!==I&&I,isChecked:!!c.selected,onValueChange:w}),e("div",Object.assign({style:{marginRight:"-4px"}},{children:c.leadingIcon}))]})):c.leadingIcon?e(t,{children:c.leadingIcon}):void 0,customComponent:c.customComponent,trailingIcon:c.isFreeForm?e(u,{children:e(d,Object.assign({style:{color:m.content.secondary}},{children:"Freeform"}))}):c.children?e(n,{width:12,height:12}):c.trailingIcon?e(t,{children:c.trailingIcon}):void 0,variant:c.disabled?"inactive":c.selected||!h&&O?"selected":"default"})}))})}));export{h as MenuItem};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import o from"../../node_modules/lodash.debounce/index.js";import{useState as s,useCallback as r,useEffect as n}from"react";import{PageLoader as c}from"../bik-layout/PageLoader.js";import{CheckBox as l}from"../checkBox/CheckBox.js";import{Input as i}from"../input/Input.js";import{StyledModal as d}from"../modals/styledModal.js";import{StyledProductPickerContainer as a,StyledZeroState as p}from"./ProductPicker.styled.js";import{BodyPrimary as m,Caption as h,
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import o from"../../node_modules/lodash.debounce/index.js";import{useState as s,useCallback as r,useEffect as n}from"react";import{PageLoader as c}from"../bik-layout/PageLoader.js";import{CheckBox as l}from"../checkBox/CheckBox.js";import{Input as i}from"../input/Input.js";import{StyledModal as d}from"../modals/styledModal.js";import{StyledProductPickerContainer as a,StyledZeroState as p}from"./ProductPicker.styled.js";import{BodyPrimary as m,Caption as h,TitleSmall as u,BodySecondary as g}from"../TypographyStyle.js";import v from"../../utils/DateUtils.js";import{DEFAULT_THEME as f}from"../../constants/Theme.js";import j from"../../assets/icons/alert_triangle.svg.js";import y from"../../assets/icons/search.svg.js";const P="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg",b=o=>{let{text:s,styleProps:r}=o;return e(p,{children:[t("div",Object.assign({className:"icon__container",style:Object.assign({},r)},{children:t(j,{width:24,height:24,color:f.colorsV2.content.secondary})})),t(u,{children:"No results found"}),t(g,Object.assign({style:{color:f.colorsV2.content.secondary,textAlign:"center"}},{children:`Sorry we could not find any results for "${s}"`}))]})},x=n=>{var d,p,g,j;const x=n.instaPost?v.dateFormat(new Date(n.instaPost.timestamp),"•",!0):"",[_,O]=s(n.products),[w,C]=s(!1),[S,N]=s(""),V=r(o((e=>{e?(O([]),n.onSearchKeyChange(e).then((e=>{O(e),C(!1)}))):(O(n.products),C(!1))}),700),[]);return e(a,{children:[n.instaPost&&e("div",Object.assign({className:"post__wrapper"},{children:[t("img",{alt:"Ig Media",onError:e=>{e.target.onerror=null,e.target.src=P},src:null===(d=n.instaPost)||void 0===d?void 0:d.media_url,className:"post__thumbnail"}),e("div",Object.assign({className:"post__info-wrapper"},{children:[t(m,Object.assign({style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",color:n.instaPost.caption?f.colorsV2.content.primary:f.colorsV2.content.secondary}},{children:(null===(p=n.instaPost)||void 0===p?void 0:p.caption)?null===(g=n.instaPost)||void 0===g?void 0:g.caption:"No caption"})),t(h,Object.assign({style:{color:f.colorsV2.content.placeholder}},{children:x}))]}))]})),t("div",Object.assign({style:{borderTop:n.instaPost?`1px solid ${f.colorsV2.stroke.primary}`:"none",borderBottom:`1px solid ${f.colorsV2.stroke.primary}`,padding:n.instaPost?"16px 24px":"0px 24px 16px 24px"}},{children:t(i,{placeholder:null!==(j=n.searchPlaceholder)&&void 0!==j?j:"Search products..",onChangeText:e=>{var t;N(e),(null===(t=e.trim())||void 0===t?void 0:t.length)>0?(C(!0),V(e)):(C(!1),O(n.products))},rightIcon:{icon:y}})})),e("div",Object.assign({style:{maxHeight:350,overflowY:"scroll"}},{children:[w&&t("div",Object.assign({className:"loader__wrapper"},{children:t(c,{})})),0!==_.length||w?_.map((o=>{var s;const r=n.selectedProducts.find((e=>e.id===o.id));return e("div",Object.assign({className:"product__wrapper"},{children:[e("div",Object.assign({className:"product__info-wrapper"},{children:[t("img",{alt:"Product",onError:e=>{e.target.onerror=null,e.target.src=P},src:null!==(s=o.image)&&void 0!==s?s:P,className:"product__image"}),t(u,{children:o.name})]})),t("div",Object.assign({style:{order:1}},{children:t(l,{isChecked:void 0!==r,onValueChange:e=>{((e,t)=>{const o=n.selectedProducts.find((e=>e.id===t.id));if(e&&!o){const e=[...n.selectedProducts,t];n.setSelectedProducts(e)}else if(o){const e=[...n.selectedProducts];let o=-1;n.selectedProducts.forEach(((e,s)=>{e.id===t.id&&(o=s)})),e.splice(o,1),n.setSelectedProducts(e)}})(e,o)}})}))]}),o.id)})):t(b,{text:S})]}))]})},_=e=>{var o;const[r,c]=s([]);return n((()=>{var t;c(null!==(t=e.selectedProducts)&&void 0!==t?t:[])}),[null===(o=e.selectedProducts)||void 0===o?void 0:o.length]),t(d,Object.assign({open:e.show,onClose:()=>{e.onClose()},footerLeftCustomElement:r.length>10?t(h,Object.assign({style:{color:f.colorsV2.content.negative}},{children:"Can't add more than 10 products"})):t(h,Object.assign({style:{color:f.colorsV2.content.placeholder}},{children:r?`${r.length} selected`:""})),headingTitle:e.title,primaryButton:{disabled:r.length>10||0===r.length,buttonType:"primary",buttonText:"Select",size:"small",onClick:()=>{e.setSelectedProducts(r),e.onClose()}},secondaryButton:e.secondaryButtonProps,footerShadow:!0},{children:t(x,Object.assign({},e,{selectedProducts:r,setSelectedProducts:c}))}))};export{_ as PricePleaseProductPicker,x as ProductPickerContent};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { TagType } from '../tag/model';
|
|
1
2
|
import { Product, ProductVariant } from './modal';
|
|
2
|
-
import { OUT_OF_STOCK_ACTION } from './type';
|
|
3
3
|
export type ProductPickerTagType = {
|
|
4
4
|
isVariant: boolean;
|
|
5
5
|
data: Product | ProductVariant;
|
|
6
|
-
|
|
6
|
+
tagText?: string;
|
|
7
|
+
tagType?: TagType;
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
9
10
|
* Used in Product Screen, Search Screen, Selected Screen and Rearrange Screen.
|
|
@@ -12,6 +13,8 @@ export type ProductPickerTagType = {
|
|
|
12
13
|
* New logic: When product has only one variant and variant name is same as product name,
|
|
13
14
|
* we consider that a variant and do operations as variant.
|
|
14
15
|
*
|
|
16
|
+
* The logic for showing tag is moved to ProductHelper.tsx.
|
|
17
|
+
*
|
|
15
18
|
* Note: If there is no Fb rejected tag in the variant, we show a shimmer,
|
|
16
19
|
* meanwhile hit the API to get FB status.
|
|
17
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,Fragment as e}from"react/jsx-runtime";import{BikShimmer as i}from"../shimmer/ShimmerComponent/BikShimmer.js";import{Tag as
|
|
1
|
+
import{jsx as t,Fragment as e}from"react/jsx-runtime";import{BikShimmer as i}from"../shimmer/ShimmerComponent/BikShimmer.js";import{Tag as r}from"../tag/Tag.js";const s=s=>{const{isVariant:a,data:m,tagText:o,tagType:n}=s;return t("div",Object.assign({style:{display:"flex"}},{children:!(null==m?void 0:m.fbStatus)&&a?t(i,{boxes:[{height:"24px",width:"100px",marginTop:"0px"}]}):o?t("div",Object.assign({style:{display:"flex"}},{children:t(r,{tagText:o,type:n,theme:"light"})})):t(e,{})}))};export{s as ProductPickerTag};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const CurrencySymbols: {
|
|
2
|
+
USD: string;
|
|
3
|
+
GBP: string;
|
|
4
|
+
CAD: string;
|
|
5
|
+
AUD: string;
|
|
6
|
+
DKK: string;
|
|
7
|
+
SEK: string;
|
|
8
|
+
EUR: string;
|
|
9
|
+
BRL: string;
|
|
10
|
+
TRY: string;
|
|
11
|
+
JPY: string;
|
|
12
|
+
SAR: string;
|
|
13
|
+
AED: string;
|
|
14
|
+
EGP: string;
|
|
15
|
+
MAD: string;
|
|
16
|
+
INR: string;
|
|
17
|
+
CHF: string;
|
|
18
|
+
CNY: string;
|
|
19
|
+
NZD: string;
|
|
20
|
+
MXN: string;
|
|
21
|
+
ZAR: string;
|
|
22
|
+
RUB: string;
|
|
23
|
+
KRW: string;
|
|
24
|
+
SGD: string;
|
|
25
|
+
PKR: string;
|
|
26
|
+
RO: string;
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const R={USD:"$",GBP:"£",CAD:"C$",AUD:"A$",DKK:"DKK",SEK:"SEK",EUR:"€",BRL:"R$",TRY:"₺",JPY:"¥",SAR:"ر.س",AED:"د.إ",EGP:"E£",MAD:"د.م.",INR:"₹",CHF:"Fr",CNY:"¥",NZD:"NZ$",MXN:"Mex$",ZAR:"R",RUB:"₽",KRW:"₩",SGD:"S$",PKR:"Rs",RO:"lei"};export{R as CurrencySymbols};
|
|
@@ -36,6 +36,12 @@ export declare class ProductHelper {
|
|
|
36
36
|
* For FB Rejected returns 'negative', for rest returns 'warning'
|
|
37
37
|
*/
|
|
38
38
|
static getTagType: (tagText: string) => TagType;
|
|
39
|
+
static getDataForProductPickerTag: (data: Product | ProductVariant, isVariant: boolean, outOfStockAction: OUT_OF_STOCK_ACTION | undefined) => {
|
|
40
|
+
isVariantForProductPickerTag: boolean;
|
|
41
|
+
dataForProductPickerTag: Product | ProductVariant;
|
|
42
|
+
tagText: string | undefined;
|
|
43
|
+
tagType: TagType;
|
|
44
|
+
};
|
|
39
45
|
}
|
|
40
46
|
/**
|
|
41
47
|
* Loops through each collection, each product, each variant.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{OUT_OF_STOCK_ACTION as
|
|
1
|
+
import{OUT_OF_STOCK_ACTION as t}from"../type.js";const n={NORMAL:null,NOT_SYNCED:"Hidden",OUT_OF_STOCK:"Out of Stock",FB_REJECTED:"Rejected on FB catalog"};class l{static getProductLabels(l){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.NORMAL,u="NORMAL";if(l.variants)return n[u];const a=l;return"REJECTED"===(null==a?void 0:a.fbStatus)?n.FB_REJECTED:(i===t.HIDE&&(!a.skipSync||0!==(null==a?void 0:a.quantity)&&-2!==(null==a?void 0:a.quantity)||(u="NOT_SYNCED"),a.skipSync&&0!==(null==a?void 0:a.quantity)&&-2!==(null==a?void 0:a.quantity)&&(u="NOT_SYNCED"),a.skipSync||0!==(null==a?void 0:a.quantity)&&-2!==(null==a?void 0:a.quantity)||(u="NOT_SYNCED"),a.skipSync||0===(null==a?void 0:a.quantity)||-2===(null==a?void 0:a.quantity)||(u="NORMAL")),i===t.BLUR&&(!a.skipSync||0!==(null==a?void 0:a.quantity)&&-2!==(null==a?void 0:a.quantity)||(u="NOT_SYNCED"),a.skipSync&&0!==(null==a?void 0:a.quantity)&&-2!==(null==a?void 0:a.quantity)&&(u="NOT_SYNCED"),a.skipSync||0!==(null==a?void 0:a.quantity)&&-2!==(null==a?void 0:a.quantity)||(u="OUT_OF_STOCK"),a.skipSync||0===(null==a?void 0:a.quantity)||-2===(null==a?void 0:a.quantity)||(u="NORMAL")),i===t.NORMAL&&(!a.skipSync||0!==(null==a?void 0:a.quantity)&&-2!==(null==a?void 0:a.quantity)||(u="NOT_SYNCED"),a.skipSync&&0!==(null==a?void 0:a.quantity)&&-2!==(null==a?void 0:a.quantity)&&(u="NOT_SYNCED"),a.skipSync||0!==(null==a?void 0:a.quantity)&&-2!==(null==a?void 0:a.quantity)||(u="NORMAL"),a.skipSync||0===(null==a?void 0:a.quantity)||-2===(null==a?void 0:a.quantity)||(u="NORMAL")),n[u])}}Object.defineProperty(l,"getTagType",{enumerable:!0,configurable:!0,writable:!0,value:t=>n.FB_REJECTED===t?"negative":"warning"}),Object.defineProperty(l,"getDataForProductPickerTag",{enumerable:!0,configurable:!0,writable:!0,value:(t,n,i)=>{var u,a;let e=t,o=n;1===Object.keys(null!==(u=null==t?void 0:t.variants)&&void 0!==u?u:{}).length&&(e=Object.values(null!==(a=null==t?void 0:t.variants)&&void 0!==a?a:{})[0],o=!0);const r=l.getProductLabels(e,i);return{isVariantForProductPickerTag:o,dataForProductPickerTag:e,tagText:null!=r?r:void 0,tagType:l.getTagType(null!=r?r:"")}}});const i=t=>{let n=[];Object.keys(t).forEach((l=>{var i;return Object.keys((null===(i=null==t?void 0:t[l])||void 0===i?void 0:i.products)||[]).forEach((i=>{var u,a;const e=null!==(u=t[l].products)&&void 0!==u?u:[],o=null!==(a=e[i].variants)&&void 0!==a?a:[];return Object.keys(o).map((t=>{const n=o[t];n.currency=e[i].currency,n.variantId=t,n.productId=i,n.collectionId=l,n.productName=e[i].name})),n=[...n,...Object.values(o)],n}))}));const l=n.sort(((t,n)=>null==t.displayOrder&&null==n.displayOrder?0:null==t.displayOrder?1:null==n.displayOrder?-1:t.displayOrder-n.displayOrder));return l.forEach(((t,n)=>{t.displayOrder=n})),l};export{l as ProductHelper,i as parseSelectedVariantsToArray};
|
|
@@ -38,6 +38,7 @@ interface ProductCardInterface {
|
|
|
38
38
|
showProductDetailInfoIcon?: boolean;
|
|
39
39
|
pickerType?: 'COLLECTION' | 'PRODUCT';
|
|
40
40
|
onProductDetailClick?: (productData: Product | ProductVariant) => void;
|
|
41
|
+
currencyAndPrice?: string;
|
|
41
42
|
}
|
|
42
43
|
export declare const ProductCard: (props: ProductCardInterface) => import("react/jsx-runtime").JSX.Element;
|
|
43
44
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as i,Fragment as o}from"react/jsx-runtime";import{COLORS as e}from"../../constants/Theme.js";import c from"../../assets/icons/info.svg.js";import{CheckBox as d}from"../checkBox/CheckBox.js";import{IconButton as n}from"../icon-button/IconButton.js";import{ShimmerImage as
|
|
1
|
+
import{jsxs as t,jsx as i,Fragment as o}from"react/jsx-runtime";import{COLORS as e}from"../../constants/Theme.js";import c from"../../assets/icons/info.svg.js";import{CheckBox as d}from"../checkBox/CheckBox.js";import{IconButton as n}from"../icon-button/IconButton.js";import{ShimmerImage as r}from"../shimmer-image/ShimmerImage.js";import{Tooltip as l}from"../tooltips/Tooltip.js";import{TitleSmall as a,BodyCaption as s}from"../TypographyStyle.js";import{CurrencySymbols as u}from"./constants.js";import{ProductHelper as v}from"./helpers/ProductHelper.js";import{ProductPickerTag as p}from"./ProductPickerTag.js";import{ProductCardStyle as h}from"./style.js";import{shouldShowVariant as m}from"./utility.js";const I=o=>{var e,c,d,n,r,l,a,s,v;const{collectionId:p,productId:h,data:I,selectedData:P,selectedCollectionsDispatch:f,viewOnly:k,upliftAdditions:g,isProductPartiallyChecked:C,hideProductCheckbox:b,outOfStockAction:j,hideVariantCheckbox:O,hideProductVariants:x,pickerType:D,onProductDetailClick:T,showProductDetailInfoIcon:S}=o,V=t=>{var i,o,e,c,d,n;if(!(null===(o=null===(i=null==P?void 0:P[p])||void 0===i?void 0:i.products)||void 0===o?void 0:o[h]))return!1;return!!(null===(n=null===(d=null===(c=null===(e=null==P?void 0:P[p])||void 0===e?void 0:e.products)||void 0===c?void 0:c[h])||void 0===d?void 0:d.variants)||void 0===n?void 0:n[t])},A=x||!m(I)?`${I.currency&&null!==(e=u[I.currency])&&void 0!==e?e:""}${null!==(v=null!==(r=null===(n=null===(d=Object.values(null!==(c=I.variants)&&void 0!==c?c:{}))||void 0===d?void 0:d[0])||void 0===n?void 0:n.price)&&void 0!==r?r:null===(s=null===(a=Object.values(null!==(l=I.variants)&&void 0!==l?l:{}))||void 0===a?void 0:a[0])||void 0===s?void 0:s.actualPrice)&&void 0!==v?v:""}`:"";return t("div",{children:[i(y,{isVariant:!1,data:I,productId:h,collectionId:p,isSelected:(()=>{var t,i;return!!(null===(i=null===(t=null==P?void 0:P[p])||void 0===t?void 0:t.products)||void 0===i?void 0:i[h])})(),isPartiallyChecked:C,selectedCollectionsDispatch:f,upliftAdditions:g,viewOnly:k,hideProductCheckbox:b,hideVariantCheckbox:O,hideProductVariants:x,pickerType:D,outOfStockAction:j,onProductDetailClick:T,showProductDetailInfoIcon:S,currencyAndPrice:A},h),x?null:m(I)&&Object.keys(I.variants||[]).map((t=>{var o,e,c,d,n,r,l;const a=`${I.currency&&null!==(o=u[I.currency])&&void 0!==o?o:""}${null!==(l=null!==(d=null===(c=null===(e=I.variants)||void 0===e?void 0:e[t])||void 0===c?void 0:c.price)&&void 0!==d?d:null===(r=null===(n=I.variants)||void 0===n?void 0:n[t])||void 0===r?void 0:r.actualPrice)&&void 0!==l?l:""}`;return i(y,{isVariant:!0,hideVariantCheckbox:O,data:Object.assign(Object.assign({},I.variants[t]),{currency:I.currency}),variantId:t,productId:h,viewOnly:k,upliftAdditions:g,collectionId:p,isSelected:V(t),selectedCollectionsDispatch:f,outOfStockAction:j,onProductDetailClick:T,showProductDetailInfoIcon:S,currencyAndPrice:a},t)}))]})},y=u=>{const{isVariant:m,data:I,productId:y,collectionId:P,variantId:f,isSelected:k,selectedCollectionsDispatch:g,viewOnly:C,upliftAdditions:b,isPartiallyChecked:j,hideProductCheckbox:O,outOfStockAction:x,hideVariantCheckbox:D,hideProductVariants:T,pickerType:S="PRODUCT",onProductDetailClick:V,showProductDetailInfoIcon:A,currencyAndPrice:w}=u,{isVariantForProductPickerTag:U,dataForProductPickerTag:$,tagText:B,tagType:F}=v.getDataForProductPickerTag(I,m,x);return t(h,Object.assign({isVariant:m,onClick:t=>{if(t.stopPropagation(),"PRODUCT"===S&&(O||D)){const t=Object.keys(I.variants);T?k?g({type:"productUnselected",data:{productId:y,collectionId:P}}):b("productSelected",{productId:y,variantId:f,collectionId:P,product:I}):k?g({type:"variantUnselected",data:{productId:y,variantId:f,collectionId:P}}):b("variantSelected",{productId:y,variantId:f||t[0],collectionId:P,variant:I})}},isActive:k},{children:[m&&!C&&!D||!m&&!C&&!O?i(d,{isChecked:k,isPartiallyChecked:j||!1,onValueChange:function(t,i,o){null==o||o.stopPropagation(),m?t?b(T?"productSelected":"variantSelected",{productId:y,variantId:f,collectionId:P,variant:I}):g({type:T?"productUnselected":"variantUnselected",data:{productId:y,variantId:f,collectionId:P}}):t?b("productSelected",{productId:y,collectionId:P,product:I}):g({type:"productUnselected",data:{productId:y,collectionId:P}})}}):i(o,{}),i("div",{children:i(r,{width:40,height:40,imageUrl:I.image,alt:"Item",borderRadius:4})}),t("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[i(l,Object.assign({variant:"light",body:I.name,placement:"bottom",delay:400},{children:i(a,Object.assign({numberOfLines:1},{children:I.name}))})),A&&i(n,{onClick:()=>{null==V||V(I)},Icon:()=>i(c,{width:20,height:20,color:e.content.placeholder})})]})),i(p,{isVariant:U,data:$,tagText:B,tagType:F}),i(s,Object.assign({color:e.content.secondary},{children:!(null==$?void 0:$.fbStatus)&&U||B?null:w}))]}))]}))};export{y as ProductCard,I as ProductGroup};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-components";import{COLORS as
|
|
1
|
+
import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-components";import{COLORS as r}from"../../constants/Theme.js";import a from"../../assets/icons/cross.svg.js";import{IconButton as e}from"../icon-button/IconButton.js";import{ShimmerImage as n}from"../shimmer-image/ShimmerImage.js";import{TitleRegular as c,BodyCaption as d}from"../TypographyStyle.js";import{CurrencySymbols as l}from"./constants.js";import{ProductHelper as s}from"./helpers/ProductHelper.js";import{ProductPickerTag as u}from"./ProductPickerTag.js";import{shouldShowVariant as p}from"./utility.js";const m=i=>o(g,{children:[t(f,{}),t(x,{children:t(e,{className:"close-button",onClick:i.onClose,Icon:a,width:20,height:20})}),t(v,{productData:i.productData,outOfStockAction:i.outOfStockAction,useDynamicInfoImageSize:i.useDynamicInfoImageSize})]}),v=i=>{var a,e,m,v,g,f,x,D,j,k,I,P,T,S,w,O;const $=void 0===i.productData.variants;let z;if($)z=`${i.productData.currency&&null!==(a=l[i.productData.currency])&&void 0!==a?a:""}${null!==(g=null!==(m=null===(e=i.productData)||void 0===e?void 0:e.price)&&void 0!==m?m:null===(v=i.productData)||void 0===v?void 0:v.actualPrice)&&void 0!==g?g:""}`;else{const o=null===(f=i.productData)||void 0===f?void 0:f.currency;z=`${o&&null!==(x=l[o])&&void 0!==x?x:""}${null!==(w=null!==(I=null===(k=null===(j=Object.values(null!==(D=i.productData.variants)&&void 0!==D?D:{}))||void 0===j?void 0:j[0])||void 0===k?void 0:k.price)&&void 0!==I?I:null===(S=null===(T=Object.values(null!==(P=i.productData.variants)&&void 0!==P?P:{}))||void 0===T?void 0:T[0])||void 0===S?void 0:S.actualPrice)&&void 0!==w?w:""}`}const{isVariantForProductPickerTag:A,dataForProductPickerTag:F,tagText:C,tagType:H}=s.getDataForProductPickerTag(i.productData,$,i.outOfStockAction);return o(y,{children:[t(h,{children:t(n,{useDynamicInfoImageSize:i.useDynamicInfoImageSize,imageUrl:i.productData.image,width:200,height:200,borderRadius:4})}),o(b,{children:[t(c,Object.assign({style:{display:"flex"}},{children:i.productData.name})),t(d,Object.assign({color:r.content.secondary},{children:`Product ID: ${i.productData.id}`})),t(d,{className:"overlay-description",dangerouslySetInnerHTML:{__html:null!==(O=i.productData.description)&&void 0!==O?O:""}}),t(d,Object.assign({color:r.content.secondary},{children:$?z:p(i.productData)?null:z})),t(u,{isVariant:A,data:F,tagText:C,tagType:H})]})]})},g=i.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1;
|
|
4
4
|
background: rgba(0, 0, 0, 0.5);
|
|
@@ -17,11 +17,11 @@ import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-component
|
|
|
17
17
|
word-break: break-word;
|
|
18
18
|
margin-top: 8px;
|
|
19
19
|
}
|
|
20
|
-
`,
|
|
20
|
+
`,f=i.div`
|
|
21
21
|
display: flex;
|
|
22
22
|
flex: 1;
|
|
23
23
|
background: rgba(0, 0, 0, 0.5);
|
|
24
|
-
`,
|
|
24
|
+
`,x=i.div`
|
|
25
25
|
position: relative;
|
|
26
26
|
|
|
27
27
|
.close-button {
|
|
@@ -29,24 +29,24 @@ import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-component
|
|
|
29
29
|
top: -50px;
|
|
30
30
|
right: 0px;
|
|
31
31
|
margin: 10px;
|
|
32
|
-
background: ${
|
|
32
|
+
background: ${r.surface.standard};
|
|
33
33
|
border-radius: 50%;
|
|
34
34
|
}
|
|
35
|
-
`,
|
|
35
|
+
`,y=i.div`
|
|
36
36
|
display: flex;
|
|
37
37
|
background: white;
|
|
38
38
|
padding: 24px;
|
|
39
39
|
gap: 24px;
|
|
40
40
|
border-radius: 8px 8px 0px 0px;
|
|
41
|
-
`,
|
|
41
|
+
`,h=i.div`
|
|
42
42
|
display: flex;
|
|
43
43
|
max-width: min(50%, 200px);
|
|
44
44
|
flex-direction: column;
|
|
45
45
|
justify-content: center;
|
|
46
46
|
align-items: center;
|
|
47
|
-
`,
|
|
47
|
+
`,b=i.div`
|
|
48
48
|
display: flex;
|
|
49
49
|
flex: 1;
|
|
50
50
|
flex-direction: column;
|
|
51
51
|
gap: 4px;
|
|
52
|
-
`;export{
|
|
52
|
+
`;export{v as ProductInfoCard,m as ProductInfoOverlay};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export declare const ContainerStyle: import("styled-components").StyledComponent<"div", any, {
|
|
1
|
+
export declare const ContainerStyle: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
renderWithoutModal?: boolean | undefined;
|
|
3
|
+
}, never>;
|
|
2
4
|
export declare const ScrollContainerStyle: import("styled-components").StyledComponent<"div", any, {
|
|
3
5
|
screenName: string;
|
|
4
6
|
}, never>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from"styled-components";import{COLORS as i}from"../../constants/Theme.js";import{ScreenName as t}from"./modal.js";const o=e.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
background-color: white;
|
|
4
|
-
height: 75vh;
|
|
4
|
+
height: ${e=>e.renderWithoutModal?"90%":"75vh"};
|
|
5
5
|
flex-direction: column;
|
|
6
6
|
`,n=e.div`
|
|
7
7
|
overflow-y: scroll;
|
|
@@ -127,11 +127,11 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
|
|
|
127
127
|
align-items: center;
|
|
128
128
|
border: 1px solid ${i.stroke.primary};
|
|
129
129
|
border-radius: 4px;
|
|
130
|
-
`;const
|
|
130
|
+
`;const u=e.div`
|
|
131
131
|
padding: 16px 24px;
|
|
132
132
|
display: flex;
|
|
133
133
|
align-items: center;
|
|
134
134
|
justify-content: space-between;
|
|
135
135
|
margin-top: auto;
|
|
136
136
|
width: 100%;
|
|
137
|
-
`;export{p as CollectionCardDetailStyle,d as CollectionCardInfoStyle,r as CollectionCardStyle,x as CollectionNameHolder,o as ContainerStyle,a as ProductCardStyle,c as ProductScreenCollectionCardStyle,l as ProductScreenHeader,n as ScrollContainerStyle,s as SelectedScreenHeader,
|
|
137
|
+
`;export{p as CollectionCardDetailStyle,d as CollectionCardInfoStyle,r as CollectionCardStyle,x as CollectionNameHolder,o as ContainerStyle,a as ProductCardStyle,c as ProductScreenCollectionCardStyle,l as ProductScreenHeader,n as ScrollContainerStyle,s as SelectedScreenHeader,u as StyledFooterForNonModal,f as VariantCardGridStyle,g as VariantCardListStyle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/delete.svg.js";import
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/delete.svg.js";import r from"../../assets/icons/drag_handle.svg.js";import{COLORS as i}from"../../constants/Theme.js";import{IconButton as a}from"../icon-button/IconButton.js";import{ShimmerImage as n}from"../shimmer-image/ShimmerImage.js";import{TitleSmall as c,BodyCaption as l}from"../TypographyStyle.js";import{CurrencySymbols as s}from"./constants.js";import{ProductHelper as d}from"./helpers/ProductHelper.js";import{ProductPickerTag as m}from"./ProductPickerTag.js";import{VariantCardListStyle as p,VariantCardGridStyle as h}from"./style.js";import{Tooltip as g}from"../tooltips/Tooltip.js";const u=h=>{var u,j,b;const{data:v,selectedCollectionsDispatch:f,outOfStockAction:y}=h,I=()=>{let t;return t=v.name.includes(v.productName)?v.name:`${v.productName} ${v.name}`,t},{dataForProductPickerTag:T,tagText:O,tagType:P}=d.getDataForProductPickerTag(v,!0,y),k=`${v.currency&&null!==(u=s[v.currency])&&void 0!==u?u:""}${null!==(b=null!==(j=v.price)&&void 0!==j?j:v.actualPrice)&&void 0!==b?b:""}`;return t(p,{children:[t("div",Object.assign({className:"text-container"},{children:[e(r,{width:24,height:24,color:i.content.placeholder}),e("div",{children:e(n,{width:40,height:40,imageUrl:v.image,alt:"Item",borderRadius:4},v.variantId)}),t("div",Object.assign({className:"tooltip-title-tag"},{children:[e(g,Object.assign({body:I(),placement:"bottom",delay:400,variant:"light"},{children:e(c,Object.assign({numberOfLines:1},{children:I()}))})),e(m,{isVariant:!0,data:T,tagText:O,tagType:P}),e(l,Object.assign({color:i.content.secondary},{children:!(null==T?void 0:T.fbStatus)||O?null:k}))]}))]})),e(a,{Icon:()=>e(o,{width:24,height:24,color:i.content.placeholder}),onClick:()=>{f&&f({type:"variantUnselected",data:{productId:v.productId,variantId:v.variantId,collectionId:v.collectionId}}),h.onDelete&&h.onDelete()}})]})},j=t=>{const{data:o}=t;return e(h,{children:e(g,Object.assign({body:o.name,alwaysVisible:!1,variant:"dark",placement:"bottom"},{children:e(n,{width:72,height:72,imageUrl:o.image,alt:"Item",borderRadius:4})}))})};export{j as VariantCardGridView,u as VariantCardListView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as i,jsx as e,Fragment as s}from"react/jsx-runtime";import{useState as l,useEffect as t}from"react";import{RadioButtonContainer as
|
|
1
|
+
import{jsxs as i,jsx as e,Fragment as s}from"react/jsx-runtime";import{useState as l,useEffect as t,useMemo as a}from"react";import{RadioButtonContainer as o,RadioButtonIcon as c}from"./RadioButton.styled.js";import{BodyCaption as r,TitleSmall as n,BodySecondary as d,BodyPrimary as b}from"../TypographyStyle.js";import{COLORS as m}from"../../constants/Theme.js";const v=s=>{const l=a((()=>(null==s?void 0:s.activeColor)||m.background.positive.vibrant),[s.activeColor]),t=a((()=>s.isDisabled?m.content.inactive:s.isActive?l:m.content.primary),[s.isDisabled,s.isActive,l]);return i("svg",Object.assign({width:s.isSmall?"16":"20",height:s.isSmall?"16":"20",viewBox:s.isSmall?"0 0 16 16":"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?6:9,stroke:t,strokeWidth:s.isSmall?1.5:2}),s.isActive&&e("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?3:5,fill:s.isDisabled?m.content.inactive:l})]}))},p=a=>{const[p,h]=l(a.isActive||!1),[g,x]=l(!1),[S,y]=l(!1);t((()=>{h(a.isActive)}),[a.isActive]);return i(o,Object.assign({onClick:()=>{var i;if(!a.skipSelectingOff&&!a.isDisabled){const e=!p;h(e),null===(i=a.onValueChange)||void 0===i||i.call(a,e,a.value)}},onMouseEnter:()=>x(!a.skipHoverState),onMouseLeave:()=>x(!1),onMouseDown:()=>y(!a.skipHoverState),onMouseUp:()=>y(!1),style:a.caption?{alignItems:"flex-start"}:{}},{children:[e(c,Object.assign({checked:p,hovered:g,clicked:S,isDisabled:a.isDisabled||!1,size:a.size,style:a.caption?{margin:"2px 0"}:{}},{children:e(v,{isSmall:"SMALL"===a.size,isActive:p,isDisabled:a.isDisabled||!1,activeColor:a.activeColor})})),i("div",{children:[a.label?a.boldOnChecked&&p||a.alwaysBold?e(n,Object.assign({color:a.isDisabled?m.text.disabled:m.text.primary},{children:a.label})):"SMALL"===a.size?e(r,Object.assign({color:a.isDisabled?m.text.disabled:m.text.primary},{children:a.label})):"MEDIUM"===a.labelSize?e(d,Object.assign({color:a.isDisabled?m.text.disabled:m.text.primary},{children:a.label})):e(b,Object.assign({color:a.isDisabled?m.text.disabled:m.text.primary},{children:a.label})):e(s,{}),a.caption&&e(r,Object.assign({color:a.isDisabled?m.text.disabled:m.text.secondary},{children:a.caption}))]})]}))};export{p as RadioButton};
|