@uniformdev/mesh-sdk-react 17.7.1-alpha.34 → 18.0.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +1 -1
- package/dist/index.d.ts +29 -29
- package/dist/index.esm.js +3550 -153
- package/dist/index.js +3649 -153
- package/dist/index.mjs +3550 -153
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,4 +1,451 @@
|
|
|
1
|
-
"use strict";var dn=Object.create;var dt=Object.defineProperty;var cn=Object.getOwnPropertyDescriptor;var pn=Object.getOwnPropertyNames;var un=Object.getPrototypeOf,mn=Object.prototype.hasOwnProperty;var Ua=(e,t)=>{for(var r in t)dt(e,r,{get:t[r],enumerable:!0})},lt=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of pn(t))!mn.call(e,o)&&o!==r&&dt(e,o,{get:()=>t[o],enumerable:!(a=cn(t,o))||a.enumerable});return e},se=(e,t,r)=>(lt(e,t,"default"),r&<(r,t,"default")),le=(e,t,r)=>(r=e!=null?dn(un(e)):{},lt(t||!e||!e.__esModule?dt(r,"default",{value:e,enumerable:!0}):r,e)),gn=e=>lt(dt({},"__esModule",{value:!0}),e);var ne={};Ua(ne,{AddListButton:()=>h.AddListButton,Button:()=>h.Button,Callout:()=>h.Callout,DamSelectedItem:()=>En,DataResourceVariablesList:()=>An,DataSourceEditor:()=>Wn,DataTypeEditor:()=>Qn,DefaultSearchRow:()=>gr,DefaultSelectedItem:()=>Rr,EntrySearch:()=>qr,Heading:()=>h.Heading,Icons:()=>ft,Input:()=>h.Input,InputComboBox:()=>h.InputComboBox,InputKeywordSearch:()=>h.InputKeywordSearch,InputSelect:()=>h.InputSelect,InputToggle:()=>h.InputToggle,InputVariables:()=>va,KeywordSearchInput:()=>h.InputKeywordSearch,Label:()=>h.Label,LoadingIndicator:()=>h.LoadingIndicator,LoadingOverlay:()=>h.LoadingOverlay,Menu:()=>h.Menu,MenuItem:()=>h.MenuItem,MeshApp:()=>Zn,ProductPreviewList:()=>nr,ProductQuery:()=>Vn,ProductQueryContext:()=>ar,ProductSearch:()=>In,ProductSearchContext:()=>jr,ProductSearchRow:()=>$r,ProductSelectedItem:()=>Jr,RequestBody:()=>On,RequestHeaders:()=>Gn,RequestMethodSelect:()=>Hn,RequestParameters:()=>Nn,RequestProvider:()=>it,RequestTypeContainer:()=>xa,RequestUrl:()=>Fn,RequestUrlInput:()=>$n,ResolvableLoadingValue:()=>tr,ScrollableList:()=>h.ScrollableList,ScrollableListItem:()=>h.ScrollableListItem,SelectionField:()=>rr,Switch:()=>h.Switch,TextVariableRenderer:()=>ha,Textarea:()=>h.Textarea,Theme:()=>h.Theme,UniformMeshLocationContext:()=>ma,UniformMeshLocationContextProvider:()=>tt,UniformMeshSdkContext:()=>et,UniformMeshSdkContextProvider:()=>Un,VariableEditor:()=>ga,VariablesList:()=>Bn,VariablesProvider:()=>at,badgeIcon:()=>Pt,createLocationValidator:()=>Jn,damSelectItemImage:()=>It,damSelectedItemContainer:()=>ea,damSelectedItemCopy:()=>aa,damSelectedItemDetails:()=>ra,damSelectedItemIcon:()=>na,damSelectedItemInfoBtn:()=>da,damSelectedItemInner:()=>ta,damSelectedItemLinkBtn:()=>_t,damSelectedItemLinkContainer:()=>sa,damSelectedItemMediaContainer:()=>la,damSelectedItemPopover:()=>ia,damSelectedItemPopoverLabel:()=>Je,damSelectedItemSmallText:()=>De,damSelectedItemTitle:()=>oa,draggableContainer:()=>Er,draggableIcon:()=>Rt,draggableIconOffset:()=>Ur,draggableIconWrapper:()=>Mr,entrySearchBtn:()=>Tr,entrySearchConfig:()=>Vr,entrySearchConfigHidden:()=>kr,entrySearchLoadMoreBtn:()=>Lr,entrySearchResultList:()=>Dr,entrySearchSelectIcon:()=>_r,entrySearchSelectImg:()=>Ir,entrySearchSelectInput:()=>kn,entrySearchSelectOption:()=>Dn,entrySearchWrapper:()=>Pr,productSearchRowActiveIcon:()=>Nr,productSearchRowCategory:()=>Gr,productSearchRowContainer:()=>Br,productSearchRowContent:()=>Ar,productSearchRowContentActive:()=>zr,productSearchRowDetails:()=>Hr,productSearchRowTitle:()=>Or,productSelectedItemContainer:()=>Kr,productSelectedItemContent:()=>Yr,productSelectedItemDetails:()=>Qr,productSelectedItemIcon:()=>Zr,productSelectedItemImage:()=>Tt,productSelectedItemLinkContainer:()=>Xr,productedSelectedItemLinkBtn:()=>Lt,productedSelectedItemSmallText:()=>Vt,searchRowBtn:()=>ur,searchRowContainer:()=>lr,searchRowContainerActive:()=>cr,searchRowContainerWithPopover:()=>dr,searchRowPopover:()=>pr,searchRowText:()=>xt,searchRowTextSmall:()=>bt,selectItemLinkBtn:()=>St,selectItemLinkContainer:()=>Sr,selectItemPopover:()=>wr,selectItemPopoverLabel:()=>Oe,selectItemSmallText:()=>be,selectedItemContainer:()=>fr,selectedItemCopy:()=>yr,selectedItemDetails:()=>hr,selectedItemIcon:()=>xr,selectedItemInner:()=>vr,selectedItemTitle:()=>br,urlEncodeRequestParameter:()=>Ra,urlEncodeRequestUrl:()=>Ca,useInitializeUniformMeshSdk:()=>La,useMeshLocation:()=>Ee,useProductQueryContext:()=>or,useProductSearchContext:()=>Xe,useRequest:()=>K,useUniformMeshLocation:()=>Xn,useUniformMeshLocationContext:()=>rt,useUniformMeshSdk:()=>ua,useUniformMeshSdkContext:()=>pa,useVariables:()=>ge,variablesToList:()=>nt});module.exports=gn(ne);var c=require("@emotion/react"),x=le(require("react"));var ft={};Ua(ft,{Caution:()=>qa,Checkmark:()=>ct,ChevronDown:()=>pt,Close:()=>Ba,Danger:()=>Aa,ExclamationPoint:()=>za,Info:()=>ut,Lightbulb:()=>Oa,MagnifyingGlass:()=>Ga,MaximizeAlt:()=>Ha,Minus:()=>mt,MoreVerticalAlt:()=>Ze,Plus:()=>gt});var Ft=require("@emotion/react/jsx-runtime"),fn=e=>(0,Ft.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...e,children:(0,Ft.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"})}),qa=fn;var $t=require("@emotion/react/jsx-runtime"),vn=e=>(0,$t.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,$t.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"})}),ct=vn;var Wt=require("@emotion/react/jsx-runtime"),hn=e=>(0,Wt.jsx)("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...e,children:(0,Wt.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"})}),pt=hn;var Ae=require("@emotion/react/jsx-runtime"),yn=e=>(0,Ae.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...e,children:(0,Ae.jsxs)("g",{fillRule:"evenodd",children:[(0,Ae.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,Ae.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"})]})}),Ba=yn;var Kt=require("@emotion/react/jsx-runtime"),bn=e=>(0,Kt.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e,children:(0,Kt.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"})}),Aa=bn;var Qt=require("@emotion/react/jsx-runtime"),xn=e=>(0,Qt.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...e,children:(0,Qt.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"})}),za=xn;var Ye=require("@emotion/react/jsx-runtime"),wn=e=>(0,Ye.jsxs)("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:[(0,Ye.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,Ye.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"})]}),ut=wn;var Yt=require("@emotion/react/jsx-runtime"),Sn=e=>(0,Yt.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e,children:(0,Yt.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"})}),Oa=Sn;var de=require("@emotion/react/jsx-runtime"),Cn=e=>(0,de.jsxs)("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,de.jsxs)("g",{clipPath:"url(#magnifying-glass_svg__a)",children:[(0,de.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,de.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,de.jsx)("defs",{children:(0,de.jsx)("clipPath",{id:"magnifying-glass_svg__a",children:(0,de.jsx)("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})})})]}),Ga=Cn;var Zt=require("@emotion/react/jsx-runtime"),Rn=e=>(0,Zt.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:(0,Zt.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"})}),Ha=Rn;var Xt=require("@emotion/react/jsx-runtime"),Pn=e=>(0,Xt.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,Xt.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"})}),mt=Pn;var Jt=require("@emotion/react/jsx-runtime"),Tn=e=>(0,Jt.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:(0,Jt.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"})}),Ze=Tn;var jt=require("@emotion/react/jsx-runtime"),Ln=e=>(0,jt.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,jt.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"})}),gt=Ln;var sr=require("@emotion/react"),io=require("@uniformdev/design-system");var er=require("@emotion/react/jsx-runtime");function te({src:e,alt:t,className:r}){let a=e&&typeof e!="string"?e:null;return a?(0,er.jsx)(a,{className:r}):(0,er.jsx)("img",{src:e,alt:t,className:r})}var z=require("@emotion/react"),$=require("@uniformdev/design-system"),pe=le(require("react")),yt=require("react-use");var Wa=require("@emotion/react"),ht=require("@uniformdev/design-system"),Ka=require("react-icons/cg");var ze=require("@emotion/react/jsx-runtime"),tr=({value:e,text:t,loading:r})=>(0,ze.jsxs)(ze.Fragment,{children:[!!t&&t,!t&&(0,ze.jsxs)(ze.Fragment,{children:[r&&`${e} (Loading...)`,!r&&`${e} (Unresolvable)`]})]});var vt=require("@emotion/react"),Na=vt.css`
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
|
+
mod
|
|
24
|
+
));
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
|
|
27
|
+
// src/index.ts
|
|
28
|
+
var src_exports = {};
|
|
29
|
+
__export(src_exports, {
|
|
30
|
+
AddListButton: () => import_design_system21.AddListButton,
|
|
31
|
+
Button: () => import_design_system21.Button,
|
|
32
|
+
Callout: () => import_design_system21.Callout,
|
|
33
|
+
DamSelectedItem: () => DamSelectedItem,
|
|
34
|
+
DataResourceVariablesList: () => DataResourceVariablesList,
|
|
35
|
+
DataSourceEditor: () => DataSourceEditor,
|
|
36
|
+
DataTypeEditor: () => DataTypeEditor,
|
|
37
|
+
DefaultSearchRow: () => DefaultSearchRow,
|
|
38
|
+
DefaultSelectedItem: () => DefaultSelectedItem,
|
|
39
|
+
EntrySearch: () => EntrySearch,
|
|
40
|
+
Heading: () => import_design_system21.Heading,
|
|
41
|
+
Icons: () => icons_exports,
|
|
42
|
+
Input: () => import_design_system21.Input,
|
|
43
|
+
InputComboBox: () => import_design_system21.InputComboBox,
|
|
44
|
+
InputKeywordSearch: () => import_design_system21.InputKeywordSearch,
|
|
45
|
+
InputSelect: () => import_design_system21.InputSelect,
|
|
46
|
+
InputToggle: () => import_design_system21.InputToggle,
|
|
47
|
+
InputVariables: () => InputVariables,
|
|
48
|
+
KeywordSearchInput: () => import_design_system21.InputKeywordSearch,
|
|
49
|
+
Label: () => import_design_system21.Label,
|
|
50
|
+
LoadingIndicator: () => import_design_system21.LoadingIndicator,
|
|
51
|
+
LoadingOverlay: () => import_design_system21.LoadingOverlay,
|
|
52
|
+
Menu: () => import_design_system21.Menu,
|
|
53
|
+
MenuItem: () => import_design_system21.MenuItem,
|
|
54
|
+
MeshApp: () => MeshApp,
|
|
55
|
+
ProductPreviewList: () => ProductPreviewList,
|
|
56
|
+
ProductQuery: () => ProductQuery,
|
|
57
|
+
ProductQueryContext: () => ProductQueryContext,
|
|
58
|
+
ProductSearch: () => ProductSearch,
|
|
59
|
+
ProductSearchContext: () => ProductSearchContext,
|
|
60
|
+
ProductSearchRow: () => ProductSearchRow,
|
|
61
|
+
ProductSelectedItem: () => ProductSelectedItem,
|
|
62
|
+
RequestBody: () => RequestBody,
|
|
63
|
+
RequestHeaders: () => RequestHeaders,
|
|
64
|
+
RequestMethodSelect: () => RequestMethodSelect,
|
|
65
|
+
RequestParameters: () => RequestParameters,
|
|
66
|
+
RequestProvider: () => RequestProvider,
|
|
67
|
+
RequestTypeContainer: () => RequestTypeContainer,
|
|
68
|
+
RequestUrl: () => RequestUrl,
|
|
69
|
+
RequestUrlInput: () => RequestUrlInput,
|
|
70
|
+
ResolvableLoadingValue: () => ResolvableLoadingValue,
|
|
71
|
+
ScrollableList: () => import_design_system21.ScrollableList,
|
|
72
|
+
ScrollableListItem: () => import_design_system21.ScrollableListItem,
|
|
73
|
+
SelectionField: () => SelectionField,
|
|
74
|
+
Switch: () => import_design_system21.Switch,
|
|
75
|
+
TextVariableRenderer: () => TextVariableRenderer,
|
|
76
|
+
Textarea: () => import_design_system21.Textarea,
|
|
77
|
+
Theme: () => import_design_system21.Theme,
|
|
78
|
+
UniformMeshLocationContext: () => UniformMeshLocationContext,
|
|
79
|
+
UniformMeshLocationContextProvider: () => UniformMeshLocationContextProvider,
|
|
80
|
+
UniformMeshSdkContext: () => UniformMeshSdkContext,
|
|
81
|
+
UniformMeshSdkContextProvider: () => UniformMeshSdkContextProvider,
|
|
82
|
+
VariableEditor: () => VariableEditor,
|
|
83
|
+
VariablesList: () => VariablesList,
|
|
84
|
+
VariablesProvider: () => VariablesProvider,
|
|
85
|
+
badgeIcon: () => badgeIcon,
|
|
86
|
+
createLocationValidator: () => createLocationValidator,
|
|
87
|
+
damSelectItemImage: () => damSelectItemImage,
|
|
88
|
+
damSelectedItemContainer: () => damSelectedItemContainer,
|
|
89
|
+
damSelectedItemCopy: () => damSelectedItemCopy,
|
|
90
|
+
damSelectedItemDetails: () => damSelectedItemDetails,
|
|
91
|
+
damSelectedItemIcon: () => damSelectedItemIcon,
|
|
92
|
+
damSelectedItemInfoBtn: () => damSelectedItemInfoBtn,
|
|
93
|
+
damSelectedItemInner: () => damSelectedItemInner,
|
|
94
|
+
damSelectedItemLinkBtn: () => damSelectedItemLinkBtn,
|
|
95
|
+
damSelectedItemLinkContainer: () => damSelectedItemLinkContainer,
|
|
96
|
+
damSelectedItemMediaContainer: () => damSelectedItemMediaContainer,
|
|
97
|
+
damSelectedItemPopover: () => damSelectedItemPopover,
|
|
98
|
+
damSelectedItemPopoverLabel: () => damSelectedItemPopoverLabel,
|
|
99
|
+
damSelectedItemSmallText: () => damSelectedItemSmallText,
|
|
100
|
+
damSelectedItemTitle: () => damSelectedItemTitle,
|
|
101
|
+
draggableContainer: () => draggableContainer,
|
|
102
|
+
draggableIcon: () => draggableIcon,
|
|
103
|
+
draggableIconOffset: () => draggableIconOffset,
|
|
104
|
+
draggableIconWrapper: () => draggableIconWrapper,
|
|
105
|
+
entrySearchBtn: () => entrySearchBtn,
|
|
106
|
+
entrySearchConfig: () => entrySearchConfig,
|
|
107
|
+
entrySearchConfigHidden: () => entrySearchConfigHidden,
|
|
108
|
+
entrySearchLoadMoreBtn: () => entrySearchLoadMoreBtn,
|
|
109
|
+
entrySearchResultList: () => entrySearchResultList,
|
|
110
|
+
entrySearchSelectIcon: () => entrySearchSelectIcon,
|
|
111
|
+
entrySearchSelectImg: () => entrySearchSelectImg,
|
|
112
|
+
entrySearchSelectInput: () => entrySearchSelectInput,
|
|
113
|
+
entrySearchSelectOption: () => entrySearchSelectOption,
|
|
114
|
+
entrySearchWrapper: () => entrySearchWrapper,
|
|
115
|
+
productSearchRowActiveIcon: () => productSearchRowActiveIcon,
|
|
116
|
+
productSearchRowCategory: () => productSearchRowCategory,
|
|
117
|
+
productSearchRowContainer: () => productSearchRowContainer,
|
|
118
|
+
productSearchRowContent: () => productSearchRowContent,
|
|
119
|
+
productSearchRowContentActive: () => productSearchRowContentActive,
|
|
120
|
+
productSearchRowDetails: () => productSearchRowDetails,
|
|
121
|
+
productSearchRowTitle: () => productSearchRowTitle,
|
|
122
|
+
productSelectedItemContainer: () => productSelectedItemContainer,
|
|
123
|
+
productSelectedItemContent: () => productSelectedItemContent,
|
|
124
|
+
productSelectedItemDetails: () => productSelectedItemDetails,
|
|
125
|
+
productSelectedItemIcon: () => productSelectedItemIcon,
|
|
126
|
+
productSelectedItemImage: () => productSelectedItemImage,
|
|
127
|
+
productSelectedItemLinkContainer: () => productSelectedItemLinkContainer,
|
|
128
|
+
productedSelectedItemLinkBtn: () => productedSelectedItemLinkBtn,
|
|
129
|
+
productedSelectedItemSmallText: () => productedSelectedItemSmallText,
|
|
130
|
+
searchRowBtn: () => searchRowBtn,
|
|
131
|
+
searchRowContainer: () => searchRowContainer,
|
|
132
|
+
searchRowContainerActive: () => searchRowContainerActive,
|
|
133
|
+
searchRowContainerWithPopover: () => searchRowContainerWithPopover,
|
|
134
|
+
searchRowPopover: () => searchRowPopover,
|
|
135
|
+
searchRowText: () => searchRowText,
|
|
136
|
+
searchRowTextSmall: () => searchRowTextSmall,
|
|
137
|
+
selectItemLinkBtn: () => selectItemLinkBtn,
|
|
138
|
+
selectItemLinkContainer: () => selectItemLinkContainer,
|
|
139
|
+
selectItemPopover: () => selectItemPopover,
|
|
140
|
+
selectItemPopoverLabel: () => selectItemPopoverLabel,
|
|
141
|
+
selectItemSmallText: () => selectItemSmallText,
|
|
142
|
+
selectedItemContainer: () => selectedItemContainer,
|
|
143
|
+
selectedItemCopy: () => selectedItemCopy,
|
|
144
|
+
selectedItemDetails: () => selectedItemDetails,
|
|
145
|
+
selectedItemIcon: () => selectedItemIcon,
|
|
146
|
+
selectedItemInner: () => selectedItemInner,
|
|
147
|
+
selectedItemTitle: () => selectedItemTitle,
|
|
148
|
+
urlEncodeRequestParameter: () => urlEncodeRequestParameter,
|
|
149
|
+
urlEncodeRequestUrl: () => urlEncodeRequestUrl,
|
|
150
|
+
useInitializeUniformMeshSdk: () => useInitializeUniformMeshSdk,
|
|
151
|
+
useMeshLocation: () => useMeshLocation,
|
|
152
|
+
useProductQueryContext: () => useProductQueryContext,
|
|
153
|
+
useProductSearchContext: () => useProductSearchContext,
|
|
154
|
+
useRequest: () => useRequest,
|
|
155
|
+
useUniformMeshLocation: () => useUniformMeshLocation,
|
|
156
|
+
useUniformMeshLocationContext: () => useUniformMeshLocationContext,
|
|
157
|
+
useUniformMeshSdk: () => useUniformMeshSdk,
|
|
158
|
+
useUniformMeshSdkContext: () => useUniformMeshSdkContext,
|
|
159
|
+
useVariables: () => useVariables,
|
|
160
|
+
variablesToList: () => variablesToList
|
|
161
|
+
});
|
|
162
|
+
module.exports = __toCommonJS(src_exports);
|
|
163
|
+
|
|
164
|
+
// ../../scripts/emotion-jsx-shim.js
|
|
165
|
+
var import_react = require("@emotion/react");
|
|
166
|
+
var React = __toESM(require("react"));
|
|
167
|
+
|
|
168
|
+
// src/assets/icons/index.ts
|
|
169
|
+
var icons_exports = {};
|
|
170
|
+
__export(icons_exports, {
|
|
171
|
+
Caution: () => Caution_default,
|
|
172
|
+
Checkmark: () => Checkmark_default,
|
|
173
|
+
ChevronDown: () => ChevronDown_default,
|
|
174
|
+
Close: () => Close_default,
|
|
175
|
+
Danger: () => Danger_default,
|
|
176
|
+
ExclamationPoint: () => ExclamationPoint_default,
|
|
177
|
+
Info: () => Info_default,
|
|
178
|
+
Lightbulb: () => Lightbulb_default,
|
|
179
|
+
MagnifyingGlass: () => MagnifyingGlass_default,
|
|
180
|
+
MaximizeAlt: () => MaximizeAlt_default,
|
|
181
|
+
Minus: () => Minus_default,
|
|
182
|
+
MoreVerticalAlt: () => MoreVerticalAlt_default,
|
|
183
|
+
Plus: () => Plus_default
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// src/assets/icons/Caution.tsx
|
|
187
|
+
var import_jsx_runtime = require("@emotion/react/jsx-runtime");
|
|
188
|
+
var SvgCaution = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
189
|
+
"svg",
|
|
190
|
+
{
|
|
191
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
192
|
+
width: "1em",
|
|
193
|
+
height: "1em",
|
|
194
|
+
viewBox: "0 0 16 16",
|
|
195
|
+
fill: "currentColor",
|
|
196
|
+
...props,
|
|
197
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
198
|
+
"path",
|
|
199
|
+
{
|
|
200
|
+
fillRule: "evenodd",
|
|
201
|
+
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"
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
var Caution_default = SvgCaution;
|
|
207
|
+
|
|
208
|
+
// src/assets/icons/Checkmark.tsx
|
|
209
|
+
var import_jsx_runtime2 = require("@emotion/react/jsx-runtime");
|
|
210
|
+
var SvgCheckmark = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
211
|
+
"svg",
|
|
212
|
+
{
|
|
213
|
+
width: "1em",
|
|
214
|
+
height: "1em",
|
|
215
|
+
viewBox: "0 0 40 40",
|
|
216
|
+
fill: "currentColor",
|
|
217
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
218
|
+
...props,
|
|
219
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
220
|
+
"path",
|
|
221
|
+
{
|
|
222
|
+
fillRule: "evenodd",
|
|
223
|
+
clipRule: "evenodd",
|
|
224
|
+
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"
|
|
225
|
+
}
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
var Checkmark_default = SvgCheckmark;
|
|
230
|
+
|
|
231
|
+
// src/assets/icons/ChevronDown.tsx
|
|
232
|
+
var import_jsx_runtime3 = require("@emotion/react/jsx-runtime");
|
|
233
|
+
var SvgChevronDown = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime3.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" }) });
|
|
234
|
+
var ChevronDown_default = SvgChevronDown;
|
|
235
|
+
|
|
236
|
+
// src/assets/icons/Close.tsx
|
|
237
|
+
var import_jsx_runtime4 = require("@emotion/react/jsx-runtime");
|
|
238
|
+
var SvgClose = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
239
|
+
"svg",
|
|
240
|
+
{
|
|
241
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
242
|
+
width: "1em",
|
|
243
|
+
height: "1em",
|
|
244
|
+
viewBox: "0 0 19 19",
|
|
245
|
+
fill: "currentColor",
|
|
246
|
+
...props,
|
|
247
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { fillRule: "evenodd", children: [
|
|
248
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.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" }),
|
|
249
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.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" })
|
|
250
|
+
] })
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
var Close_default = SvgClose;
|
|
254
|
+
|
|
255
|
+
// src/assets/icons/Danger.tsx
|
|
256
|
+
var import_jsx_runtime5 = require("@emotion/react/jsx-runtime");
|
|
257
|
+
var SvgDanger = (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
258
|
+
"svg",
|
|
259
|
+
{
|
|
260
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
261
|
+
width: "1em",
|
|
262
|
+
height: "1em",
|
|
263
|
+
viewBox: "0 0 12 16",
|
|
264
|
+
fill: "currentColor",
|
|
265
|
+
...props,
|
|
266
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
267
|
+
"path",
|
|
268
|
+
{
|
|
269
|
+
fillRule: "evenodd",
|
|
270
|
+
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"
|
|
271
|
+
}
|
|
272
|
+
)
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
var Danger_default = SvgDanger;
|
|
276
|
+
|
|
277
|
+
// src/assets/icons/ExclamationPoint.tsx
|
|
278
|
+
var import_jsx_runtime6 = require("@emotion/react/jsx-runtime");
|
|
279
|
+
var SvgExclamationPoint = (props) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
280
|
+
"svg",
|
|
281
|
+
{
|
|
282
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
283
|
+
width: "1em",
|
|
284
|
+
height: "1em",
|
|
285
|
+
viewBox: "0 0 14 16",
|
|
286
|
+
fill: "currentColor",
|
|
287
|
+
...props,
|
|
288
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
289
|
+
"path",
|
|
290
|
+
{
|
|
291
|
+
fillRule: "evenodd",
|
|
292
|
+
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"
|
|
293
|
+
}
|
|
294
|
+
)
|
|
295
|
+
}
|
|
296
|
+
);
|
|
297
|
+
var ExclamationPoint_default = SvgExclamationPoint;
|
|
298
|
+
|
|
299
|
+
// src/assets/icons/Info.tsx
|
|
300
|
+
var import_jsx_runtime7 = require("@emotion/react/jsx-runtime");
|
|
301
|
+
var SvgInfo = (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "1em", height: "1em", fill: "currentColor", ...props, children: [
|
|
302
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
303
|
+
"path",
|
|
304
|
+
{
|
|
305
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
306
|
+
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"
|
|
307
|
+
}
|
|
308
|
+
),
|
|
309
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
310
|
+
"path",
|
|
311
|
+
{
|
|
312
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
313
|
+
fillRule: "evenodd",
|
|
314
|
+
clipRule: "evenodd",
|
|
315
|
+
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"
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
] });
|
|
319
|
+
var Info_default = SvgInfo;
|
|
320
|
+
|
|
321
|
+
// src/assets/icons/Lightbulb.tsx
|
|
322
|
+
var import_jsx_runtime8 = require("@emotion/react/jsx-runtime");
|
|
323
|
+
var SvgLightbulb = (props) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
324
|
+
"svg",
|
|
325
|
+
{
|
|
326
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
327
|
+
width: "1em",
|
|
328
|
+
height: "1em",
|
|
329
|
+
viewBox: "0 0 12 16",
|
|
330
|
+
fill: "currentColor",
|
|
331
|
+
...props,
|
|
332
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
333
|
+
"path",
|
|
334
|
+
{
|
|
335
|
+
fillRule: "evenodd",
|
|
336
|
+
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"
|
|
337
|
+
}
|
|
338
|
+
)
|
|
339
|
+
}
|
|
340
|
+
);
|
|
341
|
+
var Lightbulb_default = SvgLightbulb;
|
|
342
|
+
|
|
343
|
+
// src/assets/icons/MagnifyingGlass.tsx
|
|
344
|
+
var import_jsx_runtime9 = require("@emotion/react/jsx-runtime");
|
|
345
|
+
var SvgMagnifyingGlass = (props) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
346
|
+
"svg",
|
|
347
|
+
{
|
|
348
|
+
width: "1em",
|
|
349
|
+
height: "1em",
|
|
350
|
+
viewBox: "0 0 26 24",
|
|
351
|
+
fill: "currentColor",
|
|
352
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
353
|
+
...props,
|
|
354
|
+
children: [
|
|
355
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { clipPath: "url(#magnifying-glass_svg__a)", children: [
|
|
356
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.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" }),
|
|
357
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.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" })
|
|
358
|
+
] }),
|
|
359
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("clipPath", { id: "magnifying-glass_svg__a", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { fill: "#fff", transform: "translate(.558)", d: "M0 0h24.935v24H0z" }) }) })
|
|
360
|
+
]
|
|
361
|
+
}
|
|
362
|
+
);
|
|
363
|
+
var MagnifyingGlass_default = SvgMagnifyingGlass;
|
|
364
|
+
|
|
365
|
+
// src/assets/icons/MaximizeAlt.tsx
|
|
366
|
+
var import_jsx_runtime10 = require("@emotion/react/jsx-runtime");
|
|
367
|
+
var SvgMaximizeAlt = (props) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { width: "1em", height: "1em", fill: "currentColor", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
368
|
+
"path",
|
|
369
|
+
{
|
|
370
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
371
|
+
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"
|
|
372
|
+
}
|
|
373
|
+
) });
|
|
374
|
+
var MaximizeAlt_default = SvgMaximizeAlt;
|
|
375
|
+
|
|
376
|
+
// src/assets/icons/Minus.tsx
|
|
377
|
+
var import_jsx_runtime11 = require("@emotion/react/jsx-runtime");
|
|
378
|
+
var SvgMinus = (props) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime11.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" }) });
|
|
379
|
+
var Minus_default = SvgMinus;
|
|
380
|
+
|
|
381
|
+
// src/assets/icons/MoreVerticalAlt.tsx
|
|
382
|
+
var import_jsx_runtime12 = require("@emotion/react/jsx-runtime");
|
|
383
|
+
var SvgMoreVerticalAlt = (props) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "1em", height: "1em", fill: "currentColor", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
384
|
+
"path",
|
|
385
|
+
{
|
|
386
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
387
|
+
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"
|
|
388
|
+
}
|
|
389
|
+
) });
|
|
390
|
+
var MoreVerticalAlt_default = SvgMoreVerticalAlt;
|
|
391
|
+
|
|
392
|
+
// src/assets/icons/Plus.tsx
|
|
393
|
+
var import_jsx_runtime13 = require("@emotion/react/jsx-runtime");
|
|
394
|
+
var SvgPlus = (props) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
395
|
+
"svg",
|
|
396
|
+
{
|
|
397
|
+
width: "1em",
|
|
398
|
+
height: "1em",
|
|
399
|
+
viewBox: "0 0 46 46",
|
|
400
|
+
fill: "currentColor",
|
|
401
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
402
|
+
...props,
|
|
403
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.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" })
|
|
404
|
+
}
|
|
405
|
+
);
|
|
406
|
+
var Plus_default = SvgPlus;
|
|
407
|
+
|
|
408
|
+
// src/components/commerce/ProductPreviewList.tsx
|
|
409
|
+
var import_react7 = require("@emotion/react");
|
|
410
|
+
var import_design_system3 = require("@uniformdev/design-system");
|
|
411
|
+
|
|
412
|
+
// src/components/Image/Image.tsx
|
|
413
|
+
var import_jsx_runtime14 = require("@emotion/react/jsx-runtime");
|
|
414
|
+
function Image({ src, alt, className }) {
|
|
415
|
+
const CompImage = src && typeof src !== "string" ? src : null;
|
|
416
|
+
return CompImage ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CompImage, { className }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("img", { src, alt, className });
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// src/components/commerce/ProductQuery.tsx
|
|
420
|
+
var import_react4 = require("@emotion/react");
|
|
421
|
+
var import_design_system2 = require("@uniformdev/design-system");
|
|
422
|
+
var import_react5 = __toESM(require("react"));
|
|
423
|
+
var import_react_use = require("react-use");
|
|
424
|
+
|
|
425
|
+
// src/components/commerce/SelectionField.tsx
|
|
426
|
+
var import_react3 = require("@emotion/react");
|
|
427
|
+
var import_design_system = require("@uniformdev/design-system");
|
|
428
|
+
var import_cg = require("react-icons/cg");
|
|
429
|
+
|
|
430
|
+
// src/components/commerce/ResolvableLoadingValue.tsx
|
|
431
|
+
var import_jsx_runtime15 = require("@emotion/react/jsx-runtime");
|
|
432
|
+
var ResolvableLoadingValue = ({
|
|
433
|
+
value,
|
|
434
|
+
text,
|
|
435
|
+
loading
|
|
436
|
+
}) => {
|
|
437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
438
|
+
!!text && text,
|
|
439
|
+
!text && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
440
|
+
loading && `${value} (Loading...)`,
|
|
441
|
+
!loading && `${value} (Unresolvable)`
|
|
442
|
+
] })
|
|
443
|
+
] });
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
// src/components/commerce/styles/SelectField.styles.ts
|
|
447
|
+
var import_react2 = require("@emotion/react");
|
|
448
|
+
var selectionFieldBtnContainer = import_react2.css`
|
|
2
449
|
align-items: center;
|
|
3
450
|
background: var(--gray-100);
|
|
4
451
|
border: 1px solid var(--gray-300);
|
|
@@ -7,66 +454,459 @@
|
|
|
7
454
|
justify-content: space-between;
|
|
8
455
|
margin-bottom: var(--spacing-sm);
|
|
9
456
|
margin-right: var(--spacing-sm);
|
|
10
|
-
|
|
457
|
+
`;
|
|
458
|
+
var selectionFieldBtnLabel = import_react2.css`
|
|
11
459
|
color: var(--gray-800);
|
|
12
460
|
padding: var(--spacing-3);
|
|
13
|
-
|
|
461
|
+
`;
|
|
462
|
+
var selectionFieldBtn = import_react2.css`
|
|
14
463
|
border: none;
|
|
15
464
|
border-left: 1px solid var(--gray-300);
|
|
16
465
|
background: var(--gray-100);
|
|
17
466
|
padding: var(--spacing-3);
|
|
18
|
-
`;
|
|
467
|
+
`;
|
|
468
|
+
|
|
469
|
+
// src/components/commerce/SelectionField.tsx
|
|
470
|
+
var import_jsx_runtime16 = require("@emotion/react/jsx-runtime");
|
|
471
|
+
var SelectionField = ({
|
|
472
|
+
id,
|
|
473
|
+
label,
|
|
474
|
+
loading,
|
|
475
|
+
selectedValues,
|
|
476
|
+
values,
|
|
477
|
+
onAdd,
|
|
478
|
+
onRemove
|
|
479
|
+
}) => {
|
|
480
|
+
var _a;
|
|
481
|
+
const availableValues = (_a = values == null ? void 0 : values.filter((brand) => !(selectedValues == null ? void 0 : selectedValues.includes(brand.id.toString())))) != null ? _a : [];
|
|
482
|
+
const handleRemoveClick = (e, value) => {
|
|
483
|
+
e.preventDefault();
|
|
484
|
+
onRemove(value);
|
|
485
|
+
};
|
|
486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
|
|
487
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
488
|
+
import_design_system.InputSelect,
|
|
489
|
+
{
|
|
490
|
+
id,
|
|
491
|
+
name: id,
|
|
492
|
+
label,
|
|
493
|
+
onChange: (e) => onAdd(e.target.value),
|
|
494
|
+
disabled: loading,
|
|
495
|
+
options: [
|
|
496
|
+
{ value: "", label: "Add..." },
|
|
497
|
+
...availableValues.map((option) => {
|
|
498
|
+
return {
|
|
499
|
+
value: option.id,
|
|
500
|
+
label: option.name || option.id
|
|
501
|
+
};
|
|
502
|
+
})
|
|
503
|
+
],
|
|
504
|
+
value: "",
|
|
505
|
+
css: Array.isArray(selectedValues) && selectedValues.length > 0 ? import_react3.css`
|
|
19
506
|
margin-bottom: var(--spacing-base);
|
|
20
|
-
|
|
507
|
+
` : ""
|
|
508
|
+
}
|
|
509
|
+
),
|
|
510
|
+
selectedValues == null ? void 0 : selectedValues.map((selectedValue) => {
|
|
511
|
+
var _a2;
|
|
512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { css: selectionFieldBtnContainer, children: [
|
|
513
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { css: selectionFieldBtnLabel, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
514
|
+
ResolvableLoadingValue,
|
|
515
|
+
{
|
|
516
|
+
value: selectedValue,
|
|
517
|
+
loading,
|
|
518
|
+
text: (_a2 = values.find((v) => v.id === selectedValue)) == null ? void 0 : _a2.name
|
|
519
|
+
}
|
|
520
|
+
) }),
|
|
521
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
522
|
+
"button",
|
|
523
|
+
{
|
|
524
|
+
css: selectionFieldBtn,
|
|
525
|
+
title: "remove",
|
|
526
|
+
onClick: (e) => handleRemoveClick(e, selectedValue),
|
|
527
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system.Icon, { icon: import_cg.CgClose, iconColor: "currentColor", size: 20 })
|
|
528
|
+
}
|
|
529
|
+
)
|
|
530
|
+
] }, selectedValue);
|
|
531
|
+
})
|
|
532
|
+
] });
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
// src/components/commerce/ProductQuery.tsx
|
|
536
|
+
var import_jsx_runtime17 = require("@emotion/react/jsx-runtime");
|
|
537
|
+
var initialState = {
|
|
538
|
+
count: 1,
|
|
539
|
+
categories: [],
|
|
540
|
+
brand: "",
|
|
541
|
+
keyword: "",
|
|
542
|
+
sort: "date_modified",
|
|
543
|
+
sortOrder: "desc"
|
|
544
|
+
};
|
|
545
|
+
var ProductQuery = ({
|
|
546
|
+
value,
|
|
547
|
+
setValue,
|
|
548
|
+
brands,
|
|
549
|
+
categories,
|
|
550
|
+
loading,
|
|
551
|
+
categoriesLoading,
|
|
552
|
+
brandsLoading,
|
|
553
|
+
logoIcon,
|
|
554
|
+
onGetProducts,
|
|
555
|
+
sortOptions,
|
|
556
|
+
sortOrderOptions,
|
|
557
|
+
categoryLabel = "Product Category",
|
|
558
|
+
brandLabel = "Brand",
|
|
559
|
+
disableBrands,
|
|
560
|
+
restrictToSingleCategory = false
|
|
561
|
+
}) => {
|
|
562
|
+
var _a, _b, _c;
|
|
563
|
+
const setFormState = async (state) => {
|
|
564
|
+
setValue({
|
|
565
|
+
...initialState,
|
|
566
|
+
...value || {},
|
|
567
|
+
...state
|
|
568
|
+
});
|
|
569
|
+
};
|
|
570
|
+
const formState = (0, import_react5.useMemo)(() => {
|
|
571
|
+
return {
|
|
572
|
+
...initialState,
|
|
573
|
+
...value || {}
|
|
574
|
+
};
|
|
575
|
+
}, [value]);
|
|
576
|
+
const [getProductsState, getProductsFn] = (0, import_react_use.useAsyncFn)(
|
|
577
|
+
async (options) => {
|
|
578
|
+
return await onGetProducts(options);
|
|
579
|
+
},
|
|
580
|
+
[onGetProducts]
|
|
581
|
+
);
|
|
582
|
+
(0, import_react_use.useDebounce)(
|
|
583
|
+
async () => {
|
|
584
|
+
await getProductsFn({
|
|
585
|
+
brand: formState.brand,
|
|
586
|
+
categories: formState.categories,
|
|
587
|
+
keyword: formState.keyword,
|
|
588
|
+
sort: formState.sort,
|
|
589
|
+
sortOrder: formState.sortOrder,
|
|
590
|
+
count: formState.count
|
|
591
|
+
});
|
|
592
|
+
},
|
|
593
|
+
250,
|
|
594
|
+
[formState]
|
|
595
|
+
);
|
|
596
|
+
const categoryOptions = (0, import_react5.useMemo)(() => {
|
|
597
|
+
const options = [];
|
|
598
|
+
categories == null ? void 0 : categories.forEach((category) => {
|
|
599
|
+
const categoryOptions2 = traverseCategory(category, void 0);
|
|
600
|
+
options.push(...categoryOptions2);
|
|
601
|
+
});
|
|
602
|
+
return options;
|
|
603
|
+
}, [categories]);
|
|
604
|
+
const singleChoiceCategoryOptions = (0, import_react5.useMemo)(() => {
|
|
605
|
+
return [
|
|
606
|
+
{
|
|
607
|
+
value: "",
|
|
608
|
+
label: "All categories"
|
|
609
|
+
},
|
|
610
|
+
...categoryOptions.map((option) => ({
|
|
611
|
+
label: option.name,
|
|
612
|
+
value: option.id
|
|
613
|
+
}))
|
|
614
|
+
];
|
|
615
|
+
}, [categoryOptions]);
|
|
616
|
+
const brandOptions = (0, import_react5.useMemo)(() => {
|
|
617
|
+
return (brands == null ? void 0 : brands.map((b) => ({
|
|
618
|
+
id: b.id.toString(),
|
|
619
|
+
name: b.name
|
|
620
|
+
}))) || [];
|
|
621
|
+
}, [brands]);
|
|
622
|
+
const handleAddProductCategory = (category) => {
|
|
623
|
+
if (!category) {
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
const categories2 = (value == null ? void 0 : value.categories) || [];
|
|
627
|
+
setFormState({
|
|
628
|
+
categories: [...categories2, category]
|
|
629
|
+
});
|
|
630
|
+
};
|
|
631
|
+
const handleRemoveProductCategory = (category) => {
|
|
632
|
+
var _a2;
|
|
633
|
+
setFormState({
|
|
634
|
+
categories: (_a2 = value == null ? void 0 : value.categories) == null ? void 0 : _a2.filter((c) => c !== category)
|
|
635
|
+
});
|
|
636
|
+
};
|
|
637
|
+
const handleBrandChange = (e) => {
|
|
638
|
+
setFormState({
|
|
639
|
+
brand: e.target.value
|
|
640
|
+
});
|
|
641
|
+
};
|
|
642
|
+
const handleCountChange = (value2) => {
|
|
643
|
+
const localValue = value2 || 1;
|
|
644
|
+
setFormState({ count: localValue });
|
|
645
|
+
};
|
|
646
|
+
if (loading) {
|
|
647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: "Loading..." });
|
|
648
|
+
}
|
|
649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ProductQueryContext.Provider, { value: { categories, logoIcon }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
650
|
+
"div",
|
|
651
|
+
{
|
|
652
|
+
css: import_react4.css`
|
|
21
653
|
> :not(:last-child) {
|
|
22
654
|
margin-bottom: var(--spacing-md);
|
|
23
655
|
}
|
|
24
|
-
`,
|
|
656
|
+
`,
|
|
657
|
+
children: [
|
|
658
|
+
restrictToSingleCategory ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
659
|
+
import_design_system2.InputSelect,
|
|
660
|
+
{
|
|
661
|
+
id: "selection-field-product-category",
|
|
662
|
+
label: categoryLabel,
|
|
663
|
+
disabled: loading,
|
|
664
|
+
value: (_b = (_a = formState.categories) == null ? void 0 : _a[0]) != null ? _b : "",
|
|
665
|
+
options: singleChoiceCategoryOptions,
|
|
666
|
+
onChange: (e) => {
|
|
667
|
+
setFormState({
|
|
668
|
+
categories: e.target.value === "" ? [] : [e.target.value]
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
673
|
+
SelectionField,
|
|
674
|
+
{
|
|
675
|
+
loading: categoriesLoading || false,
|
|
676
|
+
id: "selection-field-product-category",
|
|
677
|
+
label: categoryLabel,
|
|
678
|
+
onAdd: handleAddProductCategory,
|
|
679
|
+
onRemove: handleRemoveProductCategory,
|
|
680
|
+
selectedValues: formState.categories,
|
|
681
|
+
values: categoryOptions
|
|
682
|
+
}
|
|
683
|
+
),
|
|
684
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
685
|
+
"div",
|
|
686
|
+
{
|
|
687
|
+
css: import_react4.css`
|
|
25
688
|
display: flex;
|
|
26
689
|
flex-wrap: wrap;
|
|
27
690
|
column-gap: var(--spacing-lg);
|
|
28
691
|
row-gap: var(--spacing-md);
|
|
29
|
-
${(0
|
|
692
|
+
${(0, import_design_system2.mq)("md")} {
|
|
30
693
|
flex-wrap: nowrap;
|
|
31
694
|
}
|
|
32
|
-
`,
|
|
695
|
+
`,
|
|
696
|
+
children: [
|
|
697
|
+
disableBrands ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
698
|
+
"div",
|
|
699
|
+
{
|
|
700
|
+
css: import_react4.css`
|
|
33
701
|
width: 50%;
|
|
34
|
-
`,
|
|
702
|
+
`,
|
|
703
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
704
|
+
import_design_system2.InputSelect,
|
|
705
|
+
{
|
|
706
|
+
id: "brand",
|
|
707
|
+
name: "brand",
|
|
708
|
+
label: brandLabel,
|
|
709
|
+
disabled: brandsLoading,
|
|
710
|
+
value: formState.brand,
|
|
711
|
+
onChange: handleBrandChange,
|
|
712
|
+
options: [
|
|
713
|
+
{ value: "", label: "Choose..." },
|
|
714
|
+
...brandOptions.map((brand) => {
|
|
715
|
+
return { value: brand.id, label: brand.name };
|
|
716
|
+
})
|
|
717
|
+
]
|
|
718
|
+
}
|
|
719
|
+
)
|
|
720
|
+
}
|
|
721
|
+
),
|
|
722
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
723
|
+
"div",
|
|
724
|
+
{
|
|
725
|
+
css: import_react4.css`
|
|
35
726
|
flex-grow: 1;
|
|
36
727
|
position: relative;
|
|
37
|
-
`,
|
|
728
|
+
`,
|
|
729
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
730
|
+
import_design_system2.Input,
|
|
731
|
+
{
|
|
732
|
+
id: "keyword-search",
|
|
733
|
+
name: "keyword-search",
|
|
734
|
+
label: "Keyword",
|
|
735
|
+
value: formState.keyword,
|
|
736
|
+
placeholder: "Enter keyword",
|
|
737
|
+
onChange: (e) => setFormState({ keyword: e.target.value })
|
|
738
|
+
}
|
|
739
|
+
)
|
|
740
|
+
}
|
|
741
|
+
)
|
|
742
|
+
]
|
|
743
|
+
}
|
|
744
|
+
),
|
|
745
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
746
|
+
"div",
|
|
747
|
+
{
|
|
748
|
+
css: import_react4.css`
|
|
38
749
|
display: flex;
|
|
39
750
|
flex-wrap: wrap;
|
|
40
751
|
column-gap: var(--spacing-lg);
|
|
41
752
|
row-gap: var(--spacing-md);
|
|
42
|
-
${(0
|
|
753
|
+
${(0, import_design_system2.mq)("md")} {
|
|
43
754
|
flex-wrap: nowrap;
|
|
44
755
|
}
|
|
45
|
-
`,
|
|
756
|
+
`,
|
|
757
|
+
children: [
|
|
758
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
759
|
+
"div",
|
|
760
|
+
{
|
|
761
|
+
css: import_react4.css`
|
|
46
762
|
width: 100%;
|
|
47
|
-
${(0
|
|
763
|
+
${(0, import_design_system2.mq)("md")} {
|
|
48
764
|
width: 33.333333%;
|
|
49
765
|
}
|
|
50
766
|
position: relative;
|
|
51
|
-
`,
|
|
767
|
+
`,
|
|
768
|
+
children: [
|
|
769
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
770
|
+
import_design_system2.Input,
|
|
771
|
+
{
|
|
772
|
+
id: "count",
|
|
773
|
+
name: "count",
|
|
774
|
+
type: "number",
|
|
775
|
+
min: 1,
|
|
776
|
+
step: 1,
|
|
777
|
+
value: formState.count,
|
|
778
|
+
onChange: (e) => handleCountChange(e.target.valueAsNumber),
|
|
779
|
+
label: "Count"
|
|
780
|
+
}
|
|
781
|
+
),
|
|
782
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
783
|
+
"div",
|
|
784
|
+
{
|
|
785
|
+
css: import_react4.css`
|
|
52
786
|
position: absolute;
|
|
53
787
|
bottom: var(--spacing-sm);
|
|
54
788
|
right: var(--spacing-sm);
|
|
55
789
|
display: flex;
|
|
56
790
|
gap: var(--spacing-sm);
|
|
57
|
-
`,
|
|
791
|
+
`,
|
|
792
|
+
children: [
|
|
793
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
794
|
+
CountButton,
|
|
795
|
+
{
|
|
796
|
+
onCountChange: () => handleCountChange(formState.count - 1),
|
|
797
|
+
countIcon: "decrement",
|
|
798
|
+
disabled: formState.count === 1
|
|
799
|
+
}
|
|
800
|
+
),
|
|
801
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
802
|
+
CountButton,
|
|
803
|
+
{
|
|
804
|
+
onCountChange: () => handleCountChange(formState.count + 1),
|
|
805
|
+
countIcon: "increment"
|
|
806
|
+
}
|
|
807
|
+
)
|
|
808
|
+
]
|
|
809
|
+
}
|
|
810
|
+
)
|
|
811
|
+
]
|
|
812
|
+
}
|
|
813
|
+
),
|
|
814
|
+
Array.isArray(sortOptions) && sortOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
815
|
+
"div",
|
|
816
|
+
{
|
|
817
|
+
css: import_react4.css`
|
|
58
818
|
flex-grow: 1;
|
|
59
|
-
${(0
|
|
819
|
+
${(0, import_design_system2.mq)("md")} {
|
|
60
820
|
width: 33.333333%;
|
|
61
821
|
}
|
|
62
|
-
`,
|
|
822
|
+
`,
|
|
823
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
824
|
+
import_design_system2.InputSelect,
|
|
825
|
+
{
|
|
826
|
+
id: "sort",
|
|
827
|
+
name: "sort",
|
|
828
|
+
label: "Sort",
|
|
829
|
+
value: formState.sort,
|
|
830
|
+
onChange: (e) => setFormState({ sort: e.target.value }),
|
|
831
|
+
options: [
|
|
832
|
+
{ value: "", label: "Select a sort" },
|
|
833
|
+
...sortOptions.map((option) => {
|
|
834
|
+
return {
|
|
835
|
+
value: option.sortKey,
|
|
836
|
+
label: option.name
|
|
837
|
+
};
|
|
838
|
+
})
|
|
839
|
+
]
|
|
840
|
+
}
|
|
841
|
+
)
|
|
842
|
+
}
|
|
843
|
+
) : null,
|
|
844
|
+
Array.isArray(sortOrderOptions) && sortOrderOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
845
|
+
"div",
|
|
846
|
+
{
|
|
847
|
+
css: import_react4.css`
|
|
63
848
|
flex-grow: 1;
|
|
64
|
-
`,
|
|
849
|
+
`,
|
|
850
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
851
|
+
import_design_system2.InputSelect,
|
|
852
|
+
{
|
|
853
|
+
id: "sort-order",
|
|
854
|
+
name: "sort-order",
|
|
855
|
+
label: "Sort Order",
|
|
856
|
+
value: formState.sortOrder,
|
|
857
|
+
onChange: (e) => setFormState({ sortOrder: e.target.value }),
|
|
858
|
+
options: sortOrderOptions.map((option) => {
|
|
859
|
+
return {
|
|
860
|
+
value: option.sortOrderKey,
|
|
861
|
+
label: option.name
|
|
862
|
+
};
|
|
863
|
+
})
|
|
864
|
+
}
|
|
865
|
+
)
|
|
866
|
+
}
|
|
867
|
+
) : null
|
|
868
|
+
]
|
|
869
|
+
}
|
|
870
|
+
),
|
|
871
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
|
|
872
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
873
|
+
"h3",
|
|
874
|
+
{
|
|
875
|
+
css: import_react4.css`
|
|
65
876
|
font-size: var(--fs-md);
|
|
66
877
|
line-height: var(--spacing-md);
|
|
67
878
|
font-weight: var(--fw-bold);
|
|
68
879
|
margin-bottom: var(--spacing-xs);
|
|
69
|
-
`,
|
|
880
|
+
`,
|
|
881
|
+
children: "Result Preview"
|
|
882
|
+
}
|
|
883
|
+
),
|
|
884
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ProductPreviewList, { products: (_c = getProductsState.value) == null ? void 0 : _c.products })
|
|
885
|
+
] })
|
|
886
|
+
]
|
|
887
|
+
}
|
|
888
|
+
) });
|
|
889
|
+
};
|
|
890
|
+
function traverseCategory(result, parent) {
|
|
891
|
+
var _a;
|
|
892
|
+
const results = [];
|
|
893
|
+
const namePrefix = parent ? `${parent.name} > ` : "";
|
|
894
|
+
const value = {
|
|
895
|
+
id: result.id.toString(),
|
|
896
|
+
name: `${namePrefix}${result.name}`
|
|
897
|
+
};
|
|
898
|
+
results.push(value);
|
|
899
|
+
(_a = result.children) == null ? void 0 : _a.forEach((child) => {
|
|
900
|
+
const childValues = traverseCategory(child, value);
|
|
901
|
+
results.push(...childValues);
|
|
902
|
+
});
|
|
903
|
+
return results;
|
|
904
|
+
}
|
|
905
|
+
function CountButton({ onCountChange, countIcon, disabled }) {
|
|
906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
907
|
+
"button",
|
|
908
|
+
{
|
|
909
|
+
css: import_react4.css`
|
|
70
910
|
width: 2.25rem;
|
|
71
911
|
height: 2.25rem;
|
|
72
912
|
border: 1px solid var(--gray-300);
|
|
@@ -78,17 +918,45 @@
|
|
|
78
918
|
&:hover {
|
|
79
919
|
background-color: var(--gray-200);
|
|
80
920
|
}
|
|
81
|
-
${
|
|
921
|
+
${disabled ? import_react4.css`
|
|
82
922
|
cursor: not-allowed;
|
|
83
923
|
opacity: 0.3;
|
|
84
|
-
|
|
85
|
-
`,
|
|
924
|
+
` : ""}
|
|
925
|
+
`,
|
|
926
|
+
onClick: onCountChange,
|
|
927
|
+
disabled,
|
|
928
|
+
children: countIcon === "increment" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
929
|
+
Plus_default,
|
|
930
|
+
{
|
|
931
|
+
css: import_react4.css`
|
|
86
932
|
width: 1rem;
|
|
87
933
|
height: 1rem;
|
|
88
|
-
`
|
|
934
|
+
`
|
|
935
|
+
}
|
|
936
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
937
|
+
Minus_default,
|
|
938
|
+
{
|
|
939
|
+
css: import_react4.css`
|
|
89
940
|
width: 1rem;
|
|
90
941
|
height: 1rem;
|
|
91
|
-
`
|
|
942
|
+
`
|
|
943
|
+
}
|
|
944
|
+
)
|
|
945
|
+
}
|
|
946
|
+
);
|
|
947
|
+
}
|
|
948
|
+
var ProductQueryContext = import_react5.default.createContext(void 0);
|
|
949
|
+
var useProductQueryContext = () => {
|
|
950
|
+
const context = (0, import_react5.useContext)(ProductQueryContext);
|
|
951
|
+
if (!context) {
|
|
952
|
+
throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");
|
|
953
|
+
}
|
|
954
|
+
return context;
|
|
955
|
+
};
|
|
956
|
+
|
|
957
|
+
// src/components/commerce/styles/ProductPreviewList.styles.ts
|
|
958
|
+
var import_react6 = require("@emotion/react");
|
|
959
|
+
var productPreviewListLinkBtn = import_react6.css`
|
|
92
960
|
align-items: center;
|
|
93
961
|
background: var(--white);
|
|
94
962
|
border-radius: var(--rounded-base);
|
|
@@ -103,65 +971,175 @@
|
|
|
103
971
|
&:hover {
|
|
104
972
|
background: var(--gray-50);
|
|
105
973
|
}
|
|
106
|
-
|
|
974
|
+
`;
|
|
975
|
+
var productPreviewListSmallText = import_react6.css`
|
|
107
976
|
font-size: var(--fs-sm);
|
|
108
|
-
|
|
977
|
+
`;
|
|
978
|
+
var productPreviewListIcon = import_react6.css`
|
|
109
979
|
width: 1rem;
|
|
110
980
|
height: 1rem;
|
|
111
|
-
|
|
981
|
+
`;
|
|
982
|
+
var productPreviewListDetailsText = import_react6.css`
|
|
112
983
|
margin-right: var(--spacing-lg);
|
|
113
984
|
font-size: var(--fs-sm);
|
|
114
|
-
|
|
985
|
+
`;
|
|
986
|
+
var productPreviewListItem = import_react6.css`
|
|
115
987
|
border: 1px solid var(--gray-200);
|
|
116
988
|
border-radius: var(--rounded-md);
|
|
117
989
|
background: var(--gray-50);
|
|
118
990
|
margin: var(--spacing-base) 0;
|
|
119
|
-
|
|
991
|
+
`;
|
|
992
|
+
var productPreviewListItemDetailsContainer = import_react6.css`
|
|
120
993
|
align-items: center;
|
|
121
994
|
display: flex;
|
|
122
995
|
flex-grow: 1;
|
|
123
996
|
gap: var(--spacing-base);
|
|
124
997
|
padding: var(--spacing-sm);
|
|
125
998
|
margin-right: var(--spacing-sm);
|
|
126
|
-
|
|
999
|
+
`;
|
|
1000
|
+
var productPreviewListImage = import_react6.css`
|
|
127
1001
|
background: var(--gray-200);
|
|
128
1002
|
width: 3.5rem;
|
|
129
1003
|
height: 3.5rem;
|
|
130
1004
|
object-fit: cover;
|
|
131
|
-
|
|
1005
|
+
`;
|
|
1006
|
+
var productPreviewListImageDefault = import_react6.css`
|
|
132
1007
|
background: var(--gray-100);
|
|
133
1008
|
height: 3.5rem;
|
|
134
1009
|
width: 3.5rem;
|
|
135
|
-
|
|
1010
|
+
`;
|
|
1011
|
+
var productPreviewListTitle = import_react6.css`
|
|
136
1012
|
margin-top: 0;
|
|
137
1013
|
font-weight: var(--fw-bold);
|
|
138
1014
|
font-size: var(--fs-sm);
|
|
139
1015
|
width: calc(100% / 3);
|
|
140
|
-
|
|
1016
|
+
`;
|
|
1017
|
+
var productPreviewListCategoryText = import_react6.css`
|
|
141
1018
|
display: block;
|
|
142
1019
|
font-weight: var(--fw-regular);
|
|
143
|
-
`;
|
|
1020
|
+
`;
|
|
1021
|
+
|
|
1022
|
+
// src/components/commerce/ProductPreviewList.tsx
|
|
1023
|
+
var import_jsx_runtime18 = require("@emotion/react/jsx-runtime");
|
|
1024
|
+
var ProductPreviewList = ({
|
|
1025
|
+
products
|
|
1026
|
+
}) => {
|
|
1027
|
+
const { categories, logoIcon } = useProductQueryContext();
|
|
1028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
1029
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1030
|
+
"p",
|
|
1031
|
+
{
|
|
1032
|
+
css: import_react7.css`
|
|
144
1033
|
margin-bottom: var(--spacing-base);
|
|
145
|
-
`,
|
|
1034
|
+
`,
|
|
1035
|
+
children: [
|
|
1036
|
+
"Matching ",
|
|
1037
|
+
(products == null ? void 0 : products.length) || 0,
|
|
1038
|
+
" products"
|
|
1039
|
+
]
|
|
1040
|
+
}
|
|
1041
|
+
),
|
|
1042
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1043
|
+
"ul",
|
|
1044
|
+
{
|
|
1045
|
+
css: [
|
|
1046
|
+
import_react7.css`
|
|
146
1047
|
max-height: 24rem;
|
|
147
1048
|
overflow-x: auto;
|
|
148
|
-
`,
|
|
1049
|
+
`,
|
|
1050
|
+
import_design_system3.scrollbarStyles
|
|
1051
|
+
],
|
|
1052
|
+
children: products == null ? void 0 : products.map((product, index) => {
|
|
1053
|
+
var _a, _b;
|
|
1054
|
+
const [category] = (product == null ? void 0 : product.categories) || [];
|
|
1055
|
+
const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c) => c.id === category.id)) == null ? void 0 : _a.name;
|
|
1056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("li", { css: productPreviewListItem, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1057
|
+
"div",
|
|
1058
|
+
{
|
|
1059
|
+
css: productPreviewListItemDetailsContainer,
|
|
1060
|
+
"data-test-id": `product-item-${product.sku || product.id}`,
|
|
1061
|
+
children: [
|
|
1062
|
+
product.thumbnailUrl ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1063
|
+
"img",
|
|
1064
|
+
{
|
|
1065
|
+
src: product.thumbnailUrl,
|
|
1066
|
+
alt: typeof product.title === "string" ? product.title : product.name || `Product ${index}`,
|
|
1067
|
+
css: productPreviewListImage,
|
|
1068
|
+
"data-test-id": "product-image"
|
|
1069
|
+
}
|
|
1070
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { css: productPreviewListImageDefault }),
|
|
1071
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("h4", { css: productPreviewListTitle, "data-test-id": "product-name", children: [
|
|
1072
|
+
product.title || product.name,
|
|
1073
|
+
categoryName && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { css: productPreviewListCategoryText, children: categoryName })
|
|
1074
|
+
] }),
|
|
1075
|
+
product && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
1076
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { css: productPreviewListDetailsText, "data-test-id": "product-sku", children: [
|
|
1077
|
+
"SKU: ",
|
|
1078
|
+
product.sku || product.id,
|
|
1079
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("br", {})
|
|
1080
|
+
] }),
|
|
1081
|
+
product.price !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { css: productPreviewListDetailsText, "data-test-id": "product-price", children: [
|
|
1082
|
+
"Price: ",
|
|
1083
|
+
product.price
|
|
1084
|
+
] }) : null,
|
|
1085
|
+
product.editLink || product.url ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1086
|
+
"a",
|
|
1087
|
+
{
|
|
1088
|
+
css: productPreviewListLinkBtn,
|
|
1089
|
+
href: (_b = product.editLink) != null ? _b : product.url,
|
|
1090
|
+
title: `Go to ${product.title || product.name}`,
|
|
1091
|
+
target: "_blank",
|
|
1092
|
+
rel: "noopener noreferrer",
|
|
1093
|
+
"data-test-id": "edit-product-button",
|
|
1094
|
+
children: [
|
|
1095
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { css: productPreviewListSmallText, children: "Edit" }),
|
|
1096
|
+
logoIcon ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Image, { src: logoIcon, alt: "Logo", css: productPreviewListIcon }) : null
|
|
1097
|
+
]
|
|
1098
|
+
}
|
|
1099
|
+
) : null
|
|
1100
|
+
] })
|
|
1101
|
+
]
|
|
1102
|
+
}
|
|
1103
|
+
) }, `product-${product.id}`);
|
|
1104
|
+
})
|
|
1105
|
+
}
|
|
1106
|
+
)
|
|
1107
|
+
] });
|
|
1108
|
+
};
|
|
1109
|
+
|
|
1110
|
+
// src/components/commerce/ProductSearch.tsx
|
|
1111
|
+
var import_design_system9 = require("@uniformdev/design-system");
|
|
1112
|
+
var import_react21 = __toESM(require("react"));
|
|
1113
|
+
var import_react_use3 = require("react-use");
|
|
1114
|
+
|
|
1115
|
+
// src/components/EntrySearch/DefaultSearchRow.tsx
|
|
1116
|
+
var import_react9 = require("@emotion/react");
|
|
1117
|
+
var import_react10 = require("react");
|
|
1118
|
+
|
|
1119
|
+
// src/components/EntrySearch/styles/DefaultSearchRow.styles.ts
|
|
1120
|
+
var import_react8 = require("@emotion/react");
|
|
1121
|
+
var searchRowContainer = import_react8.css`
|
|
149
1122
|
cursor: pointer;
|
|
150
1123
|
padding: var(--spacing-sm);
|
|
151
1124
|
position: relative;
|
|
152
1125
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
153
1126
|
color var(--duration-fast) var(--timing-ease-out);
|
|
154
|
-
|
|
1127
|
+
`;
|
|
1128
|
+
var searchRowContainerWithPopover = import_react8.css`
|
|
155
1129
|
padding-right: var(--spacing-lg);
|
|
156
|
-
|
|
1130
|
+
`;
|
|
1131
|
+
var searchRowContainerActive = import_react8.css`
|
|
157
1132
|
background: var(--brand-secondary-3);
|
|
158
1133
|
color: var(--white);
|
|
159
|
-
|
|
1134
|
+
`;
|
|
1135
|
+
var searchRowTextSmall = import_react8.css`
|
|
160
1136
|
font-size: var(--fs-xs);
|
|
161
|
-
|
|
1137
|
+
`;
|
|
1138
|
+
var searchRowText = import_react8.css`
|
|
162
1139
|
font-weight: var(--fw-bold);
|
|
163
1140
|
margin-right: var(--spacing-sm);
|
|
164
|
-
|
|
1141
|
+
`;
|
|
1142
|
+
var searchRowPopover = import_react8.css`
|
|
165
1143
|
background: var(--white);
|
|
166
1144
|
border-left: 4px solid var(--brand-secondary-3);
|
|
167
1145
|
border-radius: var(--rounded-base);
|
|
@@ -173,20 +1151,128 @@
|
|
|
173
1151
|
right: var(--spacing-xl);
|
|
174
1152
|
z-index: var(--z-10);
|
|
175
1153
|
width: max-content;
|
|
176
|
-
|
|
1154
|
+
`;
|
|
1155
|
+
var searchRowBtn = import_react8.css`
|
|
177
1156
|
position: absolute;
|
|
178
1157
|
inset: 0 var(--spacing-sm) 0 auto;
|
|
179
|
-
`;
|
|
1158
|
+
`;
|
|
1159
|
+
|
|
1160
|
+
// src/components/EntrySearch/DefaultSearchRow.tsx
|
|
1161
|
+
var import_jsx_runtime19 = require("@emotion/react/jsx-runtime");
|
|
1162
|
+
var DefaultSearchRow = ({ result, isSelected, triggerSelection }) => {
|
|
1163
|
+
const buttonRef = (0, import_react10.useRef)(null);
|
|
1164
|
+
const popoverRef = (0, import_react10.useRef)(null);
|
|
1165
|
+
const [showInfo, setShowInfo] = (0, import_react10.useState)(false);
|
|
1166
|
+
(0, import_react10.useEffect)(() => {
|
|
1167
|
+
function handleClickOutside(event) {
|
|
1168
|
+
if (buttonRef.current && !buttonRef.current.contains(event.target) && popoverRef.current && !popoverRef.current.contains(event.target)) {
|
|
1169
|
+
setShowInfo(false);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1173
|
+
return () => {
|
|
1174
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
1175
|
+
};
|
|
1176
|
+
}, [popoverRef]);
|
|
1177
|
+
const click = (event) => {
|
|
1178
|
+
event.stopPropagation();
|
|
1179
|
+
setShowInfo(!showInfo);
|
|
1180
|
+
};
|
|
1181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1182
|
+
"div",
|
|
1183
|
+
{
|
|
1184
|
+
css: [
|
|
1185
|
+
searchRowContainer,
|
|
1186
|
+
isSelected ? searchRowContainerActive : void 0,
|
|
1187
|
+
result.popoverData ? searchRowContainerWithPopover : void 0
|
|
1188
|
+
],
|
|
1189
|
+
"data-value": result.id,
|
|
1190
|
+
role: "option",
|
|
1191
|
+
tabIndex: -1,
|
|
1192
|
+
onClick: () => triggerSelection(),
|
|
1193
|
+
children: [
|
|
1194
|
+
result.title,
|
|
1195
|
+
result.popoverData && isSelected ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
1196
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1197
|
+
"button",
|
|
1198
|
+
{
|
|
1199
|
+
type: "button",
|
|
1200
|
+
ref: buttonRef,
|
|
1201
|
+
css: searchRowBtn,
|
|
1202
|
+
"aria-controls": "path-details",
|
|
1203
|
+
onClick: (e) => click(e),
|
|
1204
|
+
"aria-expanded": showInfo,
|
|
1205
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Info_default, { width: 24, height: 24 })
|
|
1206
|
+
}
|
|
1207
|
+
),
|
|
1208
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1209
|
+
"div",
|
|
1210
|
+
{
|
|
1211
|
+
id: "path-details",
|
|
1212
|
+
"aria-hidden": !showInfo,
|
|
1213
|
+
ref: popoverRef,
|
|
1214
|
+
css: [
|
|
1215
|
+
searchRowPopover,
|
|
1216
|
+
showInfo ? import_react9.css`
|
|
180
1217
|
visibility: visible;
|
|
181
|
-
|
|
1218
|
+
` : import_react9.css`
|
|
182
1219
|
visibility: hidden;
|
|
183
|
-
`
|
|
1220
|
+
`
|
|
1221
|
+
],
|
|
1222
|
+
children: [
|
|
1223
|
+
result.metadata && Object.entries(result.metadata).map(([key, value], index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { css: searchRowTextSmall, children: [
|
|
1224
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { css: searchRowText, children: [
|
|
1225
|
+
key,
|
|
1226
|
+
":"
|
|
1227
|
+
] }),
|
|
1228
|
+
value
|
|
1229
|
+
] }, index)),
|
|
1230
|
+
Object.entries(result.popoverData).map(([key, value], index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { css: searchRowTextSmall, children: [
|
|
1231
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { css: searchRowText, children: [
|
|
1232
|
+
key,
|
|
1233
|
+
":"
|
|
1234
|
+
] }),
|
|
1235
|
+
value
|
|
1236
|
+
] }, index))
|
|
1237
|
+
]
|
|
1238
|
+
}
|
|
1239
|
+
)
|
|
1240
|
+
] }) : null
|
|
1241
|
+
]
|
|
1242
|
+
},
|
|
1243
|
+
result.id
|
|
1244
|
+
);
|
|
1245
|
+
};
|
|
1246
|
+
|
|
1247
|
+
// src/components/EntrySearch/DefaultSelectedItem.tsx
|
|
1248
|
+
var import_react12 = require("@emotion/react");
|
|
1249
|
+
var import_design_system5 = require("@uniformdev/design-system");
|
|
1250
|
+
var import_react13 = require("react");
|
|
1251
|
+
var import_cg2 = require("react-icons/cg");
|
|
1252
|
+
var import_timeago = require("timeago.js");
|
|
1253
|
+
|
|
1254
|
+
// src/utils/openWindowWithCloseCallback.ts
|
|
1255
|
+
function openWindowWithCloseCallback(href, callback) {
|
|
1256
|
+
const openedNewWindow = window.open(href, "_blank");
|
|
1257
|
+
const interval = setInterval(() => {
|
|
1258
|
+
if (openedNewWindow == null ? void 0 : openedNewWindow.closed) {
|
|
1259
|
+
clearInterval(interval);
|
|
1260
|
+
callback();
|
|
1261
|
+
}
|
|
1262
|
+
}, 500);
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
// src/components/EntrySearch/styles/DefaultSelectedItem.styles.ts
|
|
1266
|
+
var import_react11 = require("@emotion/react");
|
|
1267
|
+
var import_design_system4 = require("@uniformdev/design-system");
|
|
1268
|
+
var selectedItemContainer = import_react11.css`
|
|
184
1269
|
border: 1px solid var(--gray-200);
|
|
185
1270
|
background: var(--gray-50);
|
|
186
1271
|
border-radius: var(--rounded-base);
|
|
187
1272
|
display: flex;
|
|
188
1273
|
width: 100%;
|
|
189
|
-
|
|
1274
|
+
`;
|
|
1275
|
+
var selectedItemInner = import_react11.css`
|
|
190
1276
|
align-items: center;
|
|
191
1277
|
display: flex;
|
|
192
1278
|
flex-grow: 1;
|
|
@@ -194,22 +1280,27 @@
|
|
|
194
1280
|
margin-inline: 0 var(--spacing-sm);
|
|
195
1281
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
196
1282
|
position: relative;
|
|
197
|
-
|
|
1283
|
+
`;
|
|
1284
|
+
var selectedItemDetails = import_react11.css`
|
|
198
1285
|
flex-grow: 1;
|
|
199
|
-
|
|
1286
|
+
`;
|
|
1287
|
+
var selectedItemCopy = import_react11.css`
|
|
200
1288
|
align-items: start;
|
|
201
1289
|
display: inline-flex;
|
|
202
1290
|
position: relative;
|
|
203
|
-
|
|
1291
|
+
`;
|
|
1292
|
+
var selectedItemTitle = import_react11.css`
|
|
204
1293
|
color: var(--brand-secondary-1);
|
|
205
1294
|
font-size: var(--fs-base);
|
|
206
1295
|
font-weight: var(--fw-bold);
|
|
207
1296
|
line-height: 1;
|
|
208
1297
|
margin: 0;
|
|
209
|
-
|
|
1298
|
+
`;
|
|
1299
|
+
var selectedItemIcon = import_react11.css`
|
|
210
1300
|
width: 1.5rem;
|
|
211
1301
|
height: 1.5rem;
|
|
212
|
-
|
|
1302
|
+
`;
|
|
1303
|
+
var selectItemPopover = import_react11.css`
|
|
213
1304
|
background: var(--white);
|
|
214
1305
|
border-radius: var(--rounded-base);
|
|
215
1306
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -218,22 +1309,26 @@
|
|
|
218
1309
|
padding: var(--spacing-base);
|
|
219
1310
|
z-index: var(--z-10);
|
|
220
1311
|
width: max-content;
|
|
221
|
-
|
|
1312
|
+
`;
|
|
1313
|
+
var selectItemSmallText = import_react11.css`
|
|
222
1314
|
font-size: var(--fs-sm);
|
|
223
|
-
|
|
1315
|
+
`;
|
|
1316
|
+
var selectItemPopoverLabel = import_react11.css`
|
|
224
1317
|
font-weight: var(--fw-bold);
|
|
225
1318
|
margin-right: var(--spacing-sm);
|
|
226
|
-
|
|
1319
|
+
`;
|
|
1320
|
+
var selectItemLinkContainer = import_react11.css`
|
|
227
1321
|
display: flex;
|
|
228
1322
|
flex-direction: column;
|
|
229
1323
|
gap: var(--spacing-sm);
|
|
230
1324
|
|
|
231
|
-
${(0,
|
|
1325
|
+
${(0, import_design_system4.mq)("md")} {
|
|
232
1326
|
flex-direction: row;
|
|
233
1327
|
min-width: 200px;
|
|
234
1328
|
justify-content: end;
|
|
235
1329
|
}
|
|
236
|
-
|
|
1330
|
+
`;
|
|
1331
|
+
var selectItemLinkBtn = import_react11.css`
|
|
237
1332
|
align-items: center;
|
|
238
1333
|
background: var(--white);
|
|
239
1334
|
border-radius: var(--rounded-base);
|
|
@@ -248,29 +1343,263 @@
|
|
|
248
1343
|
&:hover {
|
|
249
1344
|
background: var(--gray-50);
|
|
250
1345
|
}
|
|
251
|
-
`;
|
|
1346
|
+
`;
|
|
1347
|
+
|
|
1348
|
+
// src/components/EntrySearch/DefaultSelectedItem.tsx
|
|
1349
|
+
var import_jsx_runtime20 = require("@emotion/react/jsx-runtime");
|
|
1350
|
+
var DefaultSelectedItem = ({
|
|
1351
|
+
selectedItem,
|
|
1352
|
+
logoIcon,
|
|
1353
|
+
onDeselect,
|
|
1354
|
+
onEditClosed
|
|
1355
|
+
}) => {
|
|
1356
|
+
var _a;
|
|
1357
|
+
const buttonRef = (0, import_react13.useRef)(null);
|
|
1358
|
+
const popoverRef = (0, import_react13.useRef)(null);
|
|
1359
|
+
const [showInfo, setShowInfo] = (0, import_react13.useState)(false);
|
|
1360
|
+
(0, import_react13.useEffect)(() => {
|
|
1361
|
+
const eventHandler = (event) => {
|
|
1362
|
+
if (buttonRef.current && !buttonRef.current.contains(event.target) && popoverRef.current && !popoverRef.current.contains(event.target)) {
|
|
1363
|
+
setShowInfo(false);
|
|
1364
|
+
}
|
|
1365
|
+
};
|
|
1366
|
+
const resizeHandler = () => {
|
|
1367
|
+
setShowInfo(false);
|
|
1368
|
+
};
|
|
1369
|
+
window.addEventListener("resize", resizeHandler, true);
|
|
1370
|
+
document.addEventListener("scroll", eventHandler, true);
|
|
1371
|
+
document.addEventListener("mousedown", eventHandler);
|
|
1372
|
+
return () => {
|
|
1373
|
+
window.removeEventListener("resize", resizeHandler, true);
|
|
1374
|
+
document.removeEventListener("scroll", eventHandler, true);
|
|
1375
|
+
document.removeEventListener("mousedown", eventHandler);
|
|
1376
|
+
};
|
|
1377
|
+
}, [popoverRef]);
|
|
1378
|
+
const popoverClick = () => {
|
|
1379
|
+
var _a2;
|
|
1380
|
+
setShowInfo(!showInfo);
|
|
1381
|
+
if (popoverRef.current && buttonRef.current) {
|
|
1382
|
+
const buttonPos = (_a2 = buttonRef == null ? void 0 : buttonRef.current) == null ? void 0 : _a2.getBoundingClientRect();
|
|
1383
|
+
const popoverWidth = popoverRef.current.offsetWidth;
|
|
1384
|
+
popoverRef.current.style["top"] = `${buttonPos.top + 30}px`;
|
|
1385
|
+
popoverRef.current.style["left"] = `${buttonPos.left - popoverWidth + 30}px`;
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { css: selectedItemContainer, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { css: selectedItemInner, children: [
|
|
1389
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { css: selectedItemDetails, children: [
|
|
1390
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { css: selectedItemCopy, children: [
|
|
1391
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1392
|
+
"h4",
|
|
1393
|
+
{
|
|
1394
|
+
css: [
|
|
1395
|
+
selectedItemTitle,
|
|
1396
|
+
selectedItem.popoverData ? import_react12.css`
|
|
252
1397
|
margin-bottom: var(--spacing-sm);
|
|
253
|
-
|
|
1398
|
+
` : ""
|
|
1399
|
+
],
|
|
1400
|
+
title: `ID: ${selectedItem.id}`,
|
|
1401
|
+
"data-test-id": "entry-id",
|
|
1402
|
+
children: selectedItem.title || selectedItem.id || ""
|
|
1403
|
+
}
|
|
1404
|
+
),
|
|
1405
|
+
selectedItem.popoverData ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
1406
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1407
|
+
"button",
|
|
1408
|
+
{
|
|
1409
|
+
type: "button",
|
|
1410
|
+
ref: buttonRef,
|
|
1411
|
+
css: import_react12.css`
|
|
254
1412
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
255
|
-
`,
|
|
1413
|
+
`,
|
|
1414
|
+
"aria-controls": "path-details",
|
|
1415
|
+
"aria-expanded": showInfo,
|
|
1416
|
+
onClick: popoverClick,
|
|
1417
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1418
|
+
import_design_system5.Icon,
|
|
1419
|
+
{
|
|
1420
|
+
icon: import_cg2.CgInfo,
|
|
1421
|
+
iconColor: "gray",
|
|
1422
|
+
size: 24,
|
|
1423
|
+
css: import_react12.css`
|
|
256
1424
|
opacity: var(--opacity-75);
|
|
257
|
-
`
|
|
1425
|
+
`
|
|
1426
|
+
}
|
|
1427
|
+
)
|
|
1428
|
+
}
|
|
1429
|
+
),
|
|
1430
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1431
|
+
"div",
|
|
1432
|
+
{
|
|
1433
|
+
id: "path-details",
|
|
1434
|
+
"aria-hidden": !showInfo,
|
|
1435
|
+
ref: popoverRef,
|
|
1436
|
+
css: [
|
|
1437
|
+
selectItemPopover,
|
|
1438
|
+
showInfo ? import_react12.css`
|
|
258
1439
|
visibility: visible;
|
|
259
|
-
|
|
1440
|
+
` : import_react12.css`
|
|
260
1441
|
visibility: hidden;
|
|
261
|
-
`
|
|
1442
|
+
`
|
|
1443
|
+
],
|
|
1444
|
+
children: Object.entries(selectedItem.popoverData).map(([key, value], index) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { css: selectItemSmallText, children: [
|
|
1445
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { css: selectItemPopoverLabel, children: [
|
|
1446
|
+
key,
|
|
1447
|
+
":"
|
|
1448
|
+
] }),
|
|
1449
|
+
value
|
|
1450
|
+
] }, index))
|
|
1451
|
+
}
|
|
1452
|
+
)
|
|
1453
|
+
] }) : null
|
|
1454
|
+
] }),
|
|
1455
|
+
selectedItem.createdDate && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { css: selectItemSmallText, children: [
|
|
1456
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { css: selectItemPopoverLabel, children: "Created:" }),
|
|
1457
|
+
(0, import_timeago.format)((_a = selectedItem.createdDate) != null ? _a : 0)
|
|
1458
|
+
] }),
|
|
1459
|
+
selectedItem.metadata ? Object.entries(selectedItem.metadata).filter(([key]) => ["type", "status"].includes(key.toLocaleLowerCase())).map(([key, value]) => {
|
|
1460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1461
|
+
"div",
|
|
1462
|
+
{
|
|
1463
|
+
css: [
|
|
1464
|
+
selectItemSmallText,
|
|
1465
|
+
import_react12.css`
|
|
262
1466
|
order: 1;
|
|
263
|
-
`
|
|
1467
|
+
`
|
|
1468
|
+
],
|
|
1469
|
+
children: [
|
|
1470
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { css: selectItemPopoverLabel, children: [
|
|
1471
|
+
key,
|
|
1472
|
+
":"
|
|
1473
|
+
] }),
|
|
1474
|
+
value
|
|
1475
|
+
]
|
|
1476
|
+
},
|
|
1477
|
+
key
|
|
1478
|
+
);
|
|
1479
|
+
}) : null,
|
|
1480
|
+
selectedItem.metadata ? Object.entries(selectedItem.metadata).filter(([key]) => !["type", "status"].includes(key.toLocaleLowerCase())).map(([key, value]) => {
|
|
1481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1482
|
+
"div",
|
|
1483
|
+
{
|
|
1484
|
+
css: [
|
|
1485
|
+
selectItemSmallText,
|
|
1486
|
+
import_react12.css`
|
|
264
1487
|
order: 1;
|
|
265
|
-
`
|
|
1488
|
+
`
|
|
1489
|
+
],
|
|
1490
|
+
children: [
|
|
1491
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1492
|
+
"span",
|
|
1493
|
+
{
|
|
1494
|
+
css: [
|
|
1495
|
+
selectItemPopoverLabel,
|
|
1496
|
+
import_react12.css`
|
|
266
1497
|
order: 1;
|
|
267
|
-
`
|
|
1498
|
+
`
|
|
1499
|
+
],
|
|
1500
|
+
children: [
|
|
1501
|
+
key,
|
|
1502
|
+
":"
|
|
1503
|
+
]
|
|
1504
|
+
}
|
|
1505
|
+
),
|
|
1506
|
+
value
|
|
1507
|
+
]
|
|
1508
|
+
},
|
|
1509
|
+
key
|
|
1510
|
+
);
|
|
1511
|
+
}) : null
|
|
1512
|
+
] }),
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { css: selectItemLinkContainer, children: [
|
|
1514
|
+
selectedItem.editLink ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1515
|
+
"a",
|
|
1516
|
+
{
|
|
1517
|
+
href: selectedItem.editLink,
|
|
1518
|
+
title: "edit",
|
|
1519
|
+
rel: "noopener noreferrer",
|
|
1520
|
+
target: "_blank",
|
|
1521
|
+
onClick: (e) => {
|
|
1522
|
+
if (onEditClosed) {
|
|
1523
|
+
openWindowWithCloseCallback(e.currentTarget.href, () => onEditClosed(selectedItem));
|
|
1524
|
+
e.preventDefault();
|
|
1525
|
+
}
|
|
1526
|
+
},
|
|
1527
|
+
css: selectItemLinkBtn,
|
|
1528
|
+
children: [
|
|
1529
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { css: selectItemSmallText, children: "Edit" }),
|
|
1530
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Image, { src: logoIcon, css: selectedItemIcon, alt: "Logo" })
|
|
1531
|
+
]
|
|
1532
|
+
}
|
|
1533
|
+
) : null,
|
|
1534
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1535
|
+
"button",
|
|
1536
|
+
{
|
|
1537
|
+
type: "button",
|
|
1538
|
+
onClick: () => {
|
|
1539
|
+
onDeselect(selectedItem);
|
|
1540
|
+
},
|
|
1541
|
+
css: selectItemLinkBtn,
|
|
1542
|
+
children: [
|
|
1543
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { css: selectItemSmallText, children: "Unlink" }),
|
|
1544
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_design_system5.Icon, { icon: import_cg2.CgClose, iconColor: "red", size: 16 })
|
|
1545
|
+
]
|
|
1546
|
+
}
|
|
1547
|
+
)
|
|
1548
|
+
] })
|
|
1549
|
+
] }) }, selectedItem.id);
|
|
1550
|
+
};
|
|
1551
|
+
|
|
1552
|
+
// src/components/EntrySearch/EntrySearch.tsx
|
|
1553
|
+
var import_react16 = require("@emotion/react");
|
|
1554
|
+
var import_design_system6 = require("@uniformdev/design-system");
|
|
1555
|
+
var React5 = __toESM(require("react"));
|
|
1556
|
+
var import_react_beautiful_dnd = require("react-beautiful-dnd");
|
|
1557
|
+
var import_react_use2 = require("react-use");
|
|
1558
|
+
var import_uuid = require("uuid");
|
|
1559
|
+
|
|
1560
|
+
// src/hooks/useLoadingDelay.ts
|
|
1561
|
+
var import_react14 = require("react");
|
|
1562
|
+
function useLoadingDelay(loading, { delay = 500, minDuration = 200 } = {
|
|
1563
|
+
delay: 500,
|
|
1564
|
+
minDuration: 200
|
|
1565
|
+
}) {
|
|
1566
|
+
const [state, setState] = (0, import_react14.useState)("IDLE");
|
|
1567
|
+
const timeout = (0, import_react14.useRef)(void 0);
|
|
1568
|
+
(0, import_react14.useEffect)(() => {
|
|
1569
|
+
if (loading && state === "IDLE") {
|
|
1570
|
+
clearTimeout(timeout.current);
|
|
1571
|
+
timeout.current = setTimeout(() => {
|
|
1572
|
+
if (!loading) {
|
|
1573
|
+
return setState("IDLE");
|
|
1574
|
+
}
|
|
1575
|
+
timeout.current = setTimeout(() => {
|
|
1576
|
+
setState("EXPIRE");
|
|
1577
|
+
}, minDuration);
|
|
1578
|
+
setState("DISPLAY");
|
|
1579
|
+
}, delay);
|
|
1580
|
+
setState("DELAY");
|
|
1581
|
+
}
|
|
1582
|
+
if (!loading && state !== "DISPLAY") {
|
|
1583
|
+
clearTimeout(timeout.current);
|
|
1584
|
+
setState("IDLE");
|
|
1585
|
+
}
|
|
1586
|
+
}, [loading, state, delay, minDuration]);
|
|
1587
|
+
(0, import_react14.useEffect)(() => {
|
|
1588
|
+
return () => clearTimeout(timeout.current);
|
|
1589
|
+
}, []);
|
|
1590
|
+
return state === "DISPLAY" || state === "EXPIRE";
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
// src/components/EntrySearch/styles/EntrySearch.styles.ts
|
|
1594
|
+
var import_react15 = require("@emotion/react");
|
|
1595
|
+
var entrySearchWrapper = import_react15.css`
|
|
268
1596
|
background: var(--white);
|
|
269
1597
|
border: 1px solid var(--gray-300);
|
|
270
1598
|
border-radius: var(--rounded-base);
|
|
271
1599
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
|
|
272
1600
|
margin-bottom: var(--spacing-base);
|
|
273
|
-
|
|
1601
|
+
`;
|
|
1602
|
+
var entrySearchBtn = import_react15.css`
|
|
274
1603
|
align-items: center;
|
|
275
1604
|
display: flex;
|
|
276
1605
|
position: relative;
|
|
@@ -278,7 +1607,8 @@
|
|
|
278
1607
|
width: 100%;
|
|
279
1608
|
background-color: transparent;
|
|
280
1609
|
border: 0;
|
|
281
|
-
|
|
1610
|
+
`;
|
|
1611
|
+
var entrySearchLoadMoreBtn = import_react15.css`
|
|
282
1612
|
color: var(--brand-secondary-1);
|
|
283
1613
|
display: block;
|
|
284
1614
|
font-weight: var(--fw-bold);
|
|
@@ -294,15 +1624,18 @@
|
|
|
294
1624
|
background: var(--gray-100);
|
|
295
1625
|
outline: none;
|
|
296
1626
|
}
|
|
297
|
-
|
|
1627
|
+
`;
|
|
1628
|
+
var entrySearchConfig = import_react15.css`
|
|
298
1629
|
background: var(--white);
|
|
299
1630
|
border: 1px solid var(--gray-300);
|
|
300
1631
|
border-radius: var(--rounded-base);
|
|
301
1632
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
|
|
302
1633
|
display: block;
|
|
303
|
-
|
|
1634
|
+
`;
|
|
1635
|
+
var entrySearchConfigHidden = import_react15.css`
|
|
304
1636
|
display: none;
|
|
305
|
-
|
|
1637
|
+
`;
|
|
1638
|
+
var entrySearchResultList = import_react15.css`
|
|
306
1639
|
overflow-y: auto;
|
|
307
1640
|
height: 16rem;
|
|
308
1641
|
margin-bottom: var(--spacing-base);
|
|
@@ -311,26 +1644,31 @@
|
|
|
311
1644
|
& > :not(:last-child) {
|
|
312
1645
|
border-bottom: 1px solid var(--gray-200);
|
|
313
1646
|
}
|
|
314
|
-
|
|
1647
|
+
`;
|
|
1648
|
+
var entrySearchSelectInput = import_react15.css`
|
|
315
1649
|
background-color: var(--gray-50);
|
|
316
1650
|
max-width: 33.33%;
|
|
317
|
-
|
|
1651
|
+
`;
|
|
1652
|
+
var entrySearchSelectIcon = import_react15.css`
|
|
318
1653
|
align-items: center;
|
|
319
1654
|
display: flex;
|
|
320
1655
|
position: absolute;
|
|
321
1656
|
inset: 0 0 0 auto;
|
|
322
1657
|
pointer-events: none;
|
|
323
1658
|
padding-right: var(--spacing-sm);
|
|
324
|
-
|
|
1659
|
+
`;
|
|
1660
|
+
var entrySearchSelectImg = import_react15.css`
|
|
325
1661
|
color: var(--brand-secondary-1);
|
|
326
1662
|
width: 1.25rem;
|
|
327
1663
|
height: 1.25rem;
|
|
328
1664
|
transition: transform var(--duration-fast) var(--timing-ease-out);
|
|
329
1665
|
transform: rotate(0);
|
|
330
|
-
|
|
1666
|
+
`;
|
|
1667
|
+
var entrySearchSelectOption = import_react15.css`
|
|
331
1668
|
background: var(--white);
|
|
332
1669
|
color: var(--brand-secondary-1);
|
|
333
|
-
|
|
1670
|
+
`;
|
|
1671
|
+
var draggableContainer = import_react15.css`
|
|
334
1672
|
position: relative;
|
|
335
1673
|
margin-block: var(--spacing-sm) 0;
|
|
336
1674
|
|
|
@@ -342,96 +1680,552 @@
|
|
|
342
1680
|
left: auto !important;
|
|
343
1681
|
top: auto !important;
|
|
344
1682
|
}
|
|
345
|
-
|
|
1683
|
+
`;
|
|
1684
|
+
var draggableIconWrapper = import_react15.css`
|
|
346
1685
|
align-items: center;
|
|
347
1686
|
display: flex;
|
|
348
1687
|
position: absolute;
|
|
349
1688
|
inset: 0 auto 0 0;
|
|
350
1689
|
margin-block: auto;
|
|
351
1690
|
opacity: 0;
|
|
352
|
-
|
|
1691
|
+
`;
|
|
1692
|
+
var draggableIcon = import_react15.css`
|
|
353
1693
|
color: var(--brand-secondary-1);
|
|
354
|
-
|
|
1694
|
+
`;
|
|
1695
|
+
var draggableIconOffset = import_react15.css`
|
|
355
1696
|
position: absolute;
|
|
356
1697
|
left: 0.375rem;
|
|
357
|
-
|
|
1698
|
+
`;
|
|
1699
|
+
var badgeIcon = import_react15.css`
|
|
358
1700
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
359
1701
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
360
|
-
`;
|
|
1702
|
+
`;
|
|
1703
|
+
|
|
1704
|
+
// src/components/EntrySearch/EntrySearch.tsx
|
|
1705
|
+
var import_jsx_runtime21 = require("@emotion/react/jsx-runtime");
|
|
1706
|
+
var DefaultNoResults = ({ searchText, selectedContentType }) => {
|
|
1707
|
+
let message = "No content found";
|
|
1708
|
+
if (selectedContentType && selectedContentType !== "any") {
|
|
1709
|
+
message = `No ${selectedContentType} content was found`;
|
|
1710
|
+
}
|
|
1711
|
+
if (searchText) {
|
|
1712
|
+
message = `${message} for keyword '${searchText}'.`;
|
|
1713
|
+
}
|
|
1714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system6.Callout, { type: "info", children: message });
|
|
1715
|
+
};
|
|
1716
|
+
var EntrySearch = ({
|
|
1717
|
+
search,
|
|
1718
|
+
results,
|
|
1719
|
+
contentTypes,
|
|
1720
|
+
selectedItems,
|
|
1721
|
+
logoIcon,
|
|
1722
|
+
select,
|
|
1723
|
+
multiSelect,
|
|
1724
|
+
multiSelectId,
|
|
1725
|
+
rowComponent,
|
|
1726
|
+
selectedItemComponent,
|
|
1727
|
+
totalResults,
|
|
1728
|
+
cursor,
|
|
1729
|
+
resultsLoading,
|
|
1730
|
+
requireContentType,
|
|
1731
|
+
onAddNew,
|
|
1732
|
+
onEditClosed,
|
|
1733
|
+
onCancel,
|
|
1734
|
+
noResultsComponent,
|
|
1735
|
+
helpComponent,
|
|
1736
|
+
onSort,
|
|
1737
|
+
typeSelectorLabel = "Content Type Select",
|
|
1738
|
+
typeSelectorAllTypesOptionText = "All content types",
|
|
1739
|
+
loadingIndicatorDelay = 1e3
|
|
1740
|
+
}) => {
|
|
1741
|
+
var _a, _b, _c;
|
|
1742
|
+
const pageSize = 5;
|
|
1743
|
+
const resolveInitialContentTypeState = () => {
|
|
1744
|
+
if (!requireContentType) {
|
|
1745
|
+
return "any";
|
|
1746
|
+
}
|
|
1747
|
+
if (Array.isArray(contentTypes) && contentTypes.length > 0) {
|
|
1748
|
+
return contentTypes[0].id;
|
|
1749
|
+
}
|
|
1750
|
+
return "";
|
|
1751
|
+
};
|
|
1752
|
+
const [textInput, setTextInput] = React5.useState("");
|
|
1753
|
+
const [contentTypeSelected, setContentTypeSelected] = React5.useState(resolveInitialContentTypeState);
|
|
1754
|
+
const [listOpen, setListOpen] = React5.useState(false);
|
|
1755
|
+
const [selectedListItems, setSelectedListItems] = React5.useState([]);
|
|
1756
|
+
const [loadingMore, setLoadingMore] = React5.useState(false);
|
|
1757
|
+
const listBoxId = React5.useRef(`x${(0, import_uuid.v4)()}`);
|
|
1758
|
+
(0, import_react_use2.useDebounce)(
|
|
1759
|
+
() => {
|
|
1760
|
+
search(textInput, {
|
|
1761
|
+
count: pageSize,
|
|
1762
|
+
offset: 0,
|
|
1763
|
+
contentType: contentTypeSelected === "any" ? void 0 : contentTypeSelected
|
|
1764
|
+
});
|
|
1765
|
+
},
|
|
1766
|
+
300,
|
|
1767
|
+
[textInput, contentTypeSelected]
|
|
1768
|
+
);
|
|
1769
|
+
const showLoadingOverlay = useLoadingDelay(resultsLoading, { delay: loadingIndicatorDelay });
|
|
1770
|
+
const handleListItemSelect = (selectedResult) => {
|
|
1771
|
+
if (selectedListItems.some((item) => item.id === selectedResult.id)) {
|
|
1772
|
+
setSelectedListItems((prev) => prev.filter((item) => item.id !== selectedResult.id));
|
|
1773
|
+
} else {
|
|
1774
|
+
if (!multiSelect) {
|
|
1775
|
+
setSelectedListItems([selectedResult]);
|
|
1776
|
+
} else {
|
|
1777
|
+
setSelectedListItems((prev) => [...prev, selectedResult]);
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
};
|
|
1781
|
+
const selectedItemsHash = selectedItems == null ? void 0 : selectedItems.map((item) => item.id + item.title).join(",");
|
|
1782
|
+
React5.useEffect(
|
|
1783
|
+
() => {
|
|
1784
|
+
if (Array.isArray(selectedItems)) {
|
|
1785
|
+
setSelectedListItems(selectedItems);
|
|
1786
|
+
}
|
|
1787
|
+
},
|
|
1788
|
+
[selectedItemsHash]
|
|
1789
|
+
);
|
|
1790
|
+
const resetForm = () => {
|
|
1791
|
+
setContentTypeSelected(resolveInitialContentTypeState());
|
|
1792
|
+
setTextInput("");
|
|
1793
|
+
setSelectedListItems((selectedItems == null ? void 0 : selectedItems.length) ? selectedItems : []);
|
|
1794
|
+
};
|
|
1795
|
+
const handleListButtonClick = () => {
|
|
1796
|
+
setListOpen((prevState) => !prevState);
|
|
1797
|
+
if (!listOpen) {
|
|
1798
|
+
resetForm();
|
|
1799
|
+
}
|
|
1800
|
+
};
|
|
1801
|
+
const handleDeselect = (result) => {
|
|
1802
|
+
const newValue = (selectedListItems == null ? void 0 : selectedListItems.filter((product) => product.id !== result.id)) || [];
|
|
1803
|
+
setSelectedListItems(newValue);
|
|
1804
|
+
select(newValue, "");
|
|
1805
|
+
};
|
|
1806
|
+
const handleAcceptClick = (e) => {
|
|
1807
|
+
e.preventDefault();
|
|
1808
|
+
select(selectedListItems, contentTypeSelected);
|
|
1809
|
+
setListOpen(false);
|
|
1810
|
+
};
|
|
1811
|
+
const handleCancelClick = (e) => {
|
|
1812
|
+
e.preventDefault();
|
|
1813
|
+
setListOpen(false);
|
|
1814
|
+
if (onCancel)
|
|
1815
|
+
onCancel();
|
|
1816
|
+
};
|
|
1817
|
+
const handleLoadMoreClick = () => {
|
|
1818
|
+
search(textInput, {
|
|
1819
|
+
count: pageSize,
|
|
1820
|
+
offset: (results == null ? void 0 : results.length) || 0,
|
|
1821
|
+
contentType: contentTypeSelected === "any" ? void 0 : contentTypeSelected,
|
|
1822
|
+
cursor
|
|
1823
|
+
});
|
|
1824
|
+
setLoadingMore(true);
|
|
1825
|
+
const timeout = setTimeout(() => {
|
|
1826
|
+
setLoadingMore(false);
|
|
1827
|
+
}, 750);
|
|
1828
|
+
return () => clearTimeout(timeout);
|
|
1829
|
+
};
|
|
1830
|
+
const showSelectedItems = selectedItems == null ? void 0 : selectedItems.length;
|
|
1831
|
+
const showSearchBox = !showSelectedItems || multiSelect;
|
|
1832
|
+
const ResolvedRowComponent = rowComponent || DefaultSearchRow;
|
|
1833
|
+
const ResolvedSelectedItemComponent = selectedItemComponent || DefaultSelectedItem;
|
|
1834
|
+
const ResolvedNoResultsComponent = noResultsComponent || DefaultNoResults;
|
|
1835
|
+
const CompIcon = logoIcon && typeof logoIcon !== "string" ? logoIcon : null;
|
|
1836
|
+
const resolvedIcon = CompIcon ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CompIcon, { css: badgeIcon }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("img", { src: logoIcon, alt: "Logo", css: badgeIcon });
|
|
1837
|
+
const onDragEnd = (res) => {
|
|
1838
|
+
var _a2, _b2;
|
|
1839
|
+
if (res.destination && res.source.droppableId === ((_a2 = res.destination) == null ? void 0 : _a2.droppableId)) {
|
|
1840
|
+
const result = [...selectedItems || []];
|
|
1841
|
+
const [removed] = (_b2 = result == null ? void 0 : result.splice(res.source.index, 1)) != null ? _b2 : [];
|
|
1842
|
+
result == null ? void 0 : result.splice(res.destination.index, 0, removed);
|
|
1843
|
+
if (onSort) {
|
|
1844
|
+
setSelectedListItems(result);
|
|
1845
|
+
onSort == null ? void 0 : onSort(result);
|
|
1846
|
+
}
|
|
1847
|
+
return result;
|
|
1848
|
+
}
|
|
1849
|
+
};
|
|
1850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1851
|
+
"div",
|
|
1852
|
+
{
|
|
1853
|
+
css: import_react16.css`
|
|
361
1854
|
width: 100%;
|
|
362
|
-
`,
|
|
1855
|
+
`,
|
|
1856
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1857
|
+
"div",
|
|
1858
|
+
{
|
|
1859
|
+
css: import_react16.css`
|
|
363
1860
|
position: relative;
|
|
364
1861
|
margin-block: var(--spacing-base);
|
|
365
|
-
`,
|
|
1862
|
+
`,
|
|
1863
|
+
children: [
|
|
1864
|
+
showSearchBox ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
1865
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { css: entrySearchWrapper, "data-test-id": "component-search", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1866
|
+
"button",
|
|
1867
|
+
{
|
|
1868
|
+
css: entrySearchBtn,
|
|
1869
|
+
onClick: handleListButtonClick,
|
|
1870
|
+
type: "button",
|
|
1871
|
+
"aria-haspopup": true,
|
|
1872
|
+
"aria-expanded": listOpen,
|
|
1873
|
+
"aria-controls": `entry-search-config-${listBoxId.current}`,
|
|
1874
|
+
children: [
|
|
1875
|
+
resolvedIcon,
|
|
1876
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1877
|
+
"span",
|
|
1878
|
+
{
|
|
1879
|
+
css: import_react16.css`
|
|
366
1880
|
margin-left: var(--spacing-base);
|
|
367
|
-
`,
|
|
1881
|
+
`,
|
|
1882
|
+
children: "Select"
|
|
1883
|
+
}
|
|
1884
|
+
),
|
|
1885
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { css: entrySearchSelectIcon, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1886
|
+
ChevronDown_default,
|
|
1887
|
+
{
|
|
1888
|
+
css: [
|
|
1889
|
+
entrySearchSelectImg,
|
|
1890
|
+
!listOpen ? void 0 : import_react16.css`
|
|
368
1891
|
transform: rotate(180deg);
|
|
369
|
-
|
|
1892
|
+
`
|
|
1893
|
+
]
|
|
1894
|
+
}
|
|
1895
|
+
) })
|
|
1896
|
+
]
|
|
1897
|
+
}
|
|
1898
|
+
) }),
|
|
1899
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1900
|
+
"div",
|
|
1901
|
+
{
|
|
1902
|
+
id: `entry-search-config-${listBoxId.current}`,
|
|
1903
|
+
"aria-hidden": !listOpen,
|
|
1904
|
+
css: [entrySearchConfig, listOpen ? void 0 : entrySearchConfigHidden],
|
|
1905
|
+
children: [
|
|
1906
|
+
helpComponent || null,
|
|
1907
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1908
|
+
"div",
|
|
1909
|
+
{
|
|
1910
|
+
css: import_react16.css`
|
|
370
1911
|
display: flex;
|
|
371
1912
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
372
1913
|
margin-bottom: var(--spacing-base);
|
|
373
|
-
`,
|
|
1914
|
+
`,
|
|
1915
|
+
children: [
|
|
1916
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1917
|
+
import_design_system6.InputSelect,
|
|
1918
|
+
{
|
|
1919
|
+
onChange: (e) => setContentTypeSelected(e.target.value),
|
|
1920
|
+
value: contentTypeSelected,
|
|
1921
|
+
label: typeSelectorLabel,
|
|
1922
|
+
showLabel: false,
|
|
1923
|
+
options: [
|
|
1924
|
+
...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
|
|
1925
|
+
...contentTypes ? contentTypes.map((option) => {
|
|
1926
|
+
return {
|
|
1927
|
+
value: option.id,
|
|
1928
|
+
label: option.name
|
|
1929
|
+
};
|
|
1930
|
+
}) : []
|
|
1931
|
+
]
|
|
1932
|
+
}
|
|
1933
|
+
),
|
|
1934
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1935
|
+
"div",
|
|
1936
|
+
{
|
|
1937
|
+
css: import_react16.css`
|
|
374
1938
|
flex-grow: 1;
|
|
375
|
-
`,
|
|
1939
|
+
`,
|
|
1940
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1941
|
+
import_design_system6.InputKeywordSearch,
|
|
1942
|
+
{
|
|
1943
|
+
inputFieldName: "searchText",
|
|
1944
|
+
placeholder: "Enter keyword to narrow your results",
|
|
1945
|
+
onSearchTextChanged: setTextInput,
|
|
1946
|
+
disabledFieldSubmission: true,
|
|
1947
|
+
value: textInput
|
|
1948
|
+
}
|
|
1949
|
+
)
|
|
1950
|
+
}
|
|
1951
|
+
)
|
|
1952
|
+
]
|
|
1953
|
+
}
|
|
1954
|
+
),
|
|
1955
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1956
|
+
"div",
|
|
1957
|
+
{
|
|
1958
|
+
css: [entrySearchResultList, import_design_system6.scrollbarStyles],
|
|
1959
|
+
id: listBoxId.current,
|
|
1960
|
+
role: "listbox",
|
|
1961
|
+
tabIndex: 0,
|
|
1962
|
+
"data-test-id": "entry-list",
|
|
1963
|
+
children: [
|
|
1964
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system6.LoadingOverlay, { isActive: showLoadingOverlay }),
|
|
1965
|
+
Array.isArray(results) && results.length > 0 ? results.map((result) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1966
|
+
ResolvedRowComponent,
|
|
1967
|
+
{
|
|
1968
|
+
isSelected: selectedListItems.some((item) => item.id === result.id),
|
|
1969
|
+
result,
|
|
1970
|
+
triggerSelection: () => handleListItemSelect(result)
|
|
1971
|
+
},
|
|
1972
|
+
result.id
|
|
1973
|
+
)) : resultsLoading ? null : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1974
|
+
ResolvedNoResultsComponent,
|
|
1975
|
+
{
|
|
1976
|
+
searchText: textInput || textInput,
|
|
1977
|
+
selectedContentType: (_b = (_a = contentTypes == null ? void 0 : contentTypes.find((t) => t.id === contentTypeSelected)) == null ? void 0 : _a.name) != null ? _b : contentTypeSelected
|
|
1978
|
+
}
|
|
1979
|
+
),
|
|
1980
|
+
!resultsLoading && typeof totalResults !== "undefined" && results && (results == null ? void 0 : results.length) < totalResults && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", css: entrySearchLoadMoreBtn, onClick: handleLoadMoreClick, children: !loadingMore ? "Load More" : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system6.LoadingIndicator, {}) })
|
|
1981
|
+
]
|
|
1982
|
+
}
|
|
1983
|
+
),
|
|
1984
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1985
|
+
"div",
|
|
1986
|
+
{
|
|
1987
|
+
css: import_react16.css`
|
|
376
1988
|
display: flex;
|
|
377
1989
|
justify-content: space-between;
|
|
378
|
-
`,
|
|
1990
|
+
`,
|
|
1991
|
+
children: [
|
|
1992
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { children: onAddNew && ((_c = contentTypes == null ? void 0 : contentTypes.length) != null ? _c : 0) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1993
|
+
import_design_system6.Menu,
|
|
1994
|
+
{
|
|
1995
|
+
menuLabel: "Add new menu",
|
|
1996
|
+
menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system6.Button, { buttonType: "secondary", children: "Add New" }),
|
|
1997
|
+
children: contentTypes == null ? void 0 : contentTypes.map((ct) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1998
|
+
import_design_system6.MenuItem,
|
|
1999
|
+
{
|
|
2000
|
+
css: import_react16.css`
|
|
379
2001
|
background: var(--white);
|
|
380
2002
|
color: var(--brand-secondary-1);
|
|
381
|
-
`,
|
|
2003
|
+
`,
|
|
2004
|
+
onClick: () => onAddNew(ct),
|
|
2005
|
+
children: ct.name
|
|
2006
|
+
},
|
|
2007
|
+
ct.id
|
|
2008
|
+
))
|
|
2009
|
+
}
|
|
2010
|
+
) : null }),
|
|
2011
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2012
|
+
"div",
|
|
2013
|
+
{
|
|
2014
|
+
css: import_react16.css`
|
|
382
2015
|
display: flex;
|
|
383
2016
|
gap: var(--spacing-base);
|
|
384
|
-
`,
|
|
2017
|
+
`,
|
|
2018
|
+
children: [
|
|
2019
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system6.Button, { buttonType: "unimportant", onClick: handleCancelClick, children: "Cancel" }),
|
|
2020
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2021
|
+
import_design_system6.Button,
|
|
2022
|
+
{
|
|
2023
|
+
disabled: !selectedListItems.length,
|
|
2024
|
+
onClick: handleAcceptClick,
|
|
2025
|
+
"data-test-id": "entry-accept-button",
|
|
2026
|
+
children: "Accept"
|
|
2027
|
+
}
|
|
2028
|
+
)
|
|
2029
|
+
]
|
|
2030
|
+
}
|
|
2031
|
+
)
|
|
2032
|
+
]
|
|
2033
|
+
}
|
|
2034
|
+
)
|
|
2035
|
+
]
|
|
2036
|
+
}
|
|
2037
|
+
)
|
|
2038
|
+
] }) : null,
|
|
2039
|
+
!listOpen ? multiSelect && selectedListItems.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_beautiful_dnd.DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_beautiful_dnd.Droppable, { droppableId: multiSelectId || "canvas-multi-select", children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2040
|
+
"div",
|
|
2041
|
+
{
|
|
2042
|
+
...provided.droppableProps,
|
|
2043
|
+
ref: provided.innerRef,
|
|
2044
|
+
css: import_react16.css`
|
|
385
2045
|
margin-block: var(--spacing-sm) 0;
|
|
386
|
-
`,
|
|
2046
|
+
`,
|
|
2047
|
+
children: [
|
|
2048
|
+
selectedListItems == null ? void 0 : selectedListItems.map((selectedItem, index) => {
|
|
2049
|
+
if (selectedItem == null ? void 0 : selectedItem.id) {
|
|
2050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_beautiful_dnd.Draggable, { draggableId: selectedItem.id, index, children: (provided2, snapshot) => {
|
|
2051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2052
|
+
"div",
|
|
2053
|
+
{
|
|
2054
|
+
css: draggableContainer,
|
|
2055
|
+
ref: provided2.innerRef,
|
|
2056
|
+
"data-dragging": snapshot.isDragging,
|
|
2057
|
+
...provided2.draggableProps,
|
|
2058
|
+
...provided2.dragHandleProps,
|
|
2059
|
+
children: [
|
|
2060
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { css: draggableIconWrapper, children: [
|
|
2061
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2062
|
+
MoreVerticalAlt_default,
|
|
2063
|
+
{
|
|
2064
|
+
css: [draggableIcon, draggableIconOffset],
|
|
2065
|
+
width: 24,
|
|
2066
|
+
height: 24
|
|
2067
|
+
}
|
|
2068
|
+
),
|
|
2069
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MoreVerticalAlt_default, { css: draggableIcon, width: 24, height: 24 })
|
|
2070
|
+
] }),
|
|
2071
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2072
|
+
ResolvedSelectedItemComponent,
|
|
2073
|
+
{
|
|
2074
|
+
logoIcon,
|
|
2075
|
+
selectedItem,
|
|
2076
|
+
onDeselect: (item) => handleDeselect(item),
|
|
2077
|
+
onEditClosed: onEditClosed ? (item) => onEditClosed(item) : void 0
|
|
2078
|
+
},
|
|
2079
|
+
`selected-item-${selectedItem.id}`
|
|
2080
|
+
)
|
|
2081
|
+
]
|
|
2082
|
+
}
|
|
2083
|
+
);
|
|
2084
|
+
} }, selectedItem.id);
|
|
2085
|
+
}
|
|
2086
|
+
}),
|
|
2087
|
+
provided.placeholder
|
|
2088
|
+
]
|
|
2089
|
+
}
|
|
2090
|
+
) }) }) : selectedListItems == null ? void 0 : selectedListItems.map((selectedItem) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2091
|
+
ResolvedSelectedItemComponent,
|
|
2092
|
+
{
|
|
2093
|
+
logoIcon,
|
|
2094
|
+
selectedItem,
|
|
2095
|
+
onDeselect: (item) => handleDeselect(item),
|
|
2096
|
+
onEditClosed: onEditClosed ? (item) => onEditClosed(item) : void 0
|
|
2097
|
+
},
|
|
2098
|
+
`selected-item-${selectedItem.id}`
|
|
2099
|
+
)) : null
|
|
2100
|
+
]
|
|
2101
|
+
}
|
|
2102
|
+
)
|
|
2103
|
+
}
|
|
2104
|
+
);
|
|
2105
|
+
};
|
|
2106
|
+
|
|
2107
|
+
// src/components/commerce/ProductSearchRow.tsx
|
|
2108
|
+
var import_react18 = require("@emotion/react");
|
|
2109
|
+
|
|
2110
|
+
// src/components/commerce/styles/ProductSearchRow.styles.ts
|
|
2111
|
+
var import_react17 = require("@emotion/react");
|
|
2112
|
+
var productSearchRowContainer = import_react17.css`
|
|
387
2113
|
cursor: pointer;
|
|
388
2114
|
padding: var(--spacing-sm) 0;
|
|
389
2115
|
margin-right: var(--spacing-sm);
|
|
390
2116
|
position: relative;
|
|
391
2117
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
392
2118
|
color var(--duration-fast) var(--timing-ease-out);
|
|
393
|
-
|
|
2119
|
+
`;
|
|
2120
|
+
var productSearchRowContent = import_react17.css`
|
|
394
2121
|
border: 2px solid transparent;
|
|
395
2122
|
border-radius: var(--rounded-base);
|
|
396
2123
|
display: flex;
|
|
397
2124
|
align-items: center;
|
|
398
2125
|
gap: var(--spacing-base);
|
|
399
2126
|
padding: var(--spacing-sm) var(--spacing-xs);
|
|
400
|
-
|
|
2127
|
+
`;
|
|
2128
|
+
var productSearchRowContentActive = import_react17.css`
|
|
401
2129
|
background-color: var(--green-50);
|
|
402
|
-
|
|
2130
|
+
`;
|
|
2131
|
+
var productSearchRowTitle = import_react17.css`
|
|
403
2132
|
font-size: var(--fs-sm);
|
|
404
2133
|
font-weight: var(--fw-bold);
|
|
405
2134
|
width: 50%;
|
|
406
|
-
|
|
2135
|
+
`;
|
|
2136
|
+
var productSearchRowCategory = import_react17.css`
|
|
407
2137
|
font-weight: var(--fw-normal);
|
|
408
2138
|
display: block;
|
|
409
|
-
|
|
2139
|
+
`;
|
|
2140
|
+
var productSearchRowDetails = import_react17.css`
|
|
410
2141
|
font-size: var(--fs-sm);
|
|
411
2142
|
> * {
|
|
412
2143
|
display: block;
|
|
413
2144
|
}
|
|
414
|
-
|
|
2145
|
+
`;
|
|
2146
|
+
var productSearchRowActiveIcon = import_react17.css`
|
|
415
2147
|
display: block;
|
|
416
2148
|
height: 1.5rem;
|
|
417
2149
|
width: 1.5rem;
|
|
418
2150
|
color: var(--brand-secondary-3);
|
|
419
2151
|
margin-left: auto;
|
|
420
|
-
`;
|
|
2152
|
+
`;
|
|
2153
|
+
|
|
2154
|
+
// src/components/commerce/ProductSearchRow.tsx
|
|
2155
|
+
var import_jsx_runtime22 = require("@emotion/react/jsx-runtime");
|
|
2156
|
+
function ProductSearchRow({
|
|
2157
|
+
result,
|
|
2158
|
+
isSelected,
|
|
2159
|
+
triggerSelection
|
|
2160
|
+
}) {
|
|
2161
|
+
var _a;
|
|
2162
|
+
const { categories, logoIcon } = useProductSearchContext();
|
|
2163
|
+
const [category] = result.categories || [{ id: "", name: "" }];
|
|
2164
|
+
const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c) => c.id === category.id)) == null ? void 0 : _a.name;
|
|
2165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2166
|
+
"div",
|
|
2167
|
+
{
|
|
2168
|
+
"data-value": result.id,
|
|
2169
|
+
role: "option",
|
|
2170
|
+
tabIndex: -1,
|
|
2171
|
+
onClick: () => triggerSelection(),
|
|
2172
|
+
css: [productSearchRowContainer],
|
|
2173
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { css: [productSearchRowContent, isSelected ? productSearchRowContentActive : void 0], children: [
|
|
2174
|
+
result.thumbnailUrl ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2175
|
+
"img",
|
|
2176
|
+
{
|
|
2177
|
+
src: result.thumbnailUrl,
|
|
2178
|
+
alt: `Thumbnail for ${result.title}`,
|
|
2179
|
+
css: import_react18.css`
|
|
421
2180
|
background-color: var(--gray-200);
|
|
422
2181
|
width: 3rem;
|
|
423
2182
|
height: 3rem;
|
|
424
2183
|
object-fit: cover;
|
|
425
|
-
`
|
|
2184
|
+
`
|
|
2185
|
+
}
|
|
2186
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2187
|
+
Image,
|
|
2188
|
+
{
|
|
2189
|
+
src: logoIcon,
|
|
2190
|
+
alt: "Logo",
|
|
2191
|
+
css: import_react18.css`
|
|
426
2192
|
height: 2.25rem;
|
|
427
2193
|
width: 2.25rem;
|
|
428
|
-
`
|
|
2194
|
+
`
|
|
2195
|
+
}
|
|
2196
|
+
),
|
|
2197
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("h4", { css: [productSearchRowTitle], children: [
|
|
2198
|
+
result.title,
|
|
2199
|
+
categoryName ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { css: [productSearchRowCategory], children: categoryName }) : null
|
|
2200
|
+
] }),
|
|
2201
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { css: [productSearchRowDetails], children: [
|
|
2202
|
+
"SKU: ",
|
|
2203
|
+
result.sku || result.id,
|
|
2204
|
+
result.price !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: result.price }) : null
|
|
2205
|
+
] }),
|
|
2206
|
+
isSelected ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Checkmark_default, { css: [productSearchRowActiveIcon] }) : null
|
|
2207
|
+
] })
|
|
2208
|
+
},
|
|
2209
|
+
result.id
|
|
2210
|
+
);
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
// src/components/commerce/ProductSelectedItem.tsx
|
|
2214
|
+
var import_react20 = require("@emotion/react");
|
|
2215
|
+
var import_design_system8 = require("@uniformdev/design-system");
|
|
2216
|
+
var import_cg3 = require("react-icons/cg");
|
|
2217
|
+
|
|
2218
|
+
// src/components/commerce/styles/ProductSelectedItem.styles.ts
|
|
2219
|
+
var import_react19 = require("@emotion/react");
|
|
2220
|
+
var import_design_system7 = require("@uniformdev/design-system");
|
|
2221
|
+
var productSelectedItemContainer = import_react19.css`
|
|
429
2222
|
border: 1px solid var(--gray-200);
|
|
430
2223
|
border-radius: var(--rounded-base);
|
|
431
2224
|
background: var(--gray-50);
|
|
432
2225
|
display: flex;
|
|
433
2226
|
width: 100%;
|
|
434
|
-
|
|
2227
|
+
`;
|
|
2228
|
+
var productSelectedItemDetails = import_react19.css`
|
|
435
2229
|
align-items: center;
|
|
436
2230
|
display: flex;
|
|
437
2231
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
@@ -439,22 +2233,25 @@
|
|
|
439
2233
|
flex-grow: 1;
|
|
440
2234
|
gap: var(--spacing-sm);
|
|
441
2235
|
margin-inline: 0 var(--spacing-sm);
|
|
442
|
-
|
|
2236
|
+
`;
|
|
2237
|
+
var productSelectedItemContent = import_react19.css`
|
|
443
2238
|
display: flex;
|
|
444
2239
|
align-items: center;
|
|
445
2240
|
gap: var(--spacing-sm);
|
|
446
2241
|
flex-grow: 1;
|
|
447
2242
|
|
|
448
|
-
${(0,
|
|
2243
|
+
${(0, import_design_system7.mq)("lg")} {
|
|
449
2244
|
width: 50%;
|
|
450
2245
|
margin-bottom: 0;
|
|
451
2246
|
}
|
|
452
|
-
|
|
2247
|
+
`;
|
|
2248
|
+
var productSelectedItemImage = import_react19.css`
|
|
453
2249
|
background-color: var(--gray-200);
|
|
454
2250
|
width: 3.5rem;
|
|
455
2251
|
height: 3.5rem;
|
|
456
2252
|
object-fit: cover;
|
|
457
|
-
|
|
2253
|
+
`;
|
|
2254
|
+
var productedSelectedItemLinkBtn = import_react19.css`
|
|
458
2255
|
align-items: center;
|
|
459
2256
|
background: var(--white);
|
|
460
2257
|
border-radius: var(--rounded-base);
|
|
@@ -469,50 +2266,277 @@
|
|
|
469
2266
|
&:hover {
|
|
470
2267
|
background: var(--gray-50);
|
|
471
2268
|
}
|
|
472
|
-
|
|
2269
|
+
`;
|
|
2270
|
+
var productedSelectedItemSmallText = import_react19.css`
|
|
473
2271
|
font-size: var(--fs-sm);
|
|
474
|
-
|
|
2272
|
+
`;
|
|
2273
|
+
var productSelectedItemIcon = import_react19.css`
|
|
475
2274
|
display: block;
|
|
476
2275
|
width: 1rem;
|
|
477
2276
|
height: 1rem;
|
|
478
|
-
|
|
2277
|
+
`;
|
|
2278
|
+
var productSelectedItemLinkContainer = import_react19.css`
|
|
479
2279
|
display: flex;
|
|
480
2280
|
flex-direction: column;
|
|
481
2281
|
gap: var(--spacing-sm);
|
|
482
2282
|
|
|
483
|
-
${(0,
|
|
2283
|
+
${(0, import_design_system7.mq)("md")} {
|
|
484
2284
|
flex-direction: row;
|
|
485
2285
|
min-width: 200px;
|
|
486
2286
|
justify-content: end;
|
|
487
2287
|
}
|
|
488
|
-
`;
|
|
2288
|
+
`;
|
|
2289
|
+
|
|
2290
|
+
// src/components/commerce/ProductSelectedItem.tsx
|
|
2291
|
+
var import_jsx_runtime23 = require("@emotion/react/jsx-runtime");
|
|
2292
|
+
function ProductSelectedItem({
|
|
2293
|
+
selectedItem,
|
|
2294
|
+
onDeselect
|
|
2295
|
+
}) {
|
|
2296
|
+
var _a;
|
|
2297
|
+
const { categories, logoIcon } = useProductSearchContext();
|
|
2298
|
+
const [category] = selectedItem.categories || [{ id: "", name: "" }];
|
|
2299
|
+
const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c) => c.id === category.id)) == null ? void 0 : _a.name;
|
|
2300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { css: [productSelectedItemContainer], children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("article", { css: [productSelectedItemDetails], children: [
|
|
2301
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { css: [productSelectedItemContent], children: [
|
|
2302
|
+
selectedItem.thumbnailUrl ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2303
|
+
"img",
|
|
2304
|
+
{
|
|
2305
|
+
src: selectedItem.thumbnailUrl,
|
|
2306
|
+
alt: categoryName,
|
|
2307
|
+
css: [productSelectedItemImage],
|
|
2308
|
+
loading: "lazy"
|
|
2309
|
+
}
|
|
2310
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { css: [productSelectedItemImage] }),
|
|
2311
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2312
|
+
"div",
|
|
2313
|
+
{
|
|
2314
|
+
css: import_react20.css`
|
|
489
2315
|
> :not(:last-child) {
|
|
490
2316
|
margin-bottom: var(--spacing-xs);
|
|
491
2317
|
}
|
|
492
|
-
`,
|
|
2318
|
+
`,
|
|
2319
|
+
children: [
|
|
2320
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2321
|
+
"h4",
|
|
2322
|
+
{
|
|
2323
|
+
css: import_react20.css`
|
|
493
2324
|
margin-top: 0px;
|
|
494
2325
|
font-weight: var(--fw-bold);
|
|
495
|
-
`,
|
|
2326
|
+
`,
|
|
2327
|
+
children: [
|
|
2328
|
+
selectedItem.title || selectedItem.id || "",
|
|
2329
|
+
categoryName && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2330
|
+
"span",
|
|
2331
|
+
{
|
|
2332
|
+
css: import_react20.css`
|
|
496
2333
|
display: block;
|
|
497
2334
|
font-weight: var(--fw-regular);
|
|
498
|
-
`,
|
|
2335
|
+
`,
|
|
2336
|
+
children: categoryName
|
|
2337
|
+
}
|
|
2338
|
+
)
|
|
2339
|
+
]
|
|
2340
|
+
}
|
|
2341
|
+
),
|
|
2342
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2343
|
+
"ul",
|
|
2344
|
+
{
|
|
2345
|
+
css: import_react20.css`
|
|
499
2346
|
font-size: var(--fs-sm);
|
|
500
2347
|
|
|
501
|
-
${(0,
|
|
2348
|
+
${(0, import_design_system8.mq)("sm")} {
|
|
502
2349
|
display: flex;
|
|
503
2350
|
gap: var(--spacing-base);
|
|
504
2351
|
}
|
|
505
|
-
`,
|
|
2352
|
+
`,
|
|
2353
|
+
children: [
|
|
2354
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("li", { children: [
|
|
2355
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2356
|
+
"span",
|
|
2357
|
+
{
|
|
2358
|
+
css: import_react20.css`
|
|
506
2359
|
margin-right: var(--spacing-xs);
|
|
507
|
-
`,
|
|
2360
|
+
`,
|
|
2361
|
+
children: "SKU:"
|
|
2362
|
+
}
|
|
2363
|
+
),
|
|
2364
|
+
selectedItem.sku || selectedItem.id
|
|
2365
|
+
] }),
|
|
2366
|
+
selectedItem.price !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("li", { children: [
|
|
2367
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2368
|
+
"span",
|
|
2369
|
+
{
|
|
2370
|
+
css: import_react20.css`
|
|
508
2371
|
margin-right: var(--spacing-xs);
|
|
509
|
-
`,
|
|
2372
|
+
`,
|
|
2373
|
+
children: "Price:"
|
|
2374
|
+
}
|
|
2375
|
+
),
|
|
2376
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: selectedItem.price })
|
|
2377
|
+
] }) : null
|
|
2378
|
+
]
|
|
2379
|
+
}
|
|
2380
|
+
)
|
|
2381
|
+
]
|
|
2382
|
+
}
|
|
2383
|
+
)
|
|
2384
|
+
] }),
|
|
2385
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { css: productSelectedItemLinkContainer, children: [
|
|
2386
|
+
selectedItem.editLink ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2387
|
+
"a",
|
|
2388
|
+
{
|
|
2389
|
+
href: selectedItem.editLink,
|
|
2390
|
+
title: "edit",
|
|
2391
|
+
rel: "noopener noreferrer",
|
|
2392
|
+
target: "_blank",
|
|
2393
|
+
css: productedSelectedItemLinkBtn,
|
|
2394
|
+
children: [
|
|
2395
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { css: productedSelectedItemSmallText, children: "Edit" }),
|
|
2396
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Image, { src: logoIcon, alt: "Logo", css: productSelectedItemIcon })
|
|
2397
|
+
]
|
|
2398
|
+
}
|
|
2399
|
+
) : null,
|
|
2400
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2401
|
+
"button",
|
|
2402
|
+
{
|
|
2403
|
+
type: "button",
|
|
2404
|
+
onClick: () => {
|
|
2405
|
+
onDeselect == null ? void 0 : onDeselect(selectedItem);
|
|
2406
|
+
},
|
|
2407
|
+
css: productedSelectedItemLinkBtn,
|
|
2408
|
+
children: [
|
|
2409
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { css: productedSelectedItemSmallText, children: "Unlink" }),
|
|
2410
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system8.Icon, { icon: import_cg3.CgClose, iconColor: "red", size: 16 })
|
|
2411
|
+
]
|
|
2412
|
+
}
|
|
2413
|
+
)
|
|
2414
|
+
] })
|
|
2415
|
+
] }) }, selectedItem.id);
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
// src/components/commerce/ProductSearch.tsx
|
|
2419
|
+
var import_jsx_runtime24 = require("@emotion/react/jsx-runtime");
|
|
2420
|
+
function ProductSearch({
|
|
2421
|
+
selectedProducts,
|
|
2422
|
+
setSelectedProducts,
|
|
2423
|
+
onGetCategories,
|
|
2424
|
+
onSearchProducts,
|
|
2425
|
+
logoIcon,
|
|
2426
|
+
multiSelect,
|
|
2427
|
+
multiSelectId,
|
|
2428
|
+
selectedItemComponent,
|
|
2429
|
+
rowComponent,
|
|
2430
|
+
errorComponent,
|
|
2431
|
+
helpComponent,
|
|
2432
|
+
noResultsComponent,
|
|
2433
|
+
onSort,
|
|
2434
|
+
typeSelectorAllTypesOptionText = "All categories",
|
|
2435
|
+
typeSelectorLabel = "Select Category"
|
|
2436
|
+
}) {
|
|
2437
|
+
var _a, _b;
|
|
2438
|
+
const {
|
|
2439
|
+
value: categories,
|
|
2440
|
+
loading: categoriesLoading,
|
|
2441
|
+
error: categoriesError
|
|
2442
|
+
} = (0, import_react_use3.useAsync)(async () => {
|
|
2443
|
+
return await onGetCategories();
|
|
2444
|
+
}, [onGetCategories]);
|
|
2445
|
+
const categoryIds = categories == null ? void 0 : categories.map((c) => c.id).join(",");
|
|
2446
|
+
const categoryOptions = (0, import_react21.useMemo)(
|
|
2447
|
+
() => {
|
|
2448
|
+
if (!categories) {
|
|
2449
|
+
return void 0;
|
|
2450
|
+
}
|
|
2451
|
+
const result = categories.map((category) => ({
|
|
2452
|
+
id: category.id,
|
|
2453
|
+
name: category.name
|
|
2454
|
+
}));
|
|
2455
|
+
return result;
|
|
2456
|
+
},
|
|
2457
|
+
[categoryIds]
|
|
2458
|
+
);
|
|
2459
|
+
const combinedSearchResults = (0, import_react21.useRef)();
|
|
2460
|
+
const [handleSearchState, handleSearch] = (0, import_react_use3.useAsyncFn)(
|
|
2461
|
+
async (text, options) => {
|
|
2462
|
+
const result = await onSearchProducts({
|
|
2463
|
+
text,
|
|
2464
|
+
options: {
|
|
2465
|
+
limit: options == null ? void 0 : options.count,
|
|
2466
|
+
offset: options == null ? void 0 : options.offset,
|
|
2467
|
+
categoryId: options == null ? void 0 : options.contentType,
|
|
2468
|
+
cursor: options == null ? void 0 : options.cursor
|
|
2469
|
+
}
|
|
2470
|
+
});
|
|
2471
|
+
if ((options == null ? void 0 : options.offset) === 0) {
|
|
2472
|
+
combinedSearchResults.current = [];
|
|
2473
|
+
}
|
|
2474
|
+
(combinedSearchResults.current = combinedSearchResults.current || []).push(...result.products);
|
|
2475
|
+
return result;
|
|
2476
|
+
},
|
|
2477
|
+
[onSearchProducts]
|
|
2478
|
+
);
|
|
2479
|
+
const handleSelect = async (items) => {
|
|
2480
|
+
await setSelectedProducts(items);
|
|
2481
|
+
};
|
|
2482
|
+
if (categoriesError || handleSearchState.error) {
|
|
2483
|
+
const ErrorComp = errorComponent ? errorComponent : ({ categoriesError: categoriesError2, searchError }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_design_system9.Callout, { type: "error", children: [
|
|
2484
|
+
"There was an error: ",
|
|
2485
|
+
(categoriesError2 == null ? void 0 : categoriesError2.message) || (searchError == null ? void 0 : searchError.message)
|
|
2486
|
+
] });
|
|
2487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ErrorComp, { categoriesError, searchError: handleSearchState.error });
|
|
2488
|
+
}
|
|
2489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ProductSearchContext.Provider, { value: { categories, logoIcon }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2490
|
+
EntrySearch,
|
|
2491
|
+
{
|
|
2492
|
+
search: handleSearch,
|
|
2493
|
+
results: combinedSearchResults.current,
|
|
2494
|
+
logoIcon,
|
|
2495
|
+
selectedItems: selectedProducts,
|
|
2496
|
+
select: handleSelect,
|
|
2497
|
+
multiSelectId: multiSelectId || "product-search-multi-select",
|
|
2498
|
+
multiSelect,
|
|
2499
|
+
contentTypes: categoryOptions,
|
|
2500
|
+
selectedItemComponent: selectedItemComponent || ProductSelectedItem,
|
|
2501
|
+
rowComponent: rowComponent || ProductSearchRow,
|
|
2502
|
+
totalResults: (_a = handleSearchState.value) == null ? void 0 : _a.total,
|
|
2503
|
+
cursor: (_b = handleSearchState.value) == null ? void 0 : _b.cursor,
|
|
2504
|
+
resultsLoading: handleSearchState.loading || categoriesLoading,
|
|
2505
|
+
helpComponent,
|
|
2506
|
+
noResultsComponent,
|
|
2507
|
+
onSort,
|
|
2508
|
+
typeSelectorAllTypesOptionText,
|
|
2509
|
+
typeSelectorLabel
|
|
2510
|
+
}
|
|
2511
|
+
) });
|
|
2512
|
+
}
|
|
2513
|
+
var ProductSearchContext = import_react21.default.createContext(void 0);
|
|
2514
|
+
var useProductSearchContext = () => {
|
|
2515
|
+
const context = (0, import_react21.useContext)(ProductSearchContext);
|
|
2516
|
+
if (!context) {
|
|
2517
|
+
throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");
|
|
2518
|
+
}
|
|
2519
|
+
return context;
|
|
2520
|
+
};
|
|
2521
|
+
|
|
2522
|
+
// src/components/dam/DamSelectedItem.tsx
|
|
2523
|
+
var import_react23 = require("@emotion/react");
|
|
2524
|
+
var import_design_system11 = require("@uniformdev/design-system");
|
|
2525
|
+
var import_react24 = require("react");
|
|
2526
|
+
var import_cg4 = require("react-icons/cg");
|
|
2527
|
+
var import_timeago2 = require("timeago.js");
|
|
2528
|
+
|
|
2529
|
+
// src/components/dam/DamSelectedItem.styles.ts
|
|
2530
|
+
var import_react22 = require("@emotion/react");
|
|
2531
|
+
var import_design_system10 = require("@uniformdev/design-system");
|
|
2532
|
+
var damSelectedItemContainer = import_react22.css`
|
|
510
2533
|
border: 1px solid var(--gray-200);
|
|
511
2534
|
background: var(--gray-50);
|
|
512
2535
|
border-radius: var(--rounded-base);
|
|
513
2536
|
display: flex;
|
|
514
2537
|
width: 100%;
|
|
515
|
-
|
|
2538
|
+
`;
|
|
2539
|
+
var damSelectedItemInner = import_react22.css`
|
|
516
2540
|
align-items: center;
|
|
517
2541
|
display: flex;
|
|
518
2542
|
flex-grow: 1;
|
|
@@ -520,23 +2544,28 @@
|
|
|
520
2544
|
margin-inline: 0 var(--spacing-sm);
|
|
521
2545
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
522
2546
|
position: relative;
|
|
523
|
-
|
|
2547
|
+
`;
|
|
2548
|
+
var damSelectedItemDetails = import_react22.css`
|
|
524
2549
|
flex-grow: 1;
|
|
525
|
-
|
|
2550
|
+
`;
|
|
2551
|
+
var damSelectedItemCopy = import_react22.css`
|
|
526
2552
|
align-items: center;
|
|
527
2553
|
display: flex;
|
|
528
2554
|
position: relative;
|
|
529
|
-
|
|
2555
|
+
`;
|
|
2556
|
+
var damSelectedItemTitle = import_react22.css`
|
|
530
2557
|
color: var(--brand-secondary-1);
|
|
531
2558
|
font-size: var(--fs-base);
|
|
532
2559
|
font-weight: var(--fw-bold);
|
|
533
2560
|
line-height: 1;
|
|
534
2561
|
margin: 0;
|
|
535
2562
|
word-break: break-word;
|
|
536
|
-
|
|
2563
|
+
`;
|
|
2564
|
+
var damSelectedItemIcon = import_react22.css`
|
|
537
2565
|
width: 1.5rem;
|
|
538
2566
|
height: 1.5rem;
|
|
539
|
-
|
|
2567
|
+
`;
|
|
2568
|
+
var damSelectedItemPopover = import_react22.css`
|
|
540
2569
|
background: var(--white);
|
|
541
2570
|
border-radius: var(--rounded-base);
|
|
542
2571
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -545,22 +2574,26 @@
|
|
|
545
2574
|
padding: var(--spacing-base);
|
|
546
2575
|
z-index: var(--z-10);
|
|
547
2576
|
width: max-content;
|
|
548
|
-
|
|
2577
|
+
`;
|
|
2578
|
+
var damSelectedItemSmallText = import_react22.css`
|
|
549
2579
|
font-size: var(--fs-sm);
|
|
550
|
-
|
|
2580
|
+
`;
|
|
2581
|
+
var damSelectedItemPopoverLabel = import_react22.css`
|
|
551
2582
|
font-weight: var(--fw-bold);
|
|
552
2583
|
margin-right: var(--spacing-sm);
|
|
553
|
-
|
|
2584
|
+
`;
|
|
2585
|
+
var damSelectedItemLinkContainer = import_react22.css`
|
|
554
2586
|
display: flex;
|
|
555
2587
|
flex-direction: column;
|
|
556
2588
|
gap: var(--spacing-sm);
|
|
557
2589
|
|
|
558
|
-
${(0,
|
|
2590
|
+
${(0, import_design_system10.mq)("md")} {
|
|
559
2591
|
flex-direction: row;
|
|
560
2592
|
justify-content: end;
|
|
561
2593
|
min-width: 200px;
|
|
562
2594
|
}
|
|
563
|
-
|
|
2595
|
+
`;
|
|
2596
|
+
var damSelectedItemLinkBtn = import_react22.css`
|
|
564
2597
|
align-items: center;
|
|
565
2598
|
background: var(--white);
|
|
566
2599
|
border-radius: var(--rounded-base);
|
|
@@ -575,40 +2608,340 @@
|
|
|
575
2608
|
&:hover {
|
|
576
2609
|
background: var(--gray-50);
|
|
577
2610
|
}
|
|
578
|
-
|
|
2611
|
+
`;
|
|
2612
|
+
var damSelectedItemMediaContainer = import_react22.css`
|
|
579
2613
|
display: flex;
|
|
580
2614
|
margin-top: var(--spacing-sm);
|
|
581
2615
|
gap: var(--spacing-sm);
|
|
582
|
-
|
|
2616
|
+
`;
|
|
2617
|
+
var damSelectedItemInfoBtn = import_react22.css`
|
|
583
2618
|
background: none;
|
|
584
2619
|
outline: none;
|
|
585
2620
|
border: none;
|
|
586
2621
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
587
|
-
|
|
2622
|
+
`;
|
|
2623
|
+
var damSelectItemImage = import_react22.css`
|
|
588
2624
|
display: block;
|
|
589
2625
|
max-width: 100%;
|
|
590
2626
|
min-width: 100px;
|
|
591
2627
|
height: auto;
|
|
592
|
-
`;
|
|
2628
|
+
`;
|
|
2629
|
+
|
|
2630
|
+
// src/components/dam/DamSelectedItem.tsx
|
|
2631
|
+
var import_jsx_runtime25 = require("@emotion/react/jsx-runtime");
|
|
2632
|
+
function DamSelectedItem({
|
|
2633
|
+
selectedItem,
|
|
2634
|
+
onDeselect,
|
|
2635
|
+
onEditClosed,
|
|
2636
|
+
logoIcon,
|
|
2637
|
+
itemDetailsRendererComponent
|
|
2638
|
+
}) {
|
|
2639
|
+
const buttonRef = (0, import_react24.useRef)(null);
|
|
2640
|
+
const popoverRef = (0, import_react24.useRef)(null);
|
|
2641
|
+
const [showInfo, setShowInfo] = (0, import_react24.useState)(false);
|
|
2642
|
+
(0, import_react24.useEffect)(() => {
|
|
2643
|
+
const eventHandler = (event) => {
|
|
2644
|
+
if (buttonRef.current && !buttonRef.current.contains(event.target) && popoverRef.current && !popoverRef.current.contains(event.target)) {
|
|
2645
|
+
setShowInfo(false);
|
|
2646
|
+
}
|
|
2647
|
+
};
|
|
2648
|
+
const resizeHandler = () => {
|
|
2649
|
+
setShowInfo(false);
|
|
2650
|
+
};
|
|
2651
|
+
window.addEventListener("resize", resizeHandler, true);
|
|
2652
|
+
document.addEventListener("scroll", eventHandler, true);
|
|
2653
|
+
document.addEventListener("mousedown", eventHandler);
|
|
2654
|
+
return () => {
|
|
2655
|
+
window.removeEventListener("resize", resizeHandler, true);
|
|
2656
|
+
document.removeEventListener("scroll", eventHandler, true);
|
|
2657
|
+
document.removeEventListener("mousedown", eventHandler);
|
|
2658
|
+
};
|
|
2659
|
+
}, [popoverRef]);
|
|
2660
|
+
const popoverClick = () => {
|
|
2661
|
+
var _a;
|
|
2662
|
+
setShowInfo(!showInfo);
|
|
2663
|
+
if (popoverRef.current && buttonRef.current) {
|
|
2664
|
+
const buttonPos = (_a = buttonRef == null ? void 0 : buttonRef.current) == null ? void 0 : _a.getBoundingClientRect();
|
|
2665
|
+
popoverRef.current.style["top"] = `${buttonPos.top + 30}px`;
|
|
2666
|
+
}
|
|
2667
|
+
};
|
|
2668
|
+
const ResolvedItemDetailsRendererComponent = itemDetailsRendererComponent != null ? itemDetailsRendererComponent : DefaultDamItemRenderer;
|
|
2669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2670
|
+
"div",
|
|
2671
|
+
{
|
|
2672
|
+
css: [
|
|
2673
|
+
damSelectedItemContainer,
|
|
2674
|
+
import_react23.css`
|
|
593
2675
|
margin: 0 0 1rem 0;
|
|
594
|
-
`
|
|
2676
|
+
`
|
|
2677
|
+
],
|
|
2678
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { css: damSelectedItemInner, children: [
|
|
2679
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { css: damSelectedItemDetails, children: [
|
|
2680
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { css: damSelectedItemCopy, children: [
|
|
2681
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2682
|
+
"h4",
|
|
2683
|
+
{
|
|
2684
|
+
css: [damSelectedItemTitle],
|
|
2685
|
+
title: `ID: ${selectedItem.id}`,
|
|
2686
|
+
"data-test-id": "dam-selected-item",
|
|
2687
|
+
children: selectedItem.title || selectedItem.id || ""
|
|
2688
|
+
}
|
|
2689
|
+
),
|
|
2690
|
+
selectedItem.popoverData ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
2691
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2692
|
+
"button",
|
|
2693
|
+
{
|
|
2694
|
+
type: "button",
|
|
2695
|
+
ref: buttonRef,
|
|
2696
|
+
css: damSelectedItemInfoBtn,
|
|
2697
|
+
"aria-controls": "path-details",
|
|
2698
|
+
"aria-expanded": showInfo,
|
|
2699
|
+
onClick: popoverClick,
|
|
2700
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2701
|
+
import_design_system11.Icon,
|
|
2702
|
+
{
|
|
2703
|
+
icon: import_cg4.CgInfo,
|
|
2704
|
+
iconColor: "gray",
|
|
2705
|
+
size: 24,
|
|
2706
|
+
css: import_react23.css`
|
|
595
2707
|
opacity: var(--opacity-75);
|
|
596
|
-
`
|
|
2708
|
+
`
|
|
2709
|
+
}
|
|
2710
|
+
)
|
|
2711
|
+
}
|
|
2712
|
+
),
|
|
2713
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2714
|
+
"div",
|
|
2715
|
+
{
|
|
2716
|
+
id: "path-details",
|
|
2717
|
+
"aria-hidden": !showInfo,
|
|
2718
|
+
ref: popoverRef,
|
|
2719
|
+
css: [
|
|
2720
|
+
damSelectedItemPopover,
|
|
2721
|
+
showInfo ? import_react23.css`
|
|
597
2722
|
visibility: visible;
|
|
598
|
-
|
|
2723
|
+
` : import_react23.css`
|
|
599
2724
|
visibility: hidden;
|
|
600
|
-
`
|
|
2725
|
+
`
|
|
2726
|
+
],
|
|
2727
|
+
children: Object.entries(selectedItem.popoverData).map(([key, value], index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { css: damSelectedItemSmallText, children: [
|
|
2728
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { css: damSelectedItemPopoverLabel, children: [
|
|
2729
|
+
key,
|
|
2730
|
+
":"
|
|
2731
|
+
] }),
|
|
2732
|
+
value
|
|
2733
|
+
] }, index))
|
|
2734
|
+
}
|
|
2735
|
+
)
|
|
2736
|
+
] }) : null
|
|
2737
|
+
] }),
|
|
2738
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ResolvedItemDetailsRendererComponent, { item: selectedItem })
|
|
2739
|
+
] }),
|
|
2740
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { css: damSelectedItemLinkContainer, children: [
|
|
2741
|
+
selectedItem.editLink ? typeof selectedItem.editLink === "string" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2742
|
+
"a",
|
|
2743
|
+
{
|
|
2744
|
+
href: selectedItem.editLink,
|
|
2745
|
+
title: "edit",
|
|
2746
|
+
rel: "noopener noreferrer",
|
|
2747
|
+
target: "_blank",
|
|
2748
|
+
onClick: (e) => {
|
|
2749
|
+
if (onEditClosed) {
|
|
2750
|
+
openWindowWithCloseCallback(e.currentTarget.href, () => onEditClosed(selectedItem));
|
|
2751
|
+
e.preventDefault();
|
|
2752
|
+
}
|
|
2753
|
+
},
|
|
2754
|
+
css: damSelectedItemLinkBtn,
|
|
2755
|
+
children: [
|
|
2756
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { css: damSelectedItemSmallText, children: "Edit" }),
|
|
2757
|
+
logoIcon ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Image, { src: logoIcon, css: damSelectedItemIcon, alt: "Logo" }) : null
|
|
2758
|
+
]
|
|
2759
|
+
}
|
|
2760
|
+
) : selectedItem.editLink : null,
|
|
2761
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2762
|
+
"button",
|
|
2763
|
+
{
|
|
2764
|
+
type: "button",
|
|
2765
|
+
onClick: () => {
|
|
2766
|
+
onDeselect(selectedItem);
|
|
2767
|
+
},
|
|
2768
|
+
css: damSelectedItemLinkBtn,
|
|
2769
|
+
children: [
|
|
2770
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { css: damSelectedItemSmallText, children: "Unlink" }),
|
|
2771
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_design_system11.Icon, { icon: import_cg4.CgClose, iconColor: "red", size: 16 })
|
|
2772
|
+
]
|
|
2773
|
+
}
|
|
2774
|
+
)
|
|
2775
|
+
] })
|
|
2776
|
+
] })
|
|
2777
|
+
},
|
|
2778
|
+
selectedItem.id
|
|
2779
|
+
);
|
|
2780
|
+
}
|
|
2781
|
+
function DefaultDamItemRenderer({ item }) {
|
|
2782
|
+
let preview = null;
|
|
2783
|
+
if (item.previewUrl && typeof item.previewUrl === "string") {
|
|
2784
|
+
if (item.type === "image") {
|
|
2785
|
+
preview = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("img", { src: item.previewUrl, alt: item.id, width: "200", css: damSelectItemImage });
|
|
2786
|
+
} else if (item.type === "video") {
|
|
2787
|
+
preview = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("video", { src: item.previewUrl, title: item.id, width: "200", controls: true, css: damSelectItemImage });
|
|
2788
|
+
}
|
|
2789
|
+
} else if (item.previewUrl && typeof item.previewUrl !== "string") {
|
|
2790
|
+
preview = item.previewUrl;
|
|
2791
|
+
}
|
|
2792
|
+
return preview || item.metadata ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { css: damSelectedItemMediaContainer, children: [
|
|
2793
|
+
preview ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: preview }) : null,
|
|
2794
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("ul", { children: [
|
|
2795
|
+
item.metadata ? Object.entries(item.metadata).map(([key, value]) => {
|
|
2796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2797
|
+
"li",
|
|
2798
|
+
{
|
|
2799
|
+
css: [
|
|
2800
|
+
damSelectedItemSmallText,
|
|
2801
|
+
import_react23.css`
|
|
601
2802
|
order: 1;
|
|
602
|
-
`
|
|
2803
|
+
`
|
|
2804
|
+
],
|
|
2805
|
+
children: [
|
|
2806
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2807
|
+
"span",
|
|
2808
|
+
{
|
|
2809
|
+
css: [
|
|
2810
|
+
damSelectedItemPopoverLabel,
|
|
2811
|
+
import_react23.css`
|
|
603
2812
|
order: 1;
|
|
604
|
-
`
|
|
2813
|
+
`
|
|
2814
|
+
],
|
|
2815
|
+
children: [
|
|
2816
|
+
key,
|
|
2817
|
+
":"
|
|
2818
|
+
]
|
|
2819
|
+
}
|
|
2820
|
+
),
|
|
2821
|
+
value
|
|
2822
|
+
]
|
|
2823
|
+
},
|
|
2824
|
+
key
|
|
2825
|
+
);
|
|
2826
|
+
}) : null,
|
|
2827
|
+
item.createdDate ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("li", { css: damSelectedItemSmallText, children: [
|
|
2828
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { css: damSelectedItemPopoverLabel, children: "Date:" }),
|
|
2829
|
+
(0, import_timeago2.format)(item.createdDate)
|
|
2830
|
+
] }) : null
|
|
2831
|
+
] })
|
|
2832
|
+
] }) : null;
|
|
2833
|
+
}
|
|
2834
|
+
|
|
2835
|
+
// src/components/DataResourceVariablesList.tsx
|
|
2836
|
+
var import_design_system15 = require("@uniformdev/design-system");
|
|
2837
|
+
|
|
2838
|
+
// src/components/UniformMeshLocationContext.tsx
|
|
2839
|
+
var import_react26 = require("react");
|
|
2840
|
+
|
|
2841
|
+
// src/components/UniformMeshSdkContext.tsx
|
|
2842
|
+
var import_design_system12 = require("@uniformdev/design-system");
|
|
2843
|
+
var import_react25 = require("react");
|
|
2844
|
+
var import_jsx_runtime26 = require("@emotion/react/jsx-runtime");
|
|
2845
|
+
var UniformMeshSdkContext = (0, import_react25.createContext)(void 0);
|
|
2846
|
+
var UniformMeshSdkContextProvider = ({ children }) => {
|
|
2847
|
+
let value = void 0;
|
|
2848
|
+
if (typeof window !== "undefined" && typeof window.UniformMeshSDK !== "undefined") {
|
|
2849
|
+
value = {
|
|
2850
|
+
sdk: window.UniformMeshSDK
|
|
2851
|
+
};
|
|
2852
|
+
}
|
|
2853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(UniformMeshSdkContext.Provider, { value, children: [
|
|
2854
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_design_system12.Theme, {}),
|
|
2855
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UniformMeshLocationContextProvider, { children })
|
|
2856
|
+
] });
|
|
2857
|
+
};
|
|
2858
|
+
var useUniformMeshSdkContext = () => {
|
|
2859
|
+
const context = (0, import_react25.useContext)(UniformMeshSdkContext);
|
|
2860
|
+
if (!context) {
|
|
2861
|
+
throw new Error("useUniformMeshSdkContext must be used within <MeshApp /> or <UniformMeshSdkContext />");
|
|
2862
|
+
}
|
|
2863
|
+
return context;
|
|
2864
|
+
};
|
|
2865
|
+
|
|
2866
|
+
// src/hooks/useUniformMeshSdk.ts
|
|
2867
|
+
function useUniformMeshSdk() {
|
|
2868
|
+
const { sdk } = useUniformMeshSdkContext();
|
|
2869
|
+
return sdk;
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
// src/components/UniformMeshLocationContext.tsx
|
|
2873
|
+
var import_jsx_runtime27 = require("@emotion/react/jsx-runtime");
|
|
2874
|
+
var UniformMeshLocationContext = (0, import_react26.createContext)(
|
|
2875
|
+
void 0
|
|
2876
|
+
);
|
|
2877
|
+
var UniformMeshLocationContextProvider = ({
|
|
2878
|
+
children
|
|
2879
|
+
}) => {
|
|
2880
|
+
const sdk = useUniformMeshSdk();
|
|
2881
|
+
const [location, setLocation] = (0, import_react26.useState)(sdk.getCurrentLocation());
|
|
2882
|
+
const valueChangeListener = (event) => {
|
|
2883
|
+
setLocation((old) => ({ ...old, value: event.newValue }));
|
|
2884
|
+
};
|
|
2885
|
+
(0, import_react26.useEffect)(() => {
|
|
2886
|
+
sdk.events.on("onValueChanged", valueChangeListener);
|
|
2887
|
+
return () => {
|
|
2888
|
+
sdk.events.off("onValueChanged", valueChangeListener);
|
|
2889
|
+
};
|
|
2890
|
+
}, [sdk]);
|
|
2891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(UniformMeshLocationContext.Provider, { value: { location }, children });
|
|
2892
|
+
};
|
|
2893
|
+
var useUniformMeshLocationContext = () => {
|
|
2894
|
+
const context = (0, import_react26.useContext)(UniformMeshLocationContext);
|
|
2895
|
+
if (!context) {
|
|
2896
|
+
throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");
|
|
2897
|
+
}
|
|
2898
|
+
return context;
|
|
2899
|
+
};
|
|
2900
|
+
|
|
2901
|
+
// src/hooks/useMeshLocation.ts
|
|
2902
|
+
var legacyWarned = false;
|
|
2903
|
+
function useMeshLocation(expectedLocation) {
|
|
2904
|
+
const { location } = useUniformMeshLocationContext();
|
|
2905
|
+
let effectiveExpected = expectedLocation;
|
|
2906
|
+
if (expectedLocation === "dataTypeInstance") {
|
|
2907
|
+
effectiveExpected = "dataResource";
|
|
2908
|
+
if (!legacyWarned) {
|
|
2909
|
+
console.warn(
|
|
2910
|
+
"`dataTypeInstance` mesh location is deprecated, please switch to `dataResource` instead."
|
|
2911
|
+
);
|
|
2912
|
+
legacyWarned = true;
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
if (effectiveExpected && location.type !== effectiveExpected) {
|
|
2916
|
+
throw new Error(`Expected location type ${expectedLocation} but got ${location.type}`);
|
|
2917
|
+
}
|
|
2918
|
+
const proxyLocation = {
|
|
2919
|
+
...location,
|
|
2920
|
+
setValue: (dispatch) => {
|
|
2921
|
+
const { newValue, options } = dispatch(location.value);
|
|
2922
|
+
location.setValue(newValue, options);
|
|
2923
|
+
}
|
|
2924
|
+
};
|
|
2925
|
+
return proxyLocation;
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
// src/components/Variables/InputVariables.tsx
|
|
2929
|
+
var import_react28 = require("@emotion/react");
|
|
2930
|
+
var import_react29 = __toESM(require("@yaireo/tagify/dist/react.tagify"));
|
|
2931
|
+
var React11 = __toESM(require("react"));
|
|
2932
|
+
|
|
2933
|
+
// src/components/Variables/InputVariables.styles.ts
|
|
2934
|
+
var import_react27 = require("@emotion/react");
|
|
2935
|
+
var variablesFormContainer = import_react27.css`
|
|
605
2936
|
> * {
|
|
606
2937
|
margin: var(--spacing-base) 0 0;
|
|
607
2938
|
}
|
|
608
|
-
|
|
2939
|
+
`;
|
|
2940
|
+
var variablesFormBtnGroup = import_react27.css`
|
|
609
2941
|
display: flex;
|
|
610
2942
|
gap: var(--spacing-sm);
|
|
611
|
-
|
|
2943
|
+
`;
|
|
2944
|
+
var tagifyStyles = import_react27.css`
|
|
612
2945
|
:root {
|
|
613
2946
|
--tagify-dd-color-primary: rgb(53, 149, 246);
|
|
614
2947
|
--tagify-dd-bg-color: var(--white);
|
|
@@ -1105,14 +3438,246 @@
|
|
|
1105
3438
|
opacity: 0;
|
|
1106
3439
|
transition: inherit;
|
|
1107
3440
|
}
|
|
1108
|
-
`;
|
|
3441
|
+
`;
|
|
3442
|
+
|
|
3443
|
+
// src/components/Variables/VariablesProvider.tsx
|
|
3444
|
+
var React10 = __toESM(require("react"));
|
|
3445
|
+
|
|
3446
|
+
// src/components/Variables/VariableEditor.tsx
|
|
3447
|
+
var import_design_system13 = require("@uniformdev/design-system");
|
|
3448
|
+
var import_formik = require("formik");
|
|
3449
|
+
var import_jsx_runtime28 = require("@emotion/react/jsx-runtime");
|
|
3450
|
+
function VariableEditor({ variable, onSubmit, onCancel }) {
|
|
3451
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
3452
|
+
const { variables } = useVariables();
|
|
3453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3454
|
+
import_formik.Formik,
|
|
3455
|
+
{
|
|
3456
|
+
initialValues: {
|
|
3457
|
+
name: variable,
|
|
3458
|
+
default: (_b = (_a = variables[variable]) == null ? void 0 : _a.default) != null ? _b : "",
|
|
3459
|
+
displayName: (_d = (_c = variables[variable]) == null ? void 0 : _c.displayName) != null ? _d : "",
|
|
3460
|
+
helpText: (_f = (_e = variables[variable]) == null ? void 0 : _e.helpText) != null ? _f : "",
|
|
3461
|
+
order: (_g = variables[variable]) == null ? void 0 : _g.order,
|
|
3462
|
+
type: (_i = (_h = variables[variable]) == null ? void 0 : _h.type) != null ? _i : ""
|
|
3463
|
+
},
|
|
3464
|
+
onSubmit: (values) => {
|
|
3465
|
+
const finalValue = {
|
|
3466
|
+
...values,
|
|
3467
|
+
helpText: values.helpText || void 0,
|
|
3468
|
+
type: values.type || void 0,
|
|
3469
|
+
displayName: values.displayName || void 0
|
|
3470
|
+
};
|
|
3471
|
+
return onSubmit(finalValue);
|
|
3472
|
+
},
|
|
3473
|
+
children: ({ getFieldProps, initialValues }) => {
|
|
3474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_formik.Form, { css: variablesFormContainer, children: [
|
|
3475
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3476
|
+
import_design_system13.Input,
|
|
3477
|
+
{
|
|
3478
|
+
...getFieldProps("name"),
|
|
3479
|
+
label: "Name",
|
|
3480
|
+
disabled: initialValues.name !== "",
|
|
3481
|
+
caption: "This cannot change once created."
|
|
3482
|
+
}
|
|
3483
|
+
),
|
|
3484
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3485
|
+
import_design_system13.Input,
|
|
3486
|
+
{
|
|
3487
|
+
...getFieldProps("helpText"),
|
|
3488
|
+
label: "Help Text",
|
|
3489
|
+
caption: "Appears in the composition data resource when entering a value for this variable.",
|
|
3490
|
+
autoComplete: "off"
|
|
3491
|
+
}
|
|
3492
|
+
),
|
|
3493
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_design_system13.Input, { ...getFieldProps("default"), label: "Default Value", autoComplete: "off" }),
|
|
3494
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { css: variablesFormBtnGroup, children: [
|
|
3495
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_design_system13.Button, { type: "submit", children: "Save" }),
|
|
3496
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_design_system13.Button, { type: "button", buttonType: "ghost", onClick: onCancel, children: "cancel" })
|
|
3497
|
+
] })
|
|
3498
|
+
] });
|
|
3499
|
+
}
|
|
3500
|
+
}
|
|
3501
|
+
);
|
|
3502
|
+
}
|
|
3503
|
+
|
|
3504
|
+
// src/components/Variables/VariablesProvider.tsx
|
|
3505
|
+
var import_jsx_runtime29 = require("@emotion/react/jsx-runtime");
|
|
3506
|
+
var VariablesContext = React10.createContext(null);
|
|
3507
|
+
function VariablesProvider({
|
|
3508
|
+
value,
|
|
3509
|
+
onChange,
|
|
3510
|
+
editVariableComponent,
|
|
3511
|
+
children
|
|
3512
|
+
}) {
|
|
3513
|
+
const [editing, setEditing] = React10.useState();
|
|
3514
|
+
const Editor2 = editVariableComponent != null ? editVariableComponent : VariableEditor;
|
|
3515
|
+
const contextValue = {
|
|
3516
|
+
dispatch: (event) => {
|
|
3517
|
+
if (event.type === "set") {
|
|
3518
|
+
const { name, ...varValue } = event.variable;
|
|
3519
|
+
onChange({ ...contextValue.variables, [event.variable.name]: varValue });
|
|
3520
|
+
if (event.openEditor) {
|
|
3521
|
+
setEditing(event.variable.name);
|
|
3522
|
+
}
|
|
3523
|
+
} else if (event.type === "edit") {
|
|
3524
|
+
setEditing(event.variable);
|
|
3525
|
+
} else if (event.type === "remove") {
|
|
3526
|
+
const newValue = { ...value };
|
|
3527
|
+
delete newValue[event.variable];
|
|
3528
|
+
onChange(newValue);
|
|
3529
|
+
} else if (event.type === "reorder") {
|
|
3530
|
+
onChange(event.result);
|
|
3531
|
+
} else {
|
|
3532
|
+
throw new Error(`Unknown event ${JSON.stringify(event)}`);
|
|
3533
|
+
}
|
|
3534
|
+
},
|
|
3535
|
+
variables: value
|
|
3536
|
+
};
|
|
3537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(VariablesContext.Provider, { value: contextValue, children: [
|
|
3538
|
+
children,
|
|
3539
|
+
typeof editing !== "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3540
|
+
Editor2,
|
|
3541
|
+
{
|
|
3542
|
+
onSubmit: (val) => {
|
|
3543
|
+
setEditing(void 0);
|
|
3544
|
+
const { name, ...varValue } = val;
|
|
3545
|
+
onChange({ ...value, [name]: varValue });
|
|
3546
|
+
},
|
|
3547
|
+
onCancel: () => setEditing(void 0),
|
|
3548
|
+
variable: editing
|
|
3549
|
+
}
|
|
3550
|
+
) : null
|
|
3551
|
+
] });
|
|
3552
|
+
}
|
|
3553
|
+
function useVariables() {
|
|
3554
|
+
const context = React10.useContext(VariablesContext);
|
|
3555
|
+
if (!context) {
|
|
3556
|
+
throw new Error("No VariablesProvider present");
|
|
3557
|
+
}
|
|
3558
|
+
return context;
|
|
3559
|
+
}
|
|
3560
|
+
|
|
3561
|
+
// src/components/Variables/InputVariables.tsx
|
|
3562
|
+
var import_jsx_runtime30 = require("@emotion/react/jsx-runtime");
|
|
3563
|
+
function cleanTagifyValue(rawValue) {
|
|
3564
|
+
return rawValue.replace(/\${{.*?"value":"([^"]+)".*?}}/g, "${$1}").replace(/[\r\n]+/g, "");
|
|
3565
|
+
}
|
|
3566
|
+
function InputVariables({
|
|
3567
|
+
"aria-label": ariaLabel,
|
|
3568
|
+
value,
|
|
3569
|
+
disableVariables,
|
|
3570
|
+
onChange,
|
|
3571
|
+
onPaste
|
|
3572
|
+
}) {
|
|
3573
|
+
const { variables, dispatch } = useVariables();
|
|
3574
|
+
const currentVariables = React11.useRef(variables);
|
|
3575
|
+
const currentDispatch = React11.useRef(dispatch);
|
|
3576
|
+
const currentSetValue = React11.useRef(onChange);
|
|
3577
|
+
const tagifyRef = React11.useRef();
|
|
3578
|
+
React11.useEffect(() => {
|
|
3579
|
+
currentVariables.current = variables;
|
|
3580
|
+
}, [variables]);
|
|
3581
|
+
React11.useEffect(() => {
|
|
3582
|
+
currentDispatch.current = dispatch;
|
|
3583
|
+
}, [dispatch]);
|
|
3584
|
+
React11.useEffect(() => {
|
|
3585
|
+
currentSetValue.current = onChange;
|
|
3586
|
+
}, [onChange]);
|
|
3587
|
+
React11.useEffect(() => {
|
|
3588
|
+
var _a;
|
|
3589
|
+
if (((_a = tagifyRef == null ? void 0 : tagifyRef.current) == null ? void 0 : _a.DOM) && onPaste) {
|
|
3590
|
+
tagifyRef.current.DOM.input.onpaste = () => {
|
|
3591
|
+
var _a2, _b;
|
|
3592
|
+
return onPaste(cleanTagifyValue((_b = (_a2 = tagifyRef.current) == null ? void 0 : _a2.getInputValue()) != null ? _b : ""));
|
|
3593
|
+
};
|
|
3594
|
+
}
|
|
3595
|
+
});
|
|
3596
|
+
React11.useEffect(() => {
|
|
3597
|
+
var _a, _b, _c;
|
|
3598
|
+
const currentTagifyValue = cleanTagifyValue((_b = (_a = tagifyRef.current) == null ? void 0 : _a.getInputValue()) != null ? _b : "");
|
|
3599
|
+
if (value !== currentTagifyValue) {
|
|
3600
|
+
(_c = tagifyRef.current) == null ? void 0 : _c.loadOriginalValues(value);
|
|
3601
|
+
}
|
|
3602
|
+
}, [value]);
|
|
3603
|
+
const handleSetValue = React11.useCallback((rawValue) => {
|
|
3604
|
+
currentSetValue.current(cleanTagifyValue(rawValue));
|
|
3605
|
+
}, []);
|
|
3606
|
+
const handleAddTag = React11.useCallback((newTagName) => {
|
|
3607
|
+
if (!currentVariables.current[newTagName]) {
|
|
3608
|
+
currentDispatch.current({
|
|
3609
|
+
type: "set",
|
|
3610
|
+
variable: { name: newTagName, default: "" },
|
|
3611
|
+
openEditor: true
|
|
3612
|
+
});
|
|
3613
|
+
}
|
|
3614
|
+
}, []);
|
|
3615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
3616
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react28.Global, { styles: tagifyStyles }),
|
|
3617
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3618
|
+
import_react29.default,
|
|
3619
|
+
{
|
|
3620
|
+
tagifyRef,
|
|
3621
|
+
"aria-label": ariaLabel,
|
|
3622
|
+
defaultValue: value,
|
|
3623
|
+
autoFocus: false,
|
|
3624
|
+
whitelist: Object.entries(variables).map(([k, v]) => {
|
|
3625
|
+
var _a;
|
|
3626
|
+
return { name: (_a = v.displayName) != null ? _a : k, value: k };
|
|
3627
|
+
}),
|
|
3628
|
+
settings: {
|
|
3629
|
+
pattern: disableVariables ? null : /\$/,
|
|
3630
|
+
enforceWhitelist: disableVariables,
|
|
3631
|
+
mixTagsInterpolator: ["${", "}"],
|
|
3632
|
+
duplicates: true,
|
|
3633
|
+
tagTextProp: "name",
|
|
3634
|
+
dropdown: {
|
|
3635
|
+
position: "text",
|
|
3636
|
+
enabled: 0,
|
|
3637
|
+
mapValueTo: (v) => v.name,
|
|
3638
|
+
includeSelectedTags: true,
|
|
3639
|
+
searchKeys: ["name", "value"],
|
|
3640
|
+
highlightFirst: true
|
|
3641
|
+
}
|
|
3642
|
+
},
|
|
3643
|
+
InputMode: "textarea",
|
|
3644
|
+
onAdd: (e) => {
|
|
3645
|
+
var _a;
|
|
3646
|
+
const newTagName = (_a = e.detail.data) == null ? void 0 : _a.value;
|
|
3647
|
+
if (newTagName) {
|
|
3648
|
+
handleAddTag(newTagName);
|
|
3649
|
+
}
|
|
3650
|
+
},
|
|
3651
|
+
onRemove: (e) => {
|
|
3652
|
+
handleSetValue(e.detail.tagify.getInputValue());
|
|
3653
|
+
},
|
|
3654
|
+
onChange: (e) => {
|
|
3655
|
+
handleSetValue(e.detail.value);
|
|
3656
|
+
},
|
|
3657
|
+
onInput: (e) => {
|
|
3658
|
+
handleSetValue(e.detail.tagify.getInputValue());
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
)
|
|
3662
|
+
] });
|
|
3663
|
+
}
|
|
3664
|
+
|
|
3665
|
+
// src/components/Variables/VariablesList.tsx
|
|
3666
|
+
var import_react31 = require("@emotion/react");
|
|
3667
|
+
var import_design_system14 = require("@uniformdev/design-system");
|
|
3668
|
+
var import_react_beautiful_dnd2 = require("react-beautiful-dnd");
|
|
3669
|
+
|
|
3670
|
+
// src/components/Variables/styles/VariablesList.styles.ts
|
|
3671
|
+
var import_react30 = require("@emotion/react");
|
|
3672
|
+
var tableRow = (isDragging) => import_react30.css`
|
|
1109
3673
|
position: relative;
|
|
1110
|
-
${
|
|
3674
|
+
${isDragging ? `
|
|
1111
3675
|
display: table;
|
|
1112
3676
|
left: auto !important;
|
|
1113
3677
|
top: auto !important;
|
|
1114
|
-
|
|
1115
|
-
|
|
3678
|
+
` : void 0}
|
|
3679
|
+
`;
|
|
3680
|
+
var tableCellDragIcon = import_react30.css`
|
|
1116
3681
|
&::after {
|
|
1117
3682
|
content: '';
|
|
1118
3683
|
display: block;
|
|
@@ -1129,7 +3694,8 @@
|
|
|
1129
3694
|
&:hover::after {
|
|
1130
3695
|
opacity: 1;
|
|
1131
3696
|
}
|
|
1132
|
-
|
|
3697
|
+
`;
|
|
3698
|
+
var variableName = import_react30.css`
|
|
1133
3699
|
border: none;
|
|
1134
3700
|
color: var(--brand-secondary-5);
|
|
1135
3701
|
font-weight: var(--fw-medium);
|
|
@@ -1139,27 +3705,957 @@
|
|
|
1139
3705
|
text-overflow: ellipsis;
|
|
1140
3706
|
white-space: nowrap;
|
|
1141
3707
|
max-width: 20ch;
|
|
1142
|
-
|
|
3708
|
+
`;
|
|
3709
|
+
var variableValue = import_react30.css`
|
|
1143
3710
|
overflow: hidden;
|
|
1144
3711
|
text-overflow: ellipsis;
|
|
1145
3712
|
white-space: nowrap;
|
|
1146
3713
|
max-width: 20ch;
|
|
1147
|
-
`;
|
|
3714
|
+
`;
|
|
3715
|
+
|
|
3716
|
+
// src/components/Variables/variablesToList.ts
|
|
3717
|
+
function variablesToList(variables) {
|
|
3718
|
+
return Object.entries(variables || {}).sort(([aKey, a], [bKey, b]) => {
|
|
3719
|
+
var _a, _b;
|
|
3720
|
+
if (a.order && b.order) {
|
|
3721
|
+
return a.order - b.order;
|
|
3722
|
+
} else if (a.order) {
|
|
3723
|
+
return 1;
|
|
3724
|
+
} else if (b.order) {
|
|
3725
|
+
return -1;
|
|
3726
|
+
}
|
|
3727
|
+
return ((_a = a.displayName) != null ? _a : aKey).localeCompare((_b = b.displayName) != null ? _b : bKey);
|
|
3728
|
+
}).map(([name, definition]) => ({
|
|
3729
|
+
name,
|
|
3730
|
+
...definition
|
|
3731
|
+
}));
|
|
3732
|
+
}
|
|
3733
|
+
|
|
3734
|
+
// src/components/Variables/VariablesList.tsx
|
|
3735
|
+
var import_jsx_runtime31 = require("@emotion/react/jsx-runtime");
|
|
3736
|
+
function VariablesList() {
|
|
3737
|
+
const { variables, dispatch } = useVariables();
|
|
3738
|
+
const sorted = variablesToList(variables);
|
|
3739
|
+
const onDragEnd = (res) => {
|
|
3740
|
+
var _a, _b;
|
|
3741
|
+
if (res.destination && res.source.droppableId === ((_a = res.destination) == null ? void 0 : _a.droppableId)) {
|
|
3742
|
+
const result = [...sorted || []];
|
|
3743
|
+
const [removed] = (_b = result == null ? void 0 : result.splice(res.source.index, 1)) != null ? _b : [];
|
|
3744
|
+
result == null ? void 0 : result.splice(res.destination.index, 0, removed);
|
|
3745
|
+
const resultAsObj = result.reduce(
|
|
3746
|
+
(acc, item, index) => ({
|
|
3747
|
+
...acc,
|
|
3748
|
+
[item.name]: { type: item.type, default: item.default, order: index }
|
|
3749
|
+
}),
|
|
3750
|
+
{}
|
|
3751
|
+
);
|
|
3752
|
+
dispatch({ type: "reorder", result: resultAsObj });
|
|
3753
|
+
return result;
|
|
3754
|
+
}
|
|
3755
|
+
};
|
|
3756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
3757
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_beautiful_dnd2.DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_beautiful_dnd2.Droppable, { droppableId: "variables-table", children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_design_system14.Table, { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
3758
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system14.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_design_system14.TableRow, { children: [
|
|
3759
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system14.TableCellHead, { children: "Name" }),
|
|
3760
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system14.TableCellHead, { children: "Default Value" }),
|
|
3761
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system14.TableCellHead, {})
|
|
3762
|
+
] }) }),
|
|
3763
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_design_system14.TableBody, { children: [
|
|
3764
|
+
sorted.map(({ name, displayName, default: defaultValue }, index) => {
|
|
3765
|
+
const text = displayName != null ? displayName : name;
|
|
3766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3767
|
+
import_react_beautiful_dnd2.Draggable,
|
|
3768
|
+
{
|
|
3769
|
+
draggableId: name,
|
|
3770
|
+
index,
|
|
3771
|
+
isDragDisabled: sorted.length === 1,
|
|
3772
|
+
children: (provided2, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3773
|
+
import_design_system14.TableRow,
|
|
3774
|
+
{
|
|
3775
|
+
ref: provided2.innerRef,
|
|
3776
|
+
...provided2.dragHandleProps,
|
|
3777
|
+
...provided2.draggableProps,
|
|
3778
|
+
id: text,
|
|
3779
|
+
css: tableRow(snapshot.isDragging),
|
|
3780
|
+
"data-dragging": snapshot.isDragging,
|
|
3781
|
+
children: [
|
|
3782
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system14.TableCellData, { css: sorted.length > 1 ? tableCellDragIcon : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3783
|
+
"button",
|
|
3784
|
+
{
|
|
3785
|
+
css: variableName,
|
|
3786
|
+
type: "button",
|
|
3787
|
+
onClick: (e) => {
|
|
3788
|
+
e.preventDefault();
|
|
3789
|
+
dispatch({ type: "edit", variable: name });
|
|
3790
|
+
},
|
|
3791
|
+
title: text,
|
|
3792
|
+
children: text
|
|
3793
|
+
}
|
|
3794
|
+
) }),
|
|
3795
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system14.TableCellData, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { css: variableValue, title: defaultValue, children: defaultValue }) }),
|
|
3796
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system14.TableCellData, { align: "right", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3797
|
+
"button",
|
|
3798
|
+
{
|
|
3799
|
+
type: "button",
|
|
3800
|
+
title: `delete ${text}`,
|
|
3801
|
+
css: [
|
|
3802
|
+
import_design_system14.button,
|
|
3803
|
+
import_react31.css`
|
|
1148
3804
|
background: transparent;
|
|
1149
|
-
`
|
|
3805
|
+
`
|
|
3806
|
+
],
|
|
3807
|
+
"aria-controls": text,
|
|
3808
|
+
onClick: () => dispatch({ type: "remove", variable: name }),
|
|
3809
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system14.Icon, { icon: "trash", iconColor: "red" })
|
|
3810
|
+
}
|
|
3811
|
+
) })
|
|
3812
|
+
]
|
|
3813
|
+
}
|
|
3814
|
+
)
|
|
3815
|
+
},
|
|
3816
|
+
name
|
|
3817
|
+
);
|
|
3818
|
+
}),
|
|
3819
|
+
provided.placeholder
|
|
3820
|
+
] })
|
|
3821
|
+
] }) }) }),
|
|
3822
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3823
|
+
import_design_system14.AddListButton,
|
|
3824
|
+
{
|
|
3825
|
+
onButtonClick: () => dispatch({ type: "edit", variable: "" }),
|
|
3826
|
+
"aria-label": "Add variable",
|
|
3827
|
+
buttonText: "add variable",
|
|
3828
|
+
icon: "math-plus",
|
|
3829
|
+
css: { marginLeft: "var(--spacing-md)" }
|
|
3830
|
+
}
|
|
3831
|
+
)
|
|
3832
|
+
] });
|
|
3833
|
+
}
|
|
3834
|
+
|
|
3835
|
+
// src/components/DataResourceVariablesList.tsx
|
|
3836
|
+
var import_jsx_runtime32 = require("@emotion/react/jsx-runtime");
|
|
3837
|
+
function DataResourceVariablesList({
|
|
3838
|
+
setVariables,
|
|
3839
|
+
noVariables: NoVariablesComponent,
|
|
3840
|
+
typeRenderers
|
|
3841
|
+
}) {
|
|
3842
|
+
const {
|
|
3843
|
+
value,
|
|
3844
|
+
metadata: { dataType }
|
|
3845
|
+
} = useMeshLocation("dataTypeInstance");
|
|
3846
|
+
const variableDefinitions = variablesToList(dataType.variables);
|
|
3847
|
+
if (variableDefinitions.length === 0) {
|
|
3848
|
+
if (NoVariablesComponent) {
|
|
3849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(NoVariablesComponent, {});
|
|
3850
|
+
}
|
|
3851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system15.Callout, { type: "note", children: "No settings are required." });
|
|
3852
|
+
}
|
|
3853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: variableDefinitions.map((variableDefinition) => {
|
|
3854
|
+
var _a, _b, _c;
|
|
3855
|
+
const VariableRenderer = variableDefinition.type ? (_a = typeRenderers == null ? void 0 : typeRenderers[variableDefinition.type]) != null ? _a : TextVariableRenderer : TextVariableRenderer;
|
|
3856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3857
|
+
VariableRenderer,
|
|
3858
|
+
{
|
|
3859
|
+
definition: variableDefinition,
|
|
3860
|
+
value: (_c = (_b = value == null ? void 0 : value[variableDefinition.name]) != null ? _b : variableDefinition.default) != null ? _c : "",
|
|
3861
|
+
setValue: (newVariableValue) => {
|
|
3862
|
+
setVariables((previousValue) => {
|
|
3863
|
+
const isDefaultValue = newVariableValue === variableDefinition.default;
|
|
3864
|
+
const newVariables = { ...previousValue };
|
|
3865
|
+
if (isDefaultValue || newVariableValue === void 0) {
|
|
3866
|
+
delete newVariables[variableDefinition.name];
|
|
3867
|
+
} else {
|
|
3868
|
+
newVariables[variableDefinition.name] = newVariableValue;
|
|
3869
|
+
}
|
|
3870
|
+
return { newValue: newVariables };
|
|
3871
|
+
});
|
|
3872
|
+
}
|
|
3873
|
+
}
|
|
3874
|
+
) }, variableDefinition.name);
|
|
3875
|
+
}) });
|
|
3876
|
+
}
|
|
3877
|
+
function TextVariableRenderer({ definition, value, setValue }) {
|
|
3878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
3879
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3880
|
+
import_design_system15.Input,
|
|
3881
|
+
{
|
|
3882
|
+
label: definition.displayName || definition.name,
|
|
3883
|
+
value,
|
|
3884
|
+
caption: definition.helpText,
|
|
3885
|
+
onChange: (e) => {
|
|
3886
|
+
setValue(e.target.value);
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
),
|
|
3890
|
+
definition.default !== "" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("small", { children: [
|
|
3891
|
+
"Default value: ",
|
|
3892
|
+
definition.default
|
|
3893
|
+
] }) : null
|
|
3894
|
+
] });
|
|
3895
|
+
}
|
|
3896
|
+
|
|
3897
|
+
// src/components/Request/RequestBody.tsx
|
|
3898
|
+
var import_react33 = require("@emotion/react");
|
|
3899
|
+
var import_react34 = __toESM(require("@monaco-editor/react"));
|
|
3900
|
+
var import_design_system16 = require("@uniformdev/design-system");
|
|
3901
|
+
var import_react35 = require("react");
|
|
3902
|
+
|
|
3903
|
+
// src/components/Request/RequestProvider.tsx
|
|
3904
|
+
var React12 = __toESM(require("react"));
|
|
3905
|
+
var import_jsx_runtime33 = require("@emotion/react/jsx-runtime");
|
|
3906
|
+
var RequestContext = React12.createContext(null);
|
|
3907
|
+
function RequestProvider({ value, onChange, children }) {
|
|
3908
|
+
const contextValue = React12.useMemo(() => {
|
|
3909
|
+
return {
|
|
3910
|
+
dispatch: (event) => {
|
|
3911
|
+
if (event.type === "setRelativeUrl") {
|
|
3912
|
+
onChange((old) => ({
|
|
3913
|
+
...old,
|
|
3914
|
+
relativeUrl: event.relativeUrl
|
|
3915
|
+
}));
|
|
3916
|
+
} else if (event.type === "updateParameter") {
|
|
3917
|
+
onChange((old) => {
|
|
3918
|
+
const newParameters = [...old.parameters];
|
|
3919
|
+
if (typeof event.index === "number") {
|
|
3920
|
+
newParameters[event.index] = event.parameter;
|
|
3921
|
+
} else {
|
|
3922
|
+
newParameters.push(event.parameter);
|
|
3923
|
+
}
|
|
3924
|
+
return { ...old, parameters: newParameters };
|
|
3925
|
+
});
|
|
3926
|
+
} else if (event.type === "removeParameter") {
|
|
3927
|
+
onChange((old) => {
|
|
3928
|
+
const newParameters = [...old.parameters];
|
|
3929
|
+
newParameters.splice(event.index, 1);
|
|
3930
|
+
return { ...old, parameters: newParameters };
|
|
3931
|
+
});
|
|
3932
|
+
} else if (event.type === "updateHeader") {
|
|
3933
|
+
onChange((old) => {
|
|
3934
|
+
const newHeaders = [...old.headers];
|
|
3935
|
+
if (typeof event.index !== "undefined") {
|
|
3936
|
+
newHeaders[event.index] = event.header;
|
|
3937
|
+
} else {
|
|
3938
|
+
newHeaders.push(event.header);
|
|
3939
|
+
}
|
|
3940
|
+
return { ...old, headers: newHeaders };
|
|
3941
|
+
});
|
|
3942
|
+
} else if (event.type === "removeHeader") {
|
|
3943
|
+
onChange((old) => {
|
|
3944
|
+
const newHeaders = [...old.headers];
|
|
3945
|
+
newHeaders.splice(event.index, 1);
|
|
3946
|
+
return { ...old, headers: newHeaders };
|
|
3947
|
+
});
|
|
3948
|
+
} else if (event.type === "setMethod") {
|
|
3949
|
+
onChange((old) => ({ ...old, method: event.method }));
|
|
3950
|
+
} else if (event.type === "setBody") {
|
|
3951
|
+
onChange((old) => {
|
|
3952
|
+
const newHeaders = [...old.headers];
|
|
3953
|
+
const contentTypeIndex = newHeaders.findIndex(
|
|
3954
|
+
({ key }) => key.trim().toLocaleLowerCase() === "content-type"
|
|
3955
|
+
);
|
|
3956
|
+
if (contentTypeIndex > -1) {
|
|
3957
|
+
newHeaders[contentTypeIndex].value = event.contentType;
|
|
3958
|
+
} else {
|
|
3959
|
+
newHeaders.push({ key: "Content-Type", value: event.contentType });
|
|
3960
|
+
}
|
|
3961
|
+
return {
|
|
3962
|
+
...old,
|
|
3963
|
+
body: event.body,
|
|
3964
|
+
headers: newHeaders
|
|
3965
|
+
};
|
|
3966
|
+
});
|
|
3967
|
+
} else {
|
|
3968
|
+
throw new Error(`Unknown event ${JSON.stringify(event)}`);
|
|
3969
|
+
}
|
|
3970
|
+
},
|
|
3971
|
+
request: value
|
|
3972
|
+
};
|
|
3973
|
+
}, [onChange, value]);
|
|
3974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(RequestContext.Provider, { value: contextValue, children });
|
|
3975
|
+
}
|
|
3976
|
+
function useRequest() {
|
|
3977
|
+
const context = React12.useContext(RequestContext);
|
|
3978
|
+
if (!context) {
|
|
3979
|
+
throw new Error("No RequestProvider present");
|
|
3980
|
+
}
|
|
3981
|
+
return context;
|
|
3982
|
+
}
|
|
3983
|
+
|
|
3984
|
+
// src/components/Request/styles/Request.styles.ts
|
|
3985
|
+
var import_react32 = require("@emotion/react");
|
|
3986
|
+
var innerContentStyles = import_react32.css`
|
|
1150
3987
|
background: var(--white);
|
|
1151
|
-
|
|
3988
|
+
`;
|
|
3989
|
+
var requestTypeContainer = (bgColor) => import_react32.css`
|
|
1152
3990
|
align-items: start;
|
|
1153
|
-
background: ${
|
|
3991
|
+
background: ${bgColor};
|
|
1154
3992
|
display: grid;
|
|
1155
3993
|
grid-template-columns: 12ch 1fr;
|
|
1156
3994
|
gap: var(--spacing-sm);
|
|
1157
|
-
`;
|
|
3995
|
+
`;
|
|
3996
|
+
|
|
3997
|
+
// src/components/Request/RequestTypeContainer.tsx
|
|
3998
|
+
var import_jsx_runtime34 = require("@emotion/react/jsx-runtime");
|
|
3999
|
+
var RequestTypeContainer = ({
|
|
4000
|
+
bgColor = "transparent",
|
|
4001
|
+
children,
|
|
4002
|
+
...props
|
|
4003
|
+
}) => {
|
|
4004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { css: requestTypeContainer(bgColor), ...props, children });
|
|
4005
|
+
};
|
|
4006
|
+
|
|
4007
|
+
// src/components/Request/RequestBody.tsx
|
|
4008
|
+
var import_jsx_runtime35 = require("@emotion/react/jsx-runtime");
|
|
4009
|
+
var LANGUAGE_OPTIONS = [
|
|
4010
|
+
{ label: "Text", value: "plaintext" },
|
|
4011
|
+
{ label: "JSON", value: "json" },
|
|
4012
|
+
{ label: "YAML", value: "yaml" },
|
|
4013
|
+
{ label: "JavaScript", value: "javascript" },
|
|
4014
|
+
{ label: "XML", value: "xml" },
|
|
4015
|
+
{ label: "HTML", value: "html" }
|
|
4016
|
+
];
|
|
4017
|
+
var LANGUAGE_TO_CONTENT_TYPE = {
|
|
4018
|
+
plaintext: "text/plain",
|
|
4019
|
+
json: "application/json",
|
|
4020
|
+
yaml: "application/x-yaml",
|
|
4021
|
+
javascript: "application/javascript",
|
|
4022
|
+
xml: "application/xml",
|
|
4023
|
+
html: "text/html"
|
|
4024
|
+
};
|
|
4025
|
+
function RequestBody() {
|
|
4026
|
+
const { request, dispatch } = useRequest();
|
|
4027
|
+
const [language, setLanguage] = (0, import_react35.useState)("json");
|
|
4028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4029
|
+
"div",
|
|
4030
|
+
{
|
|
4031
|
+
css: import_react33.css`
|
|
1158
4032
|
background: var(--white);
|
|
1159
|
-
`,
|
|
4033
|
+
`,
|
|
4034
|
+
children: [
|
|
4035
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4036
|
+
RequestTypeContainer,
|
|
4037
|
+
{
|
|
4038
|
+
bgColor: "var(--gray-100)",
|
|
4039
|
+
css: import_react33.css`
|
|
1160
4040
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
1161
|
-
`,
|
|
4041
|
+
`,
|
|
4042
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4043
|
+
import_design_system16.InputSelect,
|
|
4044
|
+
{
|
|
4045
|
+
label: "Language",
|
|
4046
|
+
showLabel: false,
|
|
4047
|
+
options: LANGUAGE_OPTIONS,
|
|
4048
|
+
value: language,
|
|
4049
|
+
onChange: (e) => {
|
|
4050
|
+
const selectedLanguage = e.currentTarget.value;
|
|
4051
|
+
setLanguage(selectedLanguage);
|
|
4052
|
+
if (request.body) {
|
|
4053
|
+
dispatch({
|
|
4054
|
+
type: "setBody",
|
|
4055
|
+
body: request.body,
|
|
4056
|
+
contentType: LANGUAGE_TO_CONTENT_TYPE[selectedLanguage]
|
|
4057
|
+
});
|
|
4058
|
+
}
|
|
4059
|
+
},
|
|
4060
|
+
"data-test-id": "body-select"
|
|
4061
|
+
}
|
|
4062
|
+
)
|
|
4063
|
+
}
|
|
4064
|
+
),
|
|
4065
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4066
|
+
import_react34.default,
|
|
4067
|
+
{
|
|
4068
|
+
height: 200,
|
|
4069
|
+
value: request.body,
|
|
4070
|
+
language,
|
|
4071
|
+
options: {
|
|
4072
|
+
language,
|
|
4073
|
+
minimap: { enabled: false },
|
|
4074
|
+
folding: false
|
|
4075
|
+
},
|
|
4076
|
+
onChange: (body) => {
|
|
4077
|
+
if (body) {
|
|
4078
|
+
dispatch({ type: "setBody", body, contentType: LANGUAGE_TO_CONTENT_TYPE[language] });
|
|
4079
|
+
}
|
|
4080
|
+
}
|
|
4081
|
+
}
|
|
4082
|
+
)
|
|
4083
|
+
]
|
|
4084
|
+
}
|
|
4085
|
+
);
|
|
4086
|
+
}
|
|
4087
|
+
|
|
4088
|
+
// src/components/Request/RequestHeaders.tsx
|
|
4089
|
+
var import_design_system17 = require("@uniformdev/design-system");
|
|
4090
|
+
var import_jsx_runtime36 = require("@emotion/react/jsx-runtime");
|
|
4091
|
+
function RequestHeaders({ disableVariables }) {
|
|
4092
|
+
var _a, _b;
|
|
4093
|
+
const { dispatch, request } = useRequest();
|
|
4094
|
+
const deezHeaders = [...request.headers, { key: "", value: "" }];
|
|
4095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { css: innerContentStyles, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_design_system17.Table, { children: [
|
|
4096
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_design_system17.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_design_system17.TableRow, { children: [
|
|
4097
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_design_system17.TableCellHead, { children: "Name" }),
|
|
4098
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_design_system17.TableCellHead, { children: "Value" })
|
|
4099
|
+
] }) }),
|
|
4100
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_design_system17.TableBody, { children: [
|
|
4101
|
+
(_b = (_a = request.baseRequest) == null ? void 0 : _a.headers) == null ? void 0 : _b.map((baseHeader) => {
|
|
4102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_design_system17.TableRow, { children: [
|
|
4103
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_design_system17.TableCellData, { width: "50%", children: [
|
|
4104
|
+
baseHeader.key,
|
|
4105
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("br", {}),
|
|
4106
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("small", { children: "from data source" }) })
|
|
4107
|
+
] }),
|
|
4108
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_design_system17.TableCellData, { width: "50%", children: [
|
|
4109
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("i", { css: { color: "var(--gray-500)" }, children: baseHeader.value }),
|
|
4110
|
+
request.headers.find((p) => p.key === baseHeader.key) ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_design_system17.WarningMessage, { message: "overridden below" }) : null
|
|
4111
|
+
] })
|
|
4112
|
+
] }, baseHeader.key);
|
|
4113
|
+
}),
|
|
4114
|
+
deezHeaders.map((header, index) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_design_system17.TableRow, { children: [
|
|
4115
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_design_system17.TableCellData, { width: "50%", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4116
|
+
import_design_system17.Input,
|
|
4117
|
+
{
|
|
4118
|
+
label: header.key,
|
|
4119
|
+
value: header.key,
|
|
4120
|
+
showLabel: false,
|
|
4121
|
+
onChange: (e) => {
|
|
4122
|
+
if (e.currentTarget.value) {
|
|
4123
|
+
dispatch({
|
|
4124
|
+
type: "updateHeader",
|
|
4125
|
+
header: { key: e.currentTarget.value, value: header.value },
|
|
4126
|
+
index
|
|
4127
|
+
});
|
|
4128
|
+
} else {
|
|
4129
|
+
dispatch({ type: "removeHeader", index });
|
|
4130
|
+
}
|
|
4131
|
+
},
|
|
4132
|
+
"data-test-id": "header-key"
|
|
4133
|
+
}
|
|
4134
|
+
) }),
|
|
4135
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_design_system17.TableCellData, { width: "50%", children: header.key ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4136
|
+
import_design_system17.Input,
|
|
4137
|
+
{
|
|
4138
|
+
showLabel: false,
|
|
4139
|
+
label: header.value,
|
|
4140
|
+
value: header.value,
|
|
4141
|
+
onChange: (e) => dispatch({
|
|
4142
|
+
type: "updateHeader",
|
|
4143
|
+
header: { key: header.key, value: e.currentTarget.value },
|
|
4144
|
+
index
|
|
4145
|
+
}),
|
|
4146
|
+
"data-test-id": "header-value"
|
|
4147
|
+
}
|
|
4148
|
+
) : null })
|
|
4149
|
+
] }, index))
|
|
4150
|
+
] })
|
|
4151
|
+
] }) });
|
|
4152
|
+
}
|
|
4153
|
+
|
|
4154
|
+
// src/components/Request/RequestMethodSelect.tsx
|
|
4155
|
+
var import_design_system18 = require("@uniformdev/design-system");
|
|
4156
|
+
var import_jsx_runtime37 = require("@emotion/react/jsx-runtime");
|
|
4157
|
+
function RequestMethodSelect(props) {
|
|
4158
|
+
var _a;
|
|
4159
|
+
const { request, dispatch } = useRequest();
|
|
4160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4161
|
+
import_design_system18.InputSelect,
|
|
4162
|
+
{
|
|
4163
|
+
...props,
|
|
4164
|
+
options: [
|
|
4165
|
+
{ label: "GET", value: "GET" },
|
|
4166
|
+
{ label: "POST", value: "POST" },
|
|
4167
|
+
{ label: "HEAD", value: "HEAD" }
|
|
4168
|
+
],
|
|
4169
|
+
value: (_a = request.method) != null ? _a : "GET",
|
|
4170
|
+
onChange: (e) => dispatch({ type: "setMethod", method: e.currentTarget.value })
|
|
4171
|
+
}
|
|
4172
|
+
);
|
|
4173
|
+
}
|
|
4174
|
+
|
|
4175
|
+
// src/components/Request/RequestParameters.tsx
|
|
4176
|
+
var import_design_system19 = require("@uniformdev/design-system");
|
|
4177
|
+
var import_jsx_runtime38 = require("@emotion/react/jsx-runtime");
|
|
4178
|
+
function RequestParameters({ disableVariables }) {
|
|
4179
|
+
var _a, _b;
|
|
4180
|
+
const { dispatch, request } = useRequest();
|
|
4181
|
+
const deezParameters = [...request.parameters, { key: "", value: "" }];
|
|
4182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { css: innerContentStyles, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_design_system19.Table, { children: [
|
|
4183
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_design_system19.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_design_system19.TableRow, { children: [
|
|
4184
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_design_system19.TableCellHead, { children: "Name" }),
|
|
4185
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_design_system19.TableCellHead, { children: "Value" })
|
|
4186
|
+
] }) }),
|
|
4187
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_design_system19.TableBody, { children: [
|
|
4188
|
+
(_b = (_a = request.baseRequest) == null ? void 0 : _a.parameters) == null ? void 0 : _b.map((baseParameter) => {
|
|
4189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_design_system19.TableRow, { children: [
|
|
4190
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_design_system19.TableCellData, { width: "50%", children: [
|
|
4191
|
+
baseParameter.key,
|
|
4192
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("br", {}),
|
|
4193
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("small", { children: "from data source" }) })
|
|
4194
|
+
] }),
|
|
4195
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_design_system19.TableCellData, { width: "50%", children: [
|
|
4196
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("i", { css: { color: "var(--gray-500)" }, children: baseParameter.value }),
|
|
4197
|
+
request.parameters.find((p) => p.key === baseParameter.key) ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_design_system19.WarningMessage, { message: "overridden below" }) : null
|
|
4198
|
+
] })
|
|
4199
|
+
] }, baseParameter.key);
|
|
4200
|
+
}),
|
|
4201
|
+
deezParameters.map((parameter, index) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_design_system19.TableRow, { children: [
|
|
4202
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_design_system19.TableCellData, { width: "50%", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4203
|
+
import_design_system19.Input,
|
|
4204
|
+
{
|
|
4205
|
+
label: parameter.key,
|
|
4206
|
+
value: parameter.key,
|
|
4207
|
+
showLabel: false,
|
|
4208
|
+
onChange: (e) => {
|
|
4209
|
+
if (e.currentTarget.value) {
|
|
4210
|
+
dispatch({
|
|
4211
|
+
type: "updateParameter",
|
|
4212
|
+
parameter: { key: e.currentTarget.value, value: parameter.value },
|
|
4213
|
+
index
|
|
4214
|
+
});
|
|
4215
|
+
} else {
|
|
4216
|
+
dispatch({ type: "removeParameter", index });
|
|
4217
|
+
}
|
|
4218
|
+
},
|
|
4219
|
+
"data-test-id": "parameter-key"
|
|
4220
|
+
}
|
|
4221
|
+
) }),
|
|
4222
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_design_system19.TableCellData, { width: "50%", children: parameter.key ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4223
|
+
import_design_system19.Input,
|
|
4224
|
+
{
|
|
4225
|
+
showLabel: false,
|
|
4226
|
+
label: parameter.value,
|
|
4227
|
+
value: parameter.value,
|
|
4228
|
+
onChange: (e) => dispatch({
|
|
4229
|
+
type: "updateParameter",
|
|
4230
|
+
parameter: { key: parameter.key, value: e.currentTarget.value },
|
|
4231
|
+
index
|
|
4232
|
+
}),
|
|
4233
|
+
"data-test-id": "parameter-value"
|
|
4234
|
+
}
|
|
4235
|
+
) : null })
|
|
4236
|
+
] }, index))
|
|
4237
|
+
] })
|
|
4238
|
+
] }) });
|
|
4239
|
+
}
|
|
4240
|
+
|
|
4241
|
+
// src/components/Request/RequestUrl.tsx
|
|
4242
|
+
var import_react36 = require("@emotion/react");
|
|
4243
|
+
var import_react37 = require("react");
|
|
4244
|
+
|
|
4245
|
+
// src/components/Request/urlEncodeRequestParameter.ts
|
|
4246
|
+
function urlEncodeRequestUrl(url, varValues) {
|
|
4247
|
+
return decodeVariablesInUrlEncodedString(encodeURI(url), varValues);
|
|
4248
|
+
}
|
|
4249
|
+
function urlEncodeRequestParameter(parameter, varValues) {
|
|
4250
|
+
return {
|
|
4251
|
+
key: decodeVariablesInUrlEncodedString(encodeURIComponent(parameter.key), varValues),
|
|
4252
|
+
value: decodeVariablesInUrlEncodedString(encodeURIComponent(parameter.value), varValues)
|
|
4253
|
+
};
|
|
4254
|
+
}
|
|
4255
|
+
function decodeVariablesInUrlEncodedString(string, varValues) {
|
|
4256
|
+
return string.replace(/(\$|%24)%7B(.*?)%7D/g, (_all, _money, body) => {
|
|
4257
|
+
var _a;
|
|
4258
|
+
const varName = decodeURIComponent(body);
|
|
4259
|
+
return ((_a = varValues == null ? void 0 : varValues[varName]) == null ? void 0 : _a.default) ? varValues[varName].default : `\${${varName}}`;
|
|
4260
|
+
});
|
|
4261
|
+
}
|
|
4262
|
+
|
|
4263
|
+
// src/components/Request/RequestUrl.tsx
|
|
4264
|
+
var import_jsx_runtime39 = require("@emotion/react/jsx-runtime");
|
|
4265
|
+
function RequestUrl() {
|
|
4266
|
+
var _a, _b;
|
|
4267
|
+
const { variables } = useVariables();
|
|
4268
|
+
const { request } = useRequest();
|
|
4269
|
+
const mergedParameters = (0, import_react37.useMemo)(() => {
|
|
4270
|
+
var _a2;
|
|
4271
|
+
if (!((_a2 = request.baseRequest) == null ? void 0 : _a2.parameters)) {
|
|
4272
|
+
return request.parameters;
|
|
4273
|
+
}
|
|
4274
|
+
return request.baseRequest.parameters.filter((baseParam) => !request.parameters.find((p) => p.key === baseParam.key)).concat(request.parameters);
|
|
4275
|
+
}, [(_a = request.baseRequest) == null ? void 0 : _a.parameters, request.parameters]);
|
|
4276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
4277
|
+
"small",
|
|
4278
|
+
{
|
|
4279
|
+
css: import_react36.css`
|
|
1162
4280
|
display: inline-block;
|
|
1163
4281
|
margin-bottom: var(--spacing-xs);
|
|
1164
4282
|
word-break: break-word;
|
|
1165
|
-
`,
|
|
4283
|
+
`,
|
|
4284
|
+
children: [
|
|
4285
|
+
request.baseRequest ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: (_b = request.baseRequest) == null ? void 0 : _b.baseUrl }) : null,
|
|
4286
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { css: { fontWeight: request.baseRequest ? "bold" : "inherit" }, children: [
|
|
4287
|
+
urlEncodeRequestUrl(request.relativeUrl, variables),
|
|
4288
|
+
mergedParameters.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
4289
|
+
"?",
|
|
4290
|
+
mergedParameters.map((param, index) => {
|
|
4291
|
+
const encoded = urlEncodeRequestParameter(param, variables);
|
|
4292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { children: [
|
|
4293
|
+
index > 0 ? "&" : null,
|
|
4294
|
+
encoded.key,
|
|
4295
|
+
"=",
|
|
4296
|
+
encoded.value
|
|
4297
|
+
] }, index);
|
|
4298
|
+
})
|
|
4299
|
+
] }) : null
|
|
4300
|
+
] })
|
|
4301
|
+
]
|
|
4302
|
+
}
|
|
4303
|
+
);
|
|
4304
|
+
}
|
|
4305
|
+
|
|
4306
|
+
// src/components/Request/RequestUrlInput.tsx
|
|
4307
|
+
var import_jsx_runtime40 = require("@emotion/react/jsx-runtime");
|
|
4308
|
+
function RequestUrlInput(props) {
|
|
4309
|
+
const { request, dispatch } = useRequest();
|
|
4310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4311
|
+
InputVariables,
|
|
4312
|
+
{
|
|
4313
|
+
...props,
|
|
4314
|
+
value: request.relativeUrl,
|
|
4315
|
+
onPaste: (value) => {
|
|
4316
|
+
var _a, _b, _c;
|
|
4317
|
+
const indexOfQueryString = value.indexOf("?");
|
|
4318
|
+
if (indexOfQueryString >= 0) {
|
|
4319
|
+
let relativeUrl = value.substring(0, indexOfQueryString);
|
|
4320
|
+
if (((_a = request.baseRequest) == null ? void 0 : _a.baseUrl) && relativeUrl.startsWith((_b = request.baseRequest) == null ? void 0 : _b.baseUrl)) {
|
|
4321
|
+
relativeUrl = relativeUrl.substring((_c = request.baseRequest) == null ? void 0 : _c.baseUrl.length);
|
|
4322
|
+
}
|
|
4323
|
+
dispatch({ type: "setRelativeUrl", relativeUrl });
|
|
4324
|
+
for (let index = request.parameters.length - 1; index >= 0; index--) {
|
|
4325
|
+
dispatch({ type: "removeParameter", index });
|
|
4326
|
+
}
|
|
4327
|
+
try {
|
|
4328
|
+
const query = new URLSearchParams(value.substring(indexOfQueryString));
|
|
4329
|
+
query.forEach((value2, key) => {
|
|
4330
|
+
dispatch({ type: "updateParameter", parameter: { key, value: value2 } });
|
|
4331
|
+
});
|
|
4332
|
+
} catch (e) {
|
|
4333
|
+
}
|
|
4334
|
+
}
|
|
4335
|
+
},
|
|
4336
|
+
onChange: (value) => {
|
|
4337
|
+
dispatch({ type: "setRelativeUrl", relativeUrl: value });
|
|
4338
|
+
}
|
|
4339
|
+
}
|
|
4340
|
+
);
|
|
4341
|
+
}
|
|
4342
|
+
|
|
4343
|
+
// src/components/DataSourceEditor.tsx
|
|
4344
|
+
var import_jsx_runtime41 = require("@emotion/react/jsx-runtime");
|
|
4345
|
+
function DataSourceEditor({ onChange, children }) {
|
|
4346
|
+
var _a;
|
|
4347
|
+
const { value } = useMeshLocation("dataSource");
|
|
4348
|
+
const currentRequestValue = convertDataSourceToRequestData(value);
|
|
4349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4350
|
+
VariablesProvider,
|
|
4351
|
+
{
|
|
4352
|
+
value: (_a = value.variables) != null ? _a : {},
|
|
4353
|
+
onChange: (newValue) => onChange((prev) => ({ newValue: { ...prev, variables: newValue } })),
|
|
4354
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4355
|
+
RequestProvider,
|
|
4356
|
+
{
|
|
4357
|
+
value: currentRequestValue,
|
|
4358
|
+
onChange: (requestDispatch) => {
|
|
4359
|
+
onChange((previousDataSource) => {
|
|
4360
|
+
const previousDataSourceAsRequestData = convertDataSourceToRequestData(previousDataSource);
|
|
4361
|
+
const updatedRequestData = requestDispatch(previousDataSourceAsRequestData);
|
|
4362
|
+
return {
|
|
4363
|
+
newValue: convertRequestDataToDataSource(previousDataSource, updatedRequestData)
|
|
4364
|
+
};
|
|
4365
|
+
});
|
|
4366
|
+
},
|
|
4367
|
+
children
|
|
4368
|
+
}
|
|
4369
|
+
)
|
|
4370
|
+
}
|
|
4371
|
+
);
|
|
4372
|
+
}
|
|
4373
|
+
function convertDataSourceToRequestData(dataSource) {
|
|
4374
|
+
var _a, _b, _c;
|
|
4375
|
+
return {
|
|
4376
|
+
headers: (_a = dataSource == null ? void 0 : dataSource.headers) != null ? _a : [],
|
|
4377
|
+
parameters: (_b = dataSource == null ? void 0 : dataSource.parameters) != null ? _b : [],
|
|
4378
|
+
relativeUrl: (_c = dataSource == null ? void 0 : dataSource.baseUrl) != null ? _c : ""
|
|
4379
|
+
};
|
|
4380
|
+
}
|
|
4381
|
+
function convertRequestDataToDataSource(dataSource, requestData) {
|
|
4382
|
+
return {
|
|
4383
|
+
...dataSource,
|
|
4384
|
+
baseUrl: requestData.relativeUrl,
|
|
4385
|
+
headers: requestData.headers.length ? requestData.headers : void 0,
|
|
4386
|
+
parameters: requestData.parameters
|
|
4387
|
+
};
|
|
4388
|
+
}
|
|
4389
|
+
|
|
4390
|
+
// src/components/DataTypeEditor.tsx
|
|
4391
|
+
var import_jsx_runtime42 = require("@emotion/react/jsx-runtime");
|
|
4392
|
+
function DataTypeEditor({ onChange, children }) {
|
|
4393
|
+
var _a;
|
|
4394
|
+
const {
|
|
4395
|
+
value,
|
|
4396
|
+
metadata: { dataSource }
|
|
4397
|
+
} = useMeshLocation("dataType");
|
|
4398
|
+
const currentRequestValue = convertDataTypeToRequestData(value, dataSource);
|
|
4399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4400
|
+
VariablesProvider,
|
|
4401
|
+
{
|
|
4402
|
+
value: (_a = value.variables) != null ? _a : {},
|
|
4403
|
+
onChange: (newValue) => onChange((prev) => ({ newValue: { ...prev, variables: newValue } })),
|
|
4404
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4405
|
+
RequestProvider,
|
|
4406
|
+
{
|
|
4407
|
+
value: currentRequestValue,
|
|
4408
|
+
onChange: (requestDispatch) => {
|
|
4409
|
+
onChange((previousDataType) => {
|
|
4410
|
+
const previousDataTypeAsRequestData = convertDataTypeToRequestData(previousDataType, dataSource);
|
|
4411
|
+
const updatedRequestData = requestDispatch(previousDataTypeAsRequestData);
|
|
4412
|
+
return {
|
|
4413
|
+
newValue: convertRequestDataToDataType(previousDataType, updatedRequestData)
|
|
4414
|
+
};
|
|
4415
|
+
});
|
|
4416
|
+
},
|
|
4417
|
+
children
|
|
4418
|
+
}
|
|
4419
|
+
)
|
|
4420
|
+
}
|
|
4421
|
+
);
|
|
4422
|
+
}
|
|
4423
|
+
function convertDataTypeToRequestData(dataType, dataSource) {
|
|
4424
|
+
var _a, _b;
|
|
4425
|
+
return {
|
|
4426
|
+
...dataType,
|
|
4427
|
+
headers: (_a = dataType.headers) != null ? _a : [],
|
|
4428
|
+
parameters: (_b = dataType.parameters) != null ? _b : [],
|
|
4429
|
+
relativeUrl: dataType.path,
|
|
4430
|
+
baseRequest: {
|
|
4431
|
+
baseUrl: dataSource.baseUrl,
|
|
4432
|
+
headers: dataSource.headers,
|
|
4433
|
+
parameters: dataSource.parameters
|
|
4434
|
+
}
|
|
4435
|
+
};
|
|
4436
|
+
}
|
|
4437
|
+
function convertRequestDataToDataType(dataType, requestData) {
|
|
4438
|
+
var _a;
|
|
4439
|
+
return {
|
|
4440
|
+
...dataType,
|
|
4441
|
+
path: requestData.relativeUrl,
|
|
4442
|
+
headers: requestData.headers.length ? requestData.headers : void 0,
|
|
4443
|
+
parameters: requestData.parameters.length ? requestData.parameters : void 0,
|
|
4444
|
+
method: (_a = requestData.method) != null ? _a : "GET",
|
|
4445
|
+
body: requestData.body
|
|
4446
|
+
};
|
|
4447
|
+
}
|
|
4448
|
+
|
|
4449
|
+
// src/components/MeshApp.tsx
|
|
4450
|
+
var import_design_system20 = require("@uniformdev/design-system");
|
|
4451
|
+
|
|
4452
|
+
// src/hooks/useInitializeUniformMeshSdk.ts
|
|
4453
|
+
var import_mesh_sdk = require("@uniformdev/mesh-sdk");
|
|
4454
|
+
var import_react38 = require("react");
|
|
4455
|
+
var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
4456
|
+
const [error, setError] = (0, import_react38.useState)();
|
|
4457
|
+
const [sdk, setSdk] = (0, import_react38.useState)();
|
|
4458
|
+
const initializationInProgress = (0, import_react38.useRef)(false);
|
|
4459
|
+
(0, import_react38.useEffect)(
|
|
4460
|
+
() => {
|
|
4461
|
+
if (typeof window === "undefined" || sdk) {
|
|
4462
|
+
return;
|
|
4463
|
+
}
|
|
4464
|
+
if (typeof window.UniformMeshSDK === "undefined" && !initializationInProgress.current) {
|
|
4465
|
+
initializationInProgress.current = true;
|
|
4466
|
+
(0, import_mesh_sdk.initializeUniformMeshSDK)({ autoResizingDisabled }).then((sdk2) => {
|
|
4467
|
+
setSdk(sdk2);
|
|
4468
|
+
}).catch((err) => {
|
|
4469
|
+
setError(err);
|
|
4470
|
+
}).finally(() => {
|
|
4471
|
+
initializationInProgress.current = false;
|
|
4472
|
+
});
|
|
4473
|
+
} else {
|
|
4474
|
+
setSdk(window.UniformMeshSDK);
|
|
4475
|
+
}
|
|
4476
|
+
},
|
|
4477
|
+
[autoResizingDisabled]
|
|
4478
|
+
);
|
|
4479
|
+
return {
|
|
4480
|
+
initializing: !sdk && !error,
|
|
4481
|
+
error,
|
|
4482
|
+
sdk
|
|
4483
|
+
};
|
|
4484
|
+
};
|
|
4485
|
+
|
|
4486
|
+
// src/components/MeshApp.tsx
|
|
4487
|
+
var import_jsx_runtime43 = require("@emotion/react/jsx-runtime");
|
|
4488
|
+
var MeshApp = ({
|
|
4489
|
+
children,
|
|
4490
|
+
loadingComponent,
|
|
4491
|
+
errorComponent
|
|
4492
|
+
}) => {
|
|
4493
|
+
const { initializing, error, sdk } = useInitializeUniformMeshSdk();
|
|
4494
|
+
if (initializing || !sdk) {
|
|
4495
|
+
const LoadingComponent = loadingComponent;
|
|
4496
|
+
return LoadingComponent ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(LoadingComponent, {}) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system20.LoadingIndicator, {});
|
|
4497
|
+
}
|
|
4498
|
+
if (error) {
|
|
4499
|
+
const ErrorComponent = errorComponent;
|
|
4500
|
+
if (ErrorComponent) {
|
|
4501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ErrorComponent, { error });
|
|
4502
|
+
}
|
|
4503
|
+
throw error;
|
|
4504
|
+
}
|
|
4505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(UniformMeshSdkContext.Provider, { value: { sdk }, children: [
|
|
4506
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system20.Theme, {}),
|
|
4507
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(UniformMeshLocationContextProvider, { children })
|
|
4508
|
+
] });
|
|
4509
|
+
};
|
|
4510
|
+
|
|
4511
|
+
// src/hooks/useUniformMeshLocation.ts
|
|
4512
|
+
function useUniformMeshLocation() {
|
|
4513
|
+
const { location } = useUniformMeshLocationContext();
|
|
4514
|
+
return location;
|
|
4515
|
+
}
|
|
4516
|
+
|
|
4517
|
+
// src/utils/createLocationValidator.ts
|
|
4518
|
+
function createLocationValidator(setValue, validate) {
|
|
4519
|
+
return (dispatch) => setValue((previous) => {
|
|
4520
|
+
const { newValue, options } = dispatch(previous);
|
|
4521
|
+
return { newValue, options: validate(newValue, options) };
|
|
4522
|
+
});
|
|
4523
|
+
}
|
|
4524
|
+
|
|
4525
|
+
// src/index.ts
|
|
4526
|
+
var import_design_system21 = require("@uniformdev/design-system");
|
|
4527
|
+
__reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
4528
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
4529
|
+
0 && (module.exports = {
|
|
4530
|
+
AddListButton,
|
|
4531
|
+
Button,
|
|
4532
|
+
Callout,
|
|
4533
|
+
DamSelectedItem,
|
|
4534
|
+
DataResourceVariablesList,
|
|
4535
|
+
DataSourceEditor,
|
|
4536
|
+
DataTypeEditor,
|
|
4537
|
+
DefaultSearchRow,
|
|
4538
|
+
DefaultSelectedItem,
|
|
4539
|
+
EntrySearch,
|
|
4540
|
+
Heading,
|
|
4541
|
+
Icons,
|
|
4542
|
+
Input,
|
|
4543
|
+
InputComboBox,
|
|
4544
|
+
InputKeywordSearch,
|
|
4545
|
+
InputSelect,
|
|
4546
|
+
InputToggle,
|
|
4547
|
+
InputVariables,
|
|
4548
|
+
KeywordSearchInput,
|
|
4549
|
+
Label,
|
|
4550
|
+
LoadingIndicator,
|
|
4551
|
+
LoadingOverlay,
|
|
4552
|
+
Menu,
|
|
4553
|
+
MenuItem,
|
|
4554
|
+
MeshApp,
|
|
4555
|
+
ProductPreviewList,
|
|
4556
|
+
ProductQuery,
|
|
4557
|
+
ProductQueryContext,
|
|
4558
|
+
ProductSearch,
|
|
4559
|
+
ProductSearchContext,
|
|
4560
|
+
ProductSearchRow,
|
|
4561
|
+
ProductSelectedItem,
|
|
4562
|
+
RequestBody,
|
|
4563
|
+
RequestHeaders,
|
|
4564
|
+
RequestMethodSelect,
|
|
4565
|
+
RequestParameters,
|
|
4566
|
+
RequestProvider,
|
|
4567
|
+
RequestTypeContainer,
|
|
4568
|
+
RequestUrl,
|
|
4569
|
+
RequestUrlInput,
|
|
4570
|
+
ResolvableLoadingValue,
|
|
4571
|
+
ScrollableList,
|
|
4572
|
+
ScrollableListItem,
|
|
4573
|
+
SelectionField,
|
|
4574
|
+
Switch,
|
|
4575
|
+
TextVariableRenderer,
|
|
4576
|
+
Textarea,
|
|
4577
|
+
Theme,
|
|
4578
|
+
UniformMeshLocationContext,
|
|
4579
|
+
UniformMeshLocationContextProvider,
|
|
4580
|
+
UniformMeshSdkContext,
|
|
4581
|
+
UniformMeshSdkContextProvider,
|
|
4582
|
+
VariableEditor,
|
|
4583
|
+
VariablesList,
|
|
4584
|
+
VariablesProvider,
|
|
4585
|
+
badgeIcon,
|
|
4586
|
+
createLocationValidator,
|
|
4587
|
+
damSelectItemImage,
|
|
4588
|
+
damSelectedItemContainer,
|
|
4589
|
+
damSelectedItemCopy,
|
|
4590
|
+
damSelectedItemDetails,
|
|
4591
|
+
damSelectedItemIcon,
|
|
4592
|
+
damSelectedItemInfoBtn,
|
|
4593
|
+
damSelectedItemInner,
|
|
4594
|
+
damSelectedItemLinkBtn,
|
|
4595
|
+
damSelectedItemLinkContainer,
|
|
4596
|
+
damSelectedItemMediaContainer,
|
|
4597
|
+
damSelectedItemPopover,
|
|
4598
|
+
damSelectedItemPopoverLabel,
|
|
4599
|
+
damSelectedItemSmallText,
|
|
4600
|
+
damSelectedItemTitle,
|
|
4601
|
+
draggableContainer,
|
|
4602
|
+
draggableIcon,
|
|
4603
|
+
draggableIconOffset,
|
|
4604
|
+
draggableIconWrapper,
|
|
4605
|
+
entrySearchBtn,
|
|
4606
|
+
entrySearchConfig,
|
|
4607
|
+
entrySearchConfigHidden,
|
|
4608
|
+
entrySearchLoadMoreBtn,
|
|
4609
|
+
entrySearchResultList,
|
|
4610
|
+
entrySearchSelectIcon,
|
|
4611
|
+
entrySearchSelectImg,
|
|
4612
|
+
entrySearchSelectInput,
|
|
4613
|
+
entrySearchSelectOption,
|
|
4614
|
+
entrySearchWrapper,
|
|
4615
|
+
productSearchRowActiveIcon,
|
|
4616
|
+
productSearchRowCategory,
|
|
4617
|
+
productSearchRowContainer,
|
|
4618
|
+
productSearchRowContent,
|
|
4619
|
+
productSearchRowContentActive,
|
|
4620
|
+
productSearchRowDetails,
|
|
4621
|
+
productSearchRowTitle,
|
|
4622
|
+
productSelectedItemContainer,
|
|
4623
|
+
productSelectedItemContent,
|
|
4624
|
+
productSelectedItemDetails,
|
|
4625
|
+
productSelectedItemIcon,
|
|
4626
|
+
productSelectedItemImage,
|
|
4627
|
+
productSelectedItemLinkContainer,
|
|
4628
|
+
productedSelectedItemLinkBtn,
|
|
4629
|
+
productedSelectedItemSmallText,
|
|
4630
|
+
searchRowBtn,
|
|
4631
|
+
searchRowContainer,
|
|
4632
|
+
searchRowContainerActive,
|
|
4633
|
+
searchRowContainerWithPopover,
|
|
4634
|
+
searchRowPopover,
|
|
4635
|
+
searchRowText,
|
|
4636
|
+
searchRowTextSmall,
|
|
4637
|
+
selectItemLinkBtn,
|
|
4638
|
+
selectItemLinkContainer,
|
|
4639
|
+
selectItemPopover,
|
|
4640
|
+
selectItemPopoverLabel,
|
|
4641
|
+
selectItemSmallText,
|
|
4642
|
+
selectedItemContainer,
|
|
4643
|
+
selectedItemCopy,
|
|
4644
|
+
selectedItemDetails,
|
|
4645
|
+
selectedItemIcon,
|
|
4646
|
+
selectedItemInner,
|
|
4647
|
+
selectedItemTitle,
|
|
4648
|
+
urlEncodeRequestParameter,
|
|
4649
|
+
urlEncodeRequestUrl,
|
|
4650
|
+
useInitializeUniformMeshSdk,
|
|
4651
|
+
useMeshLocation,
|
|
4652
|
+
useProductQueryContext,
|
|
4653
|
+
useProductSearchContext,
|
|
4654
|
+
useRequest,
|
|
4655
|
+
useUniformMeshLocation,
|
|
4656
|
+
useUniformMeshLocationContext,
|
|
4657
|
+
useUniformMeshSdk,
|
|
4658
|
+
useUniformMeshSdkContext,
|
|
4659
|
+
useVariables,
|
|
4660
|
+
variablesToList
|
|
4661
|
+
});
|