@uniformdev/mesh-sdk-react 16.1.1-alpha.319 → 16.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +126 -130
- package/dist/index.js +125 -129
- package/dist/index.mjs +126 -130
- 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})},S=(0,$.useMemo)(()=>({...wr,...t||{}}),[t]),[de,Z]=(0,ke.useAsyncFn)(async d=>await g(d),[g]);(0,ke.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,$.useMemo)(()=>{let d=[];return r==null||r.forEach(y=>{let z=Pr(y,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 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)(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=S.categories)==null?void 0:u[0])!=null?M:"",options:X,onChange:d=>{P({categories:d.target.value===""?[]:[d.target.value]})}}):(0,e.jsx)(
|
|
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);
|
|
@@ -57,7 +54,7 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
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%;
|
|
@@ -69,7 +66,7 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
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);
|
|
@@ -106,55 +103,55 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
106
103
|
&:hover {
|
|
107
104
|
background: var(--gray-50);
|
|
108
105
|
}
|
|
109
|
-
`,
|
|
106
|
+
`,Tr=U.css`
|
|
110
107
|
font-size: var(--fs-sm);
|
|
111
|
-
`,
|
|
108
|
+
`,Mr=U.css`
|
|
112
109
|
width: 1rem;
|
|
113
110
|
height: 1rem;
|
|
114
|
-
`,
|
|
111
|
+
`,it=U.css`
|
|
115
112
|
margin-right: var(--spacing-lg);
|
|
116
113
|
font-size: var(--fs-sm);
|
|
117
|
-
`,
|
|
114
|
+
`,Vr=U.css`
|
|
118
115
|
border: 1px solid var(--gray-200);
|
|
119
116
|
border-radius: var(--rounded-md);
|
|
120
117
|
background: var(--gray-50);
|
|
121
118
|
margin: var(--spacing-base) 0;
|
|
122
|
-
`,
|
|
119
|
+
`,Dr=U.css`
|
|
123
120
|
align-items: center;
|
|
124
121
|
display: flex;
|
|
125
122
|
flex-grow: 1;
|
|
126
123
|
gap: var(--spacing-base);
|
|
127
124
|
padding: var(--spacing-sm);
|
|
128
125
|
margin-right: var(--spacing-sm);
|
|
129
|
-
`,
|
|
126
|
+
`,zr=U.css`
|
|
130
127
|
background: var(--gray-200);
|
|
131
128
|
width: 3.5rem;
|
|
132
129
|
height: 3.5rem;
|
|
133
130
|
object-fit: cover;
|
|
134
|
-
`,
|
|
131
|
+
`,Ur=U.css`
|
|
135
132
|
background: var(--gray-100);
|
|
136
133
|
height: 3.5rem;
|
|
137
134
|
width: 3.5rem;
|
|
138
|
-
`,
|
|
135
|
+
`,Gr=U.css`
|
|
139
136
|
margin-top: 0;
|
|
140
137
|
font-weight: var(--fw-bold);
|
|
141
138
|
font-size: var(--fs-sm);
|
|
142
139
|
width: calc(100% / 3);
|
|
143
|
-
`,
|
|
140
|
+
`,Ar=U.css`
|
|
144
141
|
display: block;
|
|
145
142
|
font-weight: var(--fw-regular);
|
|
146
|
-
`;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`
|
|
147
144
|
margin-bottom: var(--spacing-base);
|
|
148
|
-
`},"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`
|
|
149
146
|
max-height: 24rem;
|
|
150
147
|
overflow-x: auto;
|
|
151
|
-
`,
|
|
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`
|
|
152
149
|
border: 1px solid var(--gray-200);
|
|
153
150
|
background: var(--gray-50);
|
|
154
151
|
border-radius: var(--rounded-base);
|
|
155
152
|
display: flex;
|
|
156
153
|
width: 100%;
|
|
157
|
-
`,
|
|
154
|
+
`,dt=V.css`
|
|
158
155
|
align-items: center;
|
|
159
156
|
display: flex;
|
|
160
157
|
flex-grow: 1;
|
|
@@ -162,22 +159,22 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
162
159
|
margin-inline: 0 var(--spacing-sm);
|
|
163
160
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
164
161
|
position: relative;
|
|
165
|
-
`,dt=V.css`
|
|
166
|
-
flex-grow: 1;
|
|
167
162
|
`,lt=V.css`
|
|
163
|
+
flex-grow: 1;
|
|
164
|
+
`,pt=V.css`
|
|
168
165
|
align-items: start;
|
|
169
166
|
display: inline-flex;
|
|
170
167
|
position: relative;
|
|
171
|
-
`,
|
|
168
|
+
`,mt=V.css`
|
|
172
169
|
color: var(--brand-secondary-1);
|
|
173
170
|
font-size: var(--fs-base);
|
|
174
171
|
font-weight: var(--fw-bold);
|
|
175
172
|
line-height: 1;
|
|
176
173
|
margin: 0;
|
|
177
|
-
`,
|
|
174
|
+
`,ut=V.css`
|
|
178
175
|
width: 1.5rem;
|
|
179
176
|
height: 1.5rem;
|
|
180
|
-
`,
|
|
177
|
+
`,gt=V.css`
|
|
181
178
|
background: var(--white);
|
|
182
179
|
border-radius: var(--rounded-base);
|
|
183
180
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -188,20 +185,20 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
188
185
|
width: max-content;
|
|
189
186
|
`,ee=V.css`
|
|
190
187
|
font-size: var(--fs-sm);
|
|
191
|
-
`,
|
|
188
|
+
`,me=V.css`
|
|
192
189
|
font-weight: var(--fw-bold);
|
|
193
190
|
margin-right: var(--spacing-sm);
|
|
194
|
-
`,
|
|
191
|
+
`,ft=V.css`
|
|
195
192
|
display: flex;
|
|
196
193
|
flex-direction: column;
|
|
197
194
|
gap: var(--spacing-sm);
|
|
198
195
|
|
|
199
|
-
${(0
|
|
196
|
+
${(0,Wr.mq)("md")} {
|
|
200
197
|
flex-direction: row;
|
|
201
198
|
min-width: 200px;
|
|
202
199
|
justify-content: end;
|
|
203
200
|
}
|
|
204
|
-
`,
|
|
201
|
+
`,ze=V.css`
|
|
205
202
|
align-items: center;
|
|
206
203
|
background: var(--white);
|
|
207
204
|
border-radius: var(--rounded-base);
|
|
@@ -216,39 +213,39 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
216
213
|
&:hover {
|
|
217
214
|
background: var(--gray-50);
|
|
218
215
|
}
|
|
219
|
-
`;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`
|
|
220
217
|
margin-bottom: var(--spacing-sm);
|
|
221
|
-
`:""],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`
|
|
222
219
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
223
|
-
`,"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`
|
|
224
221
|
opacity: var(--opacity-75);
|
|
225
|
-
`})),(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`
|
|
226
223
|
visibility: visible;
|
|
227
|
-
|
|
224
|
+
`:$.css`
|
|
228
225
|
visibility: hidden;
|
|
229
|
-
`]},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`
|
|
230
227
|
order: 1;
|
|
231
|
-
`],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`
|
|
232
229
|
order: 1;
|
|
233
|
-
`],key:s},(0,e.jsx)("span",{css:[
|
|
230
|
+
`],key:s},(0,e.jsx)("span",{css:[me,$.css`
|
|
234
231
|
order: 1;
|
|
235
|
-
`]},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`
|
|
236
233
|
cursor: pointer;
|
|
237
234
|
padding: var(--spacing-sm);
|
|
238
235
|
position: relative;
|
|
239
236
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
240
237
|
color var(--duration-fast) var(--timing-ease-out);
|
|
241
|
-
`,bt=te.css`
|
|
242
|
-
padding-right: var(--spacing-lg);
|
|
243
238
|
`,yt=te.css`
|
|
239
|
+
padding-right: var(--spacing-lg);
|
|
240
|
+
`,St=te.css`
|
|
244
241
|
background: var(--brand-secondary-3);
|
|
245
242
|
color: var(--white);
|
|
246
|
-
`,Ue=te.css`
|
|
247
|
-
font-size: var(--fs-xs);
|
|
248
243
|
`,Ge=te.css`
|
|
244
|
+
font-size: var(--fs-xs);
|
|
245
|
+
`,Ae=te.css`
|
|
249
246
|
font-weight: var(--fw-bold);
|
|
250
247
|
margin-right: var(--spacing-sm);
|
|
251
|
-
`,
|
|
248
|
+
`,wt=te.css`
|
|
252
249
|
background: var(--white);
|
|
253
250
|
border-left: 4px solid var(--brand-secondary-3);
|
|
254
251
|
border-radius: var(--rounded-base);
|
|
@@ -260,20 +257,20 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
260
257
|
right: var(--spacing-xl);
|
|
261
258
|
z-index: var(--z-10);
|
|
262
259
|
width: max-content;
|
|
263
|
-
`,
|
|
260
|
+
`,Ct=te.css`
|
|
264
261
|
position: absolute;
|
|
265
262
|
inset: 0 var(--spacing-sm) 0 auto;
|
|
266
|
-
`;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`
|
|
267
264
|
visibility: visible;
|
|
268
|
-
`:
|
|
265
|
+
`:Pt.css`
|
|
269
266
|
visibility: hidden;
|
|
270
|
-
`]},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`
|
|
271
268
|
background: var(--white);
|
|
272
269
|
border: 1px solid var(--gray-300);
|
|
273
270
|
border-radius: var(--rounded-base);
|
|
274
271
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
|
|
275
272
|
margin-bottom: var(--spacing-base);
|
|
276
|
-
`,
|
|
273
|
+
`,xt=L.css`
|
|
277
274
|
align-items: center;
|
|
278
275
|
display: flex;
|
|
279
276
|
position: relative;
|
|
@@ -281,7 +278,7 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
281
278
|
width: 100%;
|
|
282
279
|
background-color: transparent;
|
|
283
280
|
border: 0;
|
|
284
|
-
`,
|
|
281
|
+
`,kt=L.css`
|
|
285
282
|
color: var(--brand-secondary-1);
|
|
286
283
|
display: block;
|
|
287
284
|
font-weight: var(--fw-bold);
|
|
@@ -297,15 +294,15 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
297
294
|
background: var(--gray-100);
|
|
298
295
|
outline: none;
|
|
299
296
|
}
|
|
300
|
-
`,
|
|
297
|
+
`,It=L.css`
|
|
301
298
|
background: var(--white);
|
|
302
299
|
border: 1px solid var(--gray-300);
|
|
303
300
|
border-radius: var(--rounded-base);
|
|
304
301
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
|
|
305
302
|
display: block;
|
|
306
|
-
`,It=L.css`
|
|
307
|
-
display: none;
|
|
308
303
|
`,Et=L.css`
|
|
304
|
+
display: none;
|
|
305
|
+
`,Tt=L.css`
|
|
309
306
|
overflow-y: auto;
|
|
310
307
|
height: 16rem;
|
|
311
308
|
margin-bottom: var(--spacing-base);
|
|
@@ -314,94 +311,94 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
314
311
|
& > :not(:last-child) {
|
|
315
312
|
border-bottom: 1px solid var(--gray-200);
|
|
316
313
|
}
|
|
317
|
-
`,
|
|
314
|
+
`,Ho=L.css`
|
|
318
315
|
background-color: var(--gray-50);
|
|
319
316
|
max-width: 33.33%;
|
|
320
|
-
`,
|
|
317
|
+
`,Mt=L.css`
|
|
321
318
|
align-items: center;
|
|
322
319
|
display: flex;
|
|
323
320
|
position: absolute;
|
|
324
321
|
inset: 0 0 0 auto;
|
|
325
322
|
pointer-events: none;
|
|
326
323
|
padding-right: var(--spacing-sm);
|
|
327
|
-
`,
|
|
324
|
+
`,Vt=L.css`
|
|
328
325
|
color: var(--brand-secondary-1);
|
|
329
326
|
width: 1.25rem;
|
|
330
327
|
height: 1.25rem;
|
|
331
328
|
transition: transform var(--duration-fast) var(--timing-ease-out);
|
|
332
329
|
transform: rotate(0);
|
|
333
|
-
`,
|
|
330
|
+
`,Fo=L.css`
|
|
334
331
|
background: var(--white);
|
|
335
332
|
color: var(--brand-secondary-1);
|
|
336
|
-
`,
|
|
333
|
+
`,Dt=L.css`
|
|
337
334
|
position: relative;
|
|
338
335
|
margin-block: var(--spacing-sm) 0;
|
|
339
336
|
|
|
340
337
|
&:hover > span {
|
|
341
338
|
opacity: 0.3;
|
|
342
339
|
}
|
|
343
|
-
`,
|
|
340
|
+
`,zt=L.css`
|
|
344
341
|
align-items: center;
|
|
345
342
|
display: flex;
|
|
346
343
|
position: absolute;
|
|
347
344
|
inset: 0 auto 0 0;
|
|
348
345
|
margin-block: auto;
|
|
349
346
|
opacity: 0;
|
|
350
|
-
`,
|
|
347
|
+
`,Be=L.css`
|
|
351
348
|
color: var(--brand-secondary-1);
|
|
352
|
-
`,
|
|
349
|
+
`,Ut=L.css`
|
|
353
350
|
position: absolute;
|
|
354
351
|
left: 0.375rem;
|
|
355
|
-
`,
|
|
352
|
+
`,Oe=L.css`
|
|
356
353
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
357
354
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
358
|
-
`;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`
|
|
359
356
|
width: 100%;
|
|
360
357
|
`},(0,e.jsx)("div",{css:G.css`
|
|
361
358
|
position: relative;
|
|
362
359
|
margin-block: var(--spacing-base);
|
|
363
|
-
`},
|
|
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`
|
|
364
361
|
margin-left: var(--spacing-base);
|
|
365
|
-
`},"Select"),(0,e.jsx)("span",{css:
|
|
362
|
+
`},"Select"),(0,e.jsx)("span",{css:Mt},(0,e.jsx)(Te,{css:[Vt,H?G.css`
|
|
366
363
|
transform: rotate(180deg);
|
|
367
|
-
`: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`
|
|
368
365
|
display: flex;
|
|
369
366
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
370
367
|
margin-bottom: var(--spacing-base);
|
|
371
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`
|
|
372
369
|
flex-grow: 1;
|
|
373
|
-
`},(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`
|
|
374
371
|
display: flex;
|
|
375
372
|
justify-content: space-between;
|
|
376
|
-
`},(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`
|
|
377
374
|
background: var(--white);
|
|
378
375
|
color: var(--brand-secondary-1);
|
|
379
376
|
`,onClick:()=>D(c)},c.name))):null),(0,e.jsx)("div",{css:G.css`
|
|
380
377
|
display: flex;
|
|
381
378
|
gap: var(--spacing-base);
|
|
382
|
-
`},(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`
|
|
383
380
|
margin-block: var(--spacing-sm) 0;
|
|
384
|
-
`},y==null?void 0:y.map((h,J)=>{if(h!=null&&h.id)return(0,e.jsx)(
|
|
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`
|
|
385
382
|
cursor: pointer;
|
|
386
383
|
padding: var(--spacing-sm) 0;
|
|
387
384
|
margin-right: var(--spacing-sm);
|
|
388
385
|
position: relative;
|
|
389
386
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
390
387
|
color var(--duration-fast) var(--timing-ease-out);
|
|
391
|
-
`,
|
|
388
|
+
`,Bt=re.css`
|
|
392
389
|
border: 2px solid transparent;
|
|
393
390
|
border-radius: var(--rounded-base);
|
|
394
391
|
display: flex;
|
|
395
392
|
align-items: center;
|
|
396
393
|
gap: var(--spacing-base);
|
|
397
394
|
padding: var(--spacing-sm) var(--spacing-xs);
|
|
398
|
-
`,Bt=re.css`
|
|
399
|
-
background-color: var(--green-50);
|
|
400
395
|
`,Ot=re.css`
|
|
396
|
+
background-color: var(--green-50);
|
|
397
|
+
`,Ht=re.css`
|
|
401
398
|
font-size: var(--fs-sm);
|
|
402
399
|
font-weight: var(--fw-bold);
|
|
403
400
|
width: 50%;
|
|
404
|
-
`,
|
|
401
|
+
`,Ft=re.css`
|
|
405
402
|
font-weight: var(--fw-normal);
|
|
406
403
|
display: block;
|
|
407
404
|
`,$t=re.css`
|
|
@@ -409,28 +406,27 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
409
406
|
> * {
|
|
410
407
|
display: block;
|
|
411
408
|
}
|
|
412
|
-
`,
|
|
409
|
+
`,Kt=re.css`
|
|
413
410
|
display: block;
|
|
414
411
|
height: 1.5rem;
|
|
415
412
|
width: 1.5rem;
|
|
416
413
|
color: var(--brand-secondary-3);
|
|
417
414
|
margin-left: auto;
|
|
418
|
-
`;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`
|
|
419
416
|
background-color: var(--gray-200);
|
|
420
417
|
width: 3rem;
|
|
421
418
|
height: 3rem;
|
|
422
419
|
object-fit: cover;
|
|
423
|
-
`}):(0,e.jsx)(O,{src:a,alt:"Logo",css:
|
|
420
|
+
`}):(0,e.jsx)(O,{src:a,alt:"Logo",css:Nt.css`
|
|
424
421
|
height: 2.25rem;
|
|
425
422
|
width: 2.25rem;
|
|
426
|
-
`}),(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`
|
|
427
424
|
border: 1px solid var(--gray-200);
|
|
428
425
|
border-radius: var(--rounded-base);
|
|
429
426
|
background: var(--gray-50);
|
|
430
427
|
display: flex;
|
|
431
428
|
width: 100%;
|
|
432
|
-
|
|
433
|
-
`,_t=Q.css`
|
|
429
|
+
`,Zt=Q.css`
|
|
434
430
|
align-items: center;
|
|
435
431
|
display: flex;
|
|
436
432
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
@@ -438,22 +434,22 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
438
434
|
flex-grow: 1;
|
|
439
435
|
gap: var(--spacing-sm);
|
|
440
436
|
margin-inline: 0 var(--spacing-sm);
|
|
441
|
-
`,
|
|
437
|
+
`,Xt=Q.css`
|
|
442
438
|
display: flex;
|
|
443
439
|
align-items: center;
|
|
444
440
|
gap: var(--spacing-sm);
|
|
445
441
|
flex-grow: 1;
|
|
446
442
|
|
|
447
|
-
${(0,
|
|
443
|
+
${(0,Wt.mq)("lg")} {
|
|
448
444
|
width: 50%;
|
|
449
445
|
margin-bottom: 0;
|
|
450
446
|
}
|
|
451
|
-
`,
|
|
447
|
+
`,He=Q.css`
|
|
452
448
|
background-color: var(--gray-200);
|
|
453
449
|
width: 3.5rem;
|
|
454
450
|
height: 3.5rem;
|
|
455
451
|
object-fit: cover;
|
|
456
|
-
`,
|
|
452
|
+
`,Fe=Q.css`
|
|
457
453
|
align-items: center;
|
|
458
454
|
background: var(--white);
|
|
459
455
|
border-radius: var(--rounded-base);
|
|
@@ -470,21 +466,21 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
470
466
|
}
|
|
471
467
|
`,$e=Q.css`
|
|
472
468
|
font-size: var(--fs-sm);
|
|
473
|
-
`,
|
|
469
|
+
`,qt=Q.css`
|
|
474
470
|
display: block;
|
|
475
471
|
width: 1rem;
|
|
476
472
|
height: 1rem;
|
|
477
|
-
`,
|
|
473
|
+
`,Yt=Q.css`
|
|
478
474
|
display: flex;
|
|
479
475
|
flex-direction: column;
|
|
480
476
|
gap: var(--spacing-sm);
|
|
481
477
|
|
|
482
|
-
${(0,
|
|
478
|
+
${(0,Wt.mq)("md")} {
|
|
483
479
|
flex-direction: row;
|
|
484
480
|
min-width: 200px;
|
|
485
481
|
justify-content: end;
|
|
486
482
|
}
|
|
487
|
-
`;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`
|
|
488
484
|
> :not(:last-child) {
|
|
489
485
|
margin-bottom: var(--spacing-xs);
|
|
490
486
|
}
|
|
@@ -497,7 +493,7 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
497
493
|
`},i)),(0,e.jsx)("ul",{css:ie.css`
|
|
498
494
|
font-size: var(--fs-sm);
|
|
499
495
|
|
|
500
|
-
${(0,
|
|
496
|
+
${(0,Ke.mq)("sm")} {
|
|
501
497
|
display: flex;
|
|
502
498
|
gap: var(--spacing-base);
|
|
503
499
|
}
|
|
@@ -505,13 +501,13 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
505
501
|
margin-right: var(--spacing-xs);
|
|
506
502
|
`},"SKU:"),t.sku||t.id),t.price!==void 0?(0,e.jsx)("li",null,(0,e.jsx)("span",{css:ie.css`
|
|
507
503
|
margin-right: var(--spacing-xs);
|
|
508
|
-
`},"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`
|
|
509
505
|
border: 1px solid var(--gray-200);
|
|
510
506
|
background: var(--gray-50);
|
|
511
507
|
border-radius: var(--rounded-base);
|
|
512
508
|
display: flex;
|
|
513
509
|
width: 100%;
|
|
514
|
-
`,
|
|
510
|
+
`,tr=x.css`
|
|
515
511
|
align-items: center;
|
|
516
512
|
display: flex;
|
|
517
513
|
flex-grow: 1;
|
|
@@ -519,23 +515,23 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
519
515
|
margin-inline: 0 var(--spacing-sm);
|
|
520
516
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
521
517
|
position: relative;
|
|
522
|
-
`,tr=x.css`
|
|
523
|
-
flex-grow: 1;
|
|
524
518
|
`,rr=x.css`
|
|
519
|
+
flex-grow: 1;
|
|
520
|
+
`,or=x.css`
|
|
525
521
|
align-items: center;
|
|
526
522
|
display: flex;
|
|
527
523
|
position: relative;
|
|
528
|
-
`,
|
|
524
|
+
`,nr=x.css`
|
|
529
525
|
color: var(--brand-secondary-1);
|
|
530
526
|
font-size: var(--fs-base);
|
|
531
527
|
font-weight: var(--fw-bold);
|
|
532
528
|
line-height: 1;
|
|
533
529
|
margin: 0;
|
|
534
530
|
word-break: break-word;
|
|
535
|
-
`,
|
|
531
|
+
`,ar=x.css`
|
|
536
532
|
width: 1.5rem;
|
|
537
533
|
height: 1.5rem;
|
|
538
|
-
`,
|
|
534
|
+
`,ir=x.css`
|
|
539
535
|
background: var(--white);
|
|
540
536
|
border-radius: var(--rounded-base);
|
|
541
537
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -546,20 +542,20 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
546
542
|
width: max-content;
|
|
547
543
|
`,se=x.css`
|
|
548
544
|
font-size: var(--fs-sm);
|
|
549
|
-
`,
|
|
545
|
+
`,be=x.css`
|
|
550
546
|
font-weight: var(--fw-bold);
|
|
551
547
|
margin-right: var(--spacing-sm);
|
|
552
|
-
`,
|
|
548
|
+
`,sr=x.css`
|
|
553
549
|
display: flex;
|
|
554
550
|
flex-direction: column;
|
|
555
551
|
gap: var(--spacing-sm);
|
|
556
552
|
|
|
557
|
-
${(0,
|
|
553
|
+
${(0,jr.mq)("md")} {
|
|
558
554
|
flex-direction: row;
|
|
559
555
|
justify-content: end;
|
|
560
556
|
min-width: 200px;
|
|
561
557
|
}
|
|
562
|
-
`,
|
|
558
|
+
`,Qe=x.css`
|
|
563
559
|
align-items: center;
|
|
564
560
|
background: var(--white);
|
|
565
561
|
border-radius: var(--rounded-base);
|
|
@@ -574,30 +570,30 @@ var po=Object.create;var Pe=Object.defineProperty;var mo=Object.getOwnPropertyDe
|
|
|
574
570
|
&:hover {
|
|
575
571
|
background: var(--gray-50);
|
|
576
572
|
}
|
|
577
|
-
`,
|
|
573
|
+
`,cr=x.css`
|
|
578
574
|
display: flex;
|
|
579
575
|
margin-top: var(--spacing-sm);
|
|
580
576
|
gap: var(--spacing-sm);
|
|
581
|
-
`,
|
|
577
|
+
`,dr=x.css`
|
|
582
578
|
background: none;
|
|
583
579
|
outline: none;
|
|
584
580
|
border: none;
|
|
585
581
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
586
|
-
`,
|
|
582
|
+
`,We=x.css`
|
|
587
583
|
display: block;
|
|
588
584
|
max-width: 100%;
|
|
589
585
|
min-width: 100px;
|
|
590
586
|
height: auto;
|
|
591
|
-
`;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`
|
|
592
588
|
margin: 0 0 1rem 0;
|
|
593
|
-
`],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`
|
|
594
590
|
opacity: var(--opacity-75);
|
|
595
|
-
`})),(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`
|
|
596
592
|
visibility: visible;
|
|
597
593
|
`:ce.css`
|
|
598
594
|
visibility: hidden;
|
|
599
|
-
`]},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`
|
|
600
596
|
order: 1;
|
|
601
|
-
`],key:o},(0,e.jsx)("span",{css:[
|
|
597
|
+
`],key:o},(0,e.jsx)("span",{css:[be,ce.css`
|
|
602
598
|
order: 1;
|
|
603
|
-
`]},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});
|