@uniformdev/mesh-sdk-react 16.1.1-alpha.294 → 16.1.1-alpha.334
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/index.esm.js +131 -133
- package/dist/index.js +135 -137
- package/dist/index.mjs +131 -133
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
var
|
|
1
|
+
var vo=Object.create;var Ce=Object.defineProperty;var ho=Object.getOwnPropertyDescriptor;var bo=Object.getOwnPropertyNames;var yo=Object.getPrototypeOf,So=Object.prototype.hasOwnProperty;var br=(t,n)=>{for(var o in n)Ce(t,o,{get:n[o],enumerable:!0})},we=(t,n,o,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of bo(n))!So.call(t,a)&&a!==o&&Ce(t,a,{get:()=>n[a],enumerable:!(r=ho(n,a))||r.enumerable});return t},B=(t,n,o)=>(we(t,n,"default"),o&&we(o,n,"default")),j=(t,n,o)=>(o=t!=null?vo(yo(t)):{},we(n||!t||!t.__esModule?Ce(o,"default",{value:t,enumerable:!0}):o,t)),wo=t=>we(Ce({},"__esModule",{value:!0}),t);var A={};br(A,{AddListButton:()=>m.AddListButton,Button:()=>m.Button,Callout:()=>m.Callout,DamSelectedItem:()=>No,DefaultSearchRow:()=>Lt,DefaultSelectedItem:()=>ht,EntrySearch:()=>Gt,Heading:()=>m.Heading,Icons:()=>Ve,Input:()=>m.Input,InputSelect:()=>m.InputSelect,InputToggle:()=>m.InputToggle,KeywordSearchInput:()=>m.InputKeywordSearch,Label:()=>m.Label,LoadingIndicator:()=>m.LoadingIndicator,LoadingOverlay:()=>m.LoadingOverlay,Menu:()=>m.Menu,MenuItem:()=>m.MenuItem,ProductPreviewList:()=>at,ProductQuery:()=>Io,ProductQueryContext:()=>ot,ProductSearch:()=>Ko,ProductSearchContext:()=>jt,ProductSearchRow:()=>Qt,ProductSelectedItem:()=>Jt,ResolvableLoadingValue:()=>tt,ScrollableList:()=>m.ScrollableList,ScrollableListItem:()=>m.ScrollableListItem,SelectionField:()=>rt,Switch:()=>m.Switch,Textarea:()=>m.Textarea,Theme:()=>m.Theme,UniformMeshLocationContext:()=>Xe,UniformMeshLocationContextProvider:()=>qe,UniformMeshSdkContext:()=>Je,UniformMeshSdkContextProvider:()=>Lo,badgeIcon:()=>Oe,damSelectItemImage:()=>We,damSelectedItemContainer:()=>er,damSelectedItemCopy:()=>or,damSelectedItemDetails:()=>rr,damSelectedItemIcon:()=>ar,damSelectedItemInfoBtn:()=>dr,damSelectedItemInner:()=>tr,damSelectedItemLinkBtn:()=>Qe,damSelectedItemLinkContainer:()=>sr,damSelectedItemMediaContainer:()=>cr,damSelectedItemPopover:()=>ir,damSelectedItemPopoverLabel:()=>be,damSelectedItemSmallText:()=>se,damSelectedItemTitle:()=>nr,draggableContainer:()=>Dt,draggableIcon:()=>Be,draggableIconOffset:()=>Ut,draggableIconWrapper:()=>zt,entrySearchBtn:()=>xt,entrySearchConfig:()=>It,entrySearchConfigHidden:()=>Et,entrySearchLoadMoreBtn:()=>kt,entrySearchResultList:()=>Tt,entrySearchSelectIcon:()=>Mt,entrySearchSelectImg:()=>Vt,entrySearchSelectInput:()=>Ho,entrySearchSelectOption:()=>Fo,entrySearchWrapper:()=>Rt,productSearchRowActiveIcon:()=>Kt,productSearchRowCategory:()=>Ft,productSearchRowContainer:()=>At,productSearchRowContent:()=>Bt,productSearchRowContentActive:()=>Ot,productSearchRowDetails:()=>$t,productSearchRowTitle:()=>Ht,productSelectedItemContainer:()=>_t,productSelectedItemContent:()=>Xt,productSelectedItemDetails:()=>Zt,productSelectedItemIcon:()=>qt,productSelectedItemImage:()=>He,productSelectedItemLinkContainer:()=>Yt,productedSelectedItemLinkBtn:()=>Fe,productedSelectedItemSmallText:()=>$e,searchRowBtn:()=>Ct,searchRowContainer:()=>bt,searchRowContainerActive:()=>St,searchRowContainerWithPopover:()=>yt,searchRowPopover:()=>wt,searchRowText:()=>Ae,searchRowTextSmall:()=>Ge,selectItemLinkBtn:()=>ze,selectItemLinkContainer:()=>ft,selectItemPopover:()=>gt,selectItemPopoverLabel:()=>me,selectItemSmallText:()=>ee,selectedItemContainer:()=>ct,selectedItemCopy:()=>pt,selectedItemDetails:()=>lt,selectedItemIcon:()=>ut,selectedItemInner:()=>dt,selectedItemTitle:()=>mt,useInitializeUniformMeshSdk:()=>Po,useProductQueryContext:()=>nt,useProductSearchContext:()=>he,useUniformMeshLocation:()=>Co,useUniformMeshLocationContext:()=>Ye,useUniformMeshSdk:()=>Ro,useUniformMeshSdkContext:()=>je});module.exports=wo(A);var e=require("@emotion/react"),w=j(require("react"));var pe=require("react"),Xe=(0,pe.createContext)(void 0),qe=({children:t})=>{let[n,o]=(0,pe.useState)(),r;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let a=n||window.UniformMeshSDK.getCurrentLocation();r={location:{getValue:a.getValue,getMetadata:a.getMetadata,setValue:async(i,l)=>{await a.setValue(i,l),o(window.UniformMeshSDK.getCurrentLocation())},setValidationResult:async i=>{await a.setValidationResult(i)}}}}return(0,e.jsx)(Xe.Provider,{value:r},t)},Ye=()=>{let t=(0,pe.useContext)(Xe);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function Co(){let{location:t}=Ye();return{value:t==null?void 0:t.getValue(),setValue:t==null?void 0:t.setValue,metadata:t==null?void 0:t.getMetadata(),setValidationResult:t==null?void 0:t.setValidationResult}}var yr=require("@uniformdev/mesh-sdk"),fe=require("react"),Po=({autoResizingDisabled:t}={})=>{let[n,o]=(0,fe.useState)(),[r,a]=(0,fe.useState)();return(0,fe.useEffect)(()=>{typeof window=="undefined"||r||(typeof window.UniformMeshSDK=="undefined"?(0,yr.initializeUniformMeshSDK)({autoResizingDisabled:t}).then(i=>{a(i)}).catch(i=>{o(i)}):a(window.UniformMeshSDK))},[t]),{initializing:!r&&!n,error:n,sdk:r}};var Pe=require("react");var Sr=require("@uniformdev/design-system"),Je=(0,Pe.createContext)(void 0),Lo=({children:t})=>{let n;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(n={sdk:window.UniformMeshSDK}),(0,e.jsx)(Je.Provider,{value:n},(0,e.jsx)(Sr.Theme,null),(0,e.jsx)(qe,null,t))},je=()=>{let t=(0,Pe.useContext)(Je);if(!t)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return t};function Ro(){let{sdk:t}=je();return t}var F=j(require("react"));var Lr=require("@emotion/react"),Re=require("@uniformdev/design-system"),Rr=require("react-icons/cg");var et=j(require("react")),tt=({value:t,text:n,loading:o})=>(0,e.jsx)(et.default.Fragment,null,!!n&&n,!n&&(0,e.jsx)(et.default.Fragment,null,o&&`${t} (Loading...)`,!o&&`${t} (Unresolvable)`));var Le=require("@emotion/react"),wr=Le.css`
|
|
2
|
+
align-items: center;
|
|
3
|
+
background: var(--gray-100);
|
|
4
|
+
border: 1px solid var(--gray-300);
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
font-size: var(--fs-sm);
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
margin-bottom: var(--spacing-sm);
|
|
9
|
+
margin-right: var(--spacing-sm);
|
|
10
|
+
`,Cr=Le.css`
|
|
11
|
+
color: var(--gray-800);
|
|
12
|
+
padding: var(--spacing-3);
|
|
13
|
+
`,Pr=Le.css`
|
|
14
|
+
border: none;
|
|
15
|
+
border-left: 1px solid var(--gray-300);
|
|
16
|
+
background: var(--gray-100);
|
|
17
|
+
padding: var(--spacing-3);
|
|
18
|
+
`;var rt=({id:t,label:n,loading:o,selectedValues:r,values:a,onAdd:i,onRemove:l})=>{var v;let f=(v=a==null?void 0:a.filter(s=>!(r!=null&&r.includes(s.id.toString()))))!=null?v:[],g=(s,p)=>{s.preventDefault(),l(p)};return(0,e.jsx)("div",null,(0,e.jsx)(Re.InputSelect,{id:t,name:t,label:n,onChange:s=>i(s.target.value),disabled:o,options:[{value:"",label:"Add..."},...f.map(s=>({value:s.id,label:s.name||s.id}))],value:"",css:Array.isArray(r)&&r.length>0?Lr.css`
|
|
2
19
|
margin-bottom: var(--spacing-base);
|
|
3
|
-
`:""}),r==null?void 0:r.map(s=>{var p;return(0,e.jsx)("div",{css:
|
|
4
|
-
font-size: var(--fs-sm);
|
|
5
|
-
display: inline-flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
justify-content: space-between;
|
|
8
|
-
background-color: var(--gray-100);
|
|
9
|
-
border: 1px solid var(--gray-300);
|
|
10
|
-
margin-bottom: var(--spacing-sm);
|
|
11
|
-
margin-right: var(--spacing-sm);
|
|
12
|
-
`,key:s},(0,e.jsx)("span",{css:me.css`
|
|
13
|
-
padding: var(--spacing-3);
|
|
14
|
-
color: var(--gray-800);
|
|
15
|
-
`},(0,e.jsx)(et,{value:s,loading:o,text:(p=a.find(b=>b.id===s))==null?void 0:p.name})),(0,e.jsx)("button",{css:me.css`
|
|
16
|
-
padding: var(--spacing-3);
|
|
17
|
-
border-left: 1px solid var(--gray-300);
|
|
18
|
-
`,title:"remove",onClick:b=>g(b,s)},(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",css:me.css`
|
|
19
|
-
height: 1.25rem;
|
|
20
|
-
width: 1.25rem;
|
|
21
|
-
pointer-events: none;
|
|
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 wo=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"})),Re=wo;var Co=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"})),xe=Co;var ke=require("react-use"),E=require("@uniformdev/design-system"),R=require("@emotion/react"),wr={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Po=({value:t,setValue:n,brands:o,categories:r,loading:a,categoriesLoading:i,brandsLoading:l,logoIcon:f,onGetProducts:g,sortOptions:v,sortOrderOptions:s,categoryLabel:p="Product Category",brandLabel:b="Brand",disableBrands:D,restrictToSingleCategory:_=!1})=>{var u,M,H;let P=async d=>{n({...wr,...t||{},...d})},y=(0,$.useMemo)(()=>({...wr,...t||{}}),[t]),[de,Z]=(0,ke.useAsyncFn)(async d=>await g(d),[g]);(0,ke.useDebounce)(async()=>{await Z({brand:y.brand,categories:y.categories,keyword:y.keyword,sort:y.sort,sortOrder:y.sortOrder,count:y.count})},250,[y]);let ne=(0,$.useMemo)(()=>{let d=[];return r==null||r.forEach(S=>{let z=Pr(S,void 0);d.push(...z)}),d},[r]),X=(0,$.useMemo)(()=>[{value:"",label:"All categories"},...ne.map(d=>({label:d.name,value:d.id}))],[ne]),q=(0,$.useMemo)(()=>(o==null?void 0:o.map(d=>({id:d.id.toString(),name:d.name})))||[],[o]),Se=d=>{if(!d)return;let S=(t==null?void 0:t.categories)||[];P({categories:[...S,d]})},le=d=>{var S;P({categories:(S=t==null?void 0:t.categories)==null?void 0:S.filter(z=>z!==d)})},Y=d=>{P({brand:d.target.value})},k=d=>{P({count:d||1})};return a?(0,e.jsx)("div",null,"Loading..."):(0,e.jsx)(rt.Provider,{value:{categories:r,logoIcon:f}},(0,e.jsx)("div",{css:R.css`
|
|
20
|
+
`:""}),r==null?void 0:r.map(s=>{var p;return(0,e.jsx)("div",{css:wr,key:s},(0,e.jsx)("span",{css:Cr},(0,e.jsx)(tt,{value:s,loading:o,text:(p=a.find(b=>b.id===s))==null?void 0:p.name})),(0,e.jsx)("button",{css:Pr,title:"remove",onClick:b=>g(b,s)},(0,e.jsx)(Re.Icon,{icon:Rr.CgClose,iconColor:"currentColor",size:20})))}))};var xo=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"})),xe=xo;var ko=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"})),ke=ko;var Ie=require("react-use"),E=require("@uniformdev/design-system"),R=require("@emotion/react"),xr={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Io=({value:t,setValue:n,brands:o,categories:r,loading:a,categoriesLoading:i,brandsLoading:l,logoIcon:f,onGetProducts:g,sortOptions:v,sortOrderOptions:s,categoryLabel:p="Product Category",brandLabel:b="Brand",disableBrands:D,restrictToSingleCategory:_=!1})=>{var u,M,H;let P=async d=>{n({...xr,...t||{},...d})},S=(0,F.useMemo)(()=>({...xr,...t||{}}),[t]),[de,Z]=(0,Ie.useAsyncFn)(async d=>await g(d),[g]);(0,Ie.useDebounce)(async()=>{await Z({brand:S.brand,categories:S.categories,keyword:S.keyword,sort:S.sort,sortOrder:S.sortOrder,count:S.count})},250,[S]);let ne=(0,F.useMemo)(()=>{let d=[];return r==null||r.forEach(y=>{let z=Ir(y,void 0);d.push(...z)}),d},[r]),X=(0,F.useMemo)(()=>[{value:"",label:"All categories"},...ne.map(d=>({label:d.name,value:d.id}))],[ne]),q=(0,F.useMemo)(()=>(o==null?void 0:o.map(d=>({id:d.id.toString(),name:d.name})))||[],[o]),ye=d=>{if(!d)return;let y=(t==null?void 0:t.categories)||[];P({categories:[...y,d]})},le=d=>{var y;P({categories:(y=t==null?void 0:t.categories)==null?void 0:y.filter(z=>z!==d)})},Y=d=>{P({brand:d.target.value})},k=d=>{P({count:d||1})};return a?(0,e.jsx)("div",null,"Loading..."):(0,e.jsx)(ot.Provider,{value:{categories:r,logoIcon:f}},(0,e.jsx)("div",{css:R.css`
|
|
24
21
|
> :not(:last-child) {
|
|
25
22
|
margin-bottom: var(--spacing-md);
|
|
26
23
|
}
|
|
27
|
-
`},_?(0,e.jsx)(E.InputSelect,{id:"selection-field-product-category",label:p,disabled:a,value:(M=(u=
|
|
24
|
+
`},_?(0,e.jsx)(E.InputSelect,{id:"selection-field-product-category",label:p,disabled:a,value:(M=(u=S.categories)==null?void 0:u[0])!=null?M:"",options:X,onChange:d=>{P({categories:d.target.value===""?[]:[d.target.value]})}}):(0,e.jsx)(rt,{loading:i||!1,id:"selection-field-product-category",label:p,onAdd:ye,onRemove:le,selectedValues:S.categories,values:ne}),(0,e.jsx)("div",{css:R.css`
|
|
28
25
|
display: flex;
|
|
29
26
|
flex-wrap: wrap;
|
|
30
27
|
column-gap: var(--spacing-lg);
|
|
@@ -34,10 +31,10 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
34
31
|
}
|
|
35
32
|
`},D?null:(0,e.jsx)("div",{css:R.css`
|
|
36
33
|
width: 50%;
|
|
37
|
-
`},(0,e.jsx)(E.InputSelect,{id:"brand",name:"brand",label:b,disabled:l,value:
|
|
34
|
+
`},(0,e.jsx)(E.InputSelect,{id:"brand",name:"brand",label:b,disabled:l,value:S.brand,onChange:Y,options:[{value:"",label:"Choose..."},...q.map(d=>({value:d.id,label:d.name}))]})),(0,e.jsx)("div",{css:R.css`
|
|
38
35
|
flex-grow: 1;
|
|
39
36
|
position: relative;
|
|
40
|
-
`},(0,e.jsx)(E.Input,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:
|
|
37
|
+
`},(0,e.jsx)(E.Input,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:S.keyword,placeholder:"Enter keyword",onChange:d=>P({keyword:d.target.value})}))),(0,e.jsx)("div",{css:R.css`
|
|
41
38
|
display: flex;
|
|
42
39
|
flex-wrap: wrap;
|
|
43
40
|
column-gap: var(--spacing-lg);
|
|
@@ -51,25 +48,25 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
51
48
|
width: 33.333333%;
|
|
52
49
|
}
|
|
53
50
|
position: relative;
|
|
54
|
-
`},(0,e.jsx)(E.Input,{id:"count",name:"count",type:"number",min:1,step:1,value:
|
|
51
|
+
`},(0,e.jsx)(E.Input,{id:"count",name:"count",type:"number",min:1,step:1,value:S.count,onChange:d=>k(d.target.valueAsNumber),label:"Count"}),(0,e.jsx)("div",{css:R.css`
|
|
55
52
|
position: absolute;
|
|
56
53
|
bottom: var(--spacing-sm);
|
|
57
54
|
right: var(--spacing-sm);
|
|
58
55
|
display: flex;
|
|
59
56
|
gap: var(--spacing-sm);
|
|
60
|
-
`},(0,e.jsx)(
|
|
57
|
+
`},(0,e.jsx)(kr,{onCountChange:()=>k(S.count-1),countIcon:"decrement",disabled:S.count===1}),(0,e.jsx)(kr,{onCountChange:()=>k(S.count+1),countIcon:"increment"}))),Array.isArray(v)&&v.length>0?(0,e.jsx)("div",{css:R.css`
|
|
61
58
|
flex-grow: 1;
|
|
62
59
|
${(0,E.mq)("md")} {
|
|
63
60
|
width: 33.333333%;
|
|
64
61
|
}
|
|
65
|
-
`},(0,e.jsx)(E.InputSelect,{id:"sort",name:"sort",label:"Sort",value:
|
|
62
|
+
`},(0,e.jsx)(E.InputSelect,{id:"sort",name:"sort",label:"Sort",value:S.sort,onChange:d=>P({sort:d.target.value}),options:[{value:"",label:"Select a sort"},...v.map(d=>({value:d.sortKey,label:d.name}))]})):null,Array.isArray(s)&&s.length>0?(0,e.jsx)("div",{css:R.css`
|
|
66
63
|
flex-grow: 1;
|
|
67
|
-
`},(0,e.jsx)(E.InputSelect,{id:"sort-order",name:"sort-order",label:"Sort Order",value:
|
|
64
|
+
`},(0,e.jsx)(E.InputSelect,{id:"sort-order",name:"sort-order",label:"Sort Order",value:S.sortOrder,onChange:d=>P({sortOrder:d.target.value}),options:s.map(d=>({value:d.sortOrderKey,label:d.name}))})):null),(0,e.jsx)("div",null,(0,e.jsx)("h3",{css:R.css`
|
|
68
65
|
font-size: var(--fs-md);
|
|
69
66
|
line-height: var(--spacing-md);
|
|
70
67
|
font-weight: var(--fw-bold);
|
|
71
68
|
margin-bottom: var(--spacing-xs);
|
|
72
|
-
`},"Result Preview"),(0,e.jsx)(
|
|
69
|
+
`},"Result Preview"),(0,e.jsx)(at,{products:(H=de.value)==null?void 0:H.products}))))};function Ir(t,n){var i;let o=[],r=n?`${n.name} > `:"",a={id:t.id.toString(),name:`${r}${t.name}`};return o.push(a),(i=t.children)==null||i.forEach(l=>{let f=Ir(l,a);o.push(...f)}),o}function kr({onCountChange:t,countIcon:n,disabled:o}){return(0,e.jsx)("button",{css:R.css`
|
|
73
70
|
width: 2.25rem;
|
|
74
71
|
height: 2.25rem;
|
|
75
72
|
border: 1px solid var(--gray-300);
|
|
@@ -85,13 +82,13 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
85
82
|
cursor: not-allowed;
|
|
86
83
|
opacity: 0.3;
|
|
87
84
|
`:""}
|
|
88
|
-
`,onClick:t,disabled:o},n==="increment"?(0,e.jsx)(
|
|
85
|
+
`,onClick:t,disabled:o},n==="increment"?(0,e.jsx)(xe,{css:R.css`
|
|
89
86
|
width: 1rem;
|
|
90
87
|
height: 1rem;
|
|
91
|
-
`}):(0,e.jsx)(
|
|
88
|
+
`}):(0,e.jsx)(ke,{css:R.css`
|
|
92
89
|
width: 1rem;
|
|
93
90
|
height: 1rem;
|
|
94
|
-
`}))}var
|
|
91
|
+
`}))}var ot=F.default.createContext(void 0),nt=()=>{let t=(0,F.useContext)(ot);if(!t)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return t};function O({src:t,alt:n,className:o}){let r=t&&typeof t!="string"?t:null;return r?(0,e.jsx)(r,{className:o}):(0,e.jsx)("img",{src:t,alt:n,className:o})}var st=require("@emotion/react"),Br=require("@uniformdev/design-system");var U=require("@emotion/react"),Er=U.css`
|
|
95
92
|
align-items: center;
|
|
96
93
|
background: var(--white);
|
|
97
94
|
border-radius: var(--rounded-base);
|
|
@@ -99,61 +96,62 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
99
96
|
color: currentColor;
|
|
100
97
|
display: inline-flex;
|
|
101
98
|
justify-content: space-between;
|
|
102
|
-
padding: var(--spacing-
|
|
99
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
103
100
|
margin-left: auto;
|
|
104
101
|
text-decoration: none;
|
|
102
|
+
gap: var(--spacing-base);
|
|
105
103
|
&:hover {
|
|
106
104
|
background: var(--gray-50);
|
|
107
105
|
}
|
|
108
|
-
`,
|
|
106
|
+
`,Tr=U.css`
|
|
109
107
|
font-size: var(--fs-sm);
|
|
110
|
-
`,
|
|
111
|
-
width:
|
|
112
|
-
height:
|
|
113
|
-
`,
|
|
108
|
+
`,Mr=U.css`
|
|
109
|
+
width: 1rem;
|
|
110
|
+
height: 1rem;
|
|
111
|
+
`,it=U.css`
|
|
114
112
|
margin-right: var(--spacing-lg);
|
|
115
113
|
font-size: var(--fs-sm);
|
|
116
|
-
`,
|
|
114
|
+
`,Vr=U.css`
|
|
117
115
|
border: 1px solid var(--gray-200);
|
|
118
116
|
border-radius: var(--rounded-md);
|
|
119
117
|
background: var(--gray-50);
|
|
120
118
|
margin: var(--spacing-base) 0;
|
|
121
|
-
`,
|
|
119
|
+
`,Dr=U.css`
|
|
122
120
|
align-items: center;
|
|
123
121
|
display: flex;
|
|
124
122
|
flex-grow: 1;
|
|
125
123
|
gap: var(--spacing-base);
|
|
126
124
|
padding: var(--spacing-sm);
|
|
127
125
|
margin-right: var(--spacing-sm);
|
|
128
|
-
`,
|
|
126
|
+
`,zr=U.css`
|
|
129
127
|
background: var(--gray-200);
|
|
130
128
|
width: 3.5rem;
|
|
131
129
|
height: 3.5rem;
|
|
132
130
|
object-fit: cover;
|
|
133
|
-
`,
|
|
131
|
+
`,Ur=U.css`
|
|
134
132
|
background: var(--gray-100);
|
|
135
133
|
height: 3.5rem;
|
|
136
134
|
width: 3.5rem;
|
|
137
|
-
`,
|
|
135
|
+
`,Gr=U.css`
|
|
138
136
|
margin-top: 0;
|
|
139
137
|
font-weight: var(--fw-bold);
|
|
140
138
|
font-size: var(--fs-sm);
|
|
141
139
|
width: calc(100% / 3);
|
|
142
|
-
`,
|
|
140
|
+
`,Ar=U.css`
|
|
143
141
|
display: block;
|
|
144
142
|
font-weight: var(--fw-regular);
|
|
145
|
-
`;var
|
|
143
|
+
`;var at=({products:t})=>{let{categories:n,logoIcon:o}=nt();return(0,e.jsx)(w.Fragment,null,(0,e.jsx)("p",{css:st.css`
|
|
146
144
|
margin-bottom: var(--spacing-base);
|
|
147
|
-
`},"Matching ",(t==null?void 0:t.length)||0," products"),(0,e.jsx)("ul",{css:[
|
|
145
|
+
`},"Matching ",(t==null?void 0:t.length)||0," products"),(0,e.jsx)("ul",{css:[st.css`
|
|
148
146
|
max-height: 24rem;
|
|
149
147
|
overflow-x: auto;
|
|
150
|
-
`,
|
|
148
|
+
`,Br.scrollbarStyles]},t==null?void 0:t.map((r,a)=>{var f,g;let[i]=(r==null?void 0:r.categories)||[],l=typeof i=="undefined"||!n||(f=n.find(v=>v.id===i.id))==null?void 0:f.name;return(0,e.jsx)("li",{key:`product-${r.id}`,css:Vr},(0,e.jsx)("div",{css:Dr},r.thumbnailUrl?(0,e.jsx)("img",{src:r.thumbnailUrl,alt:typeof r.title=="string"?r.title:r.name||`Product ${a}`,css:zr}):(0,e.jsx)("div",{css:Ur}),(0,e.jsx)("h4",{css:Gr},r.title||r.name,l&&(0,e.jsx)("span",{css:Ar},l)),r&&(0,e.jsx)(w.Fragment,null,(0,e.jsx)("p",{css:it},"SKU: ",r.sku||r.id,(0,e.jsx)("br",null)),r.price!==void 0?(0,e.jsx)("p",{css:it},"Price: ",r.price):null,r.editLink||r.url?(0,e.jsx)("a",{css:Er,href:(g=r.editLink)!=null?g:r.url,title:`Go to ${r.title||r.name}`,target:"_blank",rel:"noopener noreferrer"},(0,e.jsx)("span",{css:Tr},"Edit"),o?(0,e.jsx)(O,{src:o,alt:"Logo",css:Mr}):null):null)))})))};var oe=j(require("react"));var T=j(require("react"));var Ve={};br(Ve,{Caution:()=>Or,Checkmark:()=>Ee,ChevronDown:()=>Te,Close:()=>Hr,Danger:()=>Fr,ExclamationPoint:()=>$r,Info:()=>Me,Lightbulb:()=>Kr,MagnifyingGlass:()=>Nr,MaximizeAlt:()=>Qr,Minus:()=>ke,MoreVerticalAlt:()=>ve,Plus:()=>xe});var Eo=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...t},(0,e.jsx)("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})),Or=Eo;var To=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 39.2A19.2 19.2 0 1 0 20 .8a19.2 19.2 0 0 0 0 38.4Zm8.897-22.303a2.4 2.4 0 0 0-3.394-3.394L17.6 21.407l-3.103-3.104a2.4 2.4 0 0 0-3.394 3.394l4.8 4.8a2.4 2.4 0 0 0 3.394 0l9.6-9.6Z"})),Ee=To;var Mo=t=>(0,e.jsx)("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...t},(0,e.jsx)("path",{d:"M5.293 8.293a1 1 0 0 1 1.414 0L12 13.586l5.293-5.293a1 1 0 1 1 1.414 1.414l-6 6a1 1 0 0 1-1.414 0l-6-6a1 1 0 0 1 0-1.414Z"})),Te=Mo;var Vo=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...t},(0,e.jsx)("g",{fillRule:"evenodd"},(0,e.jsx)("path",{d:"M16.578 1.636a1.174 1.174 0 0 1 0 1.66L3.296 16.578a1.174 1.174 0 1 1-1.66-1.66L14.918 1.636a1.174 1.174 0 0 1 1.66 0Z"}),(0,e.jsx)("path",{d:"M1.636 1.636a1.174 1.174 0 0 1 1.66 0l13.282 13.282a1.174 1.174 0 1 1-1.66 1.66L1.636 3.296a1.174 1.174 0 0 1 0-1.66Z"}))),Hr=Vo;var Do=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},(0,e.jsx)("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})),Fr=Do;var zo=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...t},(0,e.jsx)("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})),$r=zo;var Uo=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...t},(0,e.jsx)("path",{xmlns:"http://www.w3.org/2000/svg",d:"M11 10.98a1 1 0 1 1 2 0v6a1 1 0 1 1-2 0v-6zm1-4.929a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"}),(0,e.jsx)("path",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12a8 8 0 1 0 16 0 8 8 0 0 0-16 0z"})),Me=Uo;var Go=t=>(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},(0,e.jsx)("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})),Kr=Go;var Ao=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},(0,e.jsx)("g",{clipPath:"url(#magnifying-glass_svg__a)"},(0,e.jsx)("path",{d:"M11.539 0C5.484 0 .559 4.741.559 10.57c0 5.827 4.925 10.568 10.98 10.568 6.055 0 10.98-4.74 10.98-10.569C22.52 4.741 17.595 0 11.54 0Zm0 19.187c-4.937 0-8.954-3.866-8.954-8.618 0-4.752 4.017-8.618 8.954-8.618s8.954 3.866 8.954 8.618c0 4.752-4.017 8.618-8.954 8.618Z"}),(0,e.jsx)("path",{d:"m25.196 22.334-5.811-5.593a1.041 1.041 0 0 0-1.434 0 .95.95 0 0 0 0 1.38l5.812 5.593c.198.19.457.286.716.286.26 0 .519-.096.717-.286a.95.95 0 0 0 0-1.38Z"})),(0,e.jsx)("defs",null,(0,e.jsx)("clipPath",{id:"magnifying-glass_svg__a"},(0,e.jsx)("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})))),Nr=Ao;var Bo=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...t},(0,e.jsx)("path",{xmlns:"http://www.w3.org/2000/svg",d:"M3 3h6v2H6.462l4.843 4.843-1.415 1.414L5 6.367V9H3V3zm0 18h6v-2H6.376l4.929-4.928-1.415-1.414L5 17.548V15H3v6zm12 0h6v-6h-2v2.524l-4.867-4.866-1.414 1.414L17.647 19H15v2zm6-18h-6v2h2.562l-4.843 4.843 1.414 1.414L19 6.39V9h2V3z"})),Qr=Bo;var Oo=t=>(0,e.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...t},(0,e.jsx)("path",{xmlns:"http://www.w3.org/2000/svg",d:"M14 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})),ve=Oo;var Xr=require("react-use"),qr=require("uuid");var K=j(require("react"));function De(t,n){let o=window.open(t,"_blank"),r=setInterval(()=>{o!=null&&o.closed&&(clearInterval(r),n())},500)}var _r=require("timeago.js");var V=require("@emotion/react"),Wr=require("@uniformdev/design-system"),ct=V.css`
|
|
151
149
|
border: 1px solid var(--gray-200);
|
|
152
150
|
background: var(--gray-50);
|
|
153
151
|
border-radius: var(--rounded-base);
|
|
154
152
|
display: flex;
|
|
155
153
|
width: 100%;
|
|
156
|
-
`,
|
|
154
|
+
`,dt=V.css`
|
|
157
155
|
align-items: center;
|
|
158
156
|
display: flex;
|
|
159
157
|
flex-grow: 1;
|
|
@@ -161,22 +159,22 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
161
159
|
margin-inline: 0 var(--spacing-sm);
|
|
162
160
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
163
161
|
position: relative;
|
|
164
|
-
`,dt=V.css`
|
|
165
|
-
flex-grow: 1;
|
|
166
162
|
`,lt=V.css`
|
|
163
|
+
flex-grow: 1;
|
|
164
|
+
`,pt=V.css`
|
|
167
165
|
align-items: start;
|
|
168
166
|
display: inline-flex;
|
|
169
167
|
position: relative;
|
|
170
|
-
`,
|
|
168
|
+
`,mt=V.css`
|
|
171
169
|
color: var(--brand-secondary-1);
|
|
172
170
|
font-size: var(--fs-base);
|
|
173
171
|
font-weight: var(--fw-bold);
|
|
174
172
|
line-height: 1;
|
|
175
173
|
margin: 0;
|
|
176
|
-
`,
|
|
174
|
+
`,ut=V.css`
|
|
177
175
|
width: 1.5rem;
|
|
178
176
|
height: 1.5rem;
|
|
179
|
-
`,
|
|
177
|
+
`,gt=V.css`
|
|
180
178
|
background: var(--white);
|
|
181
179
|
border-radius: var(--rounded-base);
|
|
182
180
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -187,20 +185,20 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
187
185
|
width: max-content;
|
|
188
186
|
`,ee=V.css`
|
|
189
187
|
font-size: var(--fs-sm);
|
|
190
|
-
`,
|
|
188
|
+
`,me=V.css`
|
|
191
189
|
font-weight: var(--fw-bold);
|
|
192
190
|
margin-right: var(--spacing-sm);
|
|
193
|
-
`,
|
|
191
|
+
`,ft=V.css`
|
|
194
192
|
display: flex;
|
|
195
193
|
flex-direction: column;
|
|
196
194
|
gap: var(--spacing-sm);
|
|
197
195
|
|
|
198
|
-
${(0
|
|
196
|
+
${(0,Wr.mq)("md")} {
|
|
199
197
|
flex-direction: row;
|
|
200
198
|
min-width: 200px;
|
|
201
199
|
justify-content: end;
|
|
202
200
|
}
|
|
203
|
-
`,
|
|
201
|
+
`,ze=V.css`
|
|
204
202
|
align-items: center;
|
|
205
203
|
background: var(--white);
|
|
206
204
|
border-radius: var(--rounded-base);
|
|
@@ -215,39 +213,39 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
215
213
|
&:hover {
|
|
216
214
|
background: var(--gray-50);
|
|
217
215
|
}
|
|
218
|
-
`;var
|
|
216
|
+
`;var $=require("@emotion/react");var vt=require("@uniformdev/design-system"),Ue=require("react-icons/cg"),ht=({selectedItem:t,logoIcon:n,onDeselect:o,onEditClosed:r})=>{var v;let a=(0,K.useRef)(null),i=(0,K.useRef)(null),[l,f]=(0,K.useState)(!1);(0,K.useEffect)(()=>{let s=b=>{a.current&&!a.current.contains(b.target)&&i.current&&!i.current.contains(b.target)&&f(!1)},p=()=>{f(!1)};return window.addEventListener("resize",p,!0),document.addEventListener("scroll",s,!0),document.addEventListener("mousedown",s),()=>{window.removeEventListener("resize",p,!0),document.removeEventListener("scroll",s,!0),document.removeEventListener("mousedown",s)}},[i]);let g=()=>{var s;if(f(!l),i.current&&a.current){let p=(s=a==null?void 0:a.current)==null?void 0:s.getBoundingClientRect(),b=i.current.offsetWidth;i.current.style.top=`${p.top+30}px`,i.current.style.left=`${p.left-b+30}px`}};return(0,e.jsx)("div",{css:ct,key:t.id},(0,e.jsx)("div",{css:dt},(0,e.jsx)("div",{css:lt},(0,e.jsx)("div",{css:pt},(0,e.jsx)("h4",{css:[mt,t.popoverData?$.css`
|
|
219
217
|
margin-bottom: var(--spacing-sm);
|
|
220
|
-
`:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?(0,e.jsx)(K.default.Fragment,null,(0,e.jsx)("button",{type:"button",ref:a,css
|
|
218
|
+
`:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?(0,e.jsx)(K.default.Fragment,null,(0,e.jsx)("button",{type:"button",ref:a,css:$.css`
|
|
221
219
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
222
|
-
`,"aria-controls":"path-details","aria-expanded":l,onClick:g},(0,e.jsx)(
|
|
220
|
+
`,"aria-controls":"path-details","aria-expanded":l,onClick:g},(0,e.jsx)(vt.Icon,{icon:Ue.CgInfo,iconColor:"gray",size:24,css:$.css`
|
|
223
221
|
opacity: var(--opacity-75);
|
|
224
|
-
`})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!l,ref:i,css:[
|
|
222
|
+
`})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!l,ref:i,css:[gt,l?$.css`
|
|
225
223
|
visibility: visible;
|
|
226
|
-
|
|
224
|
+
`:$.css`
|
|
227
225
|
visibility: hidden;
|
|
228
|
-
`]},Object.entries(t.popoverData).map(([s,p],b)=>(0,e.jsx)("div",{css:ee,key:b},(0,e.jsx)("span",{css:
|
|
226
|
+
`]},Object.entries(t.popoverData).map(([s,p],b)=>(0,e.jsx)("div",{css:ee,key:b},(0,e.jsx)("span",{css:me},s,":"),p)))):null),t.createdDate&&(0,e.jsx)("div",{css:ee},(0,e.jsx)("span",{css:me},"Created:"),(0,_r.format)((v=t.createdDate)!=null?v:0)),t.metadata?Object.entries(t.metadata).filter(([s])=>["type","status"].includes(s.toLocaleLowerCase())).map(([s,p])=>(0,e.jsx)("div",{css:[ee,$.css`
|
|
229
227
|
order: 1;
|
|
230
|
-
`],key:s},(0,e.jsx)("span",{css:
|
|
228
|
+
`],key:s},(0,e.jsx)("span",{css:me},s,":"),p)):null,t.metadata?Object.entries(t.metadata).filter(([s])=>!["type","status"].includes(s.toLocaleLowerCase())).map(([s,p])=>(0,e.jsx)("div",{css:[ee,$.css`
|
|
231
229
|
order: 1;
|
|
232
|
-
`],key:s},(0,e.jsx)("span",{css:[
|
|
230
|
+
`],key:s},(0,e.jsx)("span",{css:[me,$.css`
|
|
233
231
|
order: 1;
|
|
234
|
-
`]},s,":"),p)):null),(0,e.jsx)("div",{css:
|
|
232
|
+
`]},s,":"),p)):null),(0,e.jsx)("div",{css:ft},t.editLink?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:s=>{r&&(De(s.currentTarget.href,()=>r(t)),s.preventDefault())},css:ze},(0,e.jsx)("span",{css:ee},"Edit"),(0,e.jsx)(O,{src:n,css:ut,alt:"Logo"})):null,(0,e.jsx)("button",{type:"button",onClick:()=>{o(t)},css:ze},(0,e.jsx)("span",{css:ee},"Unlink"),(0,e.jsx)(vt.Icon,{icon:Ue.CgClose,iconColor:"red",size:16})))))};var N=j(require("react"));var te=require("@emotion/react"),bt=te.css`
|
|
235
233
|
cursor: pointer;
|
|
236
234
|
padding: var(--spacing-sm);
|
|
237
235
|
position: relative;
|
|
238
236
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
239
237
|
color var(--duration-fast) var(--timing-ease-out);
|
|
240
|
-
`,bt=te.css`
|
|
241
|
-
padding-right: var(--spacing-lg);
|
|
242
238
|
`,yt=te.css`
|
|
239
|
+
padding-right: var(--spacing-lg);
|
|
240
|
+
`,St=te.css`
|
|
243
241
|
background: var(--brand-secondary-3);
|
|
244
242
|
color: var(--white);
|
|
245
|
-
`,Ue=te.css`
|
|
246
|
-
font-size: var(--fs-xs);
|
|
247
243
|
`,Ge=te.css`
|
|
244
|
+
font-size: var(--fs-xs);
|
|
245
|
+
`,Ae=te.css`
|
|
248
246
|
font-weight: var(--fw-bold);
|
|
249
247
|
margin-right: var(--spacing-sm);
|
|
250
|
-
`,
|
|
248
|
+
`,wt=te.css`
|
|
251
249
|
background: var(--white);
|
|
252
250
|
border-left: 4px solid var(--brand-secondary-3);
|
|
253
251
|
border-radius: var(--rounded-base);
|
|
@@ -259,20 +257,20 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
259
257
|
right: var(--spacing-xl);
|
|
260
258
|
z-index: var(--z-10);
|
|
261
259
|
width: max-content;
|
|
262
|
-
`,
|
|
260
|
+
`,Ct=te.css`
|
|
263
261
|
position: absolute;
|
|
264
262
|
inset: 0 var(--spacing-sm) 0 auto;
|
|
265
|
-
`;var
|
|
263
|
+
`;var Pt=require("@emotion/react"),Lt=({result:t,isSelected:n,triggerSelection:o})=>{let r=(0,N.useRef)(null),a=(0,N.useRef)(null),[i,l]=(0,N.useState)(!1);(0,N.useEffect)(()=>{function g(v){r.current&&!r.current.contains(v.target)&&a.current&&!a.current.contains(v.target)&&l(!1)}return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[a]);let f=g=>{g.stopPropagation(),l(!i)};return(0,e.jsx)("div",{key:t.id,css:[bt,n?St:void 0,t.popoverData?yt:void 0],"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o()},t.title,t.popoverData&&n?(0,e.jsx)(N.default.Fragment,null,(0,e.jsx)("button",{type:"button",ref:r,css:Ct,"aria-controls":"path-details",onClick:g=>f(g),"aria-expanded":i},(0,e.jsx)(Me,{width:24,height:24})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!i,ref:a,css:[wt,i?Pt.css`
|
|
266
264
|
visibility: visible;
|
|
267
|
-
`:
|
|
265
|
+
`:Pt.css`
|
|
268
266
|
visibility: hidden;
|
|
269
|
-
`]},t.metadata&&Object.entries(t.metadata).map(([g,v],s)=>(0,e.jsx)("div",{css:
|
|
267
|
+
`]},t.metadata&&Object.entries(t.metadata).map(([g,v],s)=>(0,e.jsx)("div",{css:Ge,key:s},(0,e.jsx)("span",{css:Ae},g,":"),v)),Object.entries(t.popoverData).map(([g,v],s)=>(0,e.jsx)("div",{css:Ge,key:s},(0,e.jsx)("span",{css:Ae},g,":"),v)))):null)};var ue=require("react-beautiful-dnd");var L=require("@emotion/react"),Rt=L.css`
|
|
270
268
|
background: var(--white);
|
|
271
269
|
border: 1px solid var(--gray-300);
|
|
272
270
|
border-radius: var(--rounded-base);
|
|
273
271
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
|
|
274
272
|
margin-bottom: var(--spacing-base);
|
|
275
|
-
`,
|
|
273
|
+
`,xt=L.css`
|
|
276
274
|
align-items: center;
|
|
277
275
|
display: flex;
|
|
278
276
|
position: relative;
|
|
@@ -280,7 +278,7 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
280
278
|
width: 100%;
|
|
281
279
|
background-color: transparent;
|
|
282
280
|
border: 0;
|
|
283
|
-
`,
|
|
281
|
+
`,kt=L.css`
|
|
284
282
|
color: var(--brand-secondary-1);
|
|
285
283
|
display: block;
|
|
286
284
|
font-weight: var(--fw-bold);
|
|
@@ -296,15 +294,15 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
296
294
|
background: var(--gray-100);
|
|
297
295
|
outline: none;
|
|
298
296
|
}
|
|
299
|
-
`,
|
|
297
|
+
`,It=L.css`
|
|
300
298
|
background: var(--white);
|
|
301
299
|
border: 1px solid var(--gray-300);
|
|
302
300
|
border-radius: var(--rounded-base);
|
|
303
301
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
|
|
304
302
|
display: block;
|
|
305
|
-
`,It=L.css`
|
|
306
|
-
display: none;
|
|
307
303
|
`,Et=L.css`
|
|
304
|
+
display: none;
|
|
305
|
+
`,Tt=L.css`
|
|
308
306
|
overflow-y: auto;
|
|
309
307
|
height: 16rem;
|
|
310
308
|
margin-bottom: var(--spacing-base);
|
|
@@ -313,94 +311,94 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
313
311
|
& > :not(:last-child) {
|
|
314
312
|
border-bottom: 1px solid var(--gray-200);
|
|
315
313
|
}
|
|
316
|
-
`,
|
|
314
|
+
`,Ho=L.css`
|
|
317
315
|
background-color: var(--gray-50);
|
|
318
316
|
max-width: 33.33%;
|
|
319
|
-
`,
|
|
317
|
+
`,Mt=L.css`
|
|
320
318
|
align-items: center;
|
|
321
319
|
display: flex;
|
|
322
320
|
position: absolute;
|
|
323
321
|
inset: 0 0 0 auto;
|
|
324
322
|
pointer-events: none;
|
|
325
323
|
padding-right: var(--spacing-sm);
|
|
326
|
-
`,
|
|
324
|
+
`,Vt=L.css`
|
|
327
325
|
color: var(--brand-secondary-1);
|
|
328
326
|
width: 1.25rem;
|
|
329
327
|
height: 1.25rem;
|
|
330
328
|
transition: transform var(--duration-fast) var(--timing-ease-out);
|
|
331
329
|
transform: rotate(0);
|
|
332
|
-
`,
|
|
330
|
+
`,Fo=L.css`
|
|
333
331
|
background: var(--white);
|
|
334
332
|
color: var(--brand-secondary-1);
|
|
335
|
-
`,
|
|
333
|
+
`,Dt=L.css`
|
|
336
334
|
position: relative;
|
|
337
335
|
margin-block: var(--spacing-sm) 0;
|
|
338
336
|
|
|
339
337
|
&:hover > span {
|
|
340
338
|
opacity: 0.3;
|
|
341
339
|
}
|
|
342
|
-
`,
|
|
340
|
+
`,zt=L.css`
|
|
343
341
|
align-items: center;
|
|
344
342
|
display: flex;
|
|
345
343
|
position: absolute;
|
|
346
344
|
inset: 0 auto 0 0;
|
|
347
345
|
margin-block: auto;
|
|
348
346
|
opacity: 0;
|
|
349
|
-
`,
|
|
347
|
+
`,Be=L.css`
|
|
350
348
|
color: var(--brand-secondary-1);
|
|
351
|
-
`,
|
|
349
|
+
`,Ut=L.css`
|
|
352
350
|
position: absolute;
|
|
353
351
|
left: 0.375rem;
|
|
354
|
-
`,
|
|
352
|
+
`,Oe=L.css`
|
|
355
353
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
356
354
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
357
|
-
`;var G=require("@emotion/react"),C=require("@uniformdev/design-system");var ae=require("react");function
|
|
355
|
+
`;var G=require("@emotion/react"),C=require("@uniformdev/design-system");var ae=require("react");function Zr(t,{delay:n=500,minDuration:o=200}={delay:500,minDuration:200}){let[r,a]=(0,ae.useState)("IDLE"),i=(0,ae.useRef)(void 0);return(0,ae.useEffect)(()=>{t&&r==="IDLE"&&(clearTimeout(i.current),i.current=setTimeout(()=>{if(!t)return a("IDLE");i.current=setTimeout(()=>{a("EXPIRE")},o),a("DISPLAY")},n),a("DELAY")),!t&&r!=="DISPLAY"&&(clearTimeout(i.current),a("IDLE"))},[t,r,n,o]),(0,ae.useEffect)(()=>()=>clearTimeout(i.current),[]),r==="DISPLAY"||r==="EXPIRE"}var $o=({searchText:t,selectedContentType:n})=>{let o="No content found";return n&&n!=="any"&&(o=`No ${n} content was found`),t&&(o=`${o} for keyword '${t}'.`),(0,e.jsx)(C.Callout,{type:"info"},o)},Gt=({search:t,results:n,contentTypes:o,selectedItems:r,logoIcon:a,select:i,multiSelect:l,multiSelectId:f,rowComponent:g,selectedItemComponent:v,totalResults:s,resultsLoading:p,requireContentType:b,onAddNew:D,onEditClosed:_,onCancel:P,noResultsComponent:S,helpComponent:de,onSort:Z,typeSelectorLabel:ne="Content Type Select",typeSelectorAllTypesOptionText:X="All content types",loadingIndicatorDelay:q=1e3})=>{var fr,vr,hr;let le=()=>b?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[Y,k]=T.useState(""),[u,M]=T.useState(le),[H,d]=T.useState(!1),[y,z]=T.useState([]),[to,pr]=T.useState(!1),Ze=T.useRef(`x${(0,qr.v4)()}`),Se=(0,Xr.useThrottle)(Y,750);T.useEffect(()=>{t(Se,{count:5,offset:0,contentType:u==="any"?void 0:u})},[Se,u]);let ro=Zr(p,{delay:q}),oo=c=>{y.some(h=>h.id===c.id)?z(h=>h.filter(J=>J.id!==c.id)):z(l?h=>[...h,c]:[c])},no=r==null?void 0:r.map(c=>c.id+c.title).join(",");T.useEffect(()=>{Array.isArray(r)&&z(r)},[no]);let ao=()=>{M(le()),k(""),z(r!=null&&r.length?r:[])},io=()=>{d(c=>!c),H||ao()},mr=c=>{let h=(y==null?void 0:y.filter(J=>J.id!==c.id))||[];z(h),i(h,"")},so=c=>{c.preventDefault(),i(y,u),d(!1)},co=c=>{c.preventDefault(),d(!1),P&&P()},lo=()=>{t(Se,{count:5,offset:(n==null?void 0:n.length)||0,contentType:u==="any"?void 0:u}),pr(!0);let c=setTimeout(()=>{pr(!1)},750);return()=>clearTimeout(c)},po=!(r==null?void 0:r.length)||l,mo=g||Lt,ur=v||ht,uo=S||$o,gr=a&&typeof a!="string"?a:null,go=gr?(0,e.jsx)(gr,{css:Oe}):(0,e.jsx)("img",{src:a,alt:"Logo",css:Oe}),fo=c=>{var h,J;if(c.destination&&c.source.droppableId===((h=c.destination)==null?void 0:h.droppableId)){let I=[...r||[]],[ge]=(J=I==null?void 0:I.splice(c.source.index,1))!=null?J:[];return I==null||I.splice(c.destination.index,0,ge),Z&&(z(I),Z==null||Z(I)),I}};return(0,e.jsx)("div",{css:G.css`
|
|
358
356
|
width: 100%;
|
|
359
357
|
`},(0,e.jsx)("div",{css:G.css`
|
|
360
358
|
position: relative;
|
|
361
359
|
margin-block: var(--spacing-base);
|
|
362
|
-
`},
|
|
360
|
+
`},po?(0,e.jsx)(T.Fragment,null,(0,e.jsx)("div",{css:Rt,"data-test-id":"component-search"},(0,e.jsx)("button",{css:xt,onClick:io,type:"button","aria-haspopup":!0,"aria-expanded":H,"aria-controls":`entry-search-config-${Ze.current}`},go,(0,e.jsx)("span",{css:G.css`
|
|
363
361
|
margin-left: var(--spacing-base);
|
|
364
|
-
`},"Select"),(0,e.jsx)("span",{css:
|
|
362
|
+
`},"Select"),(0,e.jsx)("span",{css:Mt},(0,e.jsx)(Te,{css:[Vt,H?G.css`
|
|
365
363
|
transform: rotate(180deg);
|
|
366
|
-
`:void 0]})))),(0,e.jsx)("div",{id:`entry-search-config-${
|
|
364
|
+
`:void 0]})))),(0,e.jsx)("div",{id:`entry-search-config-${Ze.current}`,"aria-hidden":!H,css:[It,H?void 0:Et]},de||null,(0,e.jsx)("div",{css:G.css`
|
|
367
365
|
display: flex;
|
|
368
366
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
369
367
|
margin-bottom: var(--spacing-base);
|
|
370
368
|
`},(0,e.jsx)(C.InputSelect,{onChange:c=>M(c.target.value),value:u,label:ne,showLabel:!1,options:[...b?[]:[{value:"any",label:X}],...o?o.map(c=>({value:c.id,label:c.name})):[]]}),(0,e.jsx)("div",{css:G.css`
|
|
371
369
|
flex-grow: 1;
|
|
372
|
-
`},(0,e.jsx)(C.InputKeywordSearch,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:k,disabledFieldSubmission:!0,value:Y}))),(0,e.jsx)("div",{css:[
|
|
370
|
+
`},(0,e.jsx)(C.InputKeywordSearch,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:k,disabledFieldSubmission:!0,value:Y}))),(0,e.jsx)("div",{css:[Tt,C.scrollbarStyles],id:Ze.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},(0,e.jsx)(C.LoadingOverlay,{isActive:ro}),Array.isArray(n)&&n.length>0?n.map(c=>(0,e.jsx)(mo,{key:c.id,isSelected:y.some(h=>h.id===c.id),result:c,triggerSelection:()=>oo(c)})):(0,e.jsx)(uo,{searchText:Se||Y,selectedContentType:(vr=(fr=o==null?void 0:o.find(c=>c.id===u))==null?void 0:fr.name)!=null?vr:u}),!p&&typeof s!="undefined"&&n&&(n==null?void 0:n.length)<s&&(0,e.jsx)("button",{type:"button",css:kt,onClick:lo},to?(0,e.jsx)(C.LoadingIndicator,null):"Load More")),(0,e.jsx)("div",{css:G.css`
|
|
373
371
|
display: flex;
|
|
374
372
|
justify-content: space-between;
|
|
375
|
-
`},(0,e.jsx)("div",null,D&&((
|
|
373
|
+
`},(0,e.jsx)("div",null,D&&((hr=o==null?void 0:o.length)!=null?hr:0)>0?(0,e.jsx)(C.Menu,{menuLabel:"Add new menu",menuTrigger:(0,e.jsx)(C.Button,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(c=>(0,e.jsx)(C.MenuItem,{key:c.id,css:G.css`
|
|
376
374
|
background: var(--white);
|
|
377
375
|
color: var(--brand-secondary-1);
|
|
378
376
|
`,onClick:()=>D(c)},c.name))):null),(0,e.jsx)("div",{css:G.css`
|
|
379
377
|
display: flex;
|
|
380
378
|
gap: var(--spacing-base);
|
|
381
|
-
`},(0,e.jsx)(C.Button,{buttonType:"unimportant",onClick:
|
|
379
|
+
`},(0,e.jsx)(C.Button,{buttonType:"unimportant",onClick:co},"Cancel"),(0,e.jsx)(C.Button,{disabled:!y.length,onClick:so,"data-test-id":"entry-accept-button"},"Accept"))))):null,H?null:l&&y.length>1?(0,e.jsx)(ue.DragDropContext,{onDragEnd:c=>fo(c)},(0,e.jsx)(ue.Droppable,{droppableId:f||"canvas-multi-select"},c=>(0,e.jsx)("div",{...c.droppableProps,ref:c.innerRef,css:G.css`
|
|
382
380
|
margin-block: var(--spacing-sm) 0;
|
|
383
|
-
`},
|
|
381
|
+
`},y==null?void 0:y.map((h,J)=>{if(h!=null&&h.id)return(0,e.jsx)(ue.Draggable,{key:h.id,draggableId:h.id,index:J},I=>(0,e.jsx)("div",{css:Dt,ref:I.innerRef,...I.draggableProps,...I.dragHandleProps},(0,e.jsx)("span",{css:zt},(0,e.jsx)(ve,{css:[Be,Ut],width:24,height:24}),(0,e.jsx)(ve,{css:Be,width:24,height:24})),(0,e.jsx)(ur,{key:`selected-item-${h.id}`,logoIcon:a,selectedItem:h,onDeselect:ge=>mr(ge),onEditClosed:_?ge=>_(ge):void 0})))}),c.placeholder))):y==null?void 0:y.map(c=>(0,e.jsx)(ur,{key:`selected-item-${c.id}`,logoIcon:a,selectedItem:c,onDeselect:h=>mr(h),onEditClosed:_?h=>_(h):void 0}))))};var re=require("@emotion/react"),At=re.css`
|
|
384
382
|
cursor: pointer;
|
|
385
383
|
padding: var(--spacing-sm) 0;
|
|
386
384
|
margin-right: var(--spacing-sm);
|
|
387
385
|
position: relative;
|
|
388
386
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
389
387
|
color var(--duration-fast) var(--timing-ease-out);
|
|
390
|
-
`,
|
|
388
|
+
`,Bt=re.css`
|
|
391
389
|
border: 2px solid transparent;
|
|
392
390
|
border-radius: var(--rounded-base);
|
|
393
391
|
display: flex;
|
|
394
392
|
align-items: center;
|
|
395
393
|
gap: var(--spacing-base);
|
|
396
394
|
padding: var(--spacing-sm) var(--spacing-xs);
|
|
397
|
-
`,Bt=re.css`
|
|
398
|
-
background-color: var(--green-50);
|
|
399
395
|
`,Ot=re.css`
|
|
396
|
+
background-color: var(--green-50);
|
|
397
|
+
`,Ht=re.css`
|
|
400
398
|
font-size: var(--fs-sm);
|
|
401
399
|
font-weight: var(--fw-bold);
|
|
402
400
|
width: 50%;
|
|
403
|
-
`,
|
|
401
|
+
`,Ft=re.css`
|
|
404
402
|
font-weight: var(--fw-normal);
|
|
405
403
|
display: block;
|
|
406
404
|
`,$t=re.css`
|
|
@@ -408,28 +406,27 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
408
406
|
> * {
|
|
409
407
|
display: block;
|
|
410
408
|
}
|
|
411
|
-
`,
|
|
409
|
+
`,Kt=re.css`
|
|
412
410
|
display: block;
|
|
413
411
|
height: 1.5rem;
|
|
414
412
|
width: 1.5rem;
|
|
415
413
|
color: var(--brand-secondary-3);
|
|
416
414
|
margin-left: auto;
|
|
417
|
-
`;var
|
|
415
|
+
`;var Nt=require("@emotion/react");function Qt({result:t,isSelected:n,triggerSelection:o}){var f;let{categories:r,logoIcon:a}=he(),[i]=t.categories||[{id:"",name:""}],l=typeof i=="undefined"||!r||(f=r.find(g=>g.id===i.id))==null?void 0:f.name;return(0,e.jsx)("div",{key:t.id,"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o(),css:[At]},(0,e.jsx)("div",{css:[Bt,n?Ot:void 0]},t.thumbnailUrl?(0,e.jsx)("img",{src:t.thumbnailUrl,alt:`Thumbnail for ${t.title}`,css:Nt.css`
|
|
418
416
|
background-color: var(--gray-200);
|
|
419
417
|
width: 3rem;
|
|
420
418
|
height: 3rem;
|
|
421
419
|
object-fit: cover;
|
|
422
|
-
`}):(0,e.jsx)(O,{src:a,alt:"Logo",css:
|
|
420
|
+
`}):(0,e.jsx)(O,{src:a,alt:"Logo",css:Nt.css`
|
|
423
421
|
height: 2.25rem;
|
|
424
422
|
width: 2.25rem;
|
|
425
|
-
`}),(0,e.jsx)("h4",{css:[
|
|
423
|
+
`}),(0,e.jsx)("h4",{css:[Ht]},t.title,l?(0,e.jsx)("span",{css:[Ft]},l):null),(0,e.jsx)("p",{css:[$t]},"SKU: ",t.sku||t.id,t.price!==void 0?(0,e.jsx)("span",null,t.price):null),n?(0,e.jsx)(Ee,{css:[Kt]}):null))}var Q=require("@emotion/react"),Wt=require("@uniformdev/design-system"),_t=Q.css`
|
|
426
424
|
border: 1px solid var(--gray-200);
|
|
427
425
|
border-radius: var(--rounded-base);
|
|
428
426
|
background: var(--gray-50);
|
|
429
427
|
display: flex;
|
|
430
428
|
width: 100%;
|
|
431
|
-
|
|
432
|
-
`,_t=Q.css`
|
|
429
|
+
`,Zt=Q.css`
|
|
433
430
|
align-items: center;
|
|
434
431
|
display: flex;
|
|
435
432
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
@@ -437,22 +434,22 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
437
434
|
flex-grow: 1;
|
|
438
435
|
gap: var(--spacing-sm);
|
|
439
436
|
margin-inline: 0 var(--spacing-sm);
|
|
440
|
-
`,
|
|
437
|
+
`,Xt=Q.css`
|
|
441
438
|
display: flex;
|
|
442
439
|
align-items: center;
|
|
443
440
|
gap: var(--spacing-sm);
|
|
444
441
|
flex-grow: 1;
|
|
445
442
|
|
|
446
|
-
${(0,
|
|
443
|
+
${(0,Wt.mq)("lg")} {
|
|
447
444
|
width: 50%;
|
|
448
445
|
margin-bottom: 0;
|
|
449
446
|
}
|
|
450
|
-
`,
|
|
447
|
+
`,He=Q.css`
|
|
451
448
|
background-color: var(--gray-200);
|
|
452
449
|
width: 3.5rem;
|
|
453
450
|
height: 3.5rem;
|
|
454
451
|
object-fit: cover;
|
|
455
|
-
`,
|
|
452
|
+
`,Fe=Q.css`
|
|
456
453
|
align-items: center;
|
|
457
454
|
background: var(--white);
|
|
458
455
|
border-radius: var(--rounded-base);
|
|
@@ -469,21 +466,21 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
469
466
|
}
|
|
470
467
|
`,$e=Q.css`
|
|
471
468
|
font-size: var(--fs-sm);
|
|
472
|
-
`,
|
|
469
|
+
`,qt=Q.css`
|
|
473
470
|
display: block;
|
|
474
471
|
width: 1rem;
|
|
475
472
|
height: 1rem;
|
|
476
|
-
`,
|
|
473
|
+
`,Yt=Q.css`
|
|
477
474
|
display: flex;
|
|
478
475
|
flex-direction: column;
|
|
479
476
|
gap: var(--spacing-sm);
|
|
480
477
|
|
|
481
|
-
${(0,
|
|
478
|
+
${(0,Wt.mq)("md")} {
|
|
482
479
|
flex-direction: row;
|
|
483
480
|
min-width: 200px;
|
|
484
481
|
justify-content: end;
|
|
485
482
|
}
|
|
486
|
-
`;var ie=require("@emotion/react"),
|
|
483
|
+
`;var ie=require("@emotion/react"),Ke=require("@uniformdev/design-system"),Yr=require("react-icons/cg");function Jt({selectedItem:t,onDeselect:n}){var l;let{categories:o,logoIcon:r}=he(),[a]=t.categories||[{id:"",name:""}],i=typeof a=="undefined"||!o||(l=o.find(f=>f.id===a.id))==null?void 0:l.name;return(0,e.jsx)("div",{css:[_t],key:t.id},(0,e.jsx)("article",{css:[Zt]},(0,e.jsx)("div",{css:[Xt]},t.thumbnailUrl?(0,e.jsx)("img",{src:t.thumbnailUrl,alt:i,css:[He],loading:"lazy"}):(0,e.jsx)("div",{css:[He]}),(0,e.jsx)("div",{css:ie.css`
|
|
487
484
|
> :not(:last-child) {
|
|
488
485
|
margin-bottom: var(--spacing-xs);
|
|
489
486
|
}
|
|
@@ -496,7 +493,7 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
496
493
|
`},i)),(0,e.jsx)("ul",{css:ie.css`
|
|
497
494
|
font-size: var(--fs-sm);
|
|
498
495
|
|
|
499
|
-
${(0,
|
|
496
|
+
${(0,Ke.mq)("sm")} {
|
|
500
497
|
display: flex;
|
|
501
498
|
gap: var(--spacing-base);
|
|
502
499
|
}
|
|
@@ -504,13 +501,13 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
504
501
|
margin-right: var(--spacing-xs);
|
|
505
502
|
`},"SKU:"),t.sku||t.id),t.price!==void 0?(0,e.jsx)("li",null,(0,e.jsx)("span",{css:ie.css`
|
|
506
503
|
margin-right: var(--spacing-xs);
|
|
507
|
-
`},"Price:"),(0,e.jsx)("span",null,t.price)):null))),(0,e.jsx)("div",{css:
|
|
504
|
+
`},"Price:"),(0,e.jsx)("span",null,t.price)):null))),(0,e.jsx)("div",{css:Yt},t.editLink?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:Fe},(0,e.jsx)("span",{css:$e},"Edit"),(0,e.jsx)(O,{src:r,alt:"Logo",css:qt})):null,(0,e.jsx)("button",{type:"button",onClick:()=>{n==null||n(t)},css:Fe},(0,e.jsx)("span",{css:$e},"Unlink"),(0,e.jsx)(Ke.Icon,{icon:Yr.CgClose,iconColor:"red",size:16})))))}var Jr=require("@uniformdev/design-system"),Ne=require("react-use");function Ko({selectedProducts:t,setSelectedProducts:n,onGetCategories:o,onSearchProducts:r,logoIcon:a,multiSelect:i,multiSelectId:l,selectedItemComponent:f,rowComponent:g,errorComponent:v,helpComponent:s,noResultsComponent:p,onSort:b,typeSelectorAllTypesOptionText:D="All categories",typeSelectorLabel:_="Select Category"}){var Y;let{value:P,loading:S,error:de}=(0,Ne.useAsync)(async()=>await o(),[o]),Z=P==null?void 0:P.map(k=>k.id).join(","),ne=(0,oe.useMemo)(()=>P?P.map(u=>({id:u.id,name:u.name})):void 0,[Z]),X=(0,oe.useRef)(),[q,ye]=(0,Ne.useAsyncFn)(async(k,u)=>{let M=await r({text:k,options:{limit:u==null?void 0:u.count,offset:u==null?void 0:u.offset,categoryId:u==null?void 0:u.contentType}});return(u==null?void 0:u.offset)===0&&(X.current=[]),(X.current=X.current||[]).push(...M.products),M},[r]),le=async k=>{await n(k)};return de||q.error?(0,e.jsx)(v||(({categoriesError:u,searchError:M})=>(0,e.jsx)(Jr.Callout,{type:"error"},"There was an error: ",(u==null?void 0:u.message)||(M==null?void 0:M.message))),{categoriesError:de,searchError:q.error}):(0,e.jsx)(jt.Provider,{value:{categories:P,logoIcon:a}},(0,e.jsx)(Gt,{search:ye,results:X.current,logoIcon:a,selectedItems:t,select:le,multiSelectId:l||"product-search-multi-select",multiSelect:i,contentTypes:ne,selectedItemComponent:f||Jt,rowComponent:g||Qt,totalResults:(Y=q.value)==null?void 0:Y.total,resultsLoading:q.loading||S,helpComponent:s,noResultsComponent:p,onSort:b,typeSelectorAllTypesOptionText:D,typeSelectorLabel:_}))}var jt=oe.default.createContext(void 0),he=()=>{let t=(0,oe.useContext)(jt);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};var x=require("@emotion/react"),jr=require("@uniformdev/design-system"),er=x.css`
|
|
508
505
|
border: 1px solid var(--gray-200);
|
|
509
506
|
background: var(--gray-50);
|
|
510
507
|
border-radius: var(--rounded-base);
|
|
511
508
|
display: flex;
|
|
512
509
|
width: 100%;
|
|
513
|
-
`,
|
|
510
|
+
`,tr=x.css`
|
|
514
511
|
align-items: center;
|
|
515
512
|
display: flex;
|
|
516
513
|
flex-grow: 1;
|
|
@@ -518,22 +515,23 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
518
515
|
margin-inline: 0 var(--spacing-sm);
|
|
519
516
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
520
517
|
position: relative;
|
|
521
|
-
`,tr=x.css`
|
|
522
|
-
flex-grow: 1;
|
|
523
518
|
`,rr=x.css`
|
|
519
|
+
flex-grow: 1;
|
|
520
|
+
`,or=x.css`
|
|
524
521
|
align-items: center;
|
|
525
522
|
display: flex;
|
|
526
523
|
position: relative;
|
|
527
|
-
`,
|
|
524
|
+
`,nr=x.css`
|
|
528
525
|
color: var(--brand-secondary-1);
|
|
529
526
|
font-size: var(--fs-base);
|
|
530
527
|
font-weight: var(--fw-bold);
|
|
531
528
|
line-height: 1;
|
|
532
529
|
margin: 0;
|
|
533
|
-
|
|
530
|
+
word-break: break-word;
|
|
531
|
+
`,ar=x.css`
|
|
534
532
|
width: 1.5rem;
|
|
535
533
|
height: 1.5rem;
|
|
536
|
-
`,
|
|
534
|
+
`,ir=x.css`
|
|
537
535
|
background: var(--white);
|
|
538
536
|
border-radius: var(--rounded-base);
|
|
539
537
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -544,20 +542,20 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
544
542
|
width: max-content;
|
|
545
543
|
`,se=x.css`
|
|
546
544
|
font-size: var(--fs-sm);
|
|
547
|
-
`,
|
|
545
|
+
`,be=x.css`
|
|
548
546
|
font-weight: var(--fw-bold);
|
|
549
547
|
margin-right: var(--spacing-sm);
|
|
550
|
-
`,
|
|
548
|
+
`,sr=x.css`
|
|
551
549
|
display: flex;
|
|
552
550
|
flex-direction: column;
|
|
553
551
|
gap: var(--spacing-sm);
|
|
554
552
|
|
|
555
|
-
${(0,
|
|
553
|
+
${(0,jr.mq)("md")} {
|
|
556
554
|
flex-direction: row;
|
|
557
555
|
justify-content: end;
|
|
558
556
|
min-width: 200px;
|
|
559
557
|
}
|
|
560
|
-
`,
|
|
558
|
+
`,Qe=x.css`
|
|
561
559
|
align-items: center;
|
|
562
560
|
background: var(--white);
|
|
563
561
|
border-radius: var(--rounded-base);
|
|
@@ -572,30 +570,30 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
572
570
|
&:hover {
|
|
573
571
|
background: var(--gray-50);
|
|
574
572
|
}
|
|
575
|
-
`,
|
|
573
|
+
`,cr=x.css`
|
|
576
574
|
display: flex;
|
|
577
575
|
margin-top: var(--spacing-sm);
|
|
578
576
|
gap: var(--spacing-sm);
|
|
579
|
-
`,
|
|
577
|
+
`,dr=x.css`
|
|
580
578
|
background: none;
|
|
581
579
|
outline: none;
|
|
582
580
|
border: none;
|
|
583
581
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
584
|
-
`,
|
|
582
|
+
`,We=x.css`
|
|
585
583
|
display: block;
|
|
586
584
|
max-width: 100%;
|
|
587
585
|
min-width: 100px;
|
|
588
586
|
height: auto;
|
|
589
|
-
`;var W=j(require("react"));var
|
|
587
|
+
`;var W=j(require("react"));var _e=require("react-icons/cg"),eo=require("timeago.js");var ce=require("@emotion/react");var lr=require("@uniformdev/design-system");function No({selectedItem:t,onDeselect:n,onEditClosed:o,logoIcon:r,itemDetailsRendererComponent:a}){let i=(0,W.useRef)(null),l=(0,W.useRef)(null),[f,g]=(0,W.useState)(!1);(0,W.useEffect)(()=>{let p=D=>{i.current&&!i.current.contains(D.target)&&l.current&&!l.current.contains(D.target)&&g(!1)},b=()=>{g(!1)};return window.addEventListener("resize",b,!0),document.addEventListener("scroll",p,!0),document.addEventListener("mousedown",p),()=>{window.removeEventListener("resize",b,!0),document.removeEventListener("scroll",p,!0),document.removeEventListener("mousedown",p)}},[l]);let v=()=>{var p;if(g(!f),l.current&&i.current){let b=(p=i==null?void 0:i.current)==null?void 0:p.getBoundingClientRect();l.current.style.top=`${b.top+30}px`}},s=a!=null?a:Qo;return(0,e.jsx)("div",{css:[er,ce.css`
|
|
590
588
|
margin: 0 0 1rem 0;
|
|
591
|
-
`],key:t.id},(0,e.jsx)("div",{css:
|
|
589
|
+
`],key:t.id},(0,e.jsx)("div",{css:tr},(0,e.jsx)("div",{css:rr},(0,e.jsx)("div",{css:or},(0,e.jsx)("h4",{css:[nr],title:`ID: ${t.id}`,"data-test-id":"dam-selected-item"},t.title||t.id||""),t.popoverData?(0,e.jsx)(W.default.Fragment,null,(0,e.jsx)("button",{type:"button",ref:i,css:dr,"aria-controls":"path-details","aria-expanded":f,onClick:v},(0,e.jsx)(lr.Icon,{icon:_e.CgInfo,iconColor:"gray",size:24,css:ce.css`
|
|
592
590
|
opacity: var(--opacity-75);
|
|
593
|
-
`})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!f,ref:l,css:[
|
|
591
|
+
`})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!f,ref:l,css:[ir,f?ce.css`
|
|
594
592
|
visibility: visible;
|
|
595
593
|
`:ce.css`
|
|
596
594
|
visibility: hidden;
|
|
597
|
-
`]},Object.entries(t.popoverData).map(([p,b],D)=>(0,e.jsx)("div",{css:se,key:D},(0,e.jsx)("span",{css:
|
|
595
|
+
`]},Object.entries(t.popoverData).map(([p,b],D)=>(0,e.jsx)("div",{css:se,key:D},(0,e.jsx)("span",{css:be},p,":"),b)))):null),(0,e.jsx)(s,{item:t})),(0,e.jsx)("div",{css:sr},t.editLink?typeof t.editLink=="string"?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:p=>{o&&(De(p.currentTarget.href,()=>o(t)),p.preventDefault())},css:Qe},(0,e.jsx)("span",{css:se},"Edit"),r?(0,e.jsx)(O,{src:r,css:ar,alt:"Logo"}):null):t.editLink:null,(0,e.jsx)("button",{type:"button",onClick:()=>{n(t)},css:Qe},(0,e.jsx)("span",{css:se},"Unlink"),(0,e.jsx)(lr.Icon,{icon:_e.CgClose,iconColor:"red",size:16})))))}function Qo({item:t}){let n=null;return t.previewUrl&&typeof t.previewUrl=="string"?t.type==="image"?n=(0,e.jsx)("img",{src:t.previewUrl,alt:t.id,width:"200",css:We}):t.type==="video"&&(n=(0,e.jsx)("video",{src:t.previewUrl,title:t.id,width:"200",controls:!0,css:We})):t.previewUrl&&typeof t.previewUrl!="string"&&(n=t.previewUrl),n||t.metadata?(0,e.jsx)("div",{css:cr},n?(0,e.jsx)("div",null,n):null,(0,e.jsx)("ul",null,t.metadata?Object.entries(t.metadata).map(([o,r])=>(0,e.jsx)("li",{css:[se,ce.css`
|
|
598
596
|
order: 1;
|
|
599
|
-
`],key:o},(0,e.jsx)("span",{css:[
|
|
597
|
+
`],key:o},(0,e.jsx)("span",{css:[be,ce.css`
|
|
600
598
|
order: 1;
|
|
601
|
-
`]},o,":"),r)):null,t.createdDate?(0,e.jsx)("li",{css:se},(0,e.jsx)("span",{css:
|
|
599
|
+
`]},o,":"),r)):null,t.createdDate?(0,e.jsx)("li",{css:se},(0,e.jsx)("span",{css:be},"Date:"),(0,eo.format)(t.createdDate)):null)):null}B(A,require("@uniformdev/mesh-sdk"),module.exports);var m=require("@uniformdev/design-system");0&&(module.exports={AddListButton,Button,Callout,DamSelectedItem,DefaultSearchRow,DefaultSelectedItem,EntrySearch,Heading,Icons,Input,InputSelect,InputToggle,KeywordSearchInput,Label,LoadingIndicator,LoadingOverlay,Menu,MenuItem,ProductPreviewList,ProductQuery,ProductQueryContext,ProductSearch,ProductSearchContext,ProductSearchRow,ProductSelectedItem,ResolvableLoadingValue,ScrollableList,ScrollableListItem,SelectionField,Switch,Textarea,Theme,UniformMeshLocationContext,UniformMeshLocationContextProvider,UniformMeshSdkContext,UniformMeshSdkContextProvider,badgeIcon,damSelectItemImage,damSelectedItemContainer,damSelectedItemCopy,damSelectedItemDetails,damSelectedItemIcon,damSelectedItemInfoBtn,damSelectedItemInner,damSelectedItemLinkBtn,damSelectedItemLinkContainer,damSelectedItemMediaContainer,damSelectedItemPopover,damSelectedItemPopoverLabel,damSelectedItemSmallText,damSelectedItemTitle,draggableContainer,draggableIcon,draggableIconOffset,draggableIconWrapper,entrySearchBtn,entrySearchConfig,entrySearchConfigHidden,entrySearchLoadMoreBtn,entrySearchResultList,entrySearchSelectIcon,entrySearchSelectImg,entrySearchSelectInput,entrySearchSelectOption,entrySearchWrapper,productSearchRowActiveIcon,productSearchRowCategory,productSearchRowContainer,productSearchRowContent,productSearchRowContentActive,productSearchRowDetails,productSearchRowTitle,productSelectedItemContainer,productSelectedItemContent,productSelectedItemDetails,productSelectedItemIcon,productSelectedItemImage,productSelectedItemLinkContainer,productedSelectedItemLinkBtn,productedSelectedItemSmallText,searchRowBtn,searchRowContainer,searchRowContainerActive,searchRowContainerWithPopover,searchRowPopover,searchRowText,searchRowTextSmall,selectItemLinkBtn,selectItemLinkContainer,selectItemPopover,selectItemPopoverLabel,selectItemSmallText,selectedItemContainer,selectedItemCopy,selectedItemDetails,selectedItemIcon,selectedItemInner,selectedItemTitle,useInitializeUniformMeshSdk,useProductQueryContext,useProductSearchContext,useUniformMeshLocation,useUniformMeshLocationContext,useUniformMeshSdk,useUniformMeshSdkContext});
|