@uniformdev/mesh-sdk-react 13.0.1-alpha.271 → 13.0.1-alpha.278
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/LICENSE.txt +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +30 -30
- package/dist/index.mjs +1 -1
- package/package.json +4 -4
package/LICENSE.txt
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import React__default, { SVGProps } from 'react';
|
|
|
6
6
|
import * as _emotion_react_types_jsx_namespace from '@emotion/react/types/jsx-namespace';
|
|
7
7
|
import { TDate } from 'timeago.js';
|
|
8
8
|
import * as _emotion_react from '@emotion/react';
|
|
9
|
-
export { Button, ButtonProps, Callout, CalloutProps, Heading, HeadingProps, Input, InputProps, InputSelect, InputToggle, InputToggleProps, InputKeywordSearch as KeywordSearchInput, LoadingIndicator, LoadingOverlay, Menu, MenuItem, MenuItemProps, MenuProps, ScrollableList, ScrollableListItem, ScrollableListItemProps, ScrollableListProps, Theme, ThemeProps } from '@uniformdev/design-system';
|
|
9
|
+
export { Button, ButtonProps, Callout, CalloutProps, Heading, HeadingProps, Input, InputProps, InputSelect, InputToggle, InputToggleProps, InputKeywordSearch as KeywordSearchInput, LoadingIndicator, LoadingOverlay, Menu, MenuItem, MenuItemProps, MenuProps, ScrollableList, ScrollableListItem, ScrollableListItemProps, ScrollableListProps, Textarea, TextareaProps, Theme, ThemeProps } from '@uniformdev/design-system';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Provides convenient access to the current Uniform Mesh location via React hook.
|
package/dist/index.esm.js
CHANGED
|
@@ -514,4 +514,4 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
514
514
|
font-size: var(--fs-sm);
|
|
515
515
|
`},"Unlink"),e(K,{css:P`
|
|
516
516
|
color: var(--brand-secondary-5);
|
|
517
|
-
`})))))}import{LoadingIndicator as oo}from"@uniformdev/design-system";import{useAsync as Ft,useAsyncFn as no}from"react-use";function Ua({value:t,setValue:n,onGetSelectedProducts:o,onGetCategories:r,onSearchProducts:c,logoIcon:d,multiSelect:v,multiSelectId:b,selectedItemComponent:h,rowComponent:u}){var E,I;let{value:s,loading:g,error:f}=Ft(async()=>await r(),[r]),{value:H,error:M}=Ft(async()=>{if(!t)return;let i=await o({ids:t});return Array.isArray(i)?i:void 0},[o,t]),F=to(()=>s?s.map(m=>({id:m.id,name:m.name})):void 0,[s]),G=ro(),[z,A]=no(async(i,m)=>{let T=await c({text:i,options:{limit:m==null?void 0:m.count,offset:m==null?void 0:m.offset,categoryId:m==null?void 0:m.contentType}});return(m==null?void 0:m.offset)===0&&(G.current=[]),(G.current=G.current||[]).push(...T.products),T},[c]),J=async i=>{i&&await n(i)};return g?e(oo,null):f||M||z.error?e("div",null,"There was an error:"," ",(f==null?void 0:f.message)||(M==null?void 0:M.message)||((E=z.error)==null?void 0:E.message)):e($t.Provider,{value:{categories:s,logoIcon:d}},e(Lt,{search:A,results:G.current,logoIcon:d,selectedItems:H,select:J,multiSelectId:b||"product-search-multi-select",multiSelect:v,contentTypes:F,selectedItemComponent:h||Ht,rowComponent:u||Ut,totalResults:(I=z.value)==null?void 0:I.total,resultsLoading:z.loading}))}var $t=jr.createContext(void 0),ie=()=>{let t=eo($t);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};export*from"@uniformdev/mesh-sdk";import{Button as Na,Callout as _a,LoadingIndicator as Za,LoadingOverlay as qa,Menu as Wa,MenuItem as Ja,Input as Xa,InputSelect as Ya,InputToggle as ja,Theme as ei,InputKeywordSearch as ti,Heading as ri,ScrollableList as oi,ScrollableListItem as ni}from"@uniformdev/design-system";export{Na as Button,_a as Callout,gt as DefaultSearchRow,st as DefaultSelectedItem,Lt as EntrySearch,ri as Heading,me as Icons,Xa as Input,Ya as InputSelect,ja as InputToggle,ti as KeywordSearchInput,Za as LoadingIndicator,qa as LoadingOverlay,Wa as Menu,Ja as MenuItem,$e as ProductPreviewList,Zo as ProductQuery,He as ProductQueryContext,Ua as ProductSearch,$t as ProductSearchContext,Ut as ProductSearchRow,Ht as ProductSelectedItem,Ge as ResolvableLoadingValue,oi as ScrollableList,ni as ScrollableListItem,ze as SelectionField,ei as Theme,Le as UniformMeshLocationContext,Me as UniformMeshLocationContextProvider,Ie as UniformMeshSdkContext,ko as UniformMeshSdkContextProvider,he as badgeIcon,Pt as draggableContainer,ve as draggableIcon,kt as draggableIconOffset,Rt as draggableIconWrapper,vt as entrySearchBtn,bt as entrySearchConfig,yt as entrySearchConfigHidden,ht as entrySearchLoadMoreBtn,St as entrySearchResultList,wt as entrySearchSelectIcon,Ct as entrySearchSelectImg,Zn as entrySearchSelectInput,qn as entrySearchSelectOption,ft as entrySearchWrapper,Gt as productSearchRowActiveIcon,Tt as productSearchRowCategory,Mt as productSearchRowContainer,Vt as productSearchRowContent,Et as productSearchRowContentActive,Dt as productSearchRowDetails,It as productSearchRowTitle,At as productSelectedItemContainer,Ot as productSelectedItemContent,Bt as productSelectedItemDetails,ye as productSelectedItemImage,pt as searchRowBtn,ct as searchRowContainer,dt as searchRowContainerActive,lt as searchRowPopover,fe as searchRowText,ge as searchRowTextSmall,ue as selectItemLinkBtn,at as selectItemLinkContainer,nt as selectItemPopover,ae as selectItemPopoverLabel,B as selectItemSmallText,ot as selectedItemCloseIcon,Xe as selectedItemContainer,et as selectedItemCopy,je as selectedItemDetails,rt as selectedItemIcon,Ye as selectedItemInner,tt as selectedItemTitle,yo as useInitializeUniformMeshSdk,Fe as useProductQueryContext,ie as useProductSearchContext,go as useUniformMeshLocation,Ve as useUniformMeshLocationContext,Mo as useUniformMeshSdk,Te as useUniformMeshSdkContext};
|
|
517
|
+
`})))))}import{LoadingIndicator as oo}from"@uniformdev/design-system";import{useAsync as Ft,useAsyncFn as no}from"react-use";function Ua({value:t,setValue:n,onGetSelectedProducts:o,onGetCategories:r,onSearchProducts:c,logoIcon:d,multiSelect:v,multiSelectId:b,selectedItemComponent:h,rowComponent:u}){var E,I;let{value:s,loading:g,error:f}=Ft(async()=>await r(),[r]),{value:H,error:M}=Ft(async()=>{if(!t)return;let i=await o({ids:t});return Array.isArray(i)?i:void 0},[o,t]),F=to(()=>s?s.map(m=>({id:m.id,name:m.name})):void 0,[s]),G=ro(),[z,A]=no(async(i,m)=>{let T=await c({text:i,options:{limit:m==null?void 0:m.count,offset:m==null?void 0:m.offset,categoryId:m==null?void 0:m.contentType}});return(m==null?void 0:m.offset)===0&&(G.current=[]),(G.current=G.current||[]).push(...T.products),T},[c]),J=async i=>{i&&await n(i)};return g?e(oo,null):f||M||z.error?e("div",null,"There was an error:"," ",(f==null?void 0:f.message)||(M==null?void 0:M.message)||((E=z.error)==null?void 0:E.message)):e($t.Provider,{value:{categories:s,logoIcon:d}},e(Lt,{search:A,results:G.current,logoIcon:d,selectedItems:H,select:J,multiSelectId:b||"product-search-multi-select",multiSelect:v,contentTypes:F,selectedItemComponent:h||Ht,rowComponent:u||Ut,totalResults:(I=z.value)==null?void 0:I.total,resultsLoading:z.loading}))}var $t=jr.createContext(void 0),ie=()=>{let t=eo($t);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};export*from"@uniformdev/mesh-sdk";import{Button as Na,Callout as _a,LoadingIndicator as Za,LoadingOverlay as qa,Menu as Wa,MenuItem as Ja,Input as Xa,InputSelect as Ya,InputToggle as ja,Theme as ei,InputKeywordSearch as ti,Heading as ri,ScrollableList as oi,ScrollableListItem as ni,Textarea as ai}from"@uniformdev/design-system";export{Na as Button,_a as Callout,gt as DefaultSearchRow,st as DefaultSelectedItem,Lt as EntrySearch,ri as Heading,me as Icons,Xa as Input,Ya as InputSelect,ja as InputToggle,ti as KeywordSearchInput,Za as LoadingIndicator,qa as LoadingOverlay,Wa as Menu,Ja as MenuItem,$e as ProductPreviewList,Zo as ProductQuery,He as ProductQueryContext,Ua as ProductSearch,$t as ProductSearchContext,Ut as ProductSearchRow,Ht as ProductSelectedItem,Ge as ResolvableLoadingValue,oi as ScrollableList,ni as ScrollableListItem,ze as SelectionField,ai as Textarea,ei as Theme,Le as UniformMeshLocationContext,Me as UniformMeshLocationContextProvider,Ie as UniformMeshSdkContext,ko as UniformMeshSdkContextProvider,he as badgeIcon,Pt as draggableContainer,ve as draggableIcon,kt as draggableIconOffset,Rt as draggableIconWrapper,vt as entrySearchBtn,bt as entrySearchConfig,yt as entrySearchConfigHidden,ht as entrySearchLoadMoreBtn,St as entrySearchResultList,wt as entrySearchSelectIcon,Ct as entrySearchSelectImg,Zn as entrySearchSelectInput,qn as entrySearchSelectOption,ft as entrySearchWrapper,Gt as productSearchRowActiveIcon,Tt as productSearchRowCategory,Mt as productSearchRowContainer,Vt as productSearchRowContent,Et as productSearchRowContentActive,Dt as productSearchRowDetails,It as productSearchRowTitle,At as productSelectedItemContainer,Ot as productSelectedItemContent,Bt as productSelectedItemDetails,ye as productSelectedItemImage,pt as searchRowBtn,ct as searchRowContainer,dt as searchRowContainerActive,lt as searchRowPopover,fe as searchRowText,ge as searchRowTextSmall,ue as selectItemLinkBtn,at as selectItemLinkContainer,nt as selectItemPopover,ae as selectItemPopoverLabel,B as selectItemSmallText,ot as selectedItemCloseIcon,Xe as selectedItemContainer,et as selectedItemCopy,je as selectedItemDetails,rt as selectedItemIcon,Ye as selectedItemInner,tt as selectedItemTitle,yo as useInitializeUniformMeshSdk,Fe as useProductQueryContext,ie as useProductSearchContext,go as useUniformMeshLocation,Ve as useUniformMeshLocationContext,Mo as useUniformMeshSdk,Te as useUniformMeshSdkContext};
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDescriptor;var Pr=Object.getOwnPropertyNames;var Rr=Object.getPrototypeOf,kr=Object.prototype.hasOwnProperty;var Ht=(t,n)=>{for(var r in n)he(t,r,{get:n[r],enumerable:!0})},ve=(t,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of Pr(n))!kr.call(t,a)&&a!==r&&he(t,a,{get:()=>n[a],enumerable:!(o=Cr(n,a))||o.enumerable});return t},D=(t,n,r)=>(ve(t,n,"default"),r&&ve(r,n,"default")),$=(t,n,r)=>(r=t!=null?wr(Rr(t)):{},ve(n||!t||!t.__esModule?he(r,"default",{value:t,enumerable:!0}):r,t)),xr=t=>ve(he({},"__esModule",{value:!0}),t);var I={};Ht(I,{Button:()=>
|
|
1
|
+
var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDescriptor;var Pr=Object.getOwnPropertyNames;var Rr=Object.getPrototypeOf,kr=Object.prototype.hasOwnProperty;var Ht=(t,n)=>{for(var r in n)he(t,r,{get:n[r],enumerable:!0})},ve=(t,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of Pr(n))!kr.call(t,a)&&a!==r&&he(t,a,{get:()=>n[a],enumerable:!(o=Cr(n,a))||o.enumerable});return t},D=(t,n,r)=>(ve(t,n,"default"),r&&ve(r,n,"default")),$=(t,n,r)=>(r=t!=null?wr(Rr(t)):{},ve(n||!t||!t.__esModule?he(r,"default",{value:t,enumerable:!0}):r,t)),xr=t=>ve(he({},"__esModule",{value:!0}),t);var I={};Ht(I,{Button:()=>u.Button,Callout:()=>u.Callout,DefaultSearchRow:()=>it,DefaultSelectedItem:()=>et,EntrySearch:()=>bt,Heading:()=>u.Heading,Icons:()=>Re,Input:()=>u.Input,InputSelect:()=>u.InputSelect,InputToggle:()=>u.InputToggle,KeywordSearchInput:()=>u.InputKeywordSearch,LoadingIndicator:()=>u.LoadingIndicator,LoadingOverlay:()=>u.LoadingOverlay,Menu:()=>u.Menu,MenuItem:()=>u.MenuItem,ProductPreviewList:()=>Ke,ProductQuery:()=>Dr,ProductQueryContext:()=>Fe,ProductSearch:()=>qr,ProductSearchContext:()=>Tt,ProductSearchRow:()=>Lt,ProductSelectedItem:()=>It,ResolvableLoadingValue:()=>Oe,ScrollableList:()=>u.ScrollableList,ScrollableListItem:()=>u.ScrollableListItem,SelectionField:()=>He,Textarea:()=>u.Textarea,Theme:()=>u.Theme,UniformMeshLocationContext:()=>De,UniformMeshLocationContextProvider:()=>Ge,UniformMeshSdkContext:()=>Ue,UniformMeshSdkContextProvider:()=>Vr,badgeIcon:()=>Ve,draggableContainer:()=>ft,draggableIcon:()=>Me,draggableIconOffset:()=>ht,draggableIconWrapper:()=>vt,entrySearchBtn:()=>ct,entrySearchConfig:()=>lt,entrySearchConfigHidden:()=>pt,entrySearchLoadMoreBtn:()=>dt,entrySearchResultList:()=>mt,entrySearchSelectIcon:()=>ut,entrySearchSelectImg:()=>gt,entrySearchSelectInput:()=>Nr,entrySearchSelectOption:()=>_r,entrySearchWrapper:()=>st,productSearchRowActiveIcon:()=>kt,productSearchRowCategory:()=>Pt,productSearchRowContainer:()=>yt,productSearchRowContent:()=>St,productSearchRowContentActive:()=>wt,productSearchRowDetails:()=>Rt,productSearchRowTitle:()=>Ct,productSelectedItemContainer:()=>Mt,productSelectedItemContent:()=>Et,productSelectedItemDetails:()=>Vt,productSelectedItemImage:()=>Ee,searchRowBtn:()=>nt,searchRowContainer:()=>tt,searchRowContainerActive:()=>rt,searchRowPopover:()=>ot,searchRowText:()=>Le,searchRowTextSmall:()=>xe,selectItemLinkBtn:()=>ke,selectItemLinkContainer:()=>je,selectItemPopover:()=>Ye,selectItemPopoverLabel:()=>ce,selectItemSmallText:()=>N,selectedItemCloseIcon:()=>Xe,selectedItemContainer:()=>Ne,selectedItemCopy:()=>qe,selectedItemDetails:()=>Ze,selectedItemIcon:()=>Je,selectedItemInner:()=>_e,selectedItemTitle:()=>We,useInitializeUniformMeshSdk:()=>Mr,useProductQueryContext:()=>$e,useProductSearchContext:()=>de,useUniformMeshLocation:()=>Lr,useUniformMeshLocationContext:()=>ze,useUniformMeshSdk:()=>Er,useUniformMeshSdkContext:()=>Ae});module.exports=xr(I);var e=require("@emotion/react"),L=$(require("react"));var j=require("react"),De=(0,j.createContext)(void 0),Ge=({children:t})=>{let[n,r]=(0,j.useState)(),o;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let a=n||window.UniformMeshSDK.getCurrentLocation();o={location:{getValue:a.getValue,getMetadata:a.getMetadata,setValue:async d=>{await a.setValue(d),r(window.UniformMeshSDK.getCurrentLocation())}}}}return(0,e.jsx)(De.Provider,{value:o},t)},ze=()=>{let t=(0,j.useContext)(De);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function Lr(){let{location:t}=ze();return{value:t==null?void 0:t.getValue(),setValue:t==null?void 0:t.setValue,metadata:t==null?void 0:t.getMetadata()}}var Ft=require("@uniformdev/mesh-sdk"),ie=require("react"),Mr=({autoResizingDisabled:t}={})=>{let[n,r]=(0,ie.useState)(),[o,a]=(0,ie.useState)();return(0,ie.useEffect)(()=>{typeof window=="undefined"||o||(typeof window.UniformMeshSDK=="undefined"?(0,Ft.initializeUniformMeshSDK)({autoResizingDisabled:t}).then(d=>{a(d)}).catch(d=>{r(d)}):a(window.UniformMeshSDK))},[t]),{initializing:!o&&!n,error:n,sdk:o}};var be=require("react");var $t=require("@uniformdev/design-system"),Ue=(0,be.createContext)(void 0),Vr=({children:t})=>{let n;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(n={sdk:window.UniformMeshSDK}),(0,e.jsx)(Ue.Provider,{value:n},(0,e.jsx)($t.Theme,null),(0,e.jsx)(Ge,null,t))},Ae=()=>{let t=(0,be.useContext)(Ue);if(!t)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return t};function Er(){let{sdk:t}=Ae();return t}var Qe=$(require("react"));var K=$(require("react"));var ee=require("@emotion/react"),Kt=require("@uniformdev/design-system");var Be=$(require("react")),Oe=({value:t,text:n,loading:r})=>(0,e.jsx)(Be.default.Fragment,null,!!n&&n,!n&&(0,e.jsx)(Be.default.Fragment,null,r&&`${t} (Loading...)`,!r&&`${t} (Unresolvable)`));var He=({name:t,loading:n,selectedValues:r,values:o,onAdd:a,onRemove:d})=>{var h;let v=(h=o==null?void 0:o.filter(m=>!(r!=null&&r.includes(m.id.toString()))))!=null?h:[],b=(m,c)=>{m.preventDefault(),d(c)};return(0,e.jsx)("div",null,(0,e.jsx)(Kt.InputSelect,{id:"product-query",name:"product-query",label:t,onChange:m=>a(m.target.value),disabled:n,options:[{value:"",label:"Add..."},...v.map(m=>({value:m.id,label:m.name||m.id}))],css:Array.isArray(r)&&r.length>0?ee.css`
|
|
2
2
|
margin-bottom: var(--spacing-base);
|
|
3
3
|
`:""}),r==null?void 0:r.map(m=>{var c;return(0,e.jsx)("div",{css:ee.css`
|
|
4
4
|
font-size: var(--fs-sm);
|
|
@@ -12,19 +12,19 @@ var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
12
12
|
`,key:m},(0,e.jsx)("span",{css:ee.css`
|
|
13
13
|
padding: var(--spacing-3);
|
|
14
14
|
color: var(--gray-800);
|
|
15
|
-
`},(0,e.jsx)(Oe,{value:m,loading:n,text:(c=o.find(
|
|
15
|
+
`},(0,e.jsx)(Oe,{value:m,loading:n,text:(c=o.find(g=>g.id===m))==null?void 0:c.name})),(0,e.jsx)("button",{css:ee.css`
|
|
16
16
|
padding: var(--spacing-3);
|
|
17
17
|
border-left: 1px solid var(--gray-300);
|
|
18
|
-
`,title:"remove",onClick:
|
|
18
|
+
`,title:"remove",onClick:g=>b(g,m)},(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",css:ee.css`
|
|
19
19
|
height: 1.25rem;
|
|
20
20
|
width: 1.25rem;
|
|
21
21
|
pointer-events: none;
|
|
22
22
|
display: block;
|
|
23
|
-
`,viewBox:"0 0 20 20",fill:"currentColor"},(0,e.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))))}))};var Ir=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("path",{d:"M44.203 21.203H24.797V1.797a1.797 1.797 0 1 0-3.594 0v19.406H1.797a1.797 1.797 0 1 0 0 3.594h19.406v19.406a1.797 1.797 0 0 0 3.594 0V24.797h19.406a1.797 1.797 0 0 0 0-3.594Z"})),ye=Ir;var Tr=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})),Se=Tr;var we=require("react-use"),M=require("@uniformdev/design-system"),C=require("@emotion/react"),Qt={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Dr=({value:t,setValue:n,brands:r,categories:o,loading:a,categoriesLoading:d,brandsLoading:
|
|
23
|
+
`,viewBox:"0 0 20 20",fill:"currentColor"},(0,e.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))))}))};var Ir=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("path",{d:"M44.203 21.203H24.797V1.797a1.797 1.797 0 1 0-3.594 0v19.406H1.797a1.797 1.797 0 1 0 0 3.594h19.406v19.406a1.797 1.797 0 0 0 3.594 0V24.797h19.406a1.797 1.797 0 0 0 0-3.594Z"})),ye=Ir;var Tr=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})),Se=Tr;var we=require("react-use"),M=require("@uniformdev/design-system"),C=require("@emotion/react"),Qt={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Dr=({value:t,setValue:n,brands:r,categories:o,loading:a,categoriesLoading:d,brandsLoading:v,logoIcon:b,onGetProducts:h,sortOptions:m,sortOrderOptions:c})=>{var U;let g=async s=>{n({...Qt,...t||{},...s})},f=(0,K.useMemo)(()=>({...Qt,...t||{}}),[t]),[J,T]=(0,we.useAsyncFn)(async s=>await h(s),[h]);(0,we.useDebounce)(async()=>{await T({brand:f.brand,categories:f.categories,keyword:f.keyword,sort:f.sort,sortOrder:f.sortOrder,count:f.count})},250,[f]);let X=(0,K.useMemo)(()=>{let s=[];return o==null||o.forEach(p=>{let A=_t(p,void 0);s.push(...A)}),s},[o]),H=(0,K.useMemo)(()=>(r==null?void 0:r.map(s=>({id:s.id.toString(),name:s.name})))||[],[r]),F=s=>{let p=(t==null?void 0:t.categories)||[];g({categories:[...p,s]})},q=s=>{var p;g({categories:(p=t==null?void 0:t.categories)==null?void 0:p.filter(A=>A!==s)})},me=s=>{g({brand:s.target.value})},z=s=>{g({count:s||1})};return a?(0,e.jsx)("div",null,"Loading..."):(0,e.jsx)(Fe.Provider,{value:{categories:o,logoIcon:b}},(0,e.jsx)("div",{css:C.css`
|
|
24
24
|
> :not(:last-child) {
|
|
25
25
|
margin-bottom: var(--spacing-md);
|
|
26
26
|
}
|
|
27
|
-
`},(0,e.jsx)(He,{loading:d||!1,name:"Product Category",onAdd:F,onRemove:q,selectedValues:
|
|
27
|
+
`},(0,e.jsx)(He,{loading:d||!1,name:"Product Category",onAdd:F,onRemove:q,selectedValues:f.categories,values:X}),(0,e.jsx)("div",{css:C.css`
|
|
28
28
|
display: flex;
|
|
29
29
|
flex-wrap: wrap;
|
|
30
30
|
column-gap: var(--spacing-lg);
|
|
@@ -35,16 +35,16 @@ var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
35
35
|
`},(0,e.jsx)("div",{css:C.css`
|
|
36
36
|
width: 50%;
|
|
37
37
|
flex-grow: 1;
|
|
38
|
-
`},(0,e.jsx)(M.InputSelect,{id:"brand",name:"brand",label:"Brand",disabled:
|
|
38
|
+
`},(0,e.jsx)(M.InputSelect,{id:"brand",name:"brand",label:"Brand",disabled:v,value:f.brand,onChange:me,options:[{value:"",label:"Select a brand"},...H.map(s=>({value:s.id,label:s.name}))]})),(0,e.jsx)("div",{css:C.css`
|
|
39
39
|
flex-grow: 1;
|
|
40
40
|
position: relative;
|
|
41
|
-
`},(0,e.jsx)(M.Input,{id:"count",name:"count",type:"number",min:1,step:1,value:
|
|
41
|
+
`},(0,e.jsx)(M.Input,{id:"count",name:"count",type:"number",min:1,step:1,value:f.count,onChange:s=>z(s.target.valueAsNumber),label:"Count"}),(0,e.jsx)("div",{css:C.css`
|
|
42
42
|
position: absolute;
|
|
43
43
|
bottom: var(--spacing-sm);
|
|
44
44
|
right: var(--spacing-sm);
|
|
45
45
|
display: flex;
|
|
46
46
|
gap: var(--spacing-sm);
|
|
47
|
-
`},(0,e.jsx)(Nt,{onCountChange:()=>z(
|
|
47
|
+
`},(0,e.jsx)(Nt,{onCountChange:()=>z(f.count-1),countIcon:"decrement",disabled:f.count===1}),(0,e.jsx)(Nt,{onCountChange:()=>z(f.count+1),countIcon:"increment"})))),(0,e.jsx)("div",{css:C.css`
|
|
48
48
|
display: flex;
|
|
49
49
|
flex-wrap: wrap;
|
|
50
50
|
column-gap: var(--spacing-lg);
|
|
@@ -57,19 +57,19 @@ var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
57
57
|
${(0,M.mq)("md")} {
|
|
58
58
|
width: 33.333333%;
|
|
59
59
|
}
|
|
60
|
-
`},(0,e.jsx)(M.Input,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:
|
|
60
|
+
`},(0,e.jsx)(M.Input,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:f.keyword,placeholder:"Enter keyword",onChange:s=>g({keyword:s.target.value})})),Array.isArray(m)&&m.length>0?(0,e.jsx)("div",{css:C.css`
|
|
61
61
|
flex-grow: 1;
|
|
62
62
|
${(0,M.mq)("md")} {
|
|
63
63
|
width: 33.333333%;
|
|
64
64
|
}
|
|
65
|
-
`},(0,e.jsx)(M.InputSelect,{id:"sort",name:"sort",label:"Sort",value:
|
|
65
|
+
`},(0,e.jsx)(M.InputSelect,{id:"sort",name:"sort",label:"Sort",value:f.sort,onChange:s=>g({sort:s.target.value}),options:[{value:"",label:"Select a sort"},...m.map(s=>({value:s.sortKey,label:s.name}))]})):null,Array.isArray(c)&&c.length>0?(0,e.jsx)("div",{css:C.css`
|
|
66
66
|
flex-grow: 1;
|
|
67
|
-
`},(0,e.jsx)(M.InputSelect,{id:"sort-order",name:"sort-order",label:"Sort Order",value:
|
|
67
|
+
`},(0,e.jsx)(M.InputSelect,{id:"sort-order",name:"sort-order",label:"Sort Order",value:f.sortOrder,onChange:s=>g({sortOrder:s.target.value}),options:c.map(s=>({value:s.sortOrderKey,label:s.name}))})):null),(0,e.jsx)("div",null,(0,e.jsx)("h3",{css:C.css`
|
|
68
68
|
font-size: var(--fs-md);
|
|
69
69
|
line-height: var(--spacing-md);
|
|
70
70
|
font-weight: var(--fw-bold);
|
|
71
71
|
margin-bottom: var(--spacing-xs);
|
|
72
|
-
`},"Result Preview"),(0,e.jsx)(Ke,{products:(U=J.value)==null?void 0:U.products}))))};function _t(t,n){var d;let r=[],o=n?`${n.name} > `:"",a={id:t.id.toString(),name:`${o}${t.name}`};return r.push(a),(d=t.children)==null||d.forEach(
|
|
72
|
+
`},"Result Preview"),(0,e.jsx)(Ke,{products:(U=J.value)==null?void 0:U.products}))))};function _t(t,n){var d;let r=[],o=n?`${n.name} > `:"",a={id:t.id.toString(),name:`${o}${t.name}`};return r.push(a),(d=t.children)==null||d.forEach(v=>{let b=_t(v,a);r.push(...b)}),r}function Nt({onCountChange:t,countIcon:n,disabled:r}){return(0,e.jsx)("button",{css:C.css`
|
|
73
73
|
width: 2.25rem;
|
|
74
74
|
height: 2.25rem;
|
|
75
75
|
border: 1px solid var(--gray-300);
|
|
@@ -96,7 +96,7 @@ var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
96
96
|
`},"Matching ",(t==null?void 0:t.length)||0," products"),(0,e.jsx)("ul",{css:[P.css`
|
|
97
97
|
max-height: 24rem;
|
|
98
98
|
overflow-x: auto;
|
|
99
|
-
`,Zt.scrollbarStyles]},t==null?void 0:t.map((o,a)=>{var b;let[d]=(o==null?void 0:o.categories)||[],
|
|
99
|
+
`,Zt.scrollbarStyles]},t==null?void 0:t.map((o,a)=>{var b;let[d]=(o==null?void 0:o.categories)||[],v=typeof d=="undefined"||!n||(b=n.find(h=>h.id===d.id))==null?void 0:b.name;return(0,e.jsx)("li",{key:`product-${o.id}`,css:P.css`
|
|
100
100
|
border: 1px solid var(--gray-300);
|
|
101
101
|
border-radius: var(--rounded-md);
|
|
102
102
|
background-color: var(--gray-100);
|
|
@@ -121,10 +121,10 @@ var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
121
121
|
font-weight: var(--fw-bold);
|
|
122
122
|
width: 33.333333%;
|
|
123
123
|
font-size: var(--fs-sm);
|
|
124
|
-
`},o.name,
|
|
124
|
+
`},o.name,v&&(0,e.jsx)("span",{css:P.css`
|
|
125
125
|
display: block;
|
|
126
126
|
font-weight: var(--fw-regular);
|
|
127
|
-
`},
|
|
127
|
+
`},v)),o&&(0,e.jsx)(Qe.default.Fragment,null,(0,e.jsx)("p",{css:P.css`
|
|
128
128
|
margin-right: var(--spacing-lg);
|
|
129
129
|
font-size: var(--fs-sm);
|
|
130
130
|
`},"SKU: ",o.sku," ",o.id,(0,e.jsx)("br",null)),o.price&&(0,e.jsx)("p",{css:P.css`
|
|
@@ -215,24 +215,24 @@ var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
215
215
|
&:hover {
|
|
216
216
|
background: var(--gray-50);
|
|
217
217
|
}
|
|
218
|
-
`;var G=require("@emotion/react");var et=({selectedItem:t,logoIcon:n,onDeselect:r,onEditClosed:o})=>{var m;let a=(0,B.useRef)(null),d=(0,B.useRef)(null),[
|
|
218
|
+
`;var G=require("@emotion/react");var et=({selectedItem:t,logoIcon:n,onDeselect:r,onEditClosed:o})=>{var m;let a=(0,B.useRef)(null),d=(0,B.useRef)(null),[v,b]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let c=f=>{a.current&&!a.current.contains(f.target)&&d.current&&!d.current.contains(f.target)&&b(!1)},g=()=>{b(!1)};return window.addEventListener("resize",g,!0),document.addEventListener("scroll",c,!0),document.addEventListener("mousedown",c),()=>{window.removeEventListener("resize",g,!0),document.removeEventListener("scroll",c,!0),document.removeEventListener("mousedown",c)}},[d]);let h=()=>{var c;if(b(!v),d.current&&a.current){let g=(c=a==null?void 0:a.current)==null?void 0:c.getBoundingClientRect();d.current.style.top=`${g.top+30}px`}};return(0,e.jsx)("div",{css:Ne,key:t.id},(0,e.jsx)("div",{css:_e},(0,e.jsx)("div",{css:Ze},(0,e.jsx)("div",{css:qe},(0,e.jsx)("h4",{css:[We,t.popoverData?G.css`
|
|
219
219
|
margin-bottom: var(--spacing-sm);
|
|
220
220
|
`:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?(0,e.jsx)(B.default.Fragment,null,(0,e.jsx)("button",{type:"button",ref:a,css:G.css`
|
|
221
221
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
222
|
-
`,"aria-controls":"path-details","aria-expanded":
|
|
222
|
+
`,"aria-controls":"path-details","aria-expanded":v,onClick:h},(0,e.jsx)(re,{width:24,height:24,css:G.css`
|
|
223
223
|
color: var(--gray-400);
|
|
224
|
-
`})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!
|
|
224
|
+
`})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!v,ref:d,css:[Ye,v?G.css`
|
|
225
225
|
visibility: visible;
|
|
226
226
|
`:G.css`
|
|
227
227
|
visibility: hidden;
|
|
228
|
-
`]},Object.entries(t.popoverData).map(([c,
|
|
228
|
+
`]},Object.entries(t.popoverData).map(([c,g],f)=>(0,e.jsx)("div",{css:N,key:f},(0,e.jsx)("span",{css:ce},c,":"),g)))):null),t.createdDate&&(0,e.jsx)("div",{css:N},(0,e.jsx)("span",{css:ce},"Created:"),(0,rr.format)((m=t.createdDate)!=null?m:0)),(0,e.jsx)("div",{css:G.css`
|
|
229
229
|
display: flex;
|
|
230
230
|
gap: var(--spacing-base);
|
|
231
|
-
`},t.metadata?Object.entries(t.metadata).filter(([c])=>["type","status"].includes(c.toLocaleLowerCase())).map(([c,
|
|
231
|
+
`},t.metadata?Object.entries(t.metadata).filter(([c])=>["type","status"].includes(c.toLocaleLowerCase())).map(([c,g])=>(0,e.jsx)("span",{css:N,key:c},g)):null),t.metadata?Object.entries(t.metadata).filter(([c])=>!["type","status"].includes(c.toLocaleLowerCase())).map(([c,g])=>(0,e.jsx)("div",{css:[N,G.css`
|
|
232
232
|
order: 1;
|
|
233
233
|
`],key:c},(0,e.jsx)("span",{css:[ce,G.css`
|
|
234
234
|
order: 1;
|
|
235
|
-
`]},c,":"),
|
|
235
|
+
`]},c,":"),g)):null),(0,e.jsx)("div",{css:je},t.editLink?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",onClick:c=>{o&&(er(c.currentTarget.href,()=>o(t)),c.preventDefault())},css:ke},(0,e.jsx)("span",{css:N},"Edit"),(0,e.jsx)(Q,{src:n,css:Je,alt:"Logo"})):null,(0,e.jsx)("button",{type:"button",onClick:c=>{c.preventDefault(),r(t)},css:ke},(0,e.jsx)("span",{css:N},"Unlink"),(0,e.jsx)(te,{css:[Xe,G.css`
|
|
236
236
|
color: var(--brand-secondary-5);
|
|
237
237
|
`]})))))};var O=$(require("react"));var W=require("@emotion/react"),tt=W.css`
|
|
238
238
|
cursor: pointer;
|
|
@@ -263,7 +263,7 @@ var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
263
263
|
`,nt=W.css`
|
|
264
264
|
position: absolute;
|
|
265
265
|
inset: 0 var(--spacing-sm) 0 auto;
|
|
266
|
-
`;var at=require("@emotion/react"),it=({result:t,isSelected:n,triggerSelection:r})=>{let o=(0,O.useRef)(null),a=(0,O.useRef)(null),[d,
|
|
266
|
+
`;var at=require("@emotion/react"),it=({result:t,isSelected:n,triggerSelection:r})=>{let o=(0,O.useRef)(null),a=(0,O.useRef)(null),[d,v]=(0,O.useState)(!1);(0,O.useEffect)(()=>{function h(m){o.current&&!o.current.contains(m.target)&&a.current&&!a.current.contains(m.target)&&v(!1)}return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[a]);let b=h=>{h.stopPropagation(),v(!d)};return(0,e.jsx)("div",{key:t.id,css:[tt,n?rt:void 0],"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>r()},t.title,t.popoverData&&n?(0,e.jsx)(O.default.Fragment,null,(0,e.jsx)("button",{type:"button",ref:o,css:nt,"aria-controls":"path-details",onClick:h=>b(h),"aria-expanded":d},(0,e.jsx)(re,{width:24,height:24})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!d,ref:a,css:[ot,d?at.css`
|
|
267
267
|
visibility: visible;
|
|
268
268
|
`:at.css`
|
|
269
269
|
visibility: hidden;
|
|
@@ -354,7 +354,7 @@ var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
354
354
|
`,Ve=w.css`
|
|
355
355
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
356
356
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
357
|
-
`;var V=require("@emotion/react"),S=require("@uniformdev/design-system"),Zr=({searchText:t,selectedContentType:n})=>{let r="No content found";return n&&(r=`No ${n} content was found`),t&&(r=`${r} for keyword '${t}'.`),(0,e.jsx)(S.Callout,{type:"info"},r)},bt=({search:t,results:n,contentTypes:r,selectedItems:o,logoIcon:a,select:d,multiSelect:
|
|
357
|
+
`;var V=require("@emotion/react"),S=require("@uniformdev/design-system"),Zr=({searchText:t,selectedContentType:n})=>{let r="No content found";return n&&(r=`No ${n} content was found`),t&&(r=`${r} for keyword '${t}'.`),(0,e.jsx)(S.Callout,{type:"info"},r)},bt=({search:t,results:n,contentTypes:r,selectedItems:o,logoIcon:a,select:d,multiSelect:v,multiSelectId:b,rowComponent:h,selectedItemComponent:m,totalResults:c,resultsLoading:g,requireContentType:f,onAddNew:J,onEditClosed:T,onCancel:X,noResultsComponent:H,helpComponent:F,onSort:q})=>{var At,Bt,Ot;let z=()=>f?Array.isArray(r)&&r.length>0?r[0].id:"":"any",[U,s]=E.useState(""),[p,A]=E.useState(z),[ne,Ie]=E.useState(!1),[ue,ge]=E.useState([]),[cr,Dt]=E.useState(!1),fe=(0,or.useThrottle)(U,750);E.useEffect(()=>{t(fe,{count:5,offset:0,contentType:p==="any"?void 0:p})},[fe,p]);let dr=i=>{ue.includes(i.id)?ge(y=>y.filter(Y=>Y!==i.id)):ge(v?y=>[...y,i==null?void 0:i.id]:[i.id])},lr=()=>{A(z()),s(""),ge(o!=null&&o.length?o.map(i=>i.id):[])},pr=()=>{Ie(i=>!i),ne||lr()},Gt=i=>{d((o==null?void 0:o.filter(y=>y.id!==i.id).map(y=>y.id))||[],"")},mr=i=>{i.preventDefault(),d(ue,p),Ie(!1)},ur=i=>{i.preventDefault(),Ie(!1),X&&X()},gr=i=>{i.preventDefault(),t(fe,{count:5,offset:(n==null?void 0:n.length)||0,contentType:p==="any"?void 0:p}),Dt(!0);let y=setTimeout(()=>{Dt(!1)},750);return()=>clearTimeout(y)},Te=E.useRef((0,nr.v4)()),fr=!(o==null?void 0:o.length)||v,vr=h||it,zt=m||et,hr=H||Zr,Ut=a&&typeof a!="string"?a:null,br=Ut?(0,e.jsx)(Ut,{css:Ve}):(0,e.jsx)("img",{src:a,alt:"CMS logo",css:Ve}),yr=i=>{var y,Y;if(i.destination&&i.source.droppableId===((y=i.destination)==null?void 0:y.droppableId)){let x=[...o||[]],[ae]=(Y=x==null?void 0:x.splice(i.source.index,1))!=null?Y:[];return x==null||x.splice(i.destination.index,0,ae),q==null||q(x.map(Sr=>Sr.id)),x}};return(0,e.jsx)("div",{css:V.css`
|
|
358
358
|
width: 100%;
|
|
359
359
|
`},(0,e.jsx)("div",{css:V.css`
|
|
360
360
|
position: relative;
|
|
@@ -367,9 +367,9 @@ var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
367
367
|
display: flex;
|
|
368
368
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
369
369
|
margin-bottom: var(--spacing-base);
|
|
370
|
-
`},(0,e.jsx)(S.InputSelect,{onChange:i=>A(i.target.value),value:p,label:"Content Type Select",showLabel:!1,options:[...
|
|
370
|
+
`},(0,e.jsx)(S.InputSelect,{onChange:i=>A(i.target.value),value:p,label:"Content Type Select",showLabel:!1,options:[...f?[]:[{value:"any",label:"All content types"}],...r?r.map(i=>({value:i.id,label:i.name})):[]]}),(0,e.jsx)("div",{css:V.css`
|
|
371
371
|
flex-grow: 1;
|
|
372
|
-
`},(0,e.jsx)(S.InputKeywordSearch,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:s,disabledFieldSubmission:!0,value:U}))),(0,e.jsx)("div",{css:[mt,S.scrollbarStyles],id:Te.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},!
|
|
372
|
+
`},(0,e.jsx)(S.InputKeywordSearch,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:s,disabledFieldSubmission:!0,value:U}))),(0,e.jsx)("div",{css:[mt,S.scrollbarStyles],id:Te.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},!g&&Array.isArray(n)?n.map(i=>(0,e.jsx)(vr,{key:i.id,isSelected:ue.includes(i.id),result:i,triggerSelection:()=>dr(i)})):g?null:(0,e.jsx)(hr,{searchText:fe||U,selectedContentType:(Bt=(At=r==null?void 0:r.find(i=>i.id===p))==null?void 0:At.name)!=null?Bt:p}),!g&&typeof c!="undefined"&&n&&(n==null?void 0:n.length)<c&&(0,e.jsx)("button",{css:dt,onClick:gr},cr?(0,e.jsx)(S.LoadingIndicator,null):"Load More"),g&&!(n!=null&&n.length)?(0,e.jsx)("div",{css:V.css`
|
|
373
373
|
padding: var(--spacing-base);
|
|
374
374
|
text-align: center;
|
|
375
375
|
width: 100%;
|
|
@@ -382,7 +382,7 @@ var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
382
382
|
`,onClick:()=>J(i)},i.name))):null),(0,e.jsx)("div",{css:V.css`
|
|
383
383
|
display: flex;
|
|
384
384
|
gap: var(--spacing-base);
|
|
385
|
-
`},(0,e.jsx)(S.Button,{buttonType:"unimportant",onClick:ur},"Cancel"),(0,e.jsx)(S.Button,{disabled:!ue.length,onClick:mr,"data-test-id":"entry-accept-button"},"Accept"))))),
|
|
385
|
+
`},(0,e.jsx)(S.Button,{buttonType:"unimportant",onClick:ur},"Cancel"),(0,e.jsx)(S.Button,{disabled:!ue.length,onClick:mr,"data-test-id":"entry-accept-button"},"Accept"))))),v?(0,e.jsx)(oe.DragDropContext,{onDragEnd:i=>yr(i)},(0,e.jsx)(oe.Droppable,{droppableId:b||"canvas-multi-select"},i=>(0,e.jsx)("div",{...i.droppableProps,ref:i.innerRef,css:V.css`
|
|
386
386
|
margin-block: var(--spacing-sm) 0;
|
|
387
387
|
`},o==null?void 0:o.map((y,Y)=>{if(y!=null&&y.id)return(0,e.jsx)(oe.Draggable,{key:y.id,draggableId:y.id,index:Y},x=>(0,e.jsx)("div",{css:ft,ref:x.innerRef,...x.draggableProps,...x.dragHandleProps},(0,e.jsx)("span",{css:vt},(0,e.jsx)(se,{css:[Me,ht],width:24,height:24}),(0,e.jsx)(se,{css:Me,width:24,height:24})),(0,e.jsx)(zt,{key:`selected-item-${y.id}`,logoIcon:a,selectedItem:y,onDeselect:ae=>Gt(ae),onEditClosed:T?ae=>T(ae):void 0})))}),i.placeholder))):o==null?void 0:o.map(i=>(0,e.jsx)(zt,{key:`selected-item-${i.id}`,logoIcon:a,selectedItem:i,onDeselect:y=>Gt(y),onEditClosed:T?y=>T(y):void 0}))))};var _=require("@emotion/react"),yt=_.css`
|
|
388
388
|
cursor: pointer;
|
|
@@ -418,7 +418,7 @@ var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
418
418
|
width: 1.5rem;
|
|
419
419
|
color: var(--brand-secondary-3);
|
|
420
420
|
margin-left: auto;
|
|
421
|
-
`;var xt=require("@emotion/react");function Lt({result:t,isSelected:n,triggerSelection:r}){var b;let{categories:o,logoIcon:a}=de(),[d]=t.categories||[{id:"",name:""}],
|
|
421
|
+
`;var xt=require("@emotion/react");function Lt({result:t,isSelected:n,triggerSelection:r}){var b;let{categories:o,logoIcon:a}=de(),[d]=t.categories||[{id:"",name:""}],v=typeof d=="undefined"||!o||(b=o.find(h=>h.id===d.id))==null?void 0:b.name;return(0,e.jsx)("div",{key:t.id,"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>r(),css:[yt]},(0,e.jsx)("div",{css:[St,n?wt:void 0]},t.thumbnailUrl?(0,e.jsx)("img",{src:t.thumbnailUrl,alt:`Thumbnail for ${t.title}`,css:xt.css`
|
|
422
422
|
background-color: var(--gray-200);
|
|
423
423
|
width: 3rem;
|
|
424
424
|
height: 3rem;
|
|
@@ -426,7 +426,7 @@ var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
426
426
|
`}):(0,e.jsx)(Q,{src:a,alt:"Logo",css:xt.css`
|
|
427
427
|
height: 2.25rem;
|
|
428
428
|
width: 2.25rem;
|
|
429
|
-
`}),(0,e.jsx)("h4",{css:[Ct]},t.title,
|
|
429
|
+
`}),(0,e.jsx)("h4",{css:[Ct]},t.title,v?(0,e.jsx)("span",{css:[Pt]},v):null),(0,e.jsx)("p",{css:[Rt]},"SKU: ",t.id,t.price&&(0,e.jsx)("span",null,t.price)),n?(0,e.jsx)(Ce,{css:[kt]}):null))}var le=require("@emotion/react"),ar=require("@uniformdev/design-system"),Mt=le.css`
|
|
430
430
|
display: flex;
|
|
431
431
|
width: 100%;
|
|
432
432
|
border: 1px solid var(--gray-300);
|
|
@@ -454,7 +454,7 @@ var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
454
454
|
width: 3.5rem;
|
|
455
455
|
height: 3.5rem;
|
|
456
456
|
object-fit: cover;
|
|
457
|
-
`;var R=require("@emotion/react"),ir=require("@uniformdev/design-system");function It({selectedItem:t,onDeselect:n}){var
|
|
457
|
+
`;var R=require("@emotion/react"),ir=require("@uniformdev/design-system");function It({selectedItem:t,onDeselect:n}){var v;let{categories:r,logoIcon:o}=de(),[a]=t.categories||[{id:"",name:""}],d=typeof a=="undefined"||!r||(v=r.find(b=>b.id===a.id))==null?void 0:v.name;return(0,e.jsx)("div",{css:[Mt],key:t.id},(0,e.jsx)("article",{css:[Vt]},(0,e.jsx)("div",{css:[Et]},t.thumbnailUrl?(0,e.jsx)("img",{src:t.thumbnailUrl,alt:d,css:[Ee],loading:"lazy"}):(0,e.jsx)("div",{css:[Ee]}),(0,e.jsx)("div",{css:R.css`
|
|
458
458
|
> :not(:last-child) {
|
|
459
459
|
margin-bottom: var(--spacing-xs);
|
|
460
460
|
}
|
|
@@ -514,4 +514,4 @@ var wr=Object.create;var he=Object.defineProperty;var Cr=Object.getOwnPropertyDe
|
|
|
514
514
|
font-size: var(--fs-sm);
|
|
515
515
|
`},"Unlink"),(0,e.jsx)(te,{css:R.css`
|
|
516
516
|
color: var(--brand-secondary-5);
|
|
517
|
-
`})))))}var sr=require("@uniformdev/design-system"),pe=require("react-use");function qr({value:t,setValue:n,onGetSelectedProducts:r,onGetCategories:o,onSearchProducts:a,logoIcon:d,multiSelect:
|
|
517
|
+
`})))))}var sr=require("@uniformdev/design-system"),pe=require("react-use");function qr({value:t,setValue:n,onGetSelectedProducts:r,onGetCategories:o,onSearchProducts:a,logoIcon:d,multiSelect:v,multiSelectId:b,selectedItemComponent:h,rowComponent:m}){var z,U;let{value:c,loading:g,error:f}=(0,pe.useAsync)(async()=>await o(),[o]),{value:J,error:T}=(0,pe.useAsync)(async()=>{if(!t)return;let s=await r({ids:t});return Array.isArray(s)?s:void 0},[r,t]),X=(0,Z.useMemo)(()=>c?c.map(p=>({id:p.id,name:p.name})):void 0,[c]),H=(0,Z.useRef)(),[F,q]=(0,pe.useAsyncFn)(async(s,p)=>{let A=await a({text:s,options:{limit:p==null?void 0:p.count,offset:p==null?void 0:p.offset,categoryId:p==null?void 0:p.contentType}});return(p==null?void 0:p.offset)===0&&(H.current=[]),(H.current=H.current||[]).push(...A.products),A},[a]),me=async s=>{s&&await n(s)};return g?(0,e.jsx)(sr.LoadingIndicator,null):f||T||F.error?(0,e.jsx)("div",null,"There was an error:"," ",(f==null?void 0:f.message)||(T==null?void 0:T.message)||((z=F.error)==null?void 0:z.message)):(0,e.jsx)(Tt.Provider,{value:{categories:c,logoIcon:d}},(0,e.jsx)(bt,{search:q,results:H.current,logoIcon:d,selectedItems:J,select:me,multiSelectId:b||"product-search-multi-select",multiSelect:v,contentTypes:X,selectedItemComponent:h||It,rowComponent:m||Lt,totalResults:(U=F.value)==null?void 0:U.total,resultsLoading:F.loading}))}var Tt=Z.default.createContext(void 0),de=()=>{let t=(0,Z.useContext)(Tt);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};D(I,require("@uniformdev/mesh-sdk"),module.exports);var u=require("@uniformdev/design-system");0&&(module.exports={Button,Callout,DefaultSearchRow,DefaultSelectedItem,EntrySearch,Heading,Icons,Input,InputSelect,InputToggle,KeywordSearchInput,LoadingIndicator,LoadingOverlay,Menu,MenuItem,ProductPreviewList,ProductQuery,ProductQueryContext,ProductSearch,ProductSearchContext,ProductSearchRow,ProductSelectedItem,ResolvableLoadingValue,ScrollableList,ScrollableListItem,SelectionField,Textarea,Theme,UniformMeshLocationContext,UniformMeshLocationContextProvider,UniformMeshSdkContext,UniformMeshSdkContextProvider,badgeIcon,draggableContainer,draggableIcon,draggableIconOffset,draggableIconWrapper,entrySearchBtn,entrySearchConfig,entrySearchConfigHidden,entrySearchLoadMoreBtn,entrySearchResultList,entrySearchSelectIcon,entrySearchSelectImg,entrySearchSelectInput,entrySearchSelectOption,entrySearchWrapper,productSearchRowActiveIcon,productSearchRowCategory,productSearchRowContainer,productSearchRowContent,productSearchRowContentActive,productSearchRowDetails,productSearchRowTitle,productSelectedItemContainer,productSelectedItemContent,productSelectedItemDetails,productSelectedItemImage,searchRowBtn,searchRowContainer,searchRowContainerActive,searchRowPopover,searchRowText,searchRowTextSmall,selectItemLinkBtn,selectItemLinkContainer,selectItemPopover,selectItemPopoverLabel,selectItemSmallText,selectedItemCloseIcon,selectedItemContainer,selectedItemCopy,selectedItemDetails,selectedItemIcon,selectedItemInner,selectedItemTitle,useInitializeUniformMeshSdk,useProductQueryContext,useProductSearchContext,useUniformMeshLocation,useUniformMeshLocationContext,useUniformMeshSdk,useUniformMeshSdkContext});
|
package/dist/index.mjs
CHANGED
|
@@ -514,4 +514,4 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
514
514
|
font-size: var(--fs-sm);
|
|
515
515
|
`},"Unlink"),e(K,{css:P`
|
|
516
516
|
color: var(--brand-secondary-5);
|
|
517
|
-
`})))))}import{LoadingIndicator as oo}from"@uniformdev/design-system";import{useAsync as Ft,useAsyncFn as no}from"react-use";function Ua({value:t,setValue:n,onGetSelectedProducts:o,onGetCategories:r,onSearchProducts:c,logoIcon:d,multiSelect:v,multiSelectId:b,selectedItemComponent:h,rowComponent:u}){var E,I;let{value:s,loading:g,error:f}=Ft(async()=>await r(),[r]),{value:H,error:M}=Ft(async()=>{if(!t)return;let i=await o({ids:t});return Array.isArray(i)?i:void 0},[o,t]),F=to(()=>s?s.map(m=>({id:m.id,name:m.name})):void 0,[s]),G=ro(),[z,A]=no(async(i,m)=>{let T=await c({text:i,options:{limit:m==null?void 0:m.count,offset:m==null?void 0:m.offset,categoryId:m==null?void 0:m.contentType}});return(m==null?void 0:m.offset)===0&&(G.current=[]),(G.current=G.current||[]).push(...T.products),T},[c]),J=async i=>{i&&await n(i)};return g?e(oo,null):f||M||z.error?e("div",null,"There was an error:"," ",(f==null?void 0:f.message)||(M==null?void 0:M.message)||((E=z.error)==null?void 0:E.message)):e($t.Provider,{value:{categories:s,logoIcon:d}},e(Lt,{search:A,results:G.current,logoIcon:d,selectedItems:H,select:J,multiSelectId:b||"product-search-multi-select",multiSelect:v,contentTypes:F,selectedItemComponent:h||Ht,rowComponent:u||Ut,totalResults:(I=z.value)==null?void 0:I.total,resultsLoading:z.loading}))}var $t=jr.createContext(void 0),ie=()=>{let t=eo($t);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};export*from"@uniformdev/mesh-sdk";import{Button as Na,Callout as _a,LoadingIndicator as Za,LoadingOverlay as qa,Menu as Wa,MenuItem as Ja,Input as Xa,InputSelect as Ya,InputToggle as ja,Theme as ei,InputKeywordSearch as ti,Heading as ri,ScrollableList as oi,ScrollableListItem as ni}from"@uniformdev/design-system";export{Na as Button,_a as Callout,gt as DefaultSearchRow,st as DefaultSelectedItem,Lt as EntrySearch,ri as Heading,me as Icons,Xa as Input,Ya as InputSelect,ja as InputToggle,ti as KeywordSearchInput,Za as LoadingIndicator,qa as LoadingOverlay,Wa as Menu,Ja as MenuItem,$e as ProductPreviewList,Zo as ProductQuery,He as ProductQueryContext,Ua as ProductSearch,$t as ProductSearchContext,Ut as ProductSearchRow,Ht as ProductSelectedItem,Ge as ResolvableLoadingValue,oi as ScrollableList,ni as ScrollableListItem,ze as SelectionField,ei as Theme,Le as UniformMeshLocationContext,Me as UniformMeshLocationContextProvider,Ie as UniformMeshSdkContext,ko as UniformMeshSdkContextProvider,he as badgeIcon,Pt as draggableContainer,ve as draggableIcon,kt as draggableIconOffset,Rt as draggableIconWrapper,vt as entrySearchBtn,bt as entrySearchConfig,yt as entrySearchConfigHidden,ht as entrySearchLoadMoreBtn,St as entrySearchResultList,wt as entrySearchSelectIcon,Ct as entrySearchSelectImg,Zn as entrySearchSelectInput,qn as entrySearchSelectOption,ft as entrySearchWrapper,Gt as productSearchRowActiveIcon,Tt as productSearchRowCategory,Mt as productSearchRowContainer,Vt as productSearchRowContent,Et as productSearchRowContentActive,Dt as productSearchRowDetails,It as productSearchRowTitle,At as productSelectedItemContainer,Ot as productSelectedItemContent,Bt as productSelectedItemDetails,ye as productSelectedItemImage,pt as searchRowBtn,ct as searchRowContainer,dt as searchRowContainerActive,lt as searchRowPopover,fe as searchRowText,ge as searchRowTextSmall,ue as selectItemLinkBtn,at as selectItemLinkContainer,nt as selectItemPopover,ae as selectItemPopoverLabel,B as selectItemSmallText,ot as selectedItemCloseIcon,Xe as selectedItemContainer,et as selectedItemCopy,je as selectedItemDetails,rt as selectedItemIcon,Ye as selectedItemInner,tt as selectedItemTitle,yo as useInitializeUniformMeshSdk,Fe as useProductQueryContext,ie as useProductSearchContext,go as useUniformMeshLocation,Ve as useUniformMeshLocationContext,Mo as useUniformMeshSdk,Te as useUniformMeshSdkContext};
|
|
517
|
+
`})))))}import{LoadingIndicator as oo}from"@uniformdev/design-system";import{useAsync as Ft,useAsyncFn as no}from"react-use";function Ua({value:t,setValue:n,onGetSelectedProducts:o,onGetCategories:r,onSearchProducts:c,logoIcon:d,multiSelect:v,multiSelectId:b,selectedItemComponent:h,rowComponent:u}){var E,I;let{value:s,loading:g,error:f}=Ft(async()=>await r(),[r]),{value:H,error:M}=Ft(async()=>{if(!t)return;let i=await o({ids:t});return Array.isArray(i)?i:void 0},[o,t]),F=to(()=>s?s.map(m=>({id:m.id,name:m.name})):void 0,[s]),G=ro(),[z,A]=no(async(i,m)=>{let T=await c({text:i,options:{limit:m==null?void 0:m.count,offset:m==null?void 0:m.offset,categoryId:m==null?void 0:m.contentType}});return(m==null?void 0:m.offset)===0&&(G.current=[]),(G.current=G.current||[]).push(...T.products),T},[c]),J=async i=>{i&&await n(i)};return g?e(oo,null):f||M||z.error?e("div",null,"There was an error:"," ",(f==null?void 0:f.message)||(M==null?void 0:M.message)||((E=z.error)==null?void 0:E.message)):e($t.Provider,{value:{categories:s,logoIcon:d}},e(Lt,{search:A,results:G.current,logoIcon:d,selectedItems:H,select:J,multiSelectId:b||"product-search-multi-select",multiSelect:v,contentTypes:F,selectedItemComponent:h||Ht,rowComponent:u||Ut,totalResults:(I=z.value)==null?void 0:I.total,resultsLoading:z.loading}))}var $t=jr.createContext(void 0),ie=()=>{let t=eo($t);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};export*from"@uniformdev/mesh-sdk";import{Button as Na,Callout as _a,LoadingIndicator as Za,LoadingOverlay as qa,Menu as Wa,MenuItem as Ja,Input as Xa,InputSelect as Ya,InputToggle as ja,Theme as ei,InputKeywordSearch as ti,Heading as ri,ScrollableList as oi,ScrollableListItem as ni,Textarea as ai}from"@uniformdev/design-system";export{Na as Button,_a as Callout,gt as DefaultSearchRow,st as DefaultSelectedItem,Lt as EntrySearch,ri as Heading,me as Icons,Xa as Input,Ya as InputSelect,ja as InputToggle,ti as KeywordSearchInput,Za as LoadingIndicator,qa as LoadingOverlay,Wa as Menu,Ja as MenuItem,$e as ProductPreviewList,Zo as ProductQuery,He as ProductQueryContext,Ua as ProductSearch,$t as ProductSearchContext,Ut as ProductSearchRow,Ht as ProductSelectedItem,Ge as ResolvableLoadingValue,oi as ScrollableList,ni as ScrollableListItem,ze as SelectionField,ai as Textarea,ei as Theme,Le as UniformMeshLocationContext,Me as UniformMeshLocationContextProvider,Ie as UniformMeshSdkContext,ko as UniformMeshSdkContextProvider,he as badgeIcon,Pt as draggableContainer,ve as draggableIcon,kt as draggableIconOffset,Rt as draggableIconWrapper,vt as entrySearchBtn,bt as entrySearchConfig,yt as entrySearchConfigHidden,ht as entrySearchLoadMoreBtn,St as entrySearchResultList,wt as entrySearchSelectIcon,Ct as entrySearchSelectImg,Zn as entrySearchSelectInput,qn as entrySearchSelectOption,ft as entrySearchWrapper,Gt as productSearchRowActiveIcon,Tt as productSearchRowCategory,Mt as productSearchRowContainer,Vt as productSearchRowContent,Et as productSearchRowContentActive,Dt as productSearchRowDetails,It as productSearchRowTitle,At as productSelectedItemContainer,Ot as productSelectedItemContent,Bt as productSelectedItemDetails,ye as productSelectedItemImage,pt as searchRowBtn,ct as searchRowContainer,dt as searchRowContainerActive,lt as searchRowPopover,fe as searchRowText,ge as searchRowTextSmall,ue as selectItemLinkBtn,at as selectItemLinkContainer,nt as selectItemPopover,ae as selectItemPopoverLabel,B as selectItemSmallText,ot as selectedItemCloseIcon,Xe as selectedItemContainer,et as selectedItemCopy,je as selectedItemDetails,rt as selectedItemIcon,Ye as selectedItemInner,tt as selectedItemTitle,yo as useInitializeUniformMeshSdk,Fe as useProductQueryContext,ie as useProductSearchContext,go as useUniformMeshLocation,Ve as useUniformMeshLocationContext,Mo as useUniformMeshSdk,Te as useUniformMeshSdkContext};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/mesh-sdk-react",
|
|
3
|
-
"version": "13.0.1-alpha.
|
|
3
|
+
"version": "13.0.1-alpha.278+8557f2dc1",
|
|
4
4
|
"description": "Uniform Mesh Framework SDK for React",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"storybook:publish": "pnpm build && pnpm build-storybook -o ./out"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@uniformdev/design-system": "^13.0.1-alpha.
|
|
48
|
-
"@uniformdev/mesh-sdk": "^13.0.1-alpha.
|
|
47
|
+
"@uniformdev/design-system": "^13.0.1-alpha.278+8557f2dc1",
|
|
48
|
+
"@uniformdev/mesh-sdk": "^13.0.1-alpha.278+8557f2dc1",
|
|
49
49
|
"react-beautiful-dnd": "13.1.0",
|
|
50
50
|
"react-use": "17.3.2",
|
|
51
51
|
"timeago.js": "4.0.2",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "8557f2dc1d71ce4c26b588fb5a4d8659a4ff3966"
|
|
85
85
|
}
|