@depict-ai/react-ui 2.1.7 → 2.1.9
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/ES10/index.cjs +1 -1
- package/ES10/index.d.ts +1 -1
- package/ES10/index.js +1 -1
- package/dist/main.js +527 -0
- package/dist/module.js +510 -0
- package/dist/styles/components/PLP/Buttons.scss +181 -0
- package/dist/styles/components/PLP/MorphingSign.scss +30 -0
- package/dist/styles/components/PLP/PLPResults.scss +26 -0
- package/dist/styles/components/PLP/ProductListingPage.scss +168 -0
- package/dist/styles/components/PLP/ScrollStatus.scss +31 -0
- package/dist/styles/components/PLP/SelectedFilters.scss +82 -0
- package/dist/styles/components/PLP/SlidableItems.scss +121 -0
- package/dist/styles/components/PLP/SortAndFilter/FloatingButtons.scss +84 -0
- package/dist/styles/components/PLP/SortAndFilter/SortAndFilter.scss +800 -0
- package/dist/styles/components/PLP/SortAndFilter/SortAndFilterModal.scss +158 -0
- package/dist/styles/components/PLP/SortAndFilter/WhiteSortAndFilter.scss +152 -0
- package/dist/styles/components/PLP/Toast.scss +59 -0
- package/dist/styles/components/PLP/index.scss +51 -0
- package/dist/styles/components/category/BreadCrumbs.scss +32 -0
- package/dist/styles/components/category/CategoryTitle.scss +40 -0
- package/dist/styles/components/category/QuickLinks.scss +80 -0
- package/dist/styles/components/category/index.scss +23 -0
- package/dist/styles/components/search/Autocomplete.scss +197 -0
- package/dist/styles/components/search/CategorySuggestions.scss +82 -0
- package/dist/styles/components/search/InstantCard.scss +122 -0
- package/dist/styles/components/search/InstantResults.scss +12 -0
- package/dist/styles/components/search/PreviousSearches.scss +90 -0
- package/dist/styles/components/search/QueryInput.scss +189 -0
- package/dist/styles/components/search/SearchModal.scss +101 -0
- package/dist/styles/components/search/SearchRecommendations.scss +28 -0
- package/dist/styles/components/search/ShowingResultsFor.scss +13 -0
- package/dist/styles/components/search/index.scss +40 -0
- package/dist/styles/default.css +1 -0
- package/dist/styles/helpers/custom_input.scss +194 -0
- package/dist/styles/helpers/supports-hover.scss +7 -0
- package/dist/styles/helpers/utils.scss +90 -0
- package/dist/styles/plain-css-fallback-styling.css +1 -1
- package/dist/styles/variables.scss +61 -0
- package/latest/index.cjs +1 -1
- package/latest/index.d.ts +1 -1
- package/latest/index.js +1 -1
- package/package.json +4 -4
- package/server/ES10/index.cjs +1 -1
- package/server/ES10/index.d.ts +1 -1
- package/server/ES10/index.js +1 -1
- package/server/latest/index.cjs +1 -1
- package/server/latest/index.d.ts +1 -1
- package/server/latest/index.js +1 -1
package/dist/module.js
ADDED
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
import {dlog as $TZSbU$dlog, href_change_ipns as $TZSbU$href_change_ipns, catchify as $TZSbU$catchify, observer as $TZSbU$observer, history_replacer as $TZSbU$history_replacer, queueMacroTask as $TZSbU$queueMacroTask, ContainedPlaceholderImage as $TZSbU$ContainedPlaceholderImage, Placeholder as $TZSbU$Placeholder} from "@depict-ai/utilishared";
|
|
2
|
+
import {add_to_version_info as $TZSbU$add_to_version_info, CategoryTitle as $43099132aad1ceb6$re_export$CategoryTitle, embedded_num_products as $43099132aad1ceb6$re_export$EmbeddedNumProducts, SearchField as $TZSbU$SearchField, DepictSearch as $TZSbU$DepictSearch, DepictCategory as $TZSbU$DepictCategory, get_search_query_updating_blocked_signal as $TZSbU$get_search_query_updating_blocked_signal, SearchPage as $TZSbU$SearchPage, CategoryPage as $TZSbU$CategoryPage, BreadCrumbs as $TZSbU$BreadCrumbs, QuickLinks as $TZSbU$QuickLinks, styles_to_valid_css_string as $TZSbU$styles_to_valid_css_string, align_field as $TZSbU$align_field} from "@depict-ai/ui";
|
|
3
|
+
import {untrack as $TZSbU$untrack, createComponent as $TZSbU$createComponent, Show as $TZSbU$Show, onCleanup as $TZSbU$onCleanup, createSignal as $TZSbU$createSignal, createRoot as $TZSbU$createRoot, createComputed as $TZSbU$createComputed} from "solid-js";
|
|
4
|
+
import {render as $TZSbU$render} from "solid-js/web";
|
|
5
|
+
import {useState as $TZSbU$useState, useRef as $TZSbU$useRef, useEffect as $TZSbU$useEffect, createElement as $TZSbU$createElement, Fragment as $TZSbU$Fragment, forwardRef as $TZSbU$forwardRef} from "react";
|
|
6
|
+
import {jsx as $TZSbU$jsx} from "react/jsx-runtime";
|
|
7
|
+
import {createPortal as $TZSbU$createPortal} from "react-dom";
|
|
8
|
+
import {en as $TZSbU$en} from "@depict-ai/ui/locales";
|
|
9
|
+
|
|
10
|
+
/*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
|
|
11
|
+
// Note, if you add an export here, also add one in src-server/main.ts
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const $42858f023ef23dab$export$8e769ad4338a911e = {
|
|
16
|
+
search: null,
|
|
17
|
+
category: null,
|
|
18
|
+
category_path: null,
|
|
19
|
+
search_page_path_: (0, $TZSbU$createSignal)(),
|
|
20
|
+
required_state_set_: (0, $TZSbU$createSignal)(false)
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
let $c83ba9ab79386687$var$run_on_href_change;
|
|
30
|
+
function $c83ba9ab79386687$export$74f3924c5027fe1d(cb) {
|
|
31
|
+
$c83ba9ab79386687$var$run_on_href_change = cb;
|
|
32
|
+
}
|
|
33
|
+
(async ()=>{
|
|
34
|
+
for await (const href of (0, $TZSbU$href_change_ipns))$c83ba9ab79386687$var$run_on_href_change?.(href);
|
|
35
|
+
})();
|
|
36
|
+
const $c83ba9ab79386687$export$775e6b3892b5ad52 = (url)=>url.pathname == (0, $TZSbU$untrack)((0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_path_[0]); // might have changed therefore get it from globalState
|
|
37
|
+
const $c83ba9ab79386687$export$92a8f8b3c630fa0d = (url)=>{
|
|
38
|
+
return $c83ba9ab79386687$export$775e6b3892b5ad52(url) || url.pathname === (0, $42858f023ef23dab$export$8e769ad4338a911e).category_path;
|
|
39
|
+
};
|
|
40
|
+
function $c83ba9ab79386687$export$f6e64e17bd69eeef(solid_component, props, wrapper_type = "div", wrapper_style = {}, react_render_handler) {
|
|
41
|
+
const [portals, set_portals] = (0, $TZSbU$useState)([]);
|
|
42
|
+
const wrapper_element_ref = (0, $TZSbU$useRef)();
|
|
43
|
+
(0, $TZSbU$useEffect)(()=>{
|
|
44
|
+
const wrapper_element = wrapper_element_ref.current;
|
|
45
|
+
const dispose = (0, $TZSbU$render)(()=>solid_component(props, set_portals), wrapper_element);
|
|
46
|
+
return dispose;
|
|
47
|
+
}, []);
|
|
48
|
+
react_render_handler?.(props);
|
|
49
|
+
return (0, $TZSbU$createElement)(wrapper_type, {
|
|
50
|
+
ref: wrapper_element_ref,
|
|
51
|
+
style: wrapper_style
|
|
52
|
+
}, portals);
|
|
53
|
+
}
|
|
54
|
+
function $c83ba9ab79386687$export$e5139bbbb9a05035(component, is_set = (0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[0]) {
|
|
55
|
+
return (...args)=>{
|
|
56
|
+
return (0, $TZSbU$createComponent)((0, $TZSbU$Show), {
|
|
57
|
+
get when () {
|
|
58
|
+
return is_set();
|
|
59
|
+
},
|
|
60
|
+
get children () {
|
|
61
|
+
return component(...args);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
async function $c83ba9ab79386687$export$79c79419c1ef0081({ display: display , info: info , component_portals: component_portals , set_portals: set_portals , react_template: react_template }) {
|
|
67
|
+
const solid_container = document.createElement("div");
|
|
68
|
+
const react_has_rendered = new Promise((r)=>{
|
|
69
|
+
const m_o = new MutationObserver(()=>{
|
|
70
|
+
m_o.disconnect();
|
|
71
|
+
r();
|
|
72
|
+
});
|
|
73
|
+
m_o.observe(solid_container, {
|
|
74
|
+
childList: true
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
const is_placeholder = info.rendering_options.type === "placeholder";
|
|
78
|
+
const reactProductCard = (0, $TZSbU$jsx)(react_template, {
|
|
79
|
+
display: is_placeholder ? null : display
|
|
80
|
+
});
|
|
81
|
+
const portal = $TZSbU$createPortal(reactProductCard, solid_container);
|
|
82
|
+
component_portals.add(portal);
|
|
83
|
+
set_portals([
|
|
84
|
+
...component_portals
|
|
85
|
+
]);
|
|
86
|
+
(0, $TZSbU$onCleanup)(()=>{
|
|
87
|
+
// this will stop working after any await so be careful to not await before this, or you'll have to carry the owner over with getOwner and runWithOwner
|
|
88
|
+
component_portals.delete(portal);
|
|
89
|
+
set_portals([
|
|
90
|
+
...component_portals
|
|
91
|
+
]);
|
|
92
|
+
});
|
|
93
|
+
await react_has_rendered; // wait for react to have finish portaling the elements so that the placeholders get removed once we have an actual result and so that the PLP code knows it has a placeholder when this is a placeholder rendering
|
|
94
|
+
return [
|
|
95
|
+
solid_container
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
function $02e2452814b6e7d6$export$4c0fa313cf50c4ad() {
|
|
103
|
+
return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)(()=>(0, $TZSbU$SearchField)({
|
|
104
|
+
depict_search: (0, $42858f023ef23dab$export$8e769ad4338a911e).search
|
|
105
|
+
})), {});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
let $8071251ee4e9ffa1$var$set = false;
|
|
115
|
+
let $8071251ee4e9ffa1$var$padding_animation;
|
|
116
|
+
function $8071251ee4e9ffa1$export$6453cbc34515a94d(is_search_page) {
|
|
117
|
+
if ($8071251ee4e9ffa1$var$set) return; // Just being safe
|
|
118
|
+
$8071251ee4e9ffa1$var$set = true;
|
|
119
|
+
let should_use_old_scroll = false;
|
|
120
|
+
const old_scrollTo = window.scrollTo;
|
|
121
|
+
window.scrollTo = (...args)=>{
|
|
122
|
+
if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !is_search_page(location)) return Reflect.apply(old_scrollTo, window, args);
|
|
123
|
+
else should_use_old_scroll = true;
|
|
124
|
+
};
|
|
125
|
+
addEventListener("popstate", (0, $TZSbU$catchify)(()=>{
|
|
126
|
+
if (!is_search_page(location)) {
|
|
127
|
+
$8071251ee4e9ffa1$var$removeLotsOfPadding(); // Just making sure
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
should_use_old_scroll = false;
|
|
131
|
+
$8071251ee4e9ffa1$var$addLotsOfPadding();
|
|
132
|
+
(0, $TZSbU$observer).wait_for_element(".depict.plp .listing-page").then(()=>{
|
|
133
|
+
$8071251ee4e9ffa1$var$removeLotsOfPadding();
|
|
134
|
+
});
|
|
135
|
+
}));
|
|
136
|
+
(0, $TZSbU$history_replacer)(()=>{
|
|
137
|
+
(0, $TZSbU$queueMacroTask)(()=>{
|
|
138
|
+
$8071251ee4e9ffa1$var$removeLotsOfPadding();
|
|
139
|
+
});
|
|
140
|
+
}, false);
|
|
141
|
+
window?.next?.router?.events?.on("routeChangeStart", ()=>{
|
|
142
|
+
$8071251ee4e9ffa1$var$addLotsOfPadding();
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/*
|
|
146
|
+
Here we want to be able to add padding that *definitely* gets applied and then be able to revert precisely to what was before.
|
|
147
|
+
The best way to achieve this is using an animation that with the fill set to none. This is because animations have the absolute highest precedence in CSS, even higher than !important. Then, to revert to the old padding, we just play the animation which is 1ms long so, it immediately finishes and whatever was defined before takes precedence again.
|
|
148
|
+
*/ function $8071251ee4e9ffa1$var$addLotsOfPadding() {
|
|
149
|
+
if ($8071251ee4e9ffa1$var$padding_animation) return; // We're already showing a bunch of padding
|
|
150
|
+
$8071251ee4e9ffa1$var$padding_animation = document.body.animate({
|
|
151
|
+
paddingBottom: (history.state?.search_scroll_restoration_data?.[0]?.min_results_loaded || 150) * 500 + "px",
|
|
152
|
+
offset: 0
|
|
153
|
+
}, 1);
|
|
154
|
+
$8071251ee4e9ffa1$var$padding_animation.pause();
|
|
155
|
+
}
|
|
156
|
+
function $8071251ee4e9ffa1$var$removeLotsOfPadding() {
|
|
157
|
+
if ($8071251ee4e9ffa1$var$padding_animation) {
|
|
158
|
+
$8071251ee4e9ffa1$var$padding_animation.play();
|
|
159
|
+
$8071251ee4e9ffa1$var$padding_animation = undefined;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
const $7216ca4c8308a0f9$export$599d4515591ef232 = (href)=>{
|
|
167
|
+
const shallow = (0, $c83ba9ab79386687$export$92a8f8b3c630fa0d)(location);
|
|
168
|
+
window.next.router.push(href, undefined, {
|
|
169
|
+
shallow: shallow,
|
|
170
|
+
scroll: true
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
function $5376eb2a386cd90d$export$9fac37a9c21c2f3b(props) {
|
|
177
|
+
const { children: children , navigateFunction: navigateFunction , market: market , merchant: merchant , locale: locale } = props;
|
|
178
|
+
const usedLocale = locale ?? (0, $TZSbU$en);
|
|
179
|
+
const { searchPagePath: searchPagePath , urlParamName: urlParamName , enableCategorySuggestions: enableCategorySuggestions } = props.search ?? {};
|
|
180
|
+
if (!market || !merchant) {
|
|
181
|
+
(0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[1](false);
|
|
182
|
+
return (0, $TZSbU$createElement)((0, $TZSbU$Fragment), null, children);
|
|
183
|
+
}
|
|
184
|
+
try {
|
|
185
|
+
const { search: search , category: category } = (0, $42858f023ef23dab$export$8e769ad4338a911e);
|
|
186
|
+
const [get_search_page_path, set_search_page_path] = (0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_path_;
|
|
187
|
+
set_search_page_path(searchPagePath);
|
|
188
|
+
const on_navigation = typeof window?.next?.router !== "undefined" || navigateFunction ? (new_href)=>{
|
|
189
|
+
if (navigateFunction) navigateFunction(new_href);
|
|
190
|
+
else (0, $7216ca4c8308a0f9$export$599d4515591ef232)(new_href);
|
|
191
|
+
} : undefined;
|
|
192
|
+
if (!search) (0, $TZSbU$createRoot)(()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).search = new (0, $TZSbU$DepictSearch)({
|
|
193
|
+
search_query_url_param_name: urlParamName,
|
|
194
|
+
market: market,
|
|
195
|
+
merchant: merchant,
|
|
196
|
+
enable_category_suggestions: enableCategorySuggestions ?? false,
|
|
197
|
+
// default category suggestions to false for @depict-ai/react-ui (https://linear.app/depictai/issue/FRO-401/default-enablecategorysuggestions-to-false)
|
|
198
|
+
localization: usedLocale,
|
|
199
|
+
url_transformer: (url)=>url.pathname = (0, $TZSbU$untrack)(get_search_page_path),
|
|
200
|
+
on_navigation: on_navigation
|
|
201
|
+
}));
|
|
202
|
+
else {
|
|
203
|
+
search.market = market;
|
|
204
|
+
search.merchant = merchant;
|
|
205
|
+
search.localization = usedLocale;
|
|
206
|
+
}
|
|
207
|
+
if (!category) (0, $TZSbU$createRoot)(()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).category = new (0, $TZSbU$DepictCategory)({
|
|
208
|
+
market: market,
|
|
209
|
+
merchant: merchant,
|
|
210
|
+
localization: usedLocale,
|
|
211
|
+
on_navigation: on_navigation
|
|
212
|
+
}));
|
|
213
|
+
else {
|
|
214
|
+
category.market = market;
|
|
215
|
+
category.merchant = merchant;
|
|
216
|
+
category.localization = usedLocale;
|
|
217
|
+
}
|
|
218
|
+
(0, $8071251ee4e9ffa1$export$6453cbc34515a94d)((0, $c83ba9ab79386687$export$92a8f8b3c630fa0d));
|
|
219
|
+
(0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[1](true);
|
|
220
|
+
} catch (e) {
|
|
221
|
+
// Make sure to not break the users app if we throw
|
|
222
|
+
queueMicrotask(()=>{
|
|
223
|
+
throw e;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
return (0, $TZSbU$createElement)((0, $TZSbU$Fragment), null, children);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
const $4db0e2f013fc5124$export$3f4580d6398c5027 = /*#__PURE__*/ (0, $TZSbU$forwardRef)((_, ref)=>{
|
|
232
|
+
return /*#__PURE__*/ (0, $TZSbU$createElement)("div", {
|
|
233
|
+
className: "depict aligner",
|
|
234
|
+
style: {
|
|
235
|
+
height: "100%"
|
|
236
|
+
},
|
|
237
|
+
ref: ref
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
function $4a678f0c87b12e78$export$210723f5a54a7028(props) {
|
|
247
|
+
return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($4a678f0c87b12e78$var$SolidSearchPage), props);
|
|
248
|
+
}
|
|
249
|
+
function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
|
|
250
|
+
const depict_search = (0, $42858f023ef23dab$export$8e769ad4338a911e).search;
|
|
251
|
+
if (!depict_search) throw Error("No depict_search instance when rendering SearchPage. Did you forget to wrap your app in DepictProvider?");
|
|
252
|
+
const search_query_updating_blocked_signal = (0, $TZSbU$get_search_query_updating_blocked_signal)(depict_search);
|
|
253
|
+
if (!search_query_updating_blocked_signal) throw Error("No search_query_updating_blocked_signal when rendering SearchPage");
|
|
254
|
+
const [, set_search_query_updating_blocked_signal] = search_query_updating_blocked_signal;
|
|
255
|
+
const update_updating_blocked_signal = ()=>{
|
|
256
|
+
set_search_query_updating_blocked_signal(!(0, $c83ba9ab79386687$export$775e6b3892b5ad52)(location));
|
|
257
|
+
};
|
|
258
|
+
// react is really slow with disposing components, we want to avoid a flash of another search query when you click on a product and navigate away
|
|
259
|
+
(0, $c83ba9ab79386687$export$74f3924c5027fe1d)(update_updating_blocked_signal); // if we navigate, re-check
|
|
260
|
+
(0, $TZSbU$createComputed)(()=>{
|
|
261
|
+
(0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_path_[0](); // if react defined path changes, re-check
|
|
262
|
+
update_updating_blocked_signal();
|
|
263
|
+
});
|
|
264
|
+
const component_portals = new Set();
|
|
265
|
+
return (0, $TZSbU$SearchPage)({
|
|
266
|
+
// Default config goes here
|
|
267
|
+
include_input_field: props.includeInputField ?? true,
|
|
268
|
+
cols_at_size: props.columnsAtSize ?? [
|
|
269
|
+
[
|
|
270
|
+
4
|
|
271
|
+
],
|
|
272
|
+
[
|
|
273
|
+
3,
|
|
274
|
+
1024
|
|
275
|
+
],
|
|
276
|
+
[
|
|
277
|
+
2,
|
|
278
|
+
901
|
|
279
|
+
]
|
|
280
|
+
],
|
|
281
|
+
grid_spacing: props.gridSpacing ?? "2%",
|
|
282
|
+
// Todo: Do we need this?
|
|
283
|
+
get_product_id: ()=>"",
|
|
284
|
+
depict_search: depict_search,
|
|
285
|
+
product_card_template: (display, info)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
|
|
286
|
+
display: display,
|
|
287
|
+
info: info,
|
|
288
|
+
react_template: props.productCard,
|
|
289
|
+
component_portals: component_portals,
|
|
290
|
+
set_portals: set_portals
|
|
291
|
+
})
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
let $48d7f568740a317d$var$render_cb;
|
|
301
|
+
function $48d7f568740a317d$export$d87c61cecb2edf0d(props) {
|
|
302
|
+
return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($48d7f568740a317d$var$SolidCategoryPage), props, "div", {}, (props)=>$48d7f568740a317d$var$render_cb?.(props));
|
|
303
|
+
}
|
|
304
|
+
function $48d7f568740a317d$var$SolidCategoryPage(props, set_portals) {
|
|
305
|
+
const depict_category = (0, $42858f023ef23dab$export$8e769ad4338a911e).category;
|
|
306
|
+
if (!depict_category) throw Error("No depict_category instance when rendering SearchPage. Did you forget to wrap your app in DepictProvider?");
|
|
307
|
+
const [category_state_set, set_category_state_set] = (0, $TZSbU$createSignal)(false);
|
|
308
|
+
$48d7f568740a317d$var$render_cb = (props)=>{
|
|
309
|
+
depict_category.category_id = props.categoryId;
|
|
310
|
+
(0, $42858f023ef23dab$export$8e769ad4338a911e).category_path = location.pathname;
|
|
311
|
+
if (props.categoryId) set_category_state_set(true);
|
|
312
|
+
};
|
|
313
|
+
$48d7f568740a317d$var$render_cb(props);
|
|
314
|
+
const component_portals = new Set();
|
|
315
|
+
const category = ()=>(0, $TZSbU$CategoryPage)({
|
|
316
|
+
depict_category: depict_category,
|
|
317
|
+
cols_at_size: props.columnsAtSize ?? [
|
|
318
|
+
[
|
|
319
|
+
4
|
|
320
|
+
],
|
|
321
|
+
[
|
|
322
|
+
3,
|
|
323
|
+
1024
|
|
324
|
+
],
|
|
325
|
+
[
|
|
326
|
+
2,
|
|
327
|
+
901
|
|
328
|
+
]
|
|
329
|
+
],
|
|
330
|
+
grid_spacing: props.gridSpacing ?? "2%",
|
|
331
|
+
get_product_id: ()=>"",
|
|
332
|
+
category_title: props.categoryTitlePlugin || (0, $43099132aad1ceb6$re_export$CategoryTitle),
|
|
333
|
+
show_breadcrumbs: props.showBreadcrumbs === undefined ? true : props.showBreadcrumbs,
|
|
334
|
+
show_quicklinks: props.showQuicklinks === undefined ? true : props.showQuicklinks,
|
|
335
|
+
product_card_template: (display, info)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
|
|
336
|
+
display: display,
|
|
337
|
+
info: info,
|
|
338
|
+
react_template: props.productCard,
|
|
339
|
+
component_portals: component_portals,
|
|
340
|
+
set_portals: set_portals
|
|
341
|
+
})
|
|
342
|
+
});
|
|
343
|
+
return (0, $c83ba9ab79386687$export$e5139bbbb9a05035)(category, category_state_set);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
function $f866f7ed9f751af4$export$5646050d516e06bc() {
|
|
351
|
+
return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($f866f7ed9f751af4$var$vanilla_breadcrumbs), {});
|
|
352
|
+
}
|
|
353
|
+
function $f866f7ed9f751af4$var$vanilla_breadcrumbs() {
|
|
354
|
+
const depict_category = (0, $42858f023ef23dab$export$8e769ad4338a911e).category;
|
|
355
|
+
if (!depict_category) throw Error("No depict_category instance when rendering BreadCrumbs. Did you forget to wrap your app in DepictProvider?");
|
|
356
|
+
return (0, $TZSbU$BreadCrumbs)({
|
|
357
|
+
depict_category: depict_category
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
function $b68a14248b7ef667$export$466cdc317043f6cb() {
|
|
366
|
+
return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($b68a14248b7ef667$var$vanilla_quick_links), {});
|
|
367
|
+
}
|
|
368
|
+
function $b68a14248b7ef667$var$vanilla_quick_links() {
|
|
369
|
+
const depict_category = (0, $42858f023ef23dab$export$8e769ad4338a911e).category;
|
|
370
|
+
if (!depict_category) throw Error("No depict_category instance when rendering QuickLinks. Did you forget to wrap your app in DepictProvider?");
|
|
371
|
+
return (0, $TZSbU$QuickLinks)({
|
|
372
|
+
depict_category: depict_category
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
const $f446a84f85ba06f6$export$3f37af283f8fb843 = ({ aspectRatio: aspectRatio })=>{
|
|
380
|
+
return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)(()=>(0, $TZSbU$ContainedPlaceholderImage)({
|
|
381
|
+
aspect_ratio: aspectRatio
|
|
382
|
+
}), {}, "div", {
|
|
383
|
+
"height": "100%"
|
|
384
|
+
});
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
const $cbd250061abf11cb$export$89c6019e4baa40b1 = ({ width: width , height: height })=>{
|
|
391
|
+
return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)(()=>(0, $TZSbU$Placeholder)({
|
|
392
|
+
width: width,
|
|
393
|
+
height: height
|
|
394
|
+
}), {}, "div", {
|
|
395
|
+
"height": "100%"
|
|
396
|
+
});
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
const $5e26376d86621891$export$d69d8daa20eae175 = (createOpenModalParams)=>{
|
|
407
|
+
const { globalState: globalState , location: location , alignerRef: alignerRef } = createOpenModalParams;
|
|
408
|
+
const openModal = ()=>{
|
|
409
|
+
const headerAligner = alignerRef?.current;
|
|
410
|
+
if (!globalState.search) throw new Error("No active search in the app!");
|
|
411
|
+
if (!headerAligner && location === "aligned") throw new Error("No active search header aligner on the page!");
|
|
412
|
+
const alignment_height = headerAligner?.clientHeight;
|
|
413
|
+
if (location !== "aligned" || isNaN(alignment_height)) {
|
|
414
|
+
// Open centered modal
|
|
415
|
+
globalState.search.modal_open = true;
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
const style_element = document.createElement("style");
|
|
419
|
+
document.head.append(style_element);
|
|
420
|
+
const resize_observer = new ResizeObserver((0, $TZSbU$catchify)(()=>{
|
|
421
|
+
const styles = (0, $TZSbU$styles_to_valid_css_string)({
|
|
422
|
+
".depict.plp .depict-search-modal .query-input": {
|
|
423
|
+
"height": `${headerAligner?.clientHeight}px`
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
style_element.replaceChildren(styles);
|
|
427
|
+
}));
|
|
428
|
+
resize_observer.observe(headerAligner);
|
|
429
|
+
let dispose_aligner;
|
|
430
|
+
/**
|
|
431
|
+
* Setting position to fixed is important to make the modal work with align_field.
|
|
432
|
+
*/ const style_props_ = (0, $TZSbU$createSignal)({
|
|
433
|
+
position: "fixed"
|
|
434
|
+
});
|
|
435
|
+
(0, $TZSbU$createRoot)((dispose)=>{
|
|
436
|
+
dispose_aligner = ()=>{
|
|
437
|
+
resize_observer.disconnect();
|
|
438
|
+
style_element.remove();
|
|
439
|
+
dispose();
|
|
440
|
+
};
|
|
441
|
+
(0, $TZSbU$align_field)(style_props_, headerAligner, undefined, false, "top");
|
|
442
|
+
});
|
|
443
|
+
globalState.search.modal_open = [
|
|
444
|
+
{
|
|
445
|
+
style_props_: style_props_
|
|
446
|
+
},
|
|
447
|
+
dispose_aligner
|
|
448
|
+
];
|
|
449
|
+
};
|
|
450
|
+
return openModal;
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
function $cfa72c75e6cf6901$export$cc1e9aaf280afdcb(params) {
|
|
455
|
+
const open = (0, $5e26376d86621891$export$d69d8daa20eae175)({
|
|
456
|
+
globalState: $42858f023ef23dab$export$8e769ad4338a911e,
|
|
457
|
+
...params
|
|
458
|
+
});
|
|
459
|
+
return {
|
|
460
|
+
open: open
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.59";
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
const $a92aa2beb560b8af$export$804fac5697cfbe35 = (router)=>(href)=>{
|
|
474
|
+
const shallow = (0, $c83ba9ab79386687$export$92a8f8b3c630fa0d)(location);
|
|
475
|
+
router.push(href, undefined, {
|
|
476
|
+
shallow: shallow,
|
|
477
|
+
scroll: true
|
|
478
|
+
});
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Helper function that creates a function that can be used as the
|
|
484
|
+
* navigateFunction callback for DepictProvider when using react-router.
|
|
485
|
+
*
|
|
486
|
+
* React-router expect relative URLs, so this function will strip the
|
|
487
|
+
* protocol, hostname and port from the URL.
|
|
488
|
+
*
|
|
489
|
+
* @param navigateFunction what useNavigate() returns
|
|
490
|
+
* @returns a function that can be used as the navigateFunction callback for DepictProvider
|
|
491
|
+
*/ const $01e1970add53d62a$export$d53481656a62aebe = (navigateFunction)=>(href)=>{
|
|
492
|
+
const url_object = new URL(href);
|
|
493
|
+
return navigateFunction(url_object.pathname + url_object.search + url_object.hash);
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
const $97603d19204ec48d$export$b8a61e5c71402559 = {
|
|
498
|
+
nextRouterNavigation: $a92aa2beb560b8af$export$804fac5697cfbe35,
|
|
499
|
+
reactRouterNavigation: $01e1970add53d62a$export$d53481656a62aebe
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
const $43099132aad1ceb6$var$package_name = "@depict-ai/react-ui";
|
|
504
|
+
(0, $TZSbU$dlog)($43099132aad1ceb6$var$package_name + " version", (0, $c9c4d066f9a5b51b$export$83d89fbfd8236492));
|
|
505
|
+
(0, $TZSbU$add_to_version_info)({
|
|
506
|
+
[$43099132aad1ceb6$var$package_name]: (0, $c9c4d066f9a5b51b$export$83d89fbfd8236492)
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
export {$b68a14248b7ef667$export$466cdc317043f6cb as QuickLinks, $f866f7ed9f751af4$export$5646050d516e06bc as BreadCrumbs, $4db0e2f013fc5124$export$3f4580d6398c5027 as DepictAligner, $5376eb2a386cd90d$export$9fac37a9c21c2f3b as DepictProvider, $48d7f568740a317d$export$d87c61cecb2edf0d as DepictCategoryPage, $4a678f0c87b12e78$export$210723f5a54a7028 as DepictSearchPage, $02e2452814b6e7d6$export$4c0fa313cf50c4ad as DepictSearchField, $f446a84f85ba06f6$export$3f37af283f8fb843 as ImagePlaceholder, $cbd250061abf11cb$export$89c6019e4baa40b1 as TextPlaceholder, $cfa72c75e6cf6901$export$cc1e9aaf280afdcb as useDepictSearchModal, $43099132aad1ceb6$re_export$CategoryTitle as CategoryTitle, $43099132aad1ceb6$re_export$EmbeddedNumProducts as EmbeddedNumProducts, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version, $97603d19204ec48d$export$b8a61e5c71402559 as Navigation};
|