@depict-ai/react-ui 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +144 -118
- package/dist/module.js +141 -115
- package/dist/styles/components/PLP/Buttons.scss +124 -0
- package/dist/styles/components/PLP/MorphingSign.scss +31 -0
- package/dist/styles/components/PLP/PLPResults.scss +20 -0
- package/dist/styles/components/PLP/ProductListingPage.scss +142 -0
- package/dist/styles/components/PLP/ScrollStatus.scss +24 -0
- package/dist/styles/components/PLP/SelectedFilters.scss +74 -0
- package/dist/styles/components/PLP/SlidableItems.scss +99 -0
- package/dist/styles/components/PLP/SortAndFilter/FloatingButtons.scss +75 -0
- package/dist/styles/components/PLP/SortAndFilter/SortAndFilter.scss +728 -0
- package/dist/styles/components/PLP/SortAndFilter/SortAndFilterModal.scss +160 -0
- package/dist/styles/components/PLP/SortAndFilter/WhiteSortAndFilter.scss +148 -0
- package/dist/styles/components/PLP/Toast.scss +54 -0
- package/dist/styles/components/PLP/index.scss +45 -0
- package/dist/styles/components/category/BreadCrumbs.scss +23 -0
- package/dist/styles/components/category/CategoryTitle.scss +28 -0
- package/dist/styles/components/category/QuickLinks.scss +71 -0
- package/dist/styles/components/category/index.scss +23 -0
- package/dist/styles/components/search/Autocomplete.scss +117 -0
- package/dist/styles/components/search/CategorySuggestions.scss +74 -0
- package/dist/styles/components/search/InstantCard.scss +94 -0
- package/dist/styles/components/search/InstantResults.scss +10 -0
- package/dist/styles/components/search/PreviousSearches.scss +77 -0
- package/dist/styles/components/search/QueryInput.scss +167 -0
- package/dist/styles/components/search/SearchModal.scss +90 -0
- package/dist/styles/components/search/SearchRecommendations.scss +25 -0
- package/dist/styles/components/search/ShowingResultsFor.scss +10 -0
- package/dist/styles/components/search/index.scss +40 -0
- package/dist/styles/default.css +1 -0
- package/dist/styles/helpers/custom_input.scss +162 -0
- package/dist/styles/helpers/supports-hover.scss +5 -0
- package/dist/styles/helpers/utils.scss +82 -0
- package/dist/styles/variables.scss +10 -0
- package/dist-server/main.js +13 -13
- package/dist-server/module.js +10 -10
- package/package.json +10 -10
- package/dist/styling/default.css +0 -1
package/dist/main.js
CHANGED
|
@@ -1,90 +1,103 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
5
|
-
var $
|
|
6
|
-
var $
|
|
7
|
-
var $
|
|
1
|
+
var $1pn1h$reactdom = require("react-dom");
|
|
2
|
+
var $1pn1h$depictaireactsolidbridge = require("@depict-ai/react-solid-bridge");
|
|
3
|
+
var $1pn1h$react = require("react");
|
|
4
|
+
var $1pn1h$depictaiui = require("@depict-ai/ui");
|
|
5
|
+
var $1pn1h$reactjsxruntime = require("react/jsx-runtime");
|
|
6
|
+
var $1pn1h$solidjs = require("solid-js");
|
|
7
|
+
var $1pn1h$depictaiutilishared = require("@depict-ai/utilishared");
|
|
8
8
|
|
|
9
9
|
function $parcel$export(e, n, v, s) {
|
|
10
10
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
$parcel$export(module.exports, "DepictSearchPage", () => $
|
|
14
|
-
$parcel$export(module.exports, "DepictProvider", () => $
|
|
15
|
-
$parcel$export(module.exports, "openModal", () => $
|
|
16
|
-
$parcel$export(module.exports, "DepictSearchHeader", () => $
|
|
13
|
+
$parcel$export(module.exports, "DepictSearchPage", () => $7c7f5a6b750dca70$export$210723f5a54a7028);
|
|
14
|
+
$parcel$export(module.exports, "DepictProvider", () => $18b830ef84ac138a$export$9fac37a9c21c2f3b);
|
|
15
|
+
$parcel$export(module.exports, "openModal", () => $20bf907adee775ba$export$a7f6cffb6b8ba11c);
|
|
16
|
+
$parcel$export(module.exports, "DepictSearchHeader", () => $20bf907adee775ba$export$cbcd1ecdb41b1d0a);
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
const $e589c49931886c97$export$8e769ad4338a911e = {
|
|
23
|
+
search: null,
|
|
24
|
+
header_alignment: null
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
22
29
|
|
|
23
|
-
|
|
24
|
-
function $
|
|
25
|
-
|
|
26
|
-
$
|
|
30
|
+
|
|
31
|
+
function $b4d0d98857ed9934$export$5cae361ad82dce8b(value) {
|
|
32
|
+
const ref = (0, $1pn1h$react.useRef)();
|
|
33
|
+
(0, $1pn1h$react.useEffect)(()=>{
|
|
34
|
+
ref.current = value;
|
|
35
|
+
}, [
|
|
36
|
+
value
|
|
37
|
+
]);
|
|
38
|
+
return ref.current;
|
|
39
|
+
}
|
|
40
|
+
let $b4d0d98857ed9934$var$run_on_href_change;
|
|
41
|
+
function $b4d0d98857ed9934$export$74f3924c5027fe1d(cb) {
|
|
42
|
+
$b4d0d98857ed9934$var$run_on_href_change = cb;
|
|
43
|
+
}
|
|
44
|
+
(async ()=>{
|
|
45
|
+
for await (const href of (0, $1pn1h$depictaiutilishared.href_change_ipns))$b4d0d98857ed9934$var$run_on_href_change?.(href);
|
|
46
|
+
})();
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
let $80a9072c96ebf849$var$set = false;
|
|
53
|
+
function $80a9072c96ebf849$export$6453cbc34515a94d(is_search_page) {
|
|
54
|
+
if ($80a9072c96ebf849$var$set) return; // Just being safe
|
|
55
|
+
$80a9072c96ebf849$var$set = true;
|
|
27
56
|
let should_use_old_scroll = false;
|
|
28
57
|
const old_scrollTo = window.scrollTo;
|
|
29
58
|
window.scrollTo = (...args)=>{
|
|
30
|
-
|
|
31
|
-
if (should_use_old_scroll || is_next_scrolling_enabled) return Reflect.apply(old_scrollTo, window, args);
|
|
59
|
+
if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !is_search_page(location)) return Reflect.apply(old_scrollTo, window, args);
|
|
32
60
|
else should_use_old_scroll = true;
|
|
33
61
|
};
|
|
34
|
-
addEventListener("popstate", ()=>{
|
|
62
|
+
addEventListener("popstate", (e)=>{
|
|
63
|
+
if (!is_search_page(location)) {
|
|
64
|
+
$80a9072c96ebf849$var$removeLotsOfPadding(); // Just making sure
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
35
67
|
should_use_old_scroll = false;
|
|
36
|
-
$
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
68
|
+
$80a9072c96ebf849$var$addLotsOfPadding();
|
|
69
|
+
(0, $1pn1h$depictaiutilishared.observer).wait_for_element(".depict.plp .listing-page").then(()=>{
|
|
70
|
+
$80a9072c96ebf849$var$removeLotsOfPadding();
|
|
71
|
+
});
|
|
40
72
|
});
|
|
41
|
-
(0, $
|
|
42
|
-
(0, $
|
|
43
|
-
$
|
|
73
|
+
(0, $1pn1h$depictaiutilishared.history_replacer)(()=>{
|
|
74
|
+
(0, $1pn1h$depictaiutilishared.queueMacroTask)(()=>{
|
|
75
|
+
$80a9072c96ebf849$var$removeLotsOfPadding();
|
|
44
76
|
});
|
|
45
77
|
}, false);
|
|
46
78
|
window?.next?.router?.events?.on("routeChangeStart", ()=>{
|
|
47
|
-
$
|
|
79
|
+
$80a9072c96ebf849$var$addLotsOfPadding();
|
|
48
80
|
});
|
|
49
81
|
}
|
|
50
|
-
function $
|
|
82
|
+
function $80a9072c96ebf849$var$addLotsOfPadding() {
|
|
51
83
|
document.body.style.paddingBottom = (history.state?.search_scroll_restoration_data?.[0]?.min_results_loaded || 150) * 500 + "px";
|
|
52
84
|
}
|
|
53
|
-
function $
|
|
85
|
+
function $80a9072c96ebf849$var$removeLotsOfPadding() {
|
|
54
86
|
document.body.style.paddingBottom = "";
|
|
55
87
|
}
|
|
56
88
|
|
|
57
89
|
|
|
58
|
-
const $
|
|
59
|
-
search: null,
|
|
60
|
-
header_alignment: null
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
function $c23231ddd12eea0a$export$5cae361ad82dce8b(value) {
|
|
67
|
-
const ref = (0, $lgFzj$react.useRef)();
|
|
68
|
-
(0, $lgFzj$react.useEffect)(()=>{
|
|
69
|
-
ref.current = value;
|
|
70
|
-
}, [
|
|
71
|
-
value
|
|
72
|
-
]);
|
|
73
|
-
return ref.current;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const $ed09819de7bb86d1$export$99ae278b8f3607a0 = (opts)=>{
|
|
90
|
+
const $7b6eabbde6829606$export$99ae278b8f3607a0 = (opts)=>{
|
|
79
91
|
const path = "/search";
|
|
80
92
|
const param = "q";
|
|
81
93
|
const is_page_ = (url)=>url.pathname == path;
|
|
82
|
-
const search = new (0, $
|
|
94
|
+
const search = new (0, $1pn1h$depictaiui.DepictSearch)({
|
|
83
95
|
search_query_url_param_name: param,
|
|
84
96
|
merchant: opts.merchant,
|
|
85
97
|
market: opts.market,
|
|
98
|
+
enable_category_suggestions: false,
|
|
86
99
|
localization: {
|
|
87
|
-
...(0, $
|
|
100
|
+
...(0, $1pn1h$depictaiui.swedish_search_translation),
|
|
88
101
|
price_formatting_: {
|
|
89
102
|
pre_: "€ ",
|
|
90
103
|
post_: "",
|
|
@@ -95,7 +108,6 @@ const $ed09819de7bb86d1$export$99ae278b8f3607a0 = (opts)=>{
|
|
|
95
108
|
},
|
|
96
109
|
on_navigation: (new_href)=>{
|
|
97
110
|
const shallow = is_page_(location);
|
|
98
|
-
debugger;
|
|
99
111
|
window.next.router.push(new_href, undefined, {
|
|
100
112
|
shallow: shallow,
|
|
101
113
|
scroll: true
|
|
@@ -105,25 +117,19 @@ const $ed09819de7bb86d1$export$99ae278b8f3607a0 = (opts)=>{
|
|
|
105
117
|
url.pathname = path;
|
|
106
118
|
}
|
|
107
119
|
});
|
|
120
|
+
(0, $80a9072c96ebf849$export$6453cbc34515a94d)(is_page_);
|
|
108
121
|
return search;
|
|
109
122
|
};
|
|
110
123
|
|
|
111
124
|
|
|
112
|
-
function $
|
|
113
|
-
const { children: children ,
|
|
114
|
-
const
|
|
115
|
-
if (!
|
|
116
|
-
(0, $
|
|
117
|
-
|
|
118
|
-
market: market
|
|
125
|
+
function $18b830ef84ac138a$export$9fac37a9c21c2f3b(props) {
|
|
126
|
+
const { children: children , search_page_path: search_page_path , ...assignable_options } = props;
|
|
127
|
+
const { search: search } = (0, $e589c49931886c97$export$8e769ad4338a911e);
|
|
128
|
+
if (!search) // Todo: use search_page_path for navigation
|
|
129
|
+
(0, $e589c49931886c97$export$8e769ad4338a911e).search = (0, $7b6eabbde6829606$export$99ae278b8f3607a0)({
|
|
130
|
+
...assignable_options
|
|
119
131
|
});
|
|
120
|
-
else
|
|
121
|
-
const { prev_merchant: prev_merchant , prev_market: prev_market , search_page_path: search_page_path1 } = previous_props;
|
|
122
|
-
// Todo: here we can check if our search config changed and react to it.
|
|
123
|
-
// Do we need to know if it changed specifically, or could we just always set the values regardless if they changed or not?
|
|
124
|
-
// Should changing merchant log an error? Is it ever not a bug?
|
|
125
|
-
}
|
|
126
|
-
console.log("DepictProvider render", props, previous_props);
|
|
132
|
+
else Object.assign(search, assignable_options);
|
|
127
133
|
return children;
|
|
128
134
|
}
|
|
129
135
|
|
|
@@ -134,39 +140,39 @@ function $36997bef3cf034d6$export$9fac37a9c21c2f3b(props) {
|
|
|
134
140
|
|
|
135
141
|
|
|
136
142
|
|
|
137
|
-
function $
|
|
138
|
-
return (0, $
|
|
143
|
+
function $20bf907adee775ba$export$cbcd1ecdb41b1d0a() {
|
|
144
|
+
return (0, $1pn1h$react.createElement)("div", {
|
|
139
145
|
className: "depict aligner",
|
|
140
|
-
ref: (e)=>(0, $
|
|
146
|
+
ref: (e)=>(0, $e589c49931886c97$export$8e769ad4338a911e).header_alignment = e
|
|
141
147
|
});
|
|
142
148
|
}
|
|
143
|
-
let $
|
|
144
|
-
function $
|
|
145
|
-
if (!(0, $
|
|
149
|
+
let $20bf907adee775ba$var$sheet;
|
|
150
|
+
function $20bf907adee775ba$export$a7f6cffb6b8ba11c() {
|
|
151
|
+
if (!(0, $e589c49931886c97$export$8e769ad4338a911e).search) {
|
|
146
152
|
console.error("No active search in the app!");
|
|
147
153
|
return;
|
|
148
154
|
}
|
|
149
|
-
if (!(0, $
|
|
155
|
+
if (!(0, $e589c49931886c97$export$8e769ad4338a911e).header_alignment) {
|
|
150
156
|
console.error("No active search header aligner on the page!");
|
|
151
157
|
return;
|
|
152
158
|
}
|
|
153
|
-
const style_props_ = (0, $
|
|
159
|
+
const style_props_ = (0, $1pn1h$solidjs.createSignal)({
|
|
154
160
|
position: "fixed",
|
|
155
161
|
top: 0
|
|
156
162
|
});
|
|
157
|
-
if ((0, $
|
|
158
|
-
let styles = `.depict.plp.in_header .depict-search-modal .query_input { height: ${(0, $
|
|
159
|
-
styles += `.depict.plp.in_header .depict-search-modal-backdrop { top: ${(0, $
|
|
160
|
-
if (!$
|
|
163
|
+
if ((0, $e589c49931886c97$export$8e769ad4338a911e).header_alignment?.clientHeight) {
|
|
164
|
+
let styles = `.depict.plp.in_header .depict-search-modal .query_input { height: ${(0, $e589c49931886c97$export$8e769ad4338a911e).header_alignment?.clientHeight}px; }`;
|
|
165
|
+
styles += `.depict.plp.in_header .depict-search-modal-backdrop { top: ${(0, $e589c49931886c97$export$8e769ad4338a911e).header_alignment?.clientHeight}px; }`;
|
|
166
|
+
if (!$20bf907adee775ba$var$sheet) {
|
|
161
167
|
const style = document.createElement("style");
|
|
162
168
|
style.append(styles);
|
|
163
169
|
document.head.appendChild(style);
|
|
164
170
|
}
|
|
165
171
|
}
|
|
166
|
-
const class_list_ = (0, $
|
|
172
|
+
const class_list_ = (0, $1pn1h$solidjs.createMemo)(()=>({
|
|
167
173
|
in_header: true
|
|
168
174
|
}));
|
|
169
|
-
(0, $
|
|
175
|
+
(0, $e589c49931886c97$export$8e769ad4338a911e).search.modal_open = [
|
|
170
176
|
{
|
|
171
177
|
style_props_: style_props_,
|
|
172
178
|
class_list_: class_list_
|
|
@@ -175,14 +181,13 @@ function $74e00cdf1575ca1b$export$a7f6cffb6b8ba11c() {
|
|
|
175
181
|
}
|
|
176
182
|
|
|
177
183
|
|
|
178
|
-
let $
|
|
179
|
-
function $
|
|
180
|
-
(0, $
|
|
181
|
-
const [
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
$6abe21f0d440de7c$var$active_render_card = async (display)=>{
|
|
184
|
+
let $7c7f5a6b750dca70$var$active_render_card;
|
|
185
|
+
function $7c7f5a6b750dca70$var$DepictSearchPageContent(opts) {
|
|
186
|
+
const [bridge, setBridge] = (0, $1pn1h$react.useState)(null);
|
|
187
|
+
const [portals, set_portals] = (0, $1pn1h$react.useState)([]);
|
|
188
|
+
(0, $1pn1h$react.useEffect)(()=>{
|
|
189
|
+
const component_portals = new Set((0, $1pn1h$react.ReactPortal));
|
|
190
|
+
$7c7f5a6b750dca70$var$active_render_card = async (display)=>{
|
|
186
191
|
const solid_container = document.createElement("div");
|
|
187
192
|
const react_has_rendered = new Promise((r)=>{
|
|
188
193
|
const m_o = new MutationObserver(()=>{
|
|
@@ -193,55 +198,76 @@ function $6abe21f0d440de7c$var$DepictSearchPageContent(opts) {
|
|
|
193
198
|
childList: true
|
|
194
199
|
});
|
|
195
200
|
});
|
|
196
|
-
const reactProductCard = (0, $
|
|
201
|
+
const reactProductCard = (0, $1pn1h$reactjsxruntime.jsx)(opts.productCardFactory, {
|
|
197
202
|
display: display
|
|
198
203
|
});
|
|
199
|
-
const portal = $
|
|
200
|
-
component_portals.
|
|
204
|
+
const portal = $1pn1h$reactdom.createPortal(reactProductCard, solid_container);
|
|
205
|
+
component_portals.add(portal);
|
|
201
206
|
set_portals([
|
|
202
207
|
...component_portals
|
|
203
208
|
]);
|
|
209
|
+
(0, $1pn1h$solidjs.onCleanup)(()=>{
|
|
210
|
+
// 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
|
|
211
|
+
component_portals.delete(portal);
|
|
212
|
+
set_portals([
|
|
213
|
+
...component_portals
|
|
214
|
+
]);
|
|
215
|
+
});
|
|
204
216
|
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
|
|
205
217
|
return [
|
|
206
218
|
solid_container
|
|
207
219
|
];
|
|
208
220
|
};
|
|
209
|
-
if (!(0, $
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
221
|
+
if (!(0, $e589c49931886c97$export$8e769ad4338a911e).search) throw Error("No search when rendering SearchPage??");
|
|
222
|
+
const solidBridge = (0, $1pn1h$reactjsxruntime.jsx)((0, $1pn1h$depictaireactsolidbridge.ReactToSolidBridge), {
|
|
223
|
+
solidComponent: ()=>{
|
|
224
|
+
const [el, dispose] = (0, $1pn1h$solidjs.createRoot)((dispose)=>{
|
|
225
|
+
(0, $b4d0d98857ed9934$export$74f3924c5027fe1d)((href)=>{
|
|
226
|
+
// TODO: Will be user specified
|
|
227
|
+
if (!new URL(href).pathname.startsWith("/search")) dispose();
|
|
228
|
+
});
|
|
229
|
+
const el = (0, $1pn1h$depictaiui.SearchPage)({
|
|
230
|
+
depict_search: (0, $e589c49931886c97$export$8e769ad4338a911e).search,
|
|
231
|
+
include_input_field: true,
|
|
232
|
+
cols_at_size: [
|
|
233
|
+
[
|
|
234
|
+
4
|
|
235
|
+
],
|
|
236
|
+
[
|
|
237
|
+
3,
|
|
238
|
+
1024
|
|
239
|
+
],
|
|
240
|
+
[
|
|
241
|
+
2,
|
|
242
|
+
901
|
|
243
|
+
]
|
|
244
|
+
],
|
|
245
|
+
grid_spacing: "10px",
|
|
246
|
+
product_card_template: (...args)=>$7c7f5a6b750dca70$var$active_render_card(...args),
|
|
247
|
+
// function might not exist yet,
|
|
248
|
+
get_product_id: ()=>""
|
|
249
|
+
});
|
|
250
|
+
return [
|
|
251
|
+
el,
|
|
252
|
+
dispose
|
|
253
|
+
];
|
|
254
|
+
});
|
|
255
|
+
(0, $1pn1h$solidjs.onCleanup)(dispose);
|
|
256
|
+
return el;
|
|
257
|
+
},
|
|
232
258
|
key: Math.random()
|
|
233
259
|
});
|
|
234
260
|
setBridge(solidBridge);
|
|
235
261
|
}, []);
|
|
236
262
|
console.log("Searchpage render", bridge, portals.length);
|
|
237
|
-
return bridge ? (0, $
|
|
263
|
+
return bridge ? (0, $1pn1h$react.createElement)("div", {}, [
|
|
238
264
|
bridge,
|
|
239
265
|
...portals
|
|
240
266
|
]) : "";
|
|
241
267
|
}
|
|
242
|
-
function $
|
|
243
|
-
return (0, $
|
|
244
|
-
children: (0, $
|
|
268
|
+
function $7c7f5a6b750dca70$export$210723f5a54a7028(opts) {
|
|
269
|
+
return (0, $1pn1h$reactjsxruntime.jsx)((0, $1pn1h$depictaireactsolidbridge.ReactToSolidBridgeProvider), {
|
|
270
|
+
children: (0, $1pn1h$reactjsxruntime.jsx)($7c7f5a6b750dca70$var$DepictSearchPageContent, opts)
|
|
245
271
|
});
|
|
246
272
|
}
|
|
247
273
|
|