@depict-ai/react-ui 2.0.4 → 2.0.5

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.
Files changed (48) hide show
  1. package/ES10/index.cjs +1 -1
  2. package/ES10/index.d.ts +1 -1
  3. package/ES10/index.js +1 -1
  4. package/dist/styles/plain-css-fallback-styling.css +1 -1
  5. package/latest/index.cjs +1 -1
  6. package/latest/index.d.ts +1 -1
  7. package/latest/index.js +1 -1
  8. package/package.json +4 -4
  9. package/server/ES10/index.cjs +1 -1
  10. package/server/ES10/index.d.ts +1 -1
  11. package/server/ES10/index.js +1 -1
  12. package/server/latest/index.cjs +1 -1
  13. package/server/latest/index.d.ts +1 -1
  14. package/server/latest/index.js +1 -1
  15. package/dist/main.js +0 -293
  16. package/dist/module.js +0 -285
  17. package/dist/styles/components/PLP/Buttons.scss +0 -124
  18. package/dist/styles/components/PLP/MorphingSign.scss +0 -31
  19. package/dist/styles/components/PLP/PLPResults.scss +0 -20
  20. package/dist/styles/components/PLP/ProductListingPage.scss +0 -142
  21. package/dist/styles/components/PLP/ScrollStatus.scss +0 -24
  22. package/dist/styles/components/PLP/SelectedFilters.scss +0 -74
  23. package/dist/styles/components/PLP/SlidableItems.scss +0 -99
  24. package/dist/styles/components/PLP/SortAndFilter/FloatingButtons.scss +0 -75
  25. package/dist/styles/components/PLP/SortAndFilter/SortAndFilter.scss +0 -728
  26. package/dist/styles/components/PLP/SortAndFilter/SortAndFilterModal.scss +0 -160
  27. package/dist/styles/components/PLP/SortAndFilter/WhiteSortAndFilter.scss +0 -148
  28. package/dist/styles/components/PLP/Toast.scss +0 -54
  29. package/dist/styles/components/PLP/index.scss +0 -45
  30. package/dist/styles/components/category/BreadCrumbs.scss +0 -23
  31. package/dist/styles/components/category/CategoryTitle.scss +0 -28
  32. package/dist/styles/components/category/QuickLinks.scss +0 -71
  33. package/dist/styles/components/category/index.scss +0 -23
  34. package/dist/styles/components/search/Autocomplete.scss +0 -117
  35. package/dist/styles/components/search/CategorySuggestions.scss +0 -74
  36. package/dist/styles/components/search/InstantCard.scss +0 -117
  37. package/dist/styles/components/search/InstantResults.scss +0 -10
  38. package/dist/styles/components/search/PreviousSearches.scss +0 -77
  39. package/dist/styles/components/search/QueryInput.scss +0 -167
  40. package/dist/styles/components/search/SearchModal.scss +0 -95
  41. package/dist/styles/components/search/SearchRecommendations.scss +0 -25
  42. package/dist/styles/components/search/ShowingResultsFor.scss +0 -10
  43. package/dist/styles/components/search/index.scss +0 -40
  44. package/dist/styles/default.css +0 -1
  45. package/dist/styles/helpers/custom_input.scss +0 -162
  46. package/dist/styles/helpers/supports-hover.scss +0 -5
  47. package/dist/styles/helpers/utils.scss +0 -82
  48. package/dist/styles/variables.scss +0 -47
package/dist/main.js DELETED
@@ -1,293 +0,0 @@
1
- var $4GYXz$depictaiui = require("@depict-ai/ui");
2
- var $4GYXz$depictaiutilishared = require("@depict-ai/utilishared");
3
- var $4GYXz$solidjs = require("solid-js");
4
- var $4GYXz$solidjsweb = require("solid-js/web");
5
- var $4GYXz$react = require("react");
6
- var $4GYXz$reactjsxruntime = require("react/jsx-runtime");
7
- var $4GYXz$reactdom = require("react-dom");
8
-
9
- function $parcel$export(e, n, v, s) {
10
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
11
- }
12
-
13
- $parcel$export(module.exports, "DepictSearchField", () => $a48f3b1a4abf2e0c$export$d2c02478244f91f7);
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
- $parcel$export(module.exports, "DepictSearchPage", () => $a6bedbe4b4d6d027$export$210723f5a54a7028);
18
- // This is where the actual source of your React stuff should live
19
- // Note, if you add an export here, also add one in src-server/main.ts
20
-
21
-
22
- const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
23
- search: null,
24
- header_alignment: null,
25
- search_page_path_: (0, $4GYXz$solidjs.createSignal)(),
26
- required_state_set_: (0, $4GYXz$solidjs.createSignal)(false)
27
- };
28
-
29
-
30
-
31
-
32
-
33
-
34
- let $b4d0d98857ed9934$var$run_on_href_change;
35
- function $b4d0d98857ed9934$export$74f3924c5027fe1d(cb) {
36
- $b4d0d98857ed9934$var$run_on_href_change = cb;
37
- }
38
- (async ()=>{
39
- for await (const href of (0, $4GYXz$depictaiutilishared.href_change_ipns))$b4d0d98857ed9934$var$run_on_href_change?.(href);
40
- })();
41
- const $b4d0d98857ed9934$export$6cb4d3a5c1ac9b43 = (url)=>url.pathname == (0, $4GYXz$solidjs.untrack)((0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_[0]); // might have changed therefore get it from globalState
42
- function $b4d0d98857ed9934$export$f6e64e17bd69eeef(solid_component, props) {
43
- const [portals, set_portals] = (0, $4GYXz$react.useState)([]);
44
- const element_ref = (0, $4GYXz$react.useRef)();
45
- (0, $4GYXz$react.useEffect)(()=>{
46
- const div_element = element_ref.current;
47
- const dispose = (0, $4GYXz$solidjsweb.render)(()=>solid_component(props, set_portals), div_element);
48
- return dispose;
49
- }, []);
50
- return (0, $4GYXz$reactjsxruntime.jsx)("div", {
51
- ref: element_ref,
52
- children: portals
53
- });
54
- }
55
- function $b4d0d98857ed9934$export$e5139bbbb9a05035(component) {
56
- return (...args)=>{
57
- return (0, $4GYXz$solidjs.createComponent)((0, $4GYXz$solidjs.Show), {
58
- get when () {
59
- return (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).required_state_set_[0]();
60
- },
61
- get children () {
62
- return component(...args);
63
- }
64
- });
65
- };
66
- }
67
-
68
-
69
-
70
-
71
- function $a48f3b1a4abf2e0c$export$d2c02478244f91f7() {
72
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)((0, $b4d0d98857ed9934$export$e5139bbbb9a05035)(()=>(0, $4GYXz$depictaiui.SearchField)({
73
- depict_search: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search
74
- })), {});
75
- }
76
-
77
-
78
-
79
-
80
-
81
- let $6319748b4f0426f0$var$set = false;
82
- function $6319748b4f0426f0$export$6453cbc34515a94d(is_search_page) {
83
- if ($6319748b4f0426f0$var$set) return; // Just being safe
84
- $6319748b4f0426f0$var$set = true;
85
- let should_use_old_scroll = false;
86
- const old_scrollTo = window.scrollTo;
87
- window.scrollTo = (...args)=>{
88
- if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !is_search_page(location)) return Reflect.apply(old_scrollTo, window, args);
89
- else should_use_old_scroll = true;
90
- };
91
- addEventListener("popstate", (e)=>{
92
- if (!is_search_page(location)) {
93
- $6319748b4f0426f0$var$removeLotsOfPadding(); // Just making sure
94
- return;
95
- }
96
- should_use_old_scroll = false;
97
- $6319748b4f0426f0$var$addLotsOfPadding();
98
- (0, $4GYXz$depictaiutilishared.observer).wait_for_element(".depict.plp .listing-page").then(()=>{
99
- $6319748b4f0426f0$var$removeLotsOfPadding();
100
- });
101
- });
102
- (0, $4GYXz$depictaiutilishared.history_replacer)(()=>{
103
- (0, $4GYXz$depictaiutilishared.queueMacroTask)(()=>{
104
- $6319748b4f0426f0$var$removeLotsOfPadding();
105
- });
106
- }, false);
107
- window?.next?.router?.events?.on("routeChangeStart", ()=>{
108
- $6319748b4f0426f0$var$addLotsOfPadding();
109
- });
110
- }
111
- // TODO: Make these animations so they don't collide with whatever padding is already on the body
112
- function $6319748b4f0426f0$var$addLotsOfPadding() {
113
- document.body.style.paddingBottom = (history.state?.search_scroll_restoration_data?.[0]?.min_results_loaded || 150) * 500 + "px";
114
- }
115
- function $6319748b4f0426f0$var$removeLotsOfPadding() {
116
- document.body.style.paddingBottom = "";
117
- }
118
-
119
-
120
-
121
-
122
-
123
- function $18b830ef84ac138a$export$9fac37a9c21c2f3b(props) {
124
- if (!props.market || !props.merchant) {
125
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).required_state_set_[1](false);
126
- return (0, $4GYXz$react.createElement)((0, $4GYXz$react.Fragment), null, props.children);
127
- }
128
- const { children: children , search_page_path: search_page_path , url_param_name: url_param_name , ...assignable_options } = props;
129
- const { search: search } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
130
- const [get_search_page_path, set_search_page_path] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_;
131
- set_search_page_path(search_page_path);
132
- if (!search) {
133
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search = new (0, $4GYXz$depictaiui.DepictSearch)({
134
- search_query_url_param_name: url_param_name,
135
- ...assignable_options,
136
- enable_category_suggestions: false,
137
- localization: {
138
- ...(0, $4GYXz$depictaiui.swedish_search_translation),
139
- price_formatting_: {
140
- pre_: "kr ",
141
- post_: "",
142
- decimal_places_delimiter_: ",",
143
- thousands_delimiter_: " ",
144
- places_after_comma_: 2
145
- }
146
- },
147
- on_navigation: (new_href)=>{
148
- const shallow = (0, $b4d0d98857ed9934$export$6cb4d3a5c1ac9b43)(location);
149
- if (window.next) window.next.router.push(new_href, undefined, {
150
- shallow: shallow,
151
- scroll: true
152
- });
153
- else location.href = new_href;
154
- },
155
- url_transformer: (url)=>url.pathname = (0, $4GYXz$solidjs.untrack)(get_search_page_path)
156
- });
157
- (0, $6319748b4f0426f0$export$6453cbc34515a94d)((0, $b4d0d98857ed9934$export$6cb4d3a5c1ac9b43));
158
- } else Object.assign(search, assignable_options);
159
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).required_state_set_[1](true);
160
- return (0, $4GYXz$react.createElement)((0, $4GYXz$react.Fragment), null, children);
161
- }
162
-
163
-
164
- // PoC maybe-component
165
- // Idea is to always give a nice "modal input in header" look with no more config than adding this component to the page header to where it can absolute-size
166
- // and cover the entire height of the header. Then we know where to put the modal input top and bottom, and the left and right we just center.
167
-
168
-
169
-
170
- function $20bf907adee775ba$export$cbcd1ecdb41b1d0a() {
171
- return (0, $4GYXz$react.createElement)("div", {
172
- className: "depict aligner",
173
- ref: (e)=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).header_alignment = e
174
- });
175
- }
176
- let $20bf907adee775ba$var$sheet;
177
- function $20bf907adee775ba$export$a7f6cffb6b8ba11c() {
178
- if (!(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search) {
179
- console.error("No active search in the app!");
180
- return;
181
- }
182
- if (!(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).header_alignment) {
183
- console.error("No active search header aligner on the page!");
184
- return;
185
- }
186
- const style_props_ = (0, $4GYXz$solidjs.createSignal)({
187
- position: "fixed",
188
- top: 0
189
- });
190
- if ((0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).header_alignment?.clientHeight) {
191
- let styles = `.depict.plp.in-header .depict-search-modal .query-input { height: ${(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).header_alignment?.clientHeight}px; }`;
192
- styles += `.depict.plp.in-header .depict-search-modal-backdrop { top: ${(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).header_alignment?.clientHeight}px; }`;
193
- if (!$20bf907adee775ba$var$sheet) {
194
- const style = document.createElement("style");
195
- style.append(styles);
196
- document.head.appendChild(style);
197
- }
198
- }
199
- const class_list_ = (0, $4GYXz$solidjs.createMemo)(()=>({
200
- "in-header": true
201
- }));
202
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search.modal_open = [
203
- {
204
- style_props_: style_props_,
205
- class_list_: class_list_
206
- }
207
- ];
208
- }
209
-
210
-
211
-
212
-
213
-
214
-
215
-
216
-
217
- function $a6bedbe4b4d6d027$export$210723f5a54a7028(opts) {
218
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)((0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($a6bedbe4b4d6d027$var$SolidSearchPage), opts);
219
- }
220
- function $a6bedbe4b4d6d027$var$SolidSearchPage(props, set_portals) {
221
- const depict_search = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search;
222
- if (!depict_search) throw Error("No depict_search instance when rendering SearchPage.");
223
- const search_query_updating_blocked_signal = (0, $4GYXz$depictaiui.get_search_query_updating_blocked_signal)(depict_search);
224
- if (!search_query_updating_blocked_signal) throw Error("No search_query_updating_blocked_signal when rendering SearchPage");
225
- const [, set_search_query_updating_blocked_signal] = search_query_updating_blocked_signal;
226
- const update_updating_blocked_signal = ()=>{
227
- set_search_query_updating_blocked_signal(!(0, $b4d0d98857ed9934$export$6cb4d3a5c1ac9b43)(location));
228
- };
229
- // 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
230
- (0, $b4d0d98857ed9934$export$74f3924c5027fe1d)(update_updating_blocked_signal); // if we navigate, re-check
231
- (0, $4GYXz$solidjs.createComputed)(()=>{
232
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_[0](); // if react defined path changes, re-check
233
- update_updating_blocked_signal();
234
- });
235
- const component_portals = new Set();
236
- return (0, $4GYXz$depictaiui.SearchPage)({
237
- // Default config goes here
238
- include_input_field: props.includeInputField ?? true,
239
- cols_at_size: props.columnsAtSize ?? [
240
- [
241
- 4
242
- ],
243
- [
244
- 3,
245
- 1024
246
- ],
247
- [
248
- 2,
249
- 901
250
- ]
251
- ],
252
- grid_spacing: props.gridSpacing ?? "2%",
253
- // Todo: Do we need this?
254
- get_product_id: ()=>"",
255
- depict_search: depict_search,
256
- product_card_template: async (display, info)=>{
257
- const solid_container = document.createElement("div");
258
- const react_has_rendered = new Promise((r)=>{
259
- const m_o = new MutationObserver(()=>{
260
- m_o.disconnect();
261
- r();
262
- });
263
- m_o.observe(solid_container, {
264
- childList: true
265
- });
266
- });
267
- const is_placeholder = info.rendering_options.type === "placeholder";
268
- const reactProductCard = (0, $4GYXz$reactjsxruntime.jsx)(props.productCard, {
269
- display: is_placeholder ? null : display
270
- });
271
- const portal = $4GYXz$reactdom.createPortal(reactProductCard, solid_container);
272
- component_portals.add(portal);
273
- set_portals([
274
- ...component_portals
275
- ]);
276
- (0, $4GYXz$solidjs.onCleanup)(()=>{
277
- // 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
278
- component_portals.delete(portal);
279
- set_portals([
280
- ...component_portals
281
- ]);
282
- });
283
- 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
284
- return [
285
- solid_container
286
- ];
287
- }
288
- });
289
- }
290
-
291
-
292
-
293
-
package/dist/module.js DELETED
@@ -1,285 +0,0 @@
1
- import {SearchField as $TZSbU$SearchField, DepictSearch as $TZSbU$DepictSearch, swedish_search_translation as $TZSbU$swedish_search_translation, get_search_query_updating_blocked_signal as $TZSbU$get_search_query_updating_blocked_signal, SearchPage as $TZSbU$SearchPage} from "@depict-ai/ui";
2
- import {href_change_ipns as $TZSbU$href_change_ipns, observer as $TZSbU$observer, history_replacer as $TZSbU$history_replacer, queueMacroTask as $TZSbU$queueMacroTask} from "@depict-ai/utilishared";
3
- import {untrack as $TZSbU$untrack, createComponent as $TZSbU$createComponent, Show as $TZSbU$Show, createSignal as $TZSbU$createSignal, createMemo as $TZSbU$createMemo, createComputed as $TZSbU$createComputed, onCleanup as $TZSbU$onCleanup} 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} from "react";
6
- import {jsx as $TZSbU$jsx} from "react/jsx-runtime";
7
- import {createPortal as $TZSbU$createPortal} from "react-dom";
8
-
9
- // This is where the actual source of your React stuff should live
10
- // Note, if you add an export here, also add one in src-server/main.ts
11
-
12
-
13
- const $42858f023ef23dab$export$8e769ad4338a911e = {
14
- search: null,
15
- header_alignment: null,
16
- search_page_path_: (0, $TZSbU$createSignal)(),
17
- required_state_set_: (0, $TZSbU$createSignal)(false)
18
- };
19
-
20
-
21
-
22
-
23
-
24
-
25
- let $c83ba9ab79386687$var$run_on_href_change;
26
- function $c83ba9ab79386687$export$74f3924c5027fe1d(cb) {
27
- $c83ba9ab79386687$var$run_on_href_change = cb;
28
- }
29
- (async ()=>{
30
- for await (const href of (0, $TZSbU$href_change_ipns))$c83ba9ab79386687$var$run_on_href_change?.(href);
31
- })();
32
- const $c83ba9ab79386687$export$6cb4d3a5c1ac9b43 = (url)=>url.pathname == (0, $TZSbU$untrack)((0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_path_[0]); // might have changed therefore get it from globalState
33
- function $c83ba9ab79386687$export$f6e64e17bd69eeef(solid_component, props) {
34
- const [portals, set_portals] = (0, $TZSbU$useState)([]);
35
- const element_ref = (0, $TZSbU$useRef)();
36
- (0, $TZSbU$useEffect)(()=>{
37
- const div_element = element_ref.current;
38
- const dispose = (0, $TZSbU$render)(()=>solid_component(props, set_portals), div_element);
39
- return dispose;
40
- }, []);
41
- return (0, $TZSbU$jsx)("div", {
42
- ref: element_ref,
43
- children: portals
44
- });
45
- }
46
- function $c83ba9ab79386687$export$e5139bbbb9a05035(component) {
47
- return (...args)=>{
48
- return (0, $TZSbU$createComponent)((0, $TZSbU$Show), {
49
- get when () {
50
- return (0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[0]();
51
- },
52
- get children () {
53
- return component(...args);
54
- }
55
- });
56
- };
57
- }
58
-
59
-
60
-
61
-
62
- function $54b0d21b77e719c4$export$d2c02478244f91f7() {
63
- return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)(()=>(0, $TZSbU$SearchField)({
64
- depict_search: (0, $42858f023ef23dab$export$8e769ad4338a911e).search
65
- })), {});
66
- }
67
-
68
-
69
-
70
-
71
-
72
- let $8071251ee4e9ffa1$var$set = false;
73
- function $8071251ee4e9ffa1$export$6453cbc34515a94d(is_search_page) {
74
- if ($8071251ee4e9ffa1$var$set) return; // Just being safe
75
- $8071251ee4e9ffa1$var$set = true;
76
- let should_use_old_scroll = false;
77
- const old_scrollTo = window.scrollTo;
78
- window.scrollTo = (...args)=>{
79
- if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !is_search_page(location)) return Reflect.apply(old_scrollTo, window, args);
80
- else should_use_old_scroll = true;
81
- };
82
- addEventListener("popstate", (e)=>{
83
- if (!is_search_page(location)) {
84
- $8071251ee4e9ffa1$var$removeLotsOfPadding(); // Just making sure
85
- return;
86
- }
87
- should_use_old_scroll = false;
88
- $8071251ee4e9ffa1$var$addLotsOfPadding();
89
- (0, $TZSbU$observer).wait_for_element(".depict.plp .listing-page").then(()=>{
90
- $8071251ee4e9ffa1$var$removeLotsOfPadding();
91
- });
92
- });
93
- (0, $TZSbU$history_replacer)(()=>{
94
- (0, $TZSbU$queueMacroTask)(()=>{
95
- $8071251ee4e9ffa1$var$removeLotsOfPadding();
96
- });
97
- }, false);
98
- window?.next?.router?.events?.on("routeChangeStart", ()=>{
99
- $8071251ee4e9ffa1$var$addLotsOfPadding();
100
- });
101
- }
102
- // TODO: Make these animations so they don't collide with whatever padding is already on the body
103
- function $8071251ee4e9ffa1$var$addLotsOfPadding() {
104
- document.body.style.paddingBottom = (history.state?.search_scroll_restoration_data?.[0]?.min_results_loaded || 150) * 500 + "px";
105
- }
106
- function $8071251ee4e9ffa1$var$removeLotsOfPadding() {
107
- document.body.style.paddingBottom = "";
108
- }
109
-
110
-
111
-
112
-
113
-
114
- function $faf794495ff8b304$export$9fac37a9c21c2f3b(props) {
115
- if (!props.market || !props.merchant) {
116
- (0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[1](false);
117
- return (0, $TZSbU$createElement)((0, $TZSbU$Fragment), null, props.children);
118
- }
119
- const { children: children , search_page_path: search_page_path , url_param_name: url_param_name , ...assignable_options } = props;
120
- const { search: search } = (0, $42858f023ef23dab$export$8e769ad4338a911e);
121
- const [get_search_page_path, set_search_page_path] = (0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_path_;
122
- set_search_page_path(search_page_path);
123
- if (!search) {
124
- (0, $42858f023ef23dab$export$8e769ad4338a911e).search = new (0, $TZSbU$DepictSearch)({
125
- search_query_url_param_name: url_param_name,
126
- ...assignable_options,
127
- enable_category_suggestions: false,
128
- localization: {
129
- ...(0, $TZSbU$swedish_search_translation),
130
- price_formatting_: {
131
- pre_: "kr ",
132
- post_: "",
133
- decimal_places_delimiter_: ",",
134
- thousands_delimiter_: " ",
135
- places_after_comma_: 2
136
- }
137
- },
138
- on_navigation: (new_href)=>{
139
- const shallow = (0, $c83ba9ab79386687$export$6cb4d3a5c1ac9b43)(location);
140
- if (window.next) window.next.router.push(new_href, undefined, {
141
- shallow: shallow,
142
- scroll: true
143
- });
144
- else location.href = new_href;
145
- },
146
- url_transformer: (url)=>url.pathname = (0, $TZSbU$untrack)(get_search_page_path)
147
- });
148
- (0, $8071251ee4e9ffa1$export$6453cbc34515a94d)((0, $c83ba9ab79386687$export$6cb4d3a5c1ac9b43));
149
- } else Object.assign(search, assignable_options);
150
- (0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[1](true);
151
- return (0, $TZSbU$createElement)((0, $TZSbU$Fragment), null, children);
152
- }
153
-
154
-
155
- // PoC maybe-component
156
- // Idea is to always give a nice "modal input in header" look with no more config than adding this component to the page header to where it can absolute-size
157
- // and cover the entire height of the header. Then we know where to put the modal input top and bottom, and the left and right we just center.
158
-
159
-
160
-
161
- function $f41a371216eff80b$export$cbcd1ecdb41b1d0a() {
162
- return (0, $TZSbU$createElement)("div", {
163
- className: "depict aligner",
164
- ref: (e)=>(0, $42858f023ef23dab$export$8e769ad4338a911e).header_alignment = e
165
- });
166
- }
167
- let $f41a371216eff80b$var$sheet;
168
- function $f41a371216eff80b$export$a7f6cffb6b8ba11c() {
169
- if (!(0, $42858f023ef23dab$export$8e769ad4338a911e).search) {
170
- console.error("No active search in the app!");
171
- return;
172
- }
173
- if (!(0, $42858f023ef23dab$export$8e769ad4338a911e).header_alignment) {
174
- console.error("No active search header aligner on the page!");
175
- return;
176
- }
177
- const style_props_ = (0, $TZSbU$createSignal)({
178
- position: "fixed",
179
- top: 0
180
- });
181
- if ((0, $42858f023ef23dab$export$8e769ad4338a911e).header_alignment?.clientHeight) {
182
- let styles = `.depict.plp.in-header .depict-search-modal .query-input { height: ${(0, $42858f023ef23dab$export$8e769ad4338a911e).header_alignment?.clientHeight}px; }`;
183
- styles += `.depict.plp.in-header .depict-search-modal-backdrop { top: ${(0, $42858f023ef23dab$export$8e769ad4338a911e).header_alignment?.clientHeight}px; }`;
184
- if (!$f41a371216eff80b$var$sheet) {
185
- const style = document.createElement("style");
186
- style.append(styles);
187
- document.head.appendChild(style);
188
- }
189
- }
190
- const class_list_ = (0, $TZSbU$createMemo)(()=>({
191
- "in-header": true
192
- }));
193
- (0, $42858f023ef23dab$export$8e769ad4338a911e).search.modal_open = [
194
- {
195
- style_props_: style_props_,
196
- class_list_: class_list_
197
- }
198
- ];
199
- }
200
-
201
-
202
-
203
-
204
-
205
-
206
-
207
-
208
- function $9f8d5ef3c016c493$export$210723f5a54a7028(opts) {
209
- return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($9f8d5ef3c016c493$var$SolidSearchPage), opts);
210
- }
211
- function $9f8d5ef3c016c493$var$SolidSearchPage(props, set_portals) {
212
- const depict_search = (0, $42858f023ef23dab$export$8e769ad4338a911e).search;
213
- if (!depict_search) throw Error("No depict_search instance when rendering SearchPage.");
214
- const search_query_updating_blocked_signal = (0, $TZSbU$get_search_query_updating_blocked_signal)(depict_search);
215
- if (!search_query_updating_blocked_signal) throw Error("No search_query_updating_blocked_signal when rendering SearchPage");
216
- const [, set_search_query_updating_blocked_signal] = search_query_updating_blocked_signal;
217
- const update_updating_blocked_signal = ()=>{
218
- set_search_query_updating_blocked_signal(!(0, $c83ba9ab79386687$export$6cb4d3a5c1ac9b43)(location));
219
- };
220
- // 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
221
- (0, $c83ba9ab79386687$export$74f3924c5027fe1d)(update_updating_blocked_signal); // if we navigate, re-check
222
- (0, $TZSbU$createComputed)(()=>{
223
- (0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_path_[0](); // if react defined path changes, re-check
224
- update_updating_blocked_signal();
225
- });
226
- const component_portals = new Set();
227
- return (0, $TZSbU$SearchPage)({
228
- // Default config goes here
229
- include_input_field: props.includeInputField ?? true,
230
- cols_at_size: props.columnsAtSize ?? [
231
- [
232
- 4
233
- ],
234
- [
235
- 3,
236
- 1024
237
- ],
238
- [
239
- 2,
240
- 901
241
- ]
242
- ],
243
- grid_spacing: props.gridSpacing ?? "2%",
244
- // Todo: Do we need this?
245
- get_product_id: ()=>"",
246
- depict_search: depict_search,
247
- product_card_template: async (display, info)=>{
248
- const solid_container = document.createElement("div");
249
- const react_has_rendered = new Promise((r)=>{
250
- const m_o = new MutationObserver(()=>{
251
- m_o.disconnect();
252
- r();
253
- });
254
- m_o.observe(solid_container, {
255
- childList: true
256
- });
257
- });
258
- const is_placeholder = info.rendering_options.type === "placeholder";
259
- const reactProductCard = (0, $TZSbU$jsx)(props.productCard, {
260
- display: is_placeholder ? null : display
261
- });
262
- const portal = $TZSbU$createPortal(reactProductCard, solid_container);
263
- component_portals.add(portal);
264
- set_portals([
265
- ...component_portals
266
- ]);
267
- (0, $TZSbU$onCleanup)(()=>{
268
- // 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
269
- component_portals.delete(portal);
270
- set_portals([
271
- ...component_portals
272
- ]);
273
- });
274
- 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
275
- return [
276
- solid_container
277
- ];
278
- }
279
- });
280
- }
281
-
282
-
283
-
284
-
285
- export {$54b0d21b77e719c4$export$d2c02478244f91f7 as DepictSearchField, $faf794495ff8b304$export$9fac37a9c21c2f3b as DepictProvider, $f41a371216eff80b$export$a7f6cffb6b8ba11c as openModal, $f41a371216eff80b$export$cbcd1ecdb41b1d0a as DepictSearchHeader, $9f8d5ef3c016c493$export$210723f5a54a7028 as DepictSearchPage};