@uniformdev/mesh-sdk-react 16.0.0 → 16.0.1-alpha.221
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 +7 -5
- package/dist/index.esm.js +74 -70
- package/dist/index.js +91 -87
- package/dist/index.mjs +74 -70
- package/package.json +16 -16
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import React__default, { SVGProps } from 'react';
|
|
|
6
6
|
import * as _emotion_react_types_jsx_namespace from '@emotion/react/types/jsx-namespace';
|
|
7
7
|
import { TDate } from 'timeago.js';
|
|
8
8
|
import * as _emotion_react from '@emotion/react';
|
|
9
|
-
export { Button, ButtonProps, Callout, CalloutProps, Heading, HeadingProps, Input, InputProps, InputSelect, InputToggle, InputToggleProps, InputKeywordSearch as KeywordSearchInput, LoadingIndicator, LoadingOverlay, Menu, MenuItem, MenuItemProps, MenuProps, ScrollableList, ScrollableListItem, ScrollableListItemProps, ScrollableListProps, Textarea, TextareaProps, Theme, ThemeProps } from '@uniformdev/design-system';
|
|
9
|
+
export { Button, ButtonProps, Callout, CalloutProps, Heading, HeadingProps, Input, InputProps, InputSelect, InputToggle, InputToggleProps, InputKeywordSearch as KeywordSearchInput, Label, LabelProps, LoadingIndicator, LoadingOverlay, Menu, MenuItem, MenuItemProps, MenuProps, ScrollableList, ScrollableListItem, ScrollableListItemProps, ScrollableListProps, Switch, SwitchProps, Textarea, TextareaProps, Theme, ThemeProps } from '@uniformdev/design-system';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Provides convenient access to the current Uniform Mesh location via React hook.
|
|
@@ -14,8 +14,9 @@ export { Button, ButtonProps, Callout, CalloutProps, Heading, HeadingProps, Inpu
|
|
|
14
14
|
*/
|
|
15
15
|
declare function useUniformMeshLocation<TLocationMethodsValue = unknown, TLocationMethodsMetadata = unknown, TLocationSetValue = TLocationMethodsValue>(): {
|
|
16
16
|
value: TLocationMethodsValue;
|
|
17
|
-
setValue: (value: TLocationSetValue) => Promise<void>;
|
|
17
|
+
setValue: (value: TLocationSetValue, options?: _uniformdev_mesh_sdk.SetValueOptions | undefined) => Promise<void>;
|
|
18
18
|
metadata: TLocationMethodsMetadata;
|
|
19
|
+
setValidationResult: (value: _uniformdev_mesh_sdk.ValidationResult) => Promise<void>;
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
interface UseUniformMeshSdkOptions {
|
|
@@ -41,7 +42,7 @@ interface UniformMeshLocationContextValue<TLocationValue = unknown, TLocationMet
|
|
|
41
42
|
location: MeshLocation<TLocationValue, TLocationMetadata, TLocationSetValue>;
|
|
42
43
|
}
|
|
43
44
|
declare const UniformMeshLocationContext: React__default.Context<UniformMeshLocationContextValue<unknown, unknown, unknown> | undefined>;
|
|
44
|
-
declare const UniformMeshLocationContextProvider: React__default.FC
|
|
45
|
+
declare const UniformMeshLocationContextProvider: React__default.FC<React__default.PropsWithChildren<unknown>>;
|
|
45
46
|
/**
|
|
46
47
|
* Provides access to the current UniformMeshLocationContext value.
|
|
47
48
|
*/
|
|
@@ -51,7 +52,7 @@ interface UniformMeshSdkContextValue {
|
|
|
51
52
|
sdk: UniformMeshSDK;
|
|
52
53
|
}
|
|
53
54
|
declare const UniformMeshSdkContext: React__default.Context<UniformMeshSdkContextValue | undefined>;
|
|
54
|
-
declare const UniformMeshSdkContextProvider: React__default.FC
|
|
55
|
+
declare const UniformMeshSdkContextProvider: React__default.FC<React__default.PropsWithChildren<unknown>>;
|
|
55
56
|
/**
|
|
56
57
|
* Provides access to the current (initialized) Uniform Mesh SDK context value.
|
|
57
58
|
*/
|
|
@@ -126,6 +127,7 @@ interface NoResultsProps {
|
|
|
126
127
|
declare const EntrySearch: <TResult extends EntrySearchResult>({ search, results, contentTypes, selectedItems, logoIcon, select, multiSelect, multiSelectId, rowComponent, selectedItemComponent, totalResults, resultsLoading, requireContentType, onAddNew, onEditClosed, onCancel, noResultsComponent, helpComponent, onSort, typeSelectorLabel, typeSelectorAllTypesOptionText, }: EntrySearchProps<TResult>) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
127
128
|
|
|
128
129
|
declare const searchRowContainer: _emotion_react.SerializedStyles;
|
|
130
|
+
declare const searchRowContainerWithPopover: _emotion_react.SerializedStyles;
|
|
129
131
|
declare const searchRowContainerActive: _emotion_react.SerializedStyles;
|
|
130
132
|
declare const searchRowTextSmall: _emotion_react.SerializedStyles;
|
|
131
133
|
declare const searchRowText: _emotion_react.SerializedStyles;
|
|
@@ -356,4 +358,4 @@ declare namespace index {
|
|
|
356
358
|
};
|
|
357
359
|
}
|
|
358
360
|
|
|
359
|
-
export { Brand, DefaultSearchRow, DefaultSelectedItem, EntrySearch, EntrySearchContentType, EntrySearchProps, EntrySearchQueryOptions, EntrySearchResult, EntrySearchRowProps, EntrySearchSelectedItemProps, GetProductOptions, GetProductsOptions, index as Icons, NoResultsProps, ProductCategory, ProductDynamicSelectorValue, ProductPreviewList, ProductQuery, ProductQueryCategory, ProductQueryContext, ProductQueryContextValue, ProductQueryProps, ProductSearch, ProductSearchContext, ProductSearchContextValue, ProductSearchProps, ProductSearchResult, ProductSearchResults, ProductSearchRow, ProductSelectedItem, ResolvableLoadingValue, SelectionField, SelectionFieldValue, UniformMeshLocationContext, UniformMeshLocationContextProvider, UniformMeshLocationContextValue, UniformMeshSdkContext, UniformMeshSdkContextProvider, UniformMeshSdkContextValue, UseUniformMeshSdkOptions, badgeIcon, draggableContainer, draggableIcon, draggableIconOffset, draggableIconWrapper, entrySearchBtn, entrySearchConfig, entrySearchConfigHidden, entrySearchLoadMoreBtn, entrySearchResultList, entrySearchSelectIcon, entrySearchSelectImg, entrySearchSelectInput, entrySearchSelectOption, entrySearchWrapper, productSearchRowActiveIcon, productSearchRowCategory, productSearchRowContainer, productSearchRowContent, productSearchRowContentActive, productSearchRowDetails, productSearchRowTitle, productSelectedItemContainer, productSelectedItemContent, productSelectedItemDetails, productSelectedItemImage, searchRowBtn, searchRowContainer, searchRowContainerActive, searchRowPopover, searchRowText, searchRowTextSmall, selectItemLinkBtn, selectItemLinkContainer, selectItemPopover, selectItemPopoverLabel, selectItemSmallText, selectedItemCloseIcon, selectedItemContainer, selectedItemCopy, selectedItemDetails, selectedItemIcon, selectedItemInner, selectedItemTitle, useInitializeUniformMeshSdk, useProductQueryContext, useProductSearchContext, useUniformMeshLocation, useUniformMeshLocationContext, useUniformMeshSdk, useUniformMeshSdkContext };
|
|
361
|
+
export { Brand, DefaultSearchRow, DefaultSelectedItem, EntrySearch, EntrySearchContentType, EntrySearchProps, EntrySearchQueryOptions, EntrySearchResult, EntrySearchRowProps, EntrySearchSelectedItemProps, GetProductOptions, GetProductsOptions, index as Icons, NoResultsProps, ProductCategory, ProductDynamicSelectorValue, ProductPreviewList, ProductQuery, ProductQueryCategory, ProductQueryContext, ProductQueryContextValue, ProductQueryProps, ProductSearch, ProductSearchContext, ProductSearchContextValue, ProductSearchProps, ProductSearchResult, ProductSearchResults, ProductSearchRow, ProductSelectedItem, ResolvableLoadingValue, SelectionField, SelectionFieldValue, UniformMeshLocationContext, UniformMeshLocationContextProvider, UniformMeshLocationContextValue, UniformMeshSdkContext, UniformMeshSdkContextProvider, UniformMeshSdkContextValue, UseUniformMeshSdkOptions, 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 };
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
1
|
+
var or=Object.defineProperty;var nr=(t,n)=>{for(var o in n)or(t,o,{get:n[o],enumerable:!0})};import{jsx as e}from"@emotion/react";import*as V from"react";import{createContext as ar,useContext as ir,useState as sr}from"react";var Ee=ar(void 0),Te=({children:t})=>{let[n,o]=sr(),r;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let i=n||window.UniformMeshSDK.getCurrentLocation();r={location:{getValue:i.getValue,getMetadata:i.getMetadata,setValue:async(d,m)=>{await i.setValue(d,m),o(window.UniformMeshSDK.getCurrentLocation())},setValidationResult:async d=>{await i.setValidationResult(d)}}}}return e(Ee.Provider,{value:r},t)},Ie=()=>{let t=ir(Ee);if(!t)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return t};function ho(){let{location:t}=Ie();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}}import{initializeUniformMeshSDK as cr}from"@uniformdev/mesh-sdk";import{useEffect as dr,useState as De}from"react";var Co=({autoResizingDisabled:t}={})=>{let[n,o]=De(),[r,i]=De();return dr(()=>{typeof window=="undefined"||r||(typeof window.UniformMeshSDK=="undefined"?cr({autoResizingDisabled:t}).then(d=>{i(d)}).catch(d=>{o(d)}):i(window.UniformMeshSDK))},[t]),{initializing:!r&&!n,error:n,sdk:r}};import{createContext as lr,useContext as pr}from"react";import{Theme as ur}from"@uniformdev/design-system";var Ge=lr(void 0),Mo=({children:t})=>{let n;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(n={sdk:window.UniformMeshSDK}),e(Ge.Provider,{value:n},e(ur,null),e(Te,null,t))},ze=()=>{let t=pr(Ge);if(!t)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return t};function To(){let{sdk:t}=ze();return t}import _e from"react";import vr,{useMemo as ie,useContext as hr}from"react";import{css as ee}from"@emotion/react";import{InputSelect as mr}from"@uniformdev/design-system";import Ue from"react";var Ae=({value:t,text:n,loading:o})=>e(Ue.Fragment,null,!!n&&n,!n&&e(Ue.Fragment,null,o&&`${t} (Loading...)`,!o&&`${t} (Unresolvable)`));var Be=({id:t,label:n,loading:o,selectedValues:r,values:i,onAdd:d,onRemove:m})=>{var b;let v=(b=i==null?void 0:i.filter(a=>!(r!=null&&r.includes(a.id.toString()))))!=null?b:[],h=(a,g)=>{a.preventDefault(),m(g)};return e("div",null,e(mr,{id:t,name:t,label:n,onChange:a=>d(a.target.value),disabled:o,options:[{value:"",label:"Add..."},...v.map(a=>({value:a.id,label:a.name||a.id}))],css:Array.isArray(r)&&r.length>0?ee`
|
|
2
2
|
margin-bottom: var(--spacing-base);
|
|
3
|
-
`:""}),r==null?void 0:r.map(a=>{var
|
|
3
|
+
`:""}),r==null?void 0:r.map(a=>{var g;return e("div",{css:ee`
|
|
4
4
|
font-size: var(--fs-sm);
|
|
5
5
|
display: inline-flex;
|
|
6
6
|
align-items: center;
|
|
@@ -12,19 +12,19 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
12
12
|
`,key:a},e("span",{css:ee`
|
|
13
13
|
padding: var(--spacing-3);
|
|
14
14
|
color: var(--gray-800);
|
|
15
|
-
`},e(Ae,{value:a,loading:o,text:(
|
|
15
|
+
`},e(Ae,{value:a,loading:o,text:(g=i.find(S=>S.id===a))==null?void 0:g.name})),e("button",{css:ee`
|
|
16
16
|
padding: var(--spacing-3);
|
|
17
17
|
border-left: 1px solid var(--gray-300);
|
|
18
|
-
`,title:"remove",onClick:
|
|
18
|
+
`,title:"remove",onClick:S=>h(S,a)},e("svg",{xmlns:"http://www.w3.org/2000/svg",css:ee`
|
|
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"},e("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"},e("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 gr=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("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"})),ne=gr;var fr=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})),ae=fr;import{useAsyncFn as br,useDebounce as yr}from"react-use";import{Input as Oe,InputSelect as se,mq as ce}from"@uniformdev/design-system";import{css as P}from"@emotion/react";var He={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Xo=({value:t,setValue:n,brands:o,categories:r,loading:i,categoriesLoading:d,brandsLoading:m,logoIcon:v,onGetProducts:h,sortOptions:b,sortOrderOptions:a,categoryLabel:g="Product Category",brandLabel:S="Brand",disableBrands:N,restrictToSingleCategory:U=!1})=>{var x,O,Z;let w=async s=>{n({...He,...t||{},...s})},y=ie(()=>({...He,...t||{}}),[t]),[_,F]=br(async s=>await h(s),[h]);yr(async()=>{await F({brand:y.brand,categories:y.categories,keyword:y.keyword,sort:y.sort,sortOrder:y.sortOrder,count:y.count})},250,[y]);let D=ie(()=>{let s=[];return r==null||r.forEach(L=>{let Y=$e(L,void 0);s.push(...Y)}),s},[r]),A=ie(()=>[{value:"",label:"All categories"},...D.map(s=>({label:s.name,value:s.id}))],[D]),re=ie(()=>(o==null?void 0:o.map(s=>({id:s.id.toString(),name:s.name})))||[],[o]),W=s=>{let L=(t==null?void 0:t.categories)||[];w({categories:[...L,s]})},B=s=>{var L;w({categories:(L=t==null?void 0:t.categories)==null?void 0:L.filter(Y=>Y!==s)})},G=s=>{w({brand:s.target.value})},u=s=>{w({count:s||1})};return i?e("div",null,"Loading..."):e(Ke.Provider,{value:{categories:r,logoIcon:v}},e("div",{css:P`
|
|
24
24
|
> :not(:last-child) {
|
|
25
25
|
margin-bottom: var(--spacing-md);
|
|
26
26
|
}
|
|
27
|
-
`},U?e(se,{id:"selection-field-product-category",label:
|
|
27
|
+
`},U?e(se,{id:"selection-field-product-category",label:g,disabled:i,value:(O=(x=y.categories)==null?void 0:x[0])!=null?O:"",options:A,onChange:s=>{w({categories:s.target.value===""?[]:[s.target.value]})}}):e(Be,{loading:d||!1,id:"selection-field-product-category",label:g,onAdd:W,onRemove:B,selectedValues:y.categories,values:D}),e("div",{css:P`
|
|
28
28
|
display: flex;
|
|
29
29
|
flex-wrap: wrap;
|
|
30
30
|
column-gap: var(--spacing-lg);
|
|
@@ -32,12 +32,12 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
32
32
|
${ce("md")} {
|
|
33
33
|
flex-wrap: nowrap;
|
|
34
34
|
}
|
|
35
|
-
`},
|
|
35
|
+
`},N?null:e("div",{css:P`
|
|
36
36
|
width: 50%;
|
|
37
|
-
`},e(se,{id:"brand",name:"brand",label:
|
|
37
|
+
`},e(se,{id:"brand",name:"brand",label:S,disabled:m,value:y.brand,onChange:G,options:[{value:"",label:"Choose..."},...re.map(s=>({value:s.id,label:s.name}))]})),e("div",{css:P`
|
|
38
38
|
flex-grow: 1;
|
|
39
39
|
position: relative;
|
|
40
|
-
`},e(Oe,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:y.keyword,placeholder:"Enter keyword",onChange:s=>
|
|
40
|
+
`},e(Oe,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:y.keyword,placeholder:"Enter keyword",onChange:s=>w({keyword:s.target.value})}))),e("div",{css:P`
|
|
41
41
|
display: flex;
|
|
42
42
|
flex-wrap: wrap;
|
|
43
43
|
column-gap: var(--spacing-lg);
|
|
@@ -62,14 +62,14 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
62
62
|
${ce("md")} {
|
|
63
63
|
width: 33.333333%;
|
|
64
64
|
}
|
|
65
|
-
`},e(se,{id:"sort",name:"sort",label:"Sort",value:y.sort,onChange:s=>
|
|
65
|
+
`},e(se,{id:"sort",name:"sort",label:"Sort",value:y.sort,onChange:s=>w({sort:s.target.value}),options:[{value:"",label:"Select a sort"},...b.map(s=>({value:s.sortKey,label:s.name}))]})):null,Array.isArray(a)&&a.length>0?e("div",{css:P`
|
|
66
66
|
flex-grow: 1;
|
|
67
|
-
`},e(se,{id:"sort-order",name:"sort-order",label:"Sort Order",value:y.sortOrder,onChange:s=>
|
|
67
|
+
`},e(se,{id:"sort-order",name:"sort-order",label:"Sort Order",value:y.sortOrder,onChange:s=>w({sortOrder:s.target.value}),options:a.map(s=>({value:s.sortOrderKey,label:s.name}))})):null),e("div",null,e("h3",{css:P`
|
|
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"),e(Ne,{products:(Z=
|
|
72
|
+
`},"Result Preview"),e(Ne,{products:(Z=_.value)==null?void 0:Z.products}))))};function $e(t,n){var d;let o=[],r=n?`${n.name} > `:"",i={id:t.id.toString(),name:`${r}${t.name}`};return o.push(i),(d=t.children)==null||d.forEach(m=>{let v=$e(m,i);o.push(...v)}),o}function Fe({onCountChange:t,countIcon:n,disabled:o}){return e("button",{css:P`
|
|
73
73
|
width: 2.25rem;
|
|
74
74
|
height: 2.25rem;
|
|
75
75
|
border: 1px solid var(--gray-300);
|
|
@@ -91,12 +91,12 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
91
91
|
`}):e(ae,{css:P`
|
|
92
92
|
width: 1rem;
|
|
93
93
|
height: 1rem;
|
|
94
|
-
`}))}var Ke=
|
|
94
|
+
`}))}var Ke=vr.createContext(void 0),Qe=()=>{let t=hr(Ke);if(!t)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return t};function H({src:t,alt:n,className:o}){let r=t&&typeof t!="string"?t:null;return r?e(r,{className:o}):e("img",{src:t,alt:n,className:o})}import{css as R}from"@emotion/react";import{scrollbarStyles as Sr}from"@uniformdev/design-system";var Ne=({products:t})=>{let{categories:n,logoIcon:o}=Qe();return e(_e.Fragment,null,e("p",{css:R`
|
|
95
95
|
margin-bottom: var(--spacing-base);
|
|
96
96
|
`},"Matching ",(t==null?void 0:t.length)||0," products"),e("ul",{css:[R`
|
|
97
97
|
max-height: 24rem;
|
|
98
98
|
overflow-x: auto;
|
|
99
|
-
`,
|
|
99
|
+
`,Sr]},t==null?void 0:t.map((r,i)=>{var v;let[d]=(r==null?void 0:r.categories)||[],m=typeof d=="undefined"||!n||(v=n.find(h=>h.id===d.id))==null?void 0:v.name;return e("li",{key:`product-${r.id}`,css:R`
|
|
100
100
|
border: 1px solid var(--gray-300);
|
|
101
101
|
border-radius: var(--rounded-md);
|
|
102
102
|
background-color: var(--gray-100);
|
|
@@ -150,7 +150,7 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
150
150
|
`},"Edit"),o?e(H,{src:o,alt:"Logo",css:R`
|
|
151
151
|
width: 2.25rem;
|
|
152
152
|
height: 2.25rem;
|
|
153
|
-
`}):null))))})))};import
|
|
153
|
+
`}):null))))})))};import eo,{useContext as to,useMemo as ro,useRef as oo}from"react";import*as T from"react";var fe={};nr(fe,{Caution:()=>We,Checkmark:()=>de,ChevronDown:()=>le,Close:()=>J,Danger:()=>Ze,ExclamationPoint:()=>qe,Info:()=>X,Lightbulb:()=>Je,MagnifyingGlass:()=>Xe,MaximizeAlt:()=>Ye,Minus:()=>ae,MoreVerticalAlt:()=>te,Plus:()=>ne});var wr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...t},e("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"})),We=wr;var Cr=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("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"})),de=Cr;var Pr=t=>e("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...t},e("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"})),le=Pr;var Rr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...t},e("g",{fillRule:"evenodd"},e("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"}),e("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"}))),J=Rr;var kr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},e("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"})),Ze=kr;var xr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...t},e("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"})),qe=xr;var Lr=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("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"}),e("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"})),X=Lr;var Mr=t=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...t},e("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"})),Je=Mr;var Vr=t=>e("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},e("g",{clipPath:"url(#magnifying-glass_svg__a)"},e("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"}),e("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"})),e("defs",null,e("clipPath",{id:"magnifying-glass_svg__a"},e("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})))),Xe=Vr;var Er=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("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"})),Ye=Er;var Tr=t=>e("svg",{width:"1em",height:"1em",fill:"currentColor",...t},e("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"})),te=Tr;import{useThrottle as Hr}from"react-use";import{v4 as Fr}from"uuid";import Dr,{useState as Gr,useRef as dt,useEffect as zr}from"react";function je(t,n){let o=window.open(t,"_blank"),r=setInterval(()=>{o!=null&&o.closed&&(clearInterval(r),n())},500)}import{format as Ur}from"timeago.js";import{css as E}from"@emotion/react";import{mq as Ir}from"@uniformdev/design-system";var et=E`
|
|
154
154
|
border: 1px solid var(--gray-200);
|
|
155
155
|
background: var(--gray-50);
|
|
156
156
|
border-radius: var(--rounded-base);
|
|
@@ -185,6 +185,7 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
185
185
|
background: var(--white);
|
|
186
186
|
border-radius: var(--rounded-base);
|
|
187
187
|
border-left: 4px solid var(--brand-secondary-3);
|
|
188
|
+
box-shadow: var(--shadow-base);
|
|
188
189
|
position: fixed;
|
|
189
190
|
padding: var(--spacing-base);
|
|
190
191
|
z-index: var(--z-10);
|
|
@@ -199,8 +200,9 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
199
200
|
flex-direction: column;
|
|
200
201
|
gap: var(--spacing-sm);
|
|
201
202
|
|
|
202
|
-
${
|
|
203
|
+
${Ir("md")} {
|
|
203
204
|
flex-direction: row;
|
|
205
|
+
min-width: 200px;
|
|
204
206
|
}
|
|
205
207
|
`,ve=E`
|
|
206
208
|
align-items: center;
|
|
@@ -215,40 +217,42 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
215
217
|
&:hover {
|
|
216
218
|
background: var(--gray-50);
|
|
217
219
|
}
|
|
218
|
-
`;import{css as z}from"@emotion/react";var lt=({selectedItem:t,logoIcon:n,onDeselect:o,onEditClosed:r})=>{var b;let i=dt(null),d=dt(null),[m,
|
|
220
|
+
`;import{css as z}from"@emotion/react";var lt=({selectedItem:t,logoIcon:n,onDeselect:o,onEditClosed:r})=>{var b;let i=dt(null),d=dt(null),[m,v]=Gr(!1);zr(()=>{let a=S=>{i.current&&!i.current.contains(S.target)&&d.current&&!d.current.contains(S.target)&&v(!1)},g=()=>{v(!1)};return window.addEventListener("resize",g,!0),document.addEventListener("scroll",a,!0),document.addEventListener("mousedown",a),()=>{window.removeEventListener("resize",g,!0),document.removeEventListener("scroll",a,!0),document.removeEventListener("mousedown",a)}},[d]);let h=()=>{var a;if(v(!m),d.current&&i.current){let g=(a=i==null?void 0:i.current)==null?void 0:a.getBoundingClientRect(),S=d.current.offsetWidth;d.current.style.top=`${g.top+30}px`,d.current.style.left=`${g.left-S+30}px`}};return e("div",{css:et,key:t.id},e("div",{css:tt},e("div",{css:rt},e("div",{css:ot},e("h4",{css:[nt,t.popoverData?z`
|
|
219
221
|
margin-bottom: var(--spacing-sm);
|
|
220
|
-
`:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?e(
|
|
222
|
+
`:""],title:`ID: ${t.id}`,"data-test-id":"entry-id"},t.title||t.id||""),t.popoverData?e(Dr.Fragment,null,e("button",{type:"button",ref:i,css:z`
|
|
221
223
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
222
|
-
`,"aria-controls":"path-details","aria-expanded":m,onClick:
|
|
224
|
+
`,"aria-controls":"path-details","aria-expanded":m,onClick:h},e(X,{width:24,height:24,css:z`
|
|
223
225
|
color: var(--gray-400);
|
|
224
226
|
`})),e("div",{id:"path-details","aria-hidden":!m,ref:d,css:[st,m?z`
|
|
225
227
|
visibility: visible;
|
|
226
228
|
`:z`
|
|
227
229
|
visibility: hidden;
|
|
228
|
-
`]},Object.entries(t.popoverData).map(([a,
|
|
230
|
+
`]},Object.entries(t.popoverData).map(([a,g],S)=>e("div",{css:$,key:S},e("span",{css:pe},a,":"),g)))):null),t.createdDate&&e("div",{css:$},e("span",{css:pe},"Created:"),Ur((b=t.createdDate)!=null?b:0)),e("div",{css:z`
|
|
229
231
|
display: flex;
|
|
230
232
|
gap: var(--spacing-base);
|
|
231
|
-
`},t.metadata?Object.entries(t.metadata).filter(([a])=>["type","status"].includes(a.toLocaleLowerCase())).map(([a,
|
|
233
|
+
`},t.metadata?Object.entries(t.metadata).filter(([a])=>["type","status"].includes(a.toLocaleLowerCase())).map(([a,g])=>e("span",{css:$,key:a},g)):null),t.metadata?Object.entries(t.metadata).filter(([a])=>!["type","status"].includes(a.toLocaleLowerCase())).map(([a,g])=>e("div",{css:[$,z`
|
|
232
234
|
order: 1;
|
|
233
235
|
`],key:a},e("span",{css:[pe,z`
|
|
234
236
|
order: 1;
|
|
235
|
-
`]},a,":"),
|
|
237
|
+
`]},a,":"),g)):null),e("div",{css:ct},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",onClick:a=>{r&&(je(a.currentTarget.href,()=>r(t)),a.preventDefault())},css:ve},e("span",{css:$},"Edit"),e(H,{src:n,css:at,alt:"Logo"})):null,e("button",{type:"button",onClick:a=>{a.preventDefault(),o(t)},css:ve},e("span",{css:$},"Unlink"),e(J,{css:[it,z`
|
|
236
238
|
color: var(--brand-secondary-5);
|
|
237
|
-
`]})))))};import
|
|
239
|
+
`]})))))};import Ar,{useState as Br,useRef as vt,useEffect as Or}from"react";import{css as K}from"@emotion/react";var pt=K`
|
|
238
240
|
cursor: pointer;
|
|
239
241
|
padding: var(--spacing-sm);
|
|
240
242
|
position: relative;
|
|
241
243
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
242
244
|
color var(--duration-fast) var(--timing-ease-out);
|
|
243
|
-
`,ut=
|
|
245
|
+
`,ut=K`
|
|
246
|
+
padding-right: var(--spacing-lg);
|
|
247
|
+
`,mt=K`
|
|
244
248
|
background: var(--brand-secondary-3);
|
|
245
249
|
color: var(--white);
|
|
246
|
-
`,he=
|
|
250
|
+
`,he=K`
|
|
247
251
|
font-size: var(--fs-xs);
|
|
248
|
-
`,be=
|
|
252
|
+
`,be=K`
|
|
249
253
|
font-weight: var(--fw-bold);
|
|
250
254
|
margin-right: var(--spacing-sm);
|
|
251
|
-
`,
|
|
255
|
+
`,gt=K`
|
|
252
256
|
background: var(--white);
|
|
253
257
|
border-left: 4px solid var(--brand-secondary-3);
|
|
254
258
|
border-radius: var(--rounded-base);
|
|
@@ -260,20 +264,20 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
260
264
|
right: var(--spacing-xl);
|
|
261
265
|
z-index: var(--z-10);
|
|
262
266
|
width: max-content;
|
|
263
|
-
`,
|
|
267
|
+
`,ft=K`
|
|
264
268
|
position: absolute;
|
|
265
269
|
inset: 0 var(--spacing-sm) 0 auto;
|
|
266
|
-
`;import{css as
|
|
270
|
+
`;import{css as ht}from"@emotion/react";var bt=({result:t,isSelected:n,triggerSelection:o})=>{let r=vt(null),i=vt(null),[d,m]=Br(!1);Or(()=>{function h(b){r.current&&!r.current.contains(b.target)&&i.current&&!i.current.contains(b.target)&&m(!1)}return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[i]);let v=h=>{h.stopPropagation(),m(!d)};return e("div",{key:t.id,css:[pt,n?mt:void 0,t.popoverData?ut:void 0],"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o()},t.title,t.popoverData&&n?e(Ar.Fragment,null,e("button",{type:"button",ref:r,css:ft,"aria-controls":"path-details",onClick:h=>v(h),"aria-expanded":d},e(X,{width:24,height:24})),e("div",{id:"path-details","aria-hidden":!d,ref:i,css:[gt,d?ht`
|
|
267
271
|
visibility: visible;
|
|
268
|
-
`:
|
|
272
|
+
`:ht`
|
|
269
273
|
visibility: hidden;
|
|
270
|
-
`]},t.metadata&&Object.entries(t.metadata).map(([
|
|
274
|
+
`]},t.metadata&&Object.entries(t.metadata).map(([h,b],a)=>e("div",{css:he,key:a},e("span",{css:be},h,":"),b)),Object.entries(t.popoverData).map(([h,b],a)=>e("div",{css:he,key:a},e("span",{css:be},h,":"),b)))):null)};import{Droppable as $r,DragDropContext as Kr,Draggable as Qr}from"react-beautiful-dnd";import{css as C}from"@emotion/react";var yt=C`
|
|
271
275
|
background: var(--white);
|
|
272
276
|
border: 1px solid var(--gray-300);
|
|
273
277
|
border-radius: var(--rounded-base);
|
|
274
278
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
|
|
275
279
|
margin-bottom: var(--spacing-base);
|
|
276
|
-
`,
|
|
280
|
+
`,St=C`
|
|
277
281
|
align-items: center;
|
|
278
282
|
display: flex;
|
|
279
283
|
position: relative;
|
|
@@ -281,7 +285,7 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
281
285
|
width: 100%;
|
|
282
286
|
background-color: transparent;
|
|
283
287
|
border: 0;
|
|
284
|
-
`,
|
|
288
|
+
`,wt=C`
|
|
285
289
|
color: var(--brand-secondary-1);
|
|
286
290
|
display: block;
|
|
287
291
|
font-weight: var(--fw-bold);
|
|
@@ -297,15 +301,15 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
297
301
|
background: var(--gray-100);
|
|
298
302
|
outline: none;
|
|
299
303
|
}
|
|
300
|
-
`,
|
|
304
|
+
`,Ct=C`
|
|
301
305
|
background: var(--white);
|
|
302
306
|
border: 1px solid var(--gray-300);
|
|
303
307
|
border-radius: var(--rounded-base);
|
|
304
308
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
|
|
305
309
|
display: block;
|
|
306
|
-
`,Ct=C`
|
|
307
|
-
display: none;
|
|
308
310
|
`,Pt=C`
|
|
311
|
+
display: none;
|
|
312
|
+
`,Rt=C`
|
|
309
313
|
overflow-y: auto;
|
|
310
314
|
max-height: 16rem;
|
|
311
315
|
margin-bottom: var(--spacing-base);
|
|
@@ -313,23 +317,23 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
313
317
|
& > :not(:last-child) {
|
|
314
318
|
border-bottom: 1px solid var(--gray-200);
|
|
315
319
|
}
|
|
316
|
-
`,
|
|
320
|
+
`,Xn=C`
|
|
317
321
|
background-color: var(--gray-50);
|
|
318
322
|
max-width: 33.33%;
|
|
319
|
-
`,
|
|
323
|
+
`,kt=C`
|
|
320
324
|
align-items: center;
|
|
321
325
|
display: flex;
|
|
322
326
|
position: absolute;
|
|
323
327
|
inset: 0 0 0 auto;
|
|
324
328
|
pointer-events: none;
|
|
325
329
|
padding-right: var(--spacing-sm);
|
|
326
|
-
`,
|
|
330
|
+
`,xt=C`
|
|
327
331
|
color: var(--brand-secondary-1);
|
|
328
332
|
width: 1.25rem;
|
|
329
333
|
height: 1.25rem;
|
|
330
334
|
transition: transform var(--duration-fast) var(--timing-ease-out);
|
|
331
335
|
transform: rotate(0);
|
|
332
|
-
`,
|
|
336
|
+
`,Yn=C`
|
|
333
337
|
background: var(--white);
|
|
334
338
|
color: var(--brand-secondary-1);
|
|
335
339
|
`,Lt=C`
|
|
@@ -339,7 +343,7 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
339
343
|
&:hover > span {
|
|
340
344
|
opacity: 0.3;
|
|
341
345
|
}
|
|
342
|
-
`,
|
|
346
|
+
`,Mt=C`
|
|
343
347
|
align-items: center;
|
|
344
348
|
display: flex;
|
|
345
349
|
position: absolute;
|
|
@@ -348,103 +352,103 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
348
352
|
opacity: 0;
|
|
349
353
|
`,ye=C`
|
|
350
354
|
color: var(--brand-secondary-1);
|
|
351
|
-
`,
|
|
355
|
+
`,Vt=C`
|
|
352
356
|
position: absolute;
|
|
353
357
|
left: 0.375rem;
|
|
354
358
|
`,Se=C`
|
|
355
359
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
356
360
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
357
|
-
`;import{css as I}from"@emotion/react";import{InputSelect as
|
|
361
|
+
`;import{css as I}from"@emotion/react";import{InputSelect as Nr,scrollbarStyles as _r,Button as we,Callout as Wr,InputKeywordSearch as Zr,LoadingIndicator as Et,Menu as qr,MenuItem as Jr}from"@uniformdev/design-system";var Xr=({searchText:t,selectedContentType:n})=>{let o="No content found";return n&&(o=`No ${n} content was found`),t&&(o=`${o} for keyword '${t}'.`),e(Wr,{type:"info"},o)},Tt=({search:t,results:n,contentTypes:o,selectedItems:r,logoIcon:i,select:d,multiSelect:m,multiSelectId:v,rowComponent:h,selectedItemComponent:b,totalResults:a,resultsLoading:g,requireContentType:S,onAddNew:N,onEditClosed:U,onCancel:w,noResultsComponent:y,helpComponent:_,onSort:F,typeSelectorLabel:D="Content Type Select",typeSelectorAllTypesOptionText:A="All content types"})=>{var Le,Me,Ve;let W=()=>S?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[B,G]=T.useState(""),[u,x]=T.useState(W),[O,Z]=T.useState(!1),[s,L]=T.useState([]),[Y,Pe]=T.useState(!1),oe=Hr(B,750);T.useEffect(()=>{t(oe,{count:5,offset:0,contentType:u==="any"?void 0:u})},[oe,u]);let _t=c=>{s.some(f=>f.id===c.id)?L(f=>f.filter(q=>q.id!==c.id)):L(m?f=>[...f,c]:[c])},Wt=()=>{x(W()),G(""),L(r!=null&&r.length?r:[])},Zt=()=>{Z(c=>!c),O||Wt()},Re=c=>{d((r==null?void 0:r.filter(f=>f.id!==c.id))||[],"")},qt=c=>{c.preventDefault(),d(s,u),Z(!1)},Jt=c=>{c.preventDefault(),Z(!1),w&&w()},Xt=c=>{c.preventDefault(),t(oe,{count:5,offset:(n==null?void 0:n.length)||0,contentType:u==="any"?void 0:u}),Pe(!0);let f=setTimeout(()=>{Pe(!1)},750);return()=>clearTimeout(f)},ge=T.useRef(Fr()),Yt=!(r==null?void 0:r.length)||m,jt=h||bt,ke=b||lt,er=y||Xr,xe=i&&typeof i!="string"?i:null,tr=xe?e(xe,{css:Se}):e("img",{src:i,alt:"Logo",css:Se}),rr=c=>{var f,q;if(c.destination&&c.source.droppableId===((f=c.destination)==null?void 0:f.droppableId)){let M=[...r||[]],[j]=(q=M==null?void 0:M.splice(c.source.index,1))!=null?q:[];return M==null||M.splice(c.destination.index,0,j),F==null||F(M),M}};return e("div",{css:I`
|
|
358
362
|
width: 100%;
|
|
359
363
|
`},e("div",{css:I`
|
|
360
364
|
position: relative;
|
|
361
365
|
margin-block: var(--spacing-base);
|
|
362
|
-
`},
|
|
366
|
+
`},Yt&&e(T.Fragment,null,e("div",{css:yt,"data-test-id":"component-search"},e("button",{css:St,onClick:Zt,type:"button","aria-haspopup":!0,"aria-expanded":O,"aria-controls":`entry-search-config-${ge.current}`},tr,e("span",{css:I`
|
|
363
367
|
margin-left: var(--spacing-base);
|
|
364
|
-
`},"Select"),e("span",{css:
|
|
368
|
+
`},"Select"),e("span",{css:kt},e(le,{css:[xt,O?I`
|
|
365
369
|
transform: rotate(180deg);
|
|
366
|
-
`:void 0]})))),e("div",{id:`entry-search-config-${ge.current}`,"aria-hidden":!O,css:[
|
|
370
|
+
`:void 0]})))),e("div",{id:`entry-search-config-${ge.current}`,"aria-hidden":!O,css:[Ct,O?void 0:Pt]},_||null,e("div",{css:I`
|
|
367
371
|
display: flex;
|
|
368
372
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
369
373
|
margin-bottom: var(--spacing-base);
|
|
370
|
-
`},e(
|
|
374
|
+
`},e(Nr,{onChange:c=>x(c.target.value),value:u,label:D,showLabel:!1,options:[...S?[]:[{value:"any",label:A}],...o?o.map(c=>({value:c.id,label:c.name})):[]]}),e("div",{css:I`
|
|
371
375
|
flex-grow: 1;
|
|
372
|
-
`},e(Zr,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:G,disabledFieldSubmission:!0,value:B}))),e("div",{css:[
|
|
376
|
+
`},e(Zr,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:G,disabledFieldSubmission:!0,value:B}))),e("div",{css:[Rt,_r],id:ge.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list"},!g&&Array.isArray(n)?n.map(c=>e(jt,{key:c.id,isSelected:s.some(f=>f.id===c.id),result:c,triggerSelection:()=>_t(c)})):g?null:e(er,{searchText:oe||B,selectedContentType:(Me=(Le=o==null?void 0:o.find(c=>c.id===u))==null?void 0:Le.name)!=null?Me:u}),!g&&typeof a!="undefined"&&n&&(n==null?void 0:n.length)<a&&e("button",{css:wt,onClick:Xt},Y?e(Et,null):"Load More"),g&&!(n!=null&&n.length)?e("div",{css:I`
|
|
373
377
|
padding: var(--spacing-base);
|
|
374
378
|
text-align: center;
|
|
375
379
|
width: 100%;
|
|
376
|
-
`},e(
|
|
380
|
+
`},e(Et,null)):null),e("div",{css:I`
|
|
377
381
|
display: flex;
|
|
378
382
|
justify-content: space-between;
|
|
379
|
-
`},e("div",null,
|
|
383
|
+
`},e("div",null,N&&((Ve=o==null?void 0:o.length)!=null?Ve:0)>0?e(qr,{menuLabel:"Add new menu",menuTrigger:e(we,{buttonType:"secondary"},"Add New")},o==null?void 0:o.map(c=>e(Jr,{key:c.id,css:I`
|
|
380
384
|
background: var(--white);
|
|
381
385
|
color: var(--brand-secondary-1);
|
|
382
|
-
`,onClick:()=>
|
|
386
|
+
`,onClick:()=>N(c)},c.name))):null),e("div",{css:I`
|
|
383
387
|
display: flex;
|
|
384
388
|
gap: var(--spacing-base);
|
|
385
|
-
`},e(we,{buttonType:"unimportant",onClick:
|
|
389
|
+
`},e(we,{buttonType:"unimportant",onClick:Jt},"Cancel"),e(we,{disabled:!s.length,onClick:qt,"data-test-id":"entry-accept-button"},"Accept"))))),m?e(Kr,{onDragEnd:c=>rr(c)},e($r,{droppableId:v||"canvas-multi-select"},c=>e("div",{...c.droppableProps,ref:c.innerRef,css:I`
|
|
386
390
|
margin-block: var(--spacing-sm) 0;
|
|
387
|
-
`},r==null?void 0:r.map((
|
|
391
|
+
`},r==null?void 0:r.map((f,q)=>{if(f!=null&&f.id)return e(Qr,{key:f.id,draggableId:f.id,index:q},M=>e("div",{css:Lt,ref:M.innerRef,...M.draggableProps,...M.dragHandleProps},e("span",{css:Mt},e(te,{css:[ye,Vt],width:24,height:24}),e(te,{css:ye,width:24,height:24})),e(ke,{key:`selected-item-${f.id}`,logoIcon:i,selectedItem:f,onDeselect:j=>Re(j),onEditClosed:U?j=>U(j):void 0})))}),c.placeholder))):r==null?void 0:r.map(c=>e(ke,{key:`selected-item-${c.id}`,logoIcon:i,selectedItem:c,onDeselect:f=>Re(f),onEditClosed:U?f=>U(f):void 0}))))};import{css as Q}from"@emotion/react";var It=Q`
|
|
388
392
|
cursor: pointer;
|
|
389
393
|
padding: var(--spacing-sm) 0;
|
|
390
394
|
margin-right: var(--spacing-sm);
|
|
391
395
|
position: relative;
|
|
392
396
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
393
397
|
color var(--duration-fast) var(--timing-ease-out);
|
|
394
|
-
`,
|
|
398
|
+
`,Dt=Q`
|
|
395
399
|
border: 2px solid transparent;
|
|
396
400
|
border-radius: var(--rounded-base);
|
|
397
401
|
display: flex;
|
|
398
402
|
align-items: center;
|
|
399
403
|
gap: var(--spacing-base);
|
|
400
404
|
padding: var(--spacing-sm) var(--spacing-xs);
|
|
401
|
-
`,
|
|
405
|
+
`,Gt=Q`
|
|
402
406
|
background-color: var(--green-50);
|
|
403
|
-
`,
|
|
407
|
+
`,zt=Q`
|
|
404
408
|
font-size: var(--fs-sm);
|
|
405
409
|
font-weight: var(--fw-bold);
|
|
406
410
|
width: 50%;
|
|
407
|
-
`,
|
|
411
|
+
`,Ut=Q`
|
|
408
412
|
font-weight: var(--fw-normal);
|
|
409
413
|
display: block;
|
|
410
|
-
`,
|
|
414
|
+
`,At=Q`
|
|
411
415
|
font-size: var(--fs-sm);
|
|
412
416
|
> * {
|
|
413
417
|
display: block;
|
|
414
418
|
}
|
|
415
|
-
`,
|
|
419
|
+
`,Bt=Q`
|
|
416
420
|
display: block;
|
|
417
421
|
height: 1.5rem;
|
|
418
422
|
width: 1.5rem;
|
|
419
423
|
color: var(--brand-secondary-3);
|
|
420
424
|
margin-left: auto;
|
|
421
|
-
`;import{css as
|
|
425
|
+
`;import{css as Ot}from"@emotion/react";function Ht({result:t,isSelected:n,triggerSelection:o}){var v;let{categories:r,logoIcon:i}=ue(),[d]=t.categories||[{id:"",name:""}],m=typeof d=="undefined"||!r||(v=r.find(h=>h.id===d.id))==null?void 0:v.name;return e("div",{key:t.id,"data-value":t.id,role:"option",tabIndex:-1,onClick:()=>o(),css:[It]},e("div",{css:[Dt,n?Gt:void 0]},t.thumbnailUrl?e("img",{src:t.thumbnailUrl,alt:`Thumbnail for ${t.title}`,css:Ot`
|
|
422
426
|
background-color: var(--gray-200);
|
|
423
427
|
width: 3rem;
|
|
424
428
|
height: 3rem;
|
|
425
429
|
object-fit: cover;
|
|
426
|
-
`}):e(H,{src:i,alt:"Logo",css:
|
|
430
|
+
`}):e(H,{src:i,alt:"Logo",css:Ot`
|
|
427
431
|
height: 2.25rem;
|
|
428
432
|
width: 2.25rem;
|
|
429
|
-
`}),e("h4",{css:[
|
|
433
|
+
`}),e("h4",{css:[zt]},t.title,m?e("span",{css:[Ut]},m):null),e("p",{css:[At]},"SKU: ",t.sku||t.id,t.price!==void 0?e("span",null,t.price):null),n?e(de,{css:[Bt]}):null))}import{css as me}from"@emotion/react";import{mq as Yr}from"@uniformdev/design-system";var Ft=me`
|
|
430
434
|
display: flex;
|
|
431
435
|
width: 100%;
|
|
432
436
|
border: 1px solid var(--gray-300);
|
|
433
437
|
border-radius: var(--rounded-base);
|
|
434
438
|
background-color: var(--gray-100);
|
|
435
439
|
margin: var(--spacing-base) 0;
|
|
436
|
-
|
|
440
|
+
`,$t=me`
|
|
437
441
|
padding: var(--spacing-base) 0 var(--spacing-base) var(--spacing-lg);
|
|
438
442
|
display: flex;
|
|
439
443
|
flex-grow: 1;
|
|
440
444
|
align-items: center;
|
|
441
445
|
margin-right: var(--spacing-sm);
|
|
442
446
|
gap: var(--spacing-base);
|
|
443
|
-
|
|
447
|
+
`,Kt=me`
|
|
444
448
|
display: flex;
|
|
445
449
|
align-items: center;
|
|
446
450
|
gap: var(--spacing-sm);
|
|
447
|
-
${
|
|
451
|
+
${Yr("lg")} {
|
|
448
452
|
width: 50%;
|
|
449
453
|
margin-bottom: 0;
|
|
450
454
|
}
|
|
@@ -453,7 +457,7 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
453
457
|
width: 3.5rem;
|
|
454
458
|
height: 3.5rem;
|
|
455
459
|
object-fit: cover;
|
|
456
|
-
`;import{css as k}from"@emotion/react";import{mq as
|
|
460
|
+
`;import{css as k}from"@emotion/react";import{mq as jr}from"@uniformdev/design-system";function Qt({selectedItem:t,onDeselect:n}){var m;let{categories:o,logoIcon:r}=ue(),[i]=t.categories||[{id:"",name:""}],d=typeof i=="undefined"||!o||(m=o.find(v=>v.id===i.id))==null?void 0:m.name;return e("div",{css:[Ft],key:t.id},e("article",{css:[$t]},e("div",{css:[Kt]},t.thumbnailUrl?e("img",{src:t.thumbnailUrl,alt:d,css:[Ce],loading:"lazy"}):e("div",{css:[Ce]}),e("div",{css:k`
|
|
457
461
|
> :not(:last-child) {
|
|
458
462
|
margin-bottom: var(--spacing-xs);
|
|
459
463
|
}
|
|
@@ -476,7 +480,7 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
476
480
|
gap: var(--spacing-sm);
|
|
477
481
|
justify-content: flex-end;
|
|
478
482
|
margin-left: auto;
|
|
479
|
-
${
|
|
483
|
+
${jr("md")} {
|
|
480
484
|
align-items: center;
|
|
481
485
|
}
|
|
482
486
|
`},t.editLink?e("a",{href:t.editLink,title:"edit",rel:"noopener",target:"__blank",css:k`
|
|
@@ -497,7 +501,7 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
497
501
|
width: 1.75rem;
|
|
498
502
|
height: 1.75rem;
|
|
499
503
|
display: block;
|
|
500
|
-
`})):null,e("button",{type:"button",onClick:
|
|
504
|
+
`})):null,e("button",{type:"button",onClick:v=>{v.preventDefault(),n==null||n(t)},css:k`
|
|
501
505
|
display: flex;
|
|
502
506
|
justify-content: space-between;
|
|
503
507
|
align-items: center;
|
|
@@ -512,6 +516,6 @@ var rr=Object.defineProperty;var or=(t,n)=>{for(var o in n)rr(t,o,{get:n[o],enum
|
|
|
512
516
|
}
|
|
513
517
|
`},e("span",{css:k`
|
|
514
518
|
font-size: var(--fs-sm);
|
|
515
|
-
`},"Unlink"),e(
|
|
519
|
+
`},"Unlink"),e(J,{css:k`
|
|
516
520
|
color: var(--brand-secondary-5);
|
|
517
|
-
`})))))}import{Callout as
|
|
521
|
+
`})))))}import{Callout as no,LoadingIndicator as ao}from"@uniformdev/design-system";import{useAsync as io,useAsyncFn as so}from"react-use";function Ha({selectedProducts:t,setSelectedProducts:n,onGetCategories:o,onSearchProducts:r,logoIcon:i,multiSelect:d,multiSelectId:m,selectedItemComponent:v,rowComponent:h,errorComponent:b,helpComponent:a,noResultsComponent:g,onSort:S,typeSelectorAllTypesOptionText:N="All categories",typeSelectorLabel:U="Select Category"}){var B;let{value:w,loading:y,error:_}=io(async()=>await o(),[o]),F=ro(()=>w?w.map(u=>({id:u.id,name:u.name})):void 0,[w]),D=oo(),[A,re]=so(async(G,u)=>{let x=await r({text:G,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&&(D.current=[]),(D.current=D.current||[]).push(...x.products),x},[r]),W=async G=>{await n(G)};return y?e(ao,null):_||A.error?e(b||(({categoriesError:u,searchError:x})=>e(no,{type:"error"},"There was an error: ",(u==null?void 0:u.message)||(x==null?void 0:x.message))),{categoriesError:_,searchError:A.error}):e(Nt.Provider,{value:{categories:w,logoIcon:i}},e(Tt,{search:re,results:D.current,logoIcon:i,selectedItems:t,select:W,multiSelectId:m||"product-search-multi-select",multiSelect:d,contentTypes:F,selectedItemComponent:v||Qt,rowComponent:h||Ht,totalResults:(B=A.value)==null?void 0:B.total,resultsLoading:A.loading,helpComponent:a,noResultsComponent:g,onSort:S,typeSelectorAllTypesOptionText:N,typeSelectorLabel:U}))}var Nt=eo.createContext(void 0),ue=()=>{let t=to(Nt);if(!t)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return t};export*from"@uniformdev/mesh-sdk";import{Button as qa,Callout as Ja,LoadingIndicator as Xa,LoadingOverlay as Ya,Menu as ja,MenuItem as ei,Input as ti,InputSelect as ri,InputToggle as oi,Theme as ni,InputKeywordSearch as ai,Heading as ii,ScrollableList as si,ScrollableListItem as ci,Textarea as di,Switch as li,Label as pi}from"@uniformdev/design-system";export{qa as Button,Ja as Callout,bt as DefaultSearchRow,lt as DefaultSelectedItem,Tt as EntrySearch,ii as Heading,fe as Icons,ti as Input,ri as InputSelect,oi as InputToggle,ai as KeywordSearchInput,pi as Label,Xa as LoadingIndicator,Ya as LoadingOverlay,ja as Menu,ei as MenuItem,Ne as ProductPreviewList,Xo as ProductQuery,Ke as ProductQueryContext,Ha as ProductSearch,Nt as ProductSearchContext,Ht as ProductSearchRow,Qt as ProductSelectedItem,Ae as ResolvableLoadingValue,si as ScrollableList,ci as ScrollableListItem,Be as SelectionField,li as Switch,di as Textarea,ni as Theme,Ee as UniformMeshLocationContext,Te as UniformMeshLocationContextProvider,Ge as UniformMeshSdkContext,Mo as UniformMeshSdkContextProvider,Se as badgeIcon,Lt as draggableContainer,ye as draggableIcon,Vt as draggableIconOffset,Mt as draggableIconWrapper,St as entrySearchBtn,Ct as entrySearchConfig,Pt as entrySearchConfigHidden,wt as entrySearchLoadMoreBtn,Rt as entrySearchResultList,kt as entrySearchSelectIcon,xt as entrySearchSelectImg,Xn as entrySearchSelectInput,Yn as entrySearchSelectOption,yt as entrySearchWrapper,Bt as productSearchRowActiveIcon,Ut as productSearchRowCategory,It as productSearchRowContainer,Dt as productSearchRowContent,Gt as productSearchRowContentActive,At as productSearchRowDetails,zt as productSearchRowTitle,Ft as productSelectedItemContainer,Kt as productSelectedItemContent,$t as productSelectedItemDetails,Ce as productSelectedItemImage,ft as searchRowBtn,pt as searchRowContainer,mt as searchRowContainerActive,ut as searchRowContainerWithPopover,gt as searchRowPopover,be as searchRowText,he as searchRowTextSmall,ve as selectItemLinkBtn,ct as selectItemLinkContainer,st as selectItemPopover,pe as selectItemPopoverLabel,$ as selectItemSmallText,it as selectedItemCloseIcon,et as selectedItemContainer,ot as selectedItemCopy,rt as selectedItemDetails,at as selectedItemIcon,tt as selectedItemInner,nt as selectedItemTitle,Co as useInitializeUniformMeshSdk,Qe as useProductQueryContext,ue as useProductSearchContext,ho as useUniformMeshLocation,Ie as useUniformMeshLocationContext,To as useUniformMeshSdk,ze as useUniformMeshSdkContext};
|