@uniformdev/mesh-sdk-react 16.1.0 → 16.1.1-alpha.139
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.d.ts +2 -1
- package/dist/index.esm.js +139 -142
- package/dist/index.js +138 -141
- package/dist/index.mjs +139 -142
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
1
|
+
var kr=Object.create;var Se=Object.defineProperty;var xr=Object.getOwnPropertyDescriptor;var Er=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,Vr=Object.prototype.hasOwnProperty;var Qt=(t,n)=>{for(var o in n)Se(t,o,{get:n[o],enumerable:!0})},be=(t,n,o,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of Er(n))!Vr.call(t,a)&&a!==o&&Se(t,a,{get:()=>n[a],enumerable:!(r=xr(n,a))||r.enumerable});return t},A=(t,n,o)=>(be(t,n,"default"),o&&be(o,n,"default")),N=(t,n,o)=>(o=t!=null?kr(Mr(t)):{},be(n||!t||!t.__esModule?Se(o,"default",{value:t,enumerable:!0}):o,t)),Tr=t=>be(Se({},"__esModule",{value:!0}),t);var z={};Qt(z,{Button:()=>l.Button,Callout:()=>l.Callout,DefaultSearchRow:()=>lt,DefaultSelectedItem:()=>ot,EntrySearch:()=>Ct,Heading:()=>l.Heading,Icons:()=>xe,Input:()=>l.Input,InputSelect:()=>l.InputSelect,InputToggle:()=>l.InputToggle,KeywordSearchInput:()=>l.InputKeywordSearch,Label:()=>l.Label,LoadingIndicator:()=>l.LoadingIndicator,LoadingOverlay:()=>l.LoadingOverlay,Menu:()=>l.Menu,MenuItem:()=>l.MenuItem,ProductPreviewList:()=>_e,ProductQuery:()=>Or,ProductQueryContext:()=>Qe,ProductSearch:()=>jr,ProductSearchContext:()=>At,ProductSearchRow:()=>Tt,ProductSelectedItem:()=>zt,ResolvableLoadingValue:()=>Fe,ScrollableList:()=>l.ScrollableList,ScrollableListItem:()=>l.ScrollableListItem,SelectionField:()=>Ke,Switch:()=>l.Switch,Textarea:()=>l.Textarea,Theme:()=>l.Theme,UniformMeshLocationContext:()=>Ae,UniformMeshLocationContextProvider:()=>Ue,UniformMeshSdkContext:()=>Be,UniformMeshSdkContextProvider:()=>Gr,badgeIcon:()=>Ie,draggableContainer:()=>bt,draggableIcon:()=>Te,draggableIconOffset:()=>wt,draggableIconWrapper:()=>St,entrySearchBtn:()=>ut,entrySearchConfig:()=>gt,entrySearchConfigHidden:()=>ft,entrySearchLoadMoreBtn:()=>mt,entrySearchResultList:()=>vt,entrySearchSelectIcon:()=>ht,entrySearchSelectImg:()=>yt,entrySearchSelectInput:()=>Yr,entrySearchSelectOption:()=>qr,entrySearchWrapper:()=>pt,productSearchRowActiveIcon:()=>Mt,productSearchRowCategory:()=>xt,productSearchRowContainer:()=>Pt,productSearchRowContent:()=>Rt,productSearchRowContentActive:()=>Lt,productSearchRowDetails:()=>Et,productSearchRowTitle:()=>kt,productSelectedItemContainer:()=>It,productSelectedItemContent:()=>Gt,productSelectedItemDetails:()=>Dt,productSelectedItemImage:()=>De,searchRowBtn:()=>ct,searchRowContainer:()=>nt,searchRowContainerActive:()=>it,searchRowContainerWithPopover:()=>at,searchRowPopover:()=>st,searchRowText:()=>Ve,searchRowTextSmall:()=>Me,selectItemLinkBtn:()=>Ee,selectItemLinkContainer:()=>rt,selectItemPopover:()=>tt,selectItemPopoverLabel:()=>fe,selectItemSmallText:()=>W,selectedItemCloseIcon:()=>et,selectedItemContainer:()=>Ze,selectedItemCopy:()=>qe,selectedItemDetails:()=>Ye,selectedItemIcon:()=>je,selectedItemInner:()=>Xe,selectedItemTitle:()=>Je,useInitializeUniformMeshSdk:()=>Dr,useProductQueryContext:()=>Ne,useProductSearchContext:()=>ve,useUniformMeshLocation:()=>Ir,useUniformMeshLocationContext:()=>Oe,useUniformMeshSdk:()=>zr,useUniformMeshSdkContext:()=>He});module.exports=Tr(z);var e=require("@emotion/react"),V=N(require("react"));var ie=require("react"),Ae=(0,ie.createContext)(void 0),Ue=({children:t})=>{let[n,o]=(0,ie.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(s,p)=>{await a.setValue(s,p),o(window.UniformMeshSDK.getCurrentLocation())},setValidationResult:async s=>{await a.setValidationResult(s)}}}}return(0,e.jsx)(Ae.Provider,{value:r},t)},Oe=()=>{let t=(0,ie.useContext)(Ae);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function Ir(){let{location:t}=Oe();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 Nt=require("@uniformdev/mesh-sdk"),me=require("react"),Dr=({autoResizingDisabled:t}={})=>{let[n,o]=(0,me.useState)(),[r,a]=(0,me.useState)();return(0,me.useEffect)(()=>{typeof window=="undefined"||r||(typeof window.UniformMeshSDK=="undefined"?(0,Nt.initializeUniformMeshSDK)({autoResizingDisabled:t}).then(s=>{a(s)}).catch(s=>{o(s)}):a(window.UniformMeshSDK))},[t]),{initializing:!r&&!n,error:n,sdk:r}};var we=require("react");var _t=require("@uniformdev/design-system"),Be=(0,we.createContext)(void 0),Gr=({children:t})=>{let n;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(n={sdk:window.UniformMeshSDK}),(0,e.jsx)(Be.Provider,{value:n},(0,e.jsx)(_t.Theme,null),(0,e.jsx)(Ue,null,t))},He=()=>{let t=(0,we.useContext)(Be);if(!t)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return t};function zr(){let{sdk:t}=He();return t}var We=N(require("react"));var O=N(require("react"));var se=require("@emotion/react"),Wt=require("@uniformdev/design-system");var $e=N(require("react")),Fe=({value:t,text:n,loading:o})=>(0,e.jsx)($e.default.Fragment,null,!!n&&n,!n&&(0,e.jsx)($e.default.Fragment,null,o&&`${t} (Loading...)`,!o&&`${t} (Unresolvable)`));var Ke=({id:t,label:n,loading:o,selectedValues:r,values:a,onAdd:s,onRemove:p})=>{var h;let v=(h=a==null?void 0:a.filter(c=>!(r!=null&&r.includes(c.id.toString()))))!=null?h:[],u=(c,f)=>{c.preventDefault(),p(f)};return(0,e.jsx)("div",null,(0,e.jsx)(Wt.InputSelect,{id:t,name:t,label:n,onChange:c=>s(c.target.value),disabled:o,options:[{value:"",label:"Add..."},...v.map(c=>({value:c.id,label:c.name||c.id}))],value:"",css:Array.isArray(r)&&r.length>0?se.css`
|
|
2
2
|
margin-bottom: var(--spacing-base);
|
|
3
|
-
`:""}),r==null?void 0:r.map(
|
|
3
|
+
`:""}),r==null?void 0:r.map(c=>{var f;return(0,e.jsx)("div",{css:se.css`
|
|
4
4
|
font-size: var(--fs-sm);
|
|
5
5
|
display: inline-flex;
|
|
6
6
|
align-items: center;
|
|
@@ -9,67 +9,67 @@ var Pr=Object.create;var Se=Object.defineProperty;var Rr=Object.getOwnPropertyDe
|
|
|
9
9
|
border: 1px solid var(--gray-300);
|
|
10
10
|
margin-bottom: var(--spacing-sm);
|
|
11
11
|
margin-right: var(--spacing-sm);
|
|
12
|
-
`,key:
|
|
12
|
+
`,key:c},(0,e.jsx)("span",{css:se.css`
|
|
13
13
|
padding: var(--spacing-3);
|
|
14
14
|
color: var(--gray-800);
|
|
15
|
-
`},(0,e.jsx)(
|
|
15
|
+
`},(0,e.jsx)(Fe,{value:c,loading:o,text:(f=a.find(C=>C.id===c))==null?void 0:f.name})),(0,e.jsx)("button",{css:se.css`
|
|
16
16
|
padding: var(--spacing-3);
|
|
17
17
|
border-left: 1px solid var(--gray-300);
|
|
18
|
-
`,title:"remove",onClick:
|
|
18
|
+
`,title:"remove",onClick:C=>u(C,c)},(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",css:se.css`
|
|
19
19
|
height: 1.25rem;
|
|
20
20
|
width: 1.25rem;
|
|
21
21
|
pointer-events: none;
|
|
22
22
|
display: block;
|
|
23
|
-
`,viewBox:"0 0 20 20",fill:"currentColor"},(0,e.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))))}))};var
|
|
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 Ar=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"})),Ce=Ar;var Ur=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"})),Pe=Ur;var Re=require("react-use"),T=require("@uniformdev/design-system"),k=require("@emotion/react"),Zt={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Or=({value:t,setValue:n,brands:o,categories:r,loading:a,categoriesLoading:s,brandsLoading:p,logoIcon:v,onGetProducts:u,sortOptions:h,sortOrderOptions:c,categoryLabel:f="Product Category",brandLabel:C="Brand",disableBrands:re,restrictToSingleCategory:$=!1})=>{var m,P,ae;let w=async i=>{n({...Zt,...t||{},...i})},y=(0,O.useMemo)(()=>({...Zt,...t||{}}),[t]),[oe,F]=(0,Re.useAsyncFn)(async i=>await u(i),[u]);(0,Re.useDebounce)(async()=>{await F({brand:y.brand,categories:y.categories,keyword:y.keyword,sort:y.sort,sortOrder:y.sortOrder,count:y.count})},250,[y]);let q=(0,O.useMemo)(()=>{let i=[];return r==null||r.forEach(L=>{let pe=Yt(L,void 0);i.push(...pe)}),i},[r]),K=(0,O.useMemo)(()=>[{value:"",label:"All categories"},...q.map(i=>({label:i.name,value:i.id}))],[q]),J=(0,O.useMemo)(()=>(o==null?void 0:o.map(i=>({id:i.id.toString(),name:i.name})))||[],[o]),ne=i=>{if(!i)return;let L=(t==null?void 0:t.categories)||[];w({categories:[...L,i]})},j=i=>{var L;w({categories:(L=t==null?void 0:t.categories)==null?void 0:L.filter(pe=>pe!==i)})},ee=i=>{w({brand:i.target.value})},b=i=>{w({count:i||1})};return a?(0,e.jsx)("div",null,"Loading..."):(0,e.jsx)(Qe.Provider,{value:{categories:r,logoIcon:v}},(0,e.jsx)("div",{css:k.css`
|
|
24
24
|
> :not(:last-child) {
|
|
25
25
|
margin-bottom: var(--spacing-md);
|
|
26
26
|
}
|
|
27
|
-
`}
|
|
27
|
+
`},$?(0,e.jsx)(T.InputSelect,{id:"selection-field-product-category",label:f,disabled:a,value:(P=(m=y.categories)==null?void 0:m[0])!=null?P:"",options:K,onChange:i=>{w({categories:i.target.value===""?[]:[i.target.value]})}}):(0,e.jsx)(Ke,{loading:s||!1,id:"selection-field-product-category",label:f,onAdd:ne,onRemove:j,selectedValues:y.categories,values:q}),(0,e.jsx)("div",{css:k.css`
|
|
28
28
|
display: flex;
|
|
29
29
|
flex-wrap: wrap;
|
|
30
30
|
column-gap: var(--spacing-lg);
|
|
31
31
|
row-gap: var(--spacing-md);
|
|
32
|
-
${(0,
|
|
32
|
+
${(0,T.mq)("md")} {
|
|
33
33
|
flex-wrap: nowrap;
|
|
34
34
|
}
|
|
35
|
-
`},
|
|
35
|
+
`},re?null:(0,e.jsx)("div",{css:k.css`
|
|
36
36
|
width: 50%;
|
|
37
|
-
`},(0,e.jsx)(
|
|
37
|
+
`},(0,e.jsx)(T.InputSelect,{id:"brand",name:"brand",label:C,disabled:p,value:y.brand,onChange:ee,options:[{value:"",label:"Choose..."},...J.map(i=>({value:i.id,label:i.name}))]})),(0,e.jsx)("div",{css:k.css`
|
|
38
38
|
flex-grow: 1;
|
|
39
39
|
position: relative;
|
|
40
|
-
`},(0,e.jsx)(
|
|
40
|
+
`},(0,e.jsx)(T.Input,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:y.keyword,placeholder:"Enter keyword",onChange:i=>w({keyword:i.target.value})}))),(0,e.jsx)("div",{css:k.css`
|
|
41
41
|
display: flex;
|
|
42
42
|
flex-wrap: wrap;
|
|
43
43
|
column-gap: var(--spacing-lg);
|
|
44
44
|
row-gap: var(--spacing-md);
|
|
45
|
-
${(0,
|
|
45
|
+
${(0,T.mq)("md")} {
|
|
46
46
|
flex-wrap: nowrap;
|
|
47
47
|
}
|
|
48
|
-
`},(0,e.jsx)("div",{css:
|
|
48
|
+
`},(0,e.jsx)("div",{css:k.css`
|
|
49
49
|
width: 100%;
|
|
50
|
-
${(0,
|
|
50
|
+
${(0,T.mq)("md")} {
|
|
51
51
|
width: 33.333333%;
|
|
52
52
|
}
|
|
53
53
|
position: relative;
|
|
54
|
-
`},(0,e.jsx)(
|
|
54
|
+
`},(0,e.jsx)(T.Input,{id:"count",name:"count",type:"number",min:1,step:1,value:y.count,onChange:i=>b(i.target.valueAsNumber),label:"Count"}),(0,e.jsx)("div",{css:k.css`
|
|
55
55
|
position: absolute;
|
|
56
56
|
bottom: var(--spacing-sm);
|
|
57
57
|
right: var(--spacing-sm);
|
|
58
58
|
display: flex;
|
|
59
59
|
gap: var(--spacing-sm);
|
|
60
|
-
`},(0,e.jsx)(
|
|
60
|
+
`},(0,e.jsx)(Xt,{onCountChange:()=>b(y.count-1),countIcon:"decrement",disabled:y.count===1}),(0,e.jsx)(Xt,{onCountChange:()=>b(y.count+1),countIcon:"increment"}))),Array.isArray(h)&&h.length>0?(0,e.jsx)("div",{css:k.css`
|
|
61
61
|
flex-grow: 1;
|
|
62
|
-
${(0,
|
|
62
|
+
${(0,T.mq)("md")} {
|
|
63
63
|
width: 33.333333%;
|
|
64
64
|
}
|
|
65
|
-
`},(0,e.jsx)(
|
|
65
|
+
`},(0,e.jsx)(T.InputSelect,{id:"sort",name:"sort",label:"Sort",value:y.sort,onChange:i=>w({sort:i.target.value}),options:[{value:"",label:"Select a sort"},...h.map(i=>({value:i.sortKey,label:i.name}))]})):null,Array.isArray(c)&&c.length>0?(0,e.jsx)("div",{css:k.css`
|
|
66
66
|
flex-grow: 1;
|
|
67
|
-
`},(0,e.jsx)(
|
|
67
|
+
`},(0,e.jsx)(T.InputSelect,{id:"sort-order",name:"sort-order",label:"Sort Order",value:y.sortOrder,onChange:i=>w({sortOrder:i.target.value}),options:c.map(i=>({value:i.sortOrderKey,label:i.name}))})):null),(0,e.jsx)("div",null,(0,e.jsx)("h3",{css:k.css`
|
|
68
68
|
font-size: var(--fs-md);
|
|
69
69
|
line-height: var(--spacing-md);
|
|
70
70
|
font-weight: var(--fw-bold);
|
|
71
71
|
margin-bottom: var(--spacing-xs);
|
|
72
|
-
`},"Result Preview"),(0,e.jsx)(
|
|
72
|
+
`},"Result Preview"),(0,e.jsx)(_e,{products:(ae=oe.value)==null?void 0:ae.products}))))};function Yt(t,n){var s;let o=[],r=n?`${n.name} > `:"",a={id:t.id.toString(),name:`${r}${t.name}`};return o.push(a),(s=t.children)==null||s.forEach(p=>{let v=Yt(p,a);o.push(...v)}),o}function Xt({onCountChange:t,countIcon:n,disabled:o}){return(0,e.jsx)("button",{css:k.css`
|
|
73
73
|
width: 2.25rem;
|
|
74
74
|
height: 2.25rem;
|
|
75
75
|
border: 1px solid var(--gray-300);
|
|
@@ -81,82 +81,82 @@ var Pr=Object.create;var Se=Object.defineProperty;var Rr=Object.getOwnPropertyDe
|
|
|
81
81
|
&:hover {
|
|
82
82
|
background-color: var(--gray-200);
|
|
83
83
|
}
|
|
84
|
-
${o?
|
|
84
|
+
${o?k.css`
|
|
85
85
|
cursor: not-allowed;
|
|
86
86
|
opacity: 0.3;
|
|
87
87
|
`:""}
|
|
88
|
-
`,onClick:t,disabled:o},n==="increment"?(0,e.jsx)(Ce,{css:
|
|
88
|
+
`,onClick:t,disabled:o},n==="increment"?(0,e.jsx)(Ce,{css:k.css`
|
|
89
89
|
width: 1rem;
|
|
90
90
|
height: 1rem;
|
|
91
|
-
`}):(0,e.jsx)(Pe,{css:
|
|
91
|
+
`}):(0,e.jsx)(Pe,{css:k.css`
|
|
92
92
|
width: 1rem;
|
|
93
93
|
height: 1rem;
|
|
94
|
-
`}))}var
|
|
94
|
+
`}))}var Qe=O.default.createContext(void 0),Ne=()=>{let t=(0,O.useContext)(Qe);if(!t)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return t};function _({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 x=require("@emotion/react"),qt=require("@uniformdev/design-system"),_e=({products:t})=>{let{categories:n,logoIcon:o}=Ne();return(0,e.jsx)(We.default.Fragment,null,(0,e.jsx)("p",{css:x.css`
|
|
95
95
|
margin-bottom: var(--spacing-base);
|
|
96
|
-
`},"Matching ",(t==null?void 0:t.length)||0," products"),(0,e.jsx)("ul",{css:[
|
|
96
|
+
`},"Matching ",(t==null?void 0:t.length)||0," products"),(0,e.jsx)("ul",{css:[x.css`
|
|
97
97
|
max-height: 24rem;
|
|
98
98
|
overflow-x: auto;
|
|
99
|
-
`,
|
|
99
|
+
`,qt.scrollbarStyles]},t==null?void 0:t.map((r,a)=>{var v,u;let[s]=(r==null?void 0:r.categories)||[],p=typeof s=="undefined"||!n||(v=n.find(h=>h.id===s.id))==null?void 0:v.name;return(0,e.jsx)("li",{key:`product-${r.id}`,css:x.css`
|
|
100
100
|
border: 1px solid var(--gray-300);
|
|
101
101
|
border-radius: var(--rounded-md);
|
|
102
102
|
background-color: var(--gray-100);
|
|
103
103
|
margin: var(--spacing-base) 0;
|
|
104
|
-
`},(0,e.jsx)("div",{css:
|
|
104
|
+
`},(0,e.jsx)("div",{css:x.css`
|
|
105
105
|
padding: var(--spacing-sm);
|
|
106
106
|
display: flex;
|
|
107
107
|
flex-grow: 1;
|
|
108
108
|
margin-right: var(--spacing-sm);
|
|
109
109
|
gap: var(--spacing-base);
|
|
110
110
|
align-items: center;
|
|
111
|
-
`},r.thumbnailUrl?(0,e.jsx)("img",{src:r.thumbnailUrl,alt:r.name||`Product ${a}`,css:
|
|
111
|
+
`},r.thumbnailUrl?(0,e.jsx)("img",{src:r.thumbnailUrl,alt:r.name||`Product ${a}`,css:x.css`
|
|
112
112
|
background-color: var(--gray-200);
|
|
113
113
|
width: 3.5rem;
|
|
114
114
|
height: 3.5rem;
|
|
115
115
|
object-fit: cover;
|
|
116
|
-
`}):(0,e.jsx)("div",{css:
|
|
116
|
+
`}):(0,e.jsx)("div",{css:x.css`
|
|
117
117
|
height: 3.5rem;
|
|
118
118
|
width: 3.5rem;
|
|
119
119
|
background-color: var(--gray-100);
|
|
120
|
-
`}),(0,e.jsx)("h4",{css:
|
|
120
|
+
`}),(0,e.jsx)("h4",{css:x.css`
|
|
121
121
|
font-weight: var(--fw-bold);
|
|
122
122
|
width: 33.333333%;
|
|
123
123
|
font-size: var(--fs-sm);
|
|
124
|
-
`},r.name,
|
|
124
|
+
`},r.name,p&&(0,e.jsx)("span",{css:x.css`
|
|
125
125
|
display: block;
|
|
126
126
|
font-weight: var(--fw-regular);
|
|
127
|
-
`},
|
|
127
|
+
`},p)),r&&(0,e.jsx)(We.default.Fragment,null,(0,e.jsx)("p",{css:x.css`
|
|
128
128
|
margin-right: var(--spacing-lg);
|
|
129
129
|
font-size: var(--fs-sm);
|
|
130
|
-
`},"SKU: ",r.sku||r.id,(0,e.jsx)("br",null)),r.price!==void 0?(0,e.jsx)("p",{css:
|
|
130
|
+
`},"SKU: ",r.sku||r.id,(0,e.jsx)("br",null)),r.price!==void 0?(0,e.jsx)("p",{css:x.css`
|
|
131
131
|
margin-right: var(--spacing-lg);
|
|
132
132
|
font-size: var(--fs-sm);
|
|
133
|
-
`},(0,e.jsx)("span",{css:
|
|
133
|
+
`},(0,e.jsx)("span",{css:x.css`
|
|
134
134
|
display: block;
|
|
135
|
-
`},"Price: ",r.price)):null,(0,e.jsx)("a",{css:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
135
|
+
`},"Price: ",r.price)):null,r.editLink||r.url?(0,e.jsx)("a",{css:x.css`
|
|
136
|
+
display: inline-flex;
|
|
137
|
+
justify-content: space-between;
|
|
138
|
+
align-items: center;
|
|
139
|
+
padding: var(--spacing-xs) var(--spacing-xs) var(--spacing-xs) var(--spacing-base);
|
|
140
|
+
background-color: var(--white);
|
|
141
|
+
border-radius: var(--rounded-base);
|
|
142
|
+
border: 2px solid var(--gray-400);
|
|
143
|
+
margin-left: auto;
|
|
144
|
+
&:hover {
|
|
145
|
+
background-color: var(--gray-100);
|
|
146
|
+
}
|
|
147
|
+
`,href:(u=r.editLink)!=null?u:r.url,title:`Goto ${r.name}`,target:"__blank",rel:"noopener"},(0,e.jsx)("span",{css:x.css`
|
|
148
|
+
font-size: var(--fs-sm);
|
|
149
|
+
margin-right: var(--spacing-sm);
|
|
150
|
+
`},"Edit"),o?(0,e.jsx)(_,{src:o,alt:"Logo",css:x.css`
|
|
151
|
+
width: 2.25rem;
|
|
152
|
+
height: 2.25rem;
|
|
153
|
+
`}):null):null)))})))};var Y=N(require("react"));var D=N(require("react"));var xe={};Qt(xe,{Caution:()=>Jt,Checkmark:()=>Le,ChevronDown:()=>ke,Close:()=>ce,Danger:()=>jt,ExclamationPoint:()=>er,Info:()=>de,Lightbulb:()=>tr,MagnifyingGlass:()=>rr,MaximizeAlt:()=>or,Minus:()=>Pe,MoreVerticalAlt:()=>ge,Plus:()=>Ce});var Br=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"})),Jt=Br;var Hr=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"})),Le=Hr;var $r=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"})),ke=$r;var Fr=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"}))),ce=Fr;var Kr=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"})),jt=Kr;var Qr=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"})),er=Qr;var Nr=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"})),de=Nr;var _r=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"})),tr=_r;var Wr=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"})))),rr=Wr;var Zr=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"})),or=Zr;var Xr=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"})),ge=Xr;var cr=require("react-use"),dr=require("uuid");var B=N(require("react"));function nr(t,n){let o=window.open(t,"_blank"),r=setInterval(()=>{o!=null&&o.closed&&(clearInterval(r),n())},500)}var ir=require("timeago.js");var I=require("@emotion/react"),ar=require("@uniformdev/design-system"),Ze=I.css`
|
|
154
154
|
border: 1px solid var(--gray-200);
|
|
155
155
|
background: var(--gray-50);
|
|
156
156
|
border-radius: var(--rounded-base);
|
|
157
157
|
display: flex;
|
|
158
158
|
width: 100%;
|
|
159
|
-
`,
|
|
159
|
+
`,Xe=I.css`
|
|
160
160
|
align-items: center;
|
|
161
161
|
display: flex;
|
|
162
162
|
flex-grow: 1;
|
|
@@ -164,24 +164,24 @@ var Pr=Object.create;var Se=Object.defineProperty;var Rr=Object.getOwnPropertyDe
|
|
|
164
164
|
margin-inline: 0 var(--spacing-sm);
|
|
165
165
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
166
166
|
position: relative;
|
|
167
|
-
`,
|
|
167
|
+
`,Ye=I.css`
|
|
168
168
|
flex-grow: 1;
|
|
169
|
-
`,
|
|
169
|
+
`,qe=I.css`
|
|
170
170
|
align-items: start;
|
|
171
171
|
display: inline-flex;
|
|
172
172
|
position: relative;
|
|
173
|
-
`,
|
|
173
|
+
`,Je=I.css`
|
|
174
174
|
color: var(--brand-secondary-1);
|
|
175
175
|
font-size: var(--fs-base);
|
|
176
176
|
font-weight: var(--fw-bold);
|
|
177
177
|
line-height: 1;
|
|
178
|
-
`,
|
|
178
|
+
`,je=I.css`
|
|
179
179
|
width: 1.5rem;
|
|
180
180
|
height: 1.5rem;
|
|
181
|
-
`,
|
|
181
|
+
`,et=I.css`
|
|
182
182
|
width: 1rem;
|
|
183
183
|
height: 1rem;
|
|
184
|
-
`,
|
|
184
|
+
`,tt=I.css`
|
|
185
185
|
background: var(--white);
|
|
186
186
|
border-radius: var(--rounded-base);
|
|
187
187
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -190,21 +190,21 @@ var Pr=Object.create;var Se=Object.defineProperty;var Rr=Object.getOwnPropertyDe
|
|
|
190
190
|
padding: var(--spacing-base);
|
|
191
191
|
z-index: var(--z-10);
|
|
192
192
|
width: max-content;
|
|
193
|
-
`,
|
|
193
|
+
`,W=I.css`
|
|
194
194
|
font-size: var(--fs-sm);
|
|
195
|
-
`,
|
|
195
|
+
`,fe=I.css`
|
|
196
196
|
font-weight: var(--fw-bold);
|
|
197
197
|
margin-right: var(--spacing-sm);
|
|
198
|
-
`,
|
|
198
|
+
`,rt=I.css`
|
|
199
199
|
display: flex;
|
|
200
200
|
flex-direction: column;
|
|
201
201
|
gap: var(--spacing-sm);
|
|
202
202
|
|
|
203
|
-
${(0,
|
|
203
|
+
${(0,ar.mq)("md")} {
|
|
204
204
|
flex-direction: row;
|
|
205
205
|
min-width: 200px;
|
|
206
206
|
}
|
|
207
|
-
`,
|
|
207
|
+
`,Ee=I.css`
|
|
208
208
|
align-items: center;
|
|
209
209
|
background: var(--white);
|
|
210
210
|
border-radius: var(--rounded-base);
|
|
@@ -217,42 +217,42 @@ var Pr=Object.create;var Se=Object.defineProperty;var Rr=Object.getOwnPropertyDe
|
|
|
217
217
|
&:hover {
|
|
218
218
|
background: var(--gray-50);
|
|
219
219
|
}
|
|
220
|
-
`;var
|
|
220
|
+
`;var U=require("@emotion/react");var ot=({selectedItem:t,logoIcon:n,onDeselect:o,onEditClosed:r})=>{var h;let a=(0,B.useRef)(null),s=(0,B.useRef)(null),[p,v]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let c=C=>{a.current&&!a.current.contains(C.target)&&s.current&&!s.current.contains(C.target)&&v(!1)},f=()=>{v(!1)};return window.addEventListener("resize",f,!0),document.addEventListener("scroll",c,!0),document.addEventListener("mousedown",c),()=>{window.removeEventListener("resize",f,!0),document.removeEventListener("scroll",c,!0),document.removeEventListener("mousedown",c)}},[s]);let u=()=>{var c;if(v(!p),s.current&&a.current){let f=(c=a==null?void 0:a.current)==null?void 0:c.getBoundingClientRect(),C=s.current.offsetWidth;s.current.style.top=`${f.top+30}px`,s.current.style.left=`${f.left-C+30}px`}};return(0,e.jsx)("div",{css:Ze,key:t.id},(0,e.jsx)("div",{css:Xe},(0,e.jsx)("div",{css:Ye},(0,e.jsx)("div",{css:qe},(0,e.jsx)("h4",{css:[Je,t.popoverData?U.css`
|
|
221
221
|
margin-bottom: var(--spacing-sm);
|
|
222
|
-
`:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?(0,e.jsx)(
|
|
222
|
+
`:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?(0,e.jsx)(B.default.Fragment,null,(0,e.jsx)("button",{type:"button",ref:a,css:U.css`
|
|
223
223
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
224
|
-
`,"aria-controls":"path-details","aria-expanded":
|
|
224
|
+
`,"aria-controls":"path-details","aria-expanded":p,onClick:u},(0,e.jsx)(de,{width:24,height:24,css:U.css`
|
|
225
225
|
color: var(--gray-400);
|
|
226
|
-
`})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!
|
|
226
|
+
`})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!p,ref:s,css:[tt,p?U.css`
|
|
227
227
|
visibility: visible;
|
|
228
|
-
`:
|
|
228
|
+
`:U.css`
|
|
229
229
|
visibility: hidden;
|
|
230
|
-
`]},Object.entries(t.popoverData).map(([
|
|
230
|
+
`]},Object.entries(t.popoverData).map(([c,f],C)=>(0,e.jsx)("div",{css:W,key:C},(0,e.jsx)("span",{css:fe},c,":"),f)))):null),t.createdDate&&(0,e.jsx)("div",{css:W},(0,e.jsx)("span",{css:fe},"Created:"),(0,ir.format)((h=t.createdDate)!=null?h:0)),(0,e.jsx)("div",{css:U.css`
|
|
231
231
|
display: flex;
|
|
232
232
|
gap: var(--spacing-base);
|
|
233
|
-
`},t.metadata?Object.entries(t.metadata).filter(([
|
|
233
|
+
`},t.metadata?Object.entries(t.metadata).filter(([c])=>["type","status"].includes(c.toLocaleLowerCase())).map(([c,f])=>(0,e.jsx)("span",{css:W,key:c},f)):null),t.metadata?Object.entries(t.metadata).filter(([c])=>!["type","status"].includes(c.toLocaleLowerCase())).map(([c,f])=>(0,e.jsx)("div",{css:[W,U.css`
|
|
234
234
|
order: 1;
|
|
235
|
-
`],key:
|
|
235
|
+
`],key:c},(0,e.jsx)("span",{css:[fe,U.css`
|
|
236
236
|
order: 1;
|
|
237
|
-
`]},
|
|
237
|
+
`]},c,":"),f)):null),(0,e.jsx)("div",{css:rt},t.editLink?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",onClick:c=>{r&&(nr(c.currentTarget.href,()=>r(t)),c.preventDefault())},css:Ee},(0,e.jsx)("span",{css:W},"Edit"),(0,e.jsx)(_,{src:n,css:je,alt:"Logo"})):null,(0,e.jsx)("button",{type:"button",onClick:()=>{o(t)},css:Ee},(0,e.jsx)("span",{css:W},"Unlink"),(0,e.jsx)(ce,{css:[et,U.css`
|
|
238
238
|
color: var(--brand-secondary-5);
|
|
239
|
-
`]})))))};var
|
|
239
|
+
`]})))))};var H=N(require("react"));var Z=require("@emotion/react"),nt=Z.css`
|
|
240
240
|
cursor: pointer;
|
|
241
241
|
padding: var(--spacing-sm);
|
|
242
242
|
position: relative;
|
|
243
243
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
244
244
|
color var(--duration-fast) var(--timing-ease-out);
|
|
245
|
-
`,
|
|
245
|
+
`,at=Z.css`
|
|
246
246
|
padding-right: var(--spacing-lg);
|
|
247
|
-
`,
|
|
247
|
+
`,it=Z.css`
|
|
248
248
|
background: var(--brand-secondary-3);
|
|
249
249
|
color: var(--white);
|
|
250
|
-
`,
|
|
250
|
+
`,Me=Z.css`
|
|
251
251
|
font-size: var(--fs-xs);
|
|
252
|
-
`,
|
|
252
|
+
`,Ve=Z.css`
|
|
253
253
|
font-weight: var(--fw-bold);
|
|
254
254
|
margin-right: var(--spacing-sm);
|
|
255
|
-
`,
|
|
255
|
+
`,st=Z.css`
|
|
256
256
|
background: var(--white);
|
|
257
257
|
border-left: 4px solid var(--brand-secondary-3);
|
|
258
258
|
border-radius: var(--rounded-base);
|
|
@@ -264,20 +264,20 @@ var Pr=Object.create;var Se=Object.defineProperty;var Rr=Object.getOwnPropertyDe
|
|
|
264
264
|
right: var(--spacing-xl);
|
|
265
265
|
z-index: var(--z-10);
|
|
266
266
|
width: max-content;
|
|
267
|
-
`,
|
|
267
|
+
`,ct=Z.css`
|
|
268
268
|
position: absolute;
|
|
269
269
|
inset: 0 var(--spacing-sm) 0 auto;
|
|
270
|
-
`;var
|
|
270
|
+
`;var dt=require("@emotion/react"),lt=({result:t,isSelected:n,triggerSelection:o})=>{let r=(0,H.useRef)(null),a=(0,H.useRef)(null),[s,p]=(0,H.useState)(!1);(0,H.useEffect)(()=>{function u(h){r.current&&!r.current.contains(h.target)&&a.current&&!a.current.contains(h.target)&&p(!1)}return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[a]);let v=u=>{u.stopPropagation(),p(!s)};return(0,e.jsx)("div",{key:t.id,css:[nt,n?it:void 0,t.popoverData?at:void 0],"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o()},t.title,t.popoverData&&n?(0,e.jsx)(H.default.Fragment,null,(0,e.jsx)("button",{type:"button",ref:r,css:ct,"aria-controls":"path-details",onClick:u=>v(u),"aria-expanded":s},(0,e.jsx)(de,{width:24,height:24})),(0,e.jsx)("div",{id:"path-details","aria-hidden":!s,ref:a,css:[st,s?dt.css`
|
|
271
271
|
visibility: visible;
|
|
272
|
-
`:
|
|
272
|
+
`:dt.css`
|
|
273
273
|
visibility: hidden;
|
|
274
|
-
`]},t.metadata&&Object.entries(t.metadata).map(([h
|
|
274
|
+
`]},t.metadata&&Object.entries(t.metadata).map(([u,h],c)=>(0,e.jsx)("div",{css:Me,key:c},(0,e.jsx)("span",{css:Ve},u,":"),h)),Object.entries(t.popoverData).map(([u,h],c)=>(0,e.jsx)("div",{css:Me,key:c},(0,e.jsx)("span",{css:Ve},u,":"),h)))):null)};var le=require("react-beautiful-dnd");var R=require("@emotion/react"),pt=R.css`
|
|
275
275
|
background: var(--white);
|
|
276
276
|
border: 1px solid var(--gray-300);
|
|
277
277
|
border-radius: var(--rounded-base);
|
|
278
278
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
|
|
279
279
|
margin-bottom: var(--spacing-base);
|
|
280
|
-
`,
|
|
280
|
+
`,ut=R.css`
|
|
281
281
|
align-items: center;
|
|
282
282
|
display: flex;
|
|
283
283
|
position: relative;
|
|
@@ -285,7 +285,7 @@ var Pr=Object.create;var Se=Object.defineProperty;var Rr=Object.getOwnPropertyDe
|
|
|
285
285
|
width: 100%;
|
|
286
286
|
background-color: transparent;
|
|
287
287
|
border: 0;
|
|
288
|
-
`,
|
|
288
|
+
`,mt=R.css`
|
|
289
289
|
color: var(--brand-secondary-1);
|
|
290
290
|
display: block;
|
|
291
291
|
font-weight: var(--fw-bold);
|
|
@@ -301,150 +301,147 @@ var Pr=Object.create;var Se=Object.defineProperty;var Rr=Object.getOwnPropertyDe
|
|
|
301
301
|
background: var(--gray-100);
|
|
302
302
|
outline: none;
|
|
303
303
|
}
|
|
304
|
-
`,
|
|
304
|
+
`,gt=R.css`
|
|
305
305
|
background: var(--white);
|
|
306
306
|
border: 1px solid var(--gray-300);
|
|
307
307
|
border-radius: var(--rounded-base);
|
|
308
308
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
|
|
309
309
|
display: block;
|
|
310
|
-
`,
|
|
310
|
+
`,ft=R.css`
|
|
311
311
|
display: none;
|
|
312
|
-
`,
|
|
312
|
+
`,vt=R.css`
|
|
313
313
|
overflow-y: auto;
|
|
314
|
-
|
|
314
|
+
height: 16rem;
|
|
315
315
|
margin-bottom: var(--spacing-base);
|
|
316
|
+
position: relative;
|
|
316
317
|
|
|
317
318
|
& > :not(:last-child) {
|
|
318
319
|
border-bottom: 1px solid var(--gray-200);
|
|
319
320
|
}
|
|
320
|
-
`,
|
|
321
|
+
`,Yr=R.css`
|
|
321
322
|
background-color: var(--gray-50);
|
|
322
323
|
max-width: 33.33%;
|
|
323
|
-
`,
|
|
324
|
+
`,ht=R.css`
|
|
324
325
|
align-items: center;
|
|
325
326
|
display: flex;
|
|
326
327
|
position: absolute;
|
|
327
328
|
inset: 0 0 0 auto;
|
|
328
329
|
pointer-events: none;
|
|
329
330
|
padding-right: var(--spacing-sm);
|
|
330
|
-
`,yt=
|
|
331
|
+
`,yt=R.css`
|
|
331
332
|
color: var(--brand-secondary-1);
|
|
332
333
|
width: 1.25rem;
|
|
333
334
|
height: 1.25rem;
|
|
334
335
|
transition: transform var(--duration-fast) var(--timing-ease-out);
|
|
335
336
|
transform: rotate(0);
|
|
336
|
-
`,
|
|
337
|
+
`,qr=R.css`
|
|
337
338
|
background: var(--white);
|
|
338
339
|
color: var(--brand-secondary-1);
|
|
339
|
-
`,
|
|
340
|
+
`,bt=R.css`
|
|
340
341
|
position: relative;
|
|
341
342
|
margin-block: var(--spacing-sm) 0;
|
|
342
343
|
|
|
343
344
|
&:hover > span {
|
|
344
345
|
opacity: 0.3;
|
|
345
346
|
}
|
|
346
|
-
`,
|
|
347
|
+
`,St=R.css`
|
|
347
348
|
align-items: center;
|
|
348
349
|
display: flex;
|
|
349
350
|
position: absolute;
|
|
350
351
|
inset: 0 auto 0 0;
|
|
351
352
|
margin-block: auto;
|
|
352
353
|
opacity: 0;
|
|
353
|
-
`,Te=
|
|
354
|
+
`,Te=R.css`
|
|
354
355
|
color: var(--brand-secondary-1);
|
|
355
|
-
`,
|
|
356
|
+
`,wt=R.css`
|
|
356
357
|
position: absolute;
|
|
357
358
|
left: 0.375rem;
|
|
358
|
-
`,Ie=
|
|
359
|
+
`,Ie=R.css`
|
|
359
360
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
360
361
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
361
|
-
`;var
|
|
362
|
+
`;var G=require("@emotion/react"),S=require("@uniformdev/design-system");var te=require("react");function sr(t,{delay:n=500,minDuration:o=200}={delay:500,minDuration:200}){let[r,a]=(0,te.useState)("IDLE"),s=(0,te.useRef)(void 0);return(0,te.useEffect)(()=>{t&&r==="IDLE"&&(clearTimeout(s.current),s.current=setTimeout(()=>{if(!t)return a("IDLE");s.current=setTimeout(()=>{a("EXPIRE")},o),a("DISPLAY")},n),a("DELAY")),!t&&r!=="DISPLAY"&&(clearTimeout(s.current),a("IDLE"))},[t,r,n,o]),(0,te.useEffect)(()=>()=>clearTimeout(s.current),[]),r==="DISPLAY"||r==="EXPIRE"}var Jr=({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)(S.Callout,{type:"info"},o)},Ct=({search:t,results:n,contentTypes:o,selectedItems:r,logoIcon:a,select:s,multiSelect:p,multiSelectId:v,rowComponent:u,selectedItemComponent:h,totalResults:c,resultsLoading:f,requireContentType:C,onAddNew:re,onEditClosed:$,onCancel:w,noResultsComponent:y,helpComponent:oe,onSort:F,typeSelectorLabel:q="Content Type Select",typeSelectorAllTypesOptionText:K="All content types"})=>{var $t,Ft,Kt;let ne=()=>C?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[j,ee]=D.useState(""),[b,m]=D.useState(ne),[P,ae]=D.useState(!1),[i,L]=D.useState([]),[pe,Ut]=D.useState(!1),ze=D.useRef(`x${(0,dr.v4)()}`),ye=(0,cr.useThrottle)(j,750);D.useEffect(()=>{t(ye,{count:5,offset:0,contentType:b==="any"?void 0:b})},[ye,b]);let mr=sr(f,{delay:1e3}),gr=d=>{i.some(g=>g.id===d.id)?L(g=>g.filter(Q=>Q.id!==d.id)):L(p?g=>[...g,d]:[d])},fr=r==null?void 0:r.map(d=>d.id).join(",");D.useEffect(()=>{Array.isArray(r)&&L(r)},[fr]);let vr=()=>{m(ne()),ee(""),L(r!=null&&r.length?r:[])},hr=()=>{ae(d=>!d),P||vr()},Ot=d=>{let g=(i==null?void 0:i.filter(Q=>Q.id!==d.id))||[];L(g),s(g,"")},yr=d=>{d.preventDefault(),s(i,b),ae(!1)},br=d=>{d.preventDefault(),ae(!1),w&&w()},Sr=()=>{t(ye,{count:5,offset:(n==null?void 0:n.length)||0,contentType:b==="any"?void 0:b}),Ut(!0);let d=setTimeout(()=>{Ut(!1)},750);return()=>clearTimeout(d)},wr=!(r==null?void 0:r.length)||p,Cr=u||lt,Bt=h||ot,Pr=y||Jr,Ht=a&&typeof a!="string"?a:null,Rr=Ht?(0,e.jsx)(Ht,{css:Ie}):(0,e.jsx)("img",{src:a,alt:"Logo",css:Ie}),Lr=d=>{var g,Q;if(d.destination&&d.source.droppableId===((g=d.destination)==null?void 0:g.droppableId)){let M=[...r||[]],[ue]=(Q=M==null?void 0:M.splice(d.source.index,1))!=null?Q:[];return M==null||M.splice(d.destination.index,0,ue),F&&(L(M),F==null||F(M)),M}};return(0,e.jsx)("div",{css:G.css`
|
|
362
363
|
width: 100%;
|
|
363
|
-
`},(0,e.jsx)("div",{css:
|
|
364
|
+
`},(0,e.jsx)("div",{css:G.css`
|
|
364
365
|
position: relative;
|
|
365
366
|
margin-block: var(--spacing-base);
|
|
366
|
-
`},
|
|
367
|
+
`},wr?(0,e.jsx)(D.Fragment,null,(0,e.jsx)("div",{css:pt,"data-test-id":"component-search"},(0,e.jsx)("button",{css:ut,onClick:hr,type:"button","aria-haspopup":!0,"aria-expanded":P,"aria-controls":`entry-search-config-${ze.current}`},Rr,(0,e.jsx)("span",{css:G.css`
|
|
367
368
|
margin-left: var(--spacing-base);
|
|
368
|
-
`},"Select"),(0,e.jsx)("span",{css:
|
|
369
|
+
`},"Select"),(0,e.jsx)("span",{css:ht},(0,e.jsx)(ke,{css:[yt,P?G.css`
|
|
369
370
|
transform: rotate(180deg);
|
|
370
|
-
`:void 0]})))),(0,e.jsx)("div",{id:`entry-search-config-${
|
|
371
|
+
`:void 0]})))),(0,e.jsx)("div",{id:`entry-search-config-${ze.current}`,"aria-hidden":!P,css:[gt,P?void 0:ft]},oe||null,(0,e.jsx)("div",{css:G.css`
|
|
371
372
|
display: flex;
|
|
372
373
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
373
374
|
margin-bottom: var(--spacing-base);
|
|
374
|
-
`},(0,e.jsx)(S.InputSelect,{onChange:
|
|
375
|
+
`},(0,e.jsx)(S.InputSelect,{onChange:d=>m(d.target.value),value:b,label:q,showLabel:!1,options:[...C?[]:[{value:"any",label:K}],...o?o.map(d=>({value:d.id,label:d.name})):[]]}),(0,e.jsx)("div",{css:G.css`
|
|
375
376
|
flex-grow: 1;
|
|
376
|
-
`},(0,e.jsx)(S.InputKeywordSearch,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:
|
|
377
|
-
padding: var(--spacing-base);
|
|
378
|
-
text-align: center;
|
|
379
|
-
width: 100%;
|
|
380
|
-
`},(0,e.jsx)(S.LoadingIndicator,null)):null),(0,e.jsx)("div",{css:D.css`
|
|
377
|
+
`},(0,e.jsx)(S.InputKeywordSearch,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:ee,disabledFieldSubmission:!0,value:j}))),(0,e.jsx)("div",{css:[vt,S.scrollbarStyles],id:ze.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},(0,e.jsx)(S.LoadingOverlay,{isActive:mr}),Array.isArray(n)&&n.length>0?n.map(d=>(0,e.jsx)(Cr,{key:d.id,isSelected:i.some(g=>g.id===d.id),result:d,triggerSelection:()=>gr(d)})):(0,e.jsx)(Pr,{searchText:ye||j,selectedContentType:(Ft=($t=o==null?void 0:o.find(d=>d.id===b))==null?void 0:$t.name)!=null?Ft:b}),!f&&typeof c!="undefined"&&n&&(n==null?void 0:n.length)<c&&(0,e.jsx)("button",{type:"button",css:mt,onClick:Sr},pe?(0,e.jsx)(S.LoadingIndicator,null):"Load More")),(0,e.jsx)("div",{css:G.css`
|
|
381
378
|
display: flex;
|
|
382
379
|
justify-content: space-between;
|
|
383
|
-
`},(0,e.jsx)("div",null,
|
|
380
|
+
`},(0,e.jsx)("div",null,re&&((Kt=o==null?void 0:o.length)!=null?Kt:0)>0?(0,e.jsx)(S.Menu,{menuLabel:"Add new menu",menuTrigger:(0,e.jsx)(S.Button,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(d=>(0,e.jsx)(S.MenuItem,{key:d.id,css:G.css`
|
|
384
381
|
background: var(--white);
|
|
385
382
|
color: var(--brand-secondary-1);
|
|
386
|
-
`,onClick:()=>
|
|
383
|
+
`,onClick:()=>re(d)},d.name))):null),(0,e.jsx)("div",{css:G.css`
|
|
387
384
|
display: flex;
|
|
388
385
|
gap: var(--spacing-base);
|
|
389
|
-
`},(0,e.jsx)(S.Button,{buttonType:"unimportant",onClick:
|
|
390
|
-
|
|
391
|
-
|
|
386
|
+
`},(0,e.jsx)(S.Button,{buttonType:"unimportant",onClick:br},"Cancel"),(0,e.jsx)(S.Button,{disabled:!i.length,onClick:yr,"data-test-id":"entry-accept-button"},"Accept"))))):null,P?null:p?(0,e.jsx)(le.DragDropContext,{onDragEnd:d=>Lr(d)},(0,e.jsx)(le.Droppable,{droppableId:v||"canvas-multi-select"},d=>(0,e.jsx)("div",{...d.droppableProps,ref:d.innerRef,css:G.css`
|
|
387
|
+
margin-block: var(--spacing-sm) 0;
|
|
388
|
+
`},i==null?void 0:i.map((g,Q)=>{if(g!=null&&g.id)return(0,e.jsx)(le.Draggable,{key:g.id,draggableId:g.id,index:Q},M=>(0,e.jsx)("div",{css:bt,ref:M.innerRef,...M.draggableProps,...M.dragHandleProps},(0,e.jsx)("span",{css:St},(0,e.jsx)(ge,{css:[Te,wt],width:24,height:24}),(0,e.jsx)(ge,{css:Te,width:24,height:24})),(0,e.jsx)(Bt,{key:`selected-item-${g.id}`,logoIcon:a,selectedItem:g,onDeselect:ue=>Ot(ue),onEditClosed:$?ue=>$(ue):void 0})))}),d.placeholder))):i==null?void 0:i.map(d=>(0,e.jsx)(Bt,{key:`selected-item-${d.id}`,logoIcon:a,selectedItem:d,onDeselect:g=>Ot(g),onEditClosed:$?g=>$(g):void 0}))))};var X=require("@emotion/react"),Pt=X.css`
|
|
392
389
|
cursor: pointer;
|
|
393
390
|
padding: var(--spacing-sm) 0;
|
|
394
391
|
margin-right: var(--spacing-sm);
|
|
395
392
|
position: relative;
|
|
396
393
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
397
394
|
color var(--duration-fast) var(--timing-ease-out);
|
|
398
|
-
`,
|
|
395
|
+
`,Rt=X.css`
|
|
399
396
|
border: 2px solid transparent;
|
|
400
397
|
border-radius: var(--rounded-base);
|
|
401
398
|
display: flex;
|
|
402
399
|
align-items: center;
|
|
403
400
|
gap: var(--spacing-base);
|
|
404
401
|
padding: var(--spacing-sm) var(--spacing-xs);
|
|
405
|
-
`,xt=X.css`
|
|
406
|
-
background-color: var(--green-50);
|
|
407
402
|
`,Lt=X.css`
|
|
403
|
+
background-color: var(--green-50);
|
|
404
|
+
`,kt=X.css`
|
|
408
405
|
font-size: var(--fs-sm);
|
|
409
406
|
font-weight: var(--fw-bold);
|
|
410
407
|
width: 50%;
|
|
411
|
-
`,
|
|
408
|
+
`,xt=X.css`
|
|
412
409
|
font-weight: var(--fw-normal);
|
|
413
410
|
display: block;
|
|
414
|
-
`,
|
|
411
|
+
`,Et=X.css`
|
|
415
412
|
font-size: var(--fs-sm);
|
|
416
413
|
> * {
|
|
417
414
|
display: block;
|
|
418
415
|
}
|
|
419
|
-
`,
|
|
416
|
+
`,Mt=X.css`
|
|
420
417
|
display: block;
|
|
421
418
|
height: 1.5rem;
|
|
422
419
|
width: 1.5rem;
|
|
423
420
|
color: var(--brand-secondary-3);
|
|
424
421
|
margin-left: auto;
|
|
425
|
-
`;var
|
|
422
|
+
`;var Vt=require("@emotion/react");function Tt({result:t,isSelected:n,triggerSelection:o}){var v;let{categories:r,logoIcon:a}=ve(),[s]=t.categories||[{id:"",name:""}],p=typeof s=="undefined"||!r||(v=r.find(u=>u.id===s.id))==null?void 0:v.name;return(0,e.jsx)("div",{key:t.id,"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o(),css:[Pt]},(0,e.jsx)("div",{css:[Rt,n?Lt:void 0]},t.thumbnailUrl?(0,e.jsx)("img",{src:t.thumbnailUrl,alt:`Thumbnail for ${t.title}`,css:Vt.css`
|
|
426
423
|
background-color: var(--gray-200);
|
|
427
424
|
width: 3rem;
|
|
428
425
|
height: 3rem;
|
|
429
426
|
object-fit: cover;
|
|
430
|
-
`}):(0,e.jsx)(
|
|
427
|
+
`}):(0,e.jsx)(_,{src:a,alt:"Logo",css:Vt.css`
|
|
431
428
|
height: 2.25rem;
|
|
432
429
|
width: 2.25rem;
|
|
433
|
-
`}),(0,e.jsx)("h4",{css:[
|
|
430
|
+
`}),(0,e.jsx)("h4",{css:[kt]},t.title,p?(0,e.jsx)("span",{css:[xt]},p):null),(0,e.jsx)("p",{css:[Et]},"SKU: ",t.sku||t.id,t.price!==void 0?(0,e.jsx)("span",null,t.price):null),n?(0,e.jsx)(Le,{css:[Mt]}):null))}var he=require("@emotion/react"),lr=require("@uniformdev/design-system"),It=he.css`
|
|
434
431
|
display: flex;
|
|
435
432
|
width: 100%;
|
|
436
433
|
border: 1px solid var(--gray-300);
|
|
437
434
|
border-radius: var(--rounded-base);
|
|
438
435
|
background-color: var(--gray-100);
|
|
439
436
|
margin: var(--spacing-base) 0;
|
|
440
|
-
`,
|
|
437
|
+
`,Dt=he.css`
|
|
441
438
|
padding: var(--spacing-base) 0 var(--spacing-base) var(--spacing-lg);
|
|
442
439
|
display: flex;
|
|
443
440
|
flex-grow: 1;
|
|
444
441
|
align-items: center;
|
|
445
442
|
margin-right: var(--spacing-sm);
|
|
446
443
|
gap: var(--spacing-base);
|
|
447
|
-
`,
|
|
444
|
+
`,Gt=he.css`
|
|
448
445
|
display: flex;
|
|
449
446
|
align-items: center;
|
|
450
447
|
gap: var(--spacing-sm);
|
|
@@ -452,29 +449,29 @@ var Pr=Object.create;var Se=Object.defineProperty;var Rr=Object.getOwnPropertyDe
|
|
|
452
449
|
width: 50%;
|
|
453
450
|
margin-bottom: 0;
|
|
454
451
|
}
|
|
455
|
-
`,De=
|
|
452
|
+
`,De=he.css`
|
|
456
453
|
background-color: var(--gray-200);
|
|
457
454
|
width: 3.5rem;
|
|
458
455
|
height: 3.5rem;
|
|
459
456
|
object-fit: cover;
|
|
460
|
-
`;var
|
|
457
|
+
`;var E=require("@emotion/react"),pr=require("@uniformdev/design-system");function zt({selectedItem:t,onDeselect:n}){var p;let{categories:o,logoIcon:r}=ve(),[a]=t.categories||[{id:"",name:""}],s=typeof a=="undefined"||!o||(p=o.find(v=>v.id===a.id))==null?void 0:p.name;return(0,e.jsx)("div",{css:[It],key:t.id},(0,e.jsx)("article",{css:[Dt]},(0,e.jsx)("div",{css:[Gt]},t.thumbnailUrl?(0,e.jsx)("img",{src:t.thumbnailUrl,alt:s,css:[De],loading:"lazy"}):(0,e.jsx)("div",{css:[De]}),(0,e.jsx)("div",{css:E.css`
|
|
461
458
|
> :not(:last-child) {
|
|
462
459
|
margin-bottom: var(--spacing-xs);
|
|
463
460
|
}
|
|
464
|
-
`},(0,e.jsx)("h4",{css:
|
|
461
|
+
`},(0,e.jsx)("h4",{css:E.css`
|
|
465
462
|
font-weight: var(--fw-bold);
|
|
466
|
-
`},t.title||t.id||"",
|
|
463
|
+
`},t.title||t.id||"",s&&(0,e.jsx)("span",{css:E.css`
|
|
467
464
|
display: block;
|
|
468
465
|
font-weight: var(--fw-regular);
|
|
469
|
-
`},
|
|
466
|
+
`},s)),(0,e.jsx)("ul",{css:E.css`
|
|
470
467
|
font-size: var(--fs-sm);
|
|
471
468
|
display: flex;
|
|
472
469
|
gap: var(--spacing-base);
|
|
473
|
-
`},(0,e.jsx)("li",null,(0,e.jsx)("span",{css:
|
|
470
|
+
`},(0,e.jsx)("li",null,(0,e.jsx)("span",{css:E.css`
|
|
474
471
|
margin-right: var(--spacing-xs);
|
|
475
|
-
`},"SKU:"),t.sku||t.id),t.price!==void 0?(0,e.jsx)("li",null,(0,e.jsx)("span",{css:
|
|
472
|
+
`},"SKU:"),t.sku||t.id),t.price!==void 0?(0,e.jsx)("li",null,(0,e.jsx)("span",{css:E.css`
|
|
476
473
|
margin-right: var(--spacing-xs);
|
|
477
|
-
`},"Price:"),(0,e.jsx)("span",null,t.price)):null))),(0,e.jsx)("div",{css:
|
|
474
|
+
`},"Price:"),(0,e.jsx)("span",null,t.price)):null))),(0,e.jsx)("div",{css:E.css`
|
|
478
475
|
display: flex;
|
|
479
476
|
flex-wrap: wrap;
|
|
480
477
|
gap: var(--spacing-sm);
|
|
@@ -483,7 +480,7 @@ var Pr=Object.create;var Se=Object.defineProperty;var Rr=Object.getOwnPropertyDe
|
|
|
483
480
|
${(0,pr.mq)("md")} {
|
|
484
481
|
align-items: center;
|
|
485
482
|
}
|
|
486
|
-
`},t.editLink?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",css:
|
|
483
|
+
`},t.editLink?(0,e.jsx)("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",css:E.css`
|
|
487
484
|
display: inline-flex;
|
|
488
485
|
justify-content: space-between;
|
|
489
486
|
align-items: center;
|
|
@@ -494,14 +491,14 @@ var Pr=Object.create;var Se=Object.defineProperty;var Rr=Object.getOwnPropertyDe
|
|
|
494
491
|
&:hover {
|
|
495
492
|
background-color: var(--gray-100);
|
|
496
493
|
}
|
|
497
|
-
`},(0,e.jsx)("span",{css:
|
|
494
|
+
`},(0,e.jsx)("span",{css:E.css`
|
|
498
495
|
margin-right: var(--spacing-sm);
|
|
499
496
|
font-size: var(--fs-sm);
|
|
500
|
-
`},"Edit"),(0,e.jsx)(
|
|
497
|
+
`},"Edit"),(0,e.jsx)(_,{src:r,alt:"Logo",css:E.css`
|
|
501
498
|
width: 1.75rem;
|
|
502
499
|
height: 1.75rem;
|
|
503
500
|
display: block;
|
|
504
|
-
`})):null,(0,e.jsx)("button",{type:"button",onClick:
|
|
501
|
+
`})):null,(0,e.jsx)("button",{type:"button",onClick:()=>{n==null||n(t)},css:E.css`
|
|
505
502
|
display: flex;
|
|
506
503
|
justify-content: space-between;
|
|
507
504
|
align-items: center;
|
|
@@ -514,8 +511,8 @@ var Pr=Object.create;var Se=Object.defineProperty;var Rr=Object.getOwnPropertyDe
|
|
|
514
511
|
&:hover {
|
|
515
512
|
background-color: var(--gray-100);
|
|
516
513
|
}
|
|
517
|
-
`},(0,e.jsx)("span",{css:
|
|
514
|
+
`},(0,e.jsx)("span",{css:E.css`
|
|
518
515
|
font-size: var(--fs-sm);
|
|
519
|
-
`},"Unlink"),(0,e.jsx)(
|
|
516
|
+
`},"Unlink"),(0,e.jsx)(ce,{css:E.css`
|
|
520
517
|
color: var(--brand-secondary-5);
|
|
521
|
-
`})))))}var
|
|
518
|
+
`})))))}var ur=require("@uniformdev/design-system"),Ge=require("react-use");function jr({selectedProducts:t,setSelectedProducts:n,onGetCategories:o,onSearchProducts:r,logoIcon:a,multiSelect:s,multiSelectId:p,selectedItemComponent:v,rowComponent:u,errorComponent:h,helpComponent:c,noResultsComponent:f,onSort:C,typeSelectorAllTypesOptionText:re="All categories",typeSelectorLabel:$="Select Category"}){var ee;let{value:w,loading:y,error:oe}=(0,Ge.useAsync)(async()=>await o(),[o]),F=w==null?void 0:w.map(b=>b.id).join(","),q=(0,Y.useMemo)(()=>w?w.map(m=>({id:m.id,name:m.name})):void 0,[F]),K=(0,Y.useRef)(),[J,ne]=(0,Ge.useAsyncFn)(async(b,m)=>{let P=await r({text:b,options:{limit:m==null?void 0:m.count,offset:m==null?void 0:m.offset,categoryId:m==null?void 0:m.contentType}});return(m==null?void 0:m.offset)===0&&(K.current=[]),(K.current=K.current||[]).push(...P.products),P},[r]),j=async b=>{await n(b)};return oe||J.error?(0,e.jsx)(h||(({categoriesError:m,searchError:P})=>(0,e.jsx)(ur.Callout,{type:"error"},"There was an error: ",(m==null?void 0:m.message)||(P==null?void 0:P.message))),{categoriesError:oe,searchError:J.error}):(0,e.jsx)(At.Provider,{value:{categories:w,logoIcon:a}},(0,e.jsx)(Ct,{search:ne,results:K.current,logoIcon:a,selectedItems:t,select:j,multiSelectId:p||"product-search-multi-select",multiSelect:s,contentTypes:q,selectedItemComponent:v||zt,rowComponent:u||Tt,totalResults:(ee=J.value)==null?void 0:ee.total,resultsLoading:J.loading||y,helpComponent:c,noResultsComponent:f,onSort:C,typeSelectorAllTypesOptionText:re,typeSelectorLabel:$}))}var At=Y.default.createContext(void 0),ve=()=>{let t=(0,Y.useContext)(At);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};A(z,require("@uniformdev/mesh-sdk"),module.exports);var l=require("@uniformdev/design-system");0&&(module.exports={Button,Callout,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,draggableContainer,draggableIcon,draggableIconOffset,draggableIconWrapper,entrySearchBtn,entrySearchConfig,entrySearchConfigHidden,entrySearchLoadMoreBtn,entrySearchResultList,entrySearchSelectIcon,entrySearchSelectImg,entrySearchSelectInput,entrySearchSelectOption,entrySearchWrapper,productSearchRowActiveIcon,productSearchRowCategory,productSearchRowContainer,productSearchRowContent,productSearchRowContentActive,productSearchRowDetails,productSearchRowTitle,productSelectedItemContainer,productSelectedItemContent,productSelectedItemDetails,productSelectedItemImage,searchRowBtn,searchRowContainer,searchRowContainerActive,searchRowContainerWithPopover,searchRowPopover,searchRowText,searchRowTextSmall,selectItemLinkBtn,selectItemLinkContainer,selectItemPopover,selectItemPopoverLabel,selectItemSmallText,selectedItemCloseIcon,selectedItemContainer,selectedItemCopy,selectedItemDetails,selectedItemIcon,selectedItemInner,selectedItemTitle,useInitializeUniformMeshSdk,useProductQueryContext,useProductSearchContext,useUniformMeshLocation,useUniformMeshLocationContext,useUniformMeshSdk,useUniformMeshSdkContext});
|