@depict-ai/react-ui 0.0.53 → 0.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +91 -40
- package/dist/main.js +113 -74
- package/dist/module.js +115 -77
- package/dist/styles/components/PLP/Buttons.scss +46 -0
- package/dist/styles/components/PLP/PLPResults.scss +6 -0
- package/dist/styles/components/PLP/ProductListingPage.scss +27 -2
- package/dist/styles/components/PLP/ScrollStatus.scss +8 -1
- package/dist/styles/components/PLP/SelectedFilters.scss +7 -0
- package/dist/styles/components/PLP/SlidableItems.scss +8 -0
- package/dist/styles/components/PLP/SortAndFilter/FloatingButtons.scss +9 -0
- package/dist/styles/components/PLP/SortAndFilter/SortAndFilter.scss +57 -0
- package/dist/styles/components/PLP/SortAndFilter/WhiteSortAndFilter.scss +4 -0
- package/dist/styles/components/PLP/Toast.scss +5 -0
- package/dist/styles/components/PLP/index.scss +14 -6
- package/dist/styles/components/category/BreadCrumbs.scss +13 -4
- package/dist/styles/components/category/CategoryTitle.scss +13 -2
- package/dist/styles/components/category/QuickLinks.scss +12 -4
- package/dist/styles/components/category/index.scss +5 -5
- package/dist/styles/components/search/QueryInput.scss +9 -0
- package/dist/styles/components/search/SearchModal.scss +8 -0
- package/dist/styles/components/search/SearchRecommendations.scss +3 -0
- package/dist/styles/components/search/ShowingResultsFor.scss +3 -0
- package/dist/styles/components/search/index.scss +5 -5
- package/dist/styles/default.css +1 -1
- package/dist/styles/index.scss +3 -48
- package/dist/styles/variables.scss +15 -3
- package/dist-server/index.d.ts +2 -1
- package/dist-server/main.js +7 -1
- package/dist-server/module.js +7 -2
- package/package.json +3 -3
package/dist/module.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
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, SearchField as $TZSbU$SearchField, DepictSearch as $TZSbU$DepictSearch, get_search_query_updating_blocked_signal as $TZSbU$get_search_query_updating_blocked_signal, SearchPage as $TZSbU$SearchPage} from "@depict-ai/ui";
|
|
3
|
-
import {untrack as $TZSbU$untrack, createComponent as $TZSbU$createComponent, Show as $TZSbU$Show,
|
|
2
|
+
import {add_to_version_info as $TZSbU$add_to_version_info, SearchField as $TZSbU$SearchField, DepictSearch as $TZSbU$DepictSearch, get_search_query_updating_blocked_signal as $TZSbU$get_search_query_updating_blocked_signal, SearchPage as $TZSbU$SearchPage, CategoryPage as $TZSbU$CategoryPage, embedded_num_products as $TZSbU$embedded_num_products} 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, createComputed as $TZSbU$createComputed} from "solid-js";
|
|
4
4
|
import {render as $TZSbU$render} from "solid-js/web";
|
|
5
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 {en as $TZSbU$en} from "@depict-ai/ui/locales";
|
|
7
|
-
import {createPortal as $TZSbU$createPortal} from "react-dom";
|
|
8
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
9
|
|
|
10
10
|
/*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
|
|
11
11
|
// Note, if you add an export here, also add one in src-server/main.ts
|
|
@@ -14,6 +14,7 @@ import {jsx as $TZSbU$jsx} from "react/jsx-runtime";
|
|
|
14
14
|
|
|
15
15
|
const $42858f023ef23dab$export$8e769ad4338a911e = {
|
|
16
16
|
search: null,
|
|
17
|
+
category: null,
|
|
17
18
|
header_alignment: null,
|
|
18
19
|
search_page_path_: (0, $TZSbU$createSignal)(),
|
|
19
20
|
required_state_set_: (0, $TZSbU$createSignal)(false)
|
|
@@ -23,6 +24,8 @@ const $42858f023ef23dab$export$8e769ad4338a911e = {
|
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
|
|
27
|
+
|
|
28
|
+
|
|
26
29
|
let $c83ba9ab79386687$var$run_on_href_change;
|
|
27
30
|
function $c83ba9ab79386687$export$74f3924c5027fe1d(cb) {
|
|
28
31
|
$c83ba9ab79386687$var$run_on_href_change = cb;
|
|
@@ -31,7 +34,7 @@ function $c83ba9ab79386687$export$74f3924c5027fe1d(cb) {
|
|
|
31
34
|
for await (const href of (0, $TZSbU$href_change_ipns))$c83ba9ab79386687$var$run_on_href_change?.(href);
|
|
32
35
|
})();
|
|
33
36
|
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
|
|
34
|
-
function $c83ba9ab79386687$export$f6e64e17bd69eeef(solid_component, props, wrapper_type = "div", wrapper_style = {}) {
|
|
37
|
+
function $c83ba9ab79386687$export$f6e64e17bd69eeef(solid_component, props, wrapper_type = "div", wrapper_style = {}, render_cb) {
|
|
35
38
|
const [portals, set_portals] = (0, $TZSbU$useState)([]);
|
|
36
39
|
const wrapper_element_ref = (0, $TZSbU$useRef)();
|
|
37
40
|
(0, $TZSbU$useEffect)(()=>{
|
|
@@ -39,6 +42,7 @@ function $c83ba9ab79386687$export$f6e64e17bd69eeef(solid_component, props, wrapp
|
|
|
39
42
|
const dispose = (0, $TZSbU$render)(()=>solid_component(props, set_portals), wrapper_element);
|
|
40
43
|
return dispose;
|
|
41
44
|
}, []);
|
|
45
|
+
render_cb?.(props);
|
|
42
46
|
return (0, $TZSbU$createElement)(wrapper_type, {
|
|
43
47
|
ref: wrapper_element_ref,
|
|
44
48
|
style: wrapper_style
|
|
@@ -56,6 +60,38 @@ function $c83ba9ab79386687$export$e5139bbbb9a05035(component) {
|
|
|
56
60
|
});
|
|
57
61
|
};
|
|
58
62
|
}
|
|
63
|
+
async function $c83ba9ab79386687$export$79c79419c1ef0081({ display: display , info: info , component_portals: component_portals , set_portals: set_portals , react_template: react_template }) {
|
|
64
|
+
const solid_container = document.createElement("div");
|
|
65
|
+
const react_has_rendered = new Promise((r)=>{
|
|
66
|
+
const m_o = new MutationObserver(()=>{
|
|
67
|
+
m_o.disconnect();
|
|
68
|
+
r();
|
|
69
|
+
});
|
|
70
|
+
m_o.observe(solid_container, {
|
|
71
|
+
childList: true
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
const is_placeholder = info.rendering_options.type === "placeholder";
|
|
75
|
+
const reactProductCard = (0, $TZSbU$jsx)(react_template, {
|
|
76
|
+
display: is_placeholder ? null : display
|
|
77
|
+
});
|
|
78
|
+
const portal = $TZSbU$createPortal(reactProductCard, solid_container);
|
|
79
|
+
component_portals.add(portal);
|
|
80
|
+
set_portals([
|
|
81
|
+
...component_portals
|
|
82
|
+
]);
|
|
83
|
+
(0, $TZSbU$onCleanup)(()=>{
|
|
84
|
+
// 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
|
|
85
|
+
component_portals.delete(portal);
|
|
86
|
+
set_portals([
|
|
87
|
+
...component_portals
|
|
88
|
+
]);
|
|
89
|
+
});
|
|
90
|
+
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
|
|
91
|
+
return [
|
|
92
|
+
solid_container
|
|
93
|
+
];
|
|
94
|
+
}
|
|
59
95
|
|
|
60
96
|
|
|
61
97
|
|
|
@@ -135,7 +171,7 @@ const $7216ca4c8308a0f9$export$599d4515591ef232 = (href)=>{
|
|
|
135
171
|
|
|
136
172
|
|
|
137
173
|
function $faf794495ff8b304$export$9fac37a9c21c2f3b(props) {
|
|
138
|
-
const { children: children ,
|
|
174
|
+
const { children: children , navigateFunction: navigateFunction , market: market , merchant: merchant , locale: locale } = props;
|
|
139
175
|
const usedLocale = locale ?? (0, $TZSbU$en);
|
|
140
176
|
const { searchPagePath: searchPagePath , urlParamName: urlParamName , enableCategorySuggestions: enableCategorySuggestions } = props.search ?? {};
|
|
141
177
|
if (!market || !merchant) {
|
|
@@ -143,9 +179,13 @@ function $faf794495ff8b304$export$9fac37a9c21c2f3b(props) {
|
|
|
143
179
|
return (0, $TZSbU$createElement)((0, $TZSbU$Fragment), null, children);
|
|
144
180
|
}
|
|
145
181
|
try {
|
|
146
|
-
const { search: search } = (0, $42858f023ef23dab$export$8e769ad4338a911e);
|
|
182
|
+
const { search: search , category: category } = (0, $42858f023ef23dab$export$8e769ad4338a911e);
|
|
147
183
|
const [get_search_page_path, set_search_page_path] = (0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_path_;
|
|
148
184
|
set_search_page_path(searchPagePath);
|
|
185
|
+
const on_navigation = typeof window?.next?.router !== "undefined" || navigateFunction ? (new_href)=>{
|
|
186
|
+
if (navigateFunction) navigateFunction(new_href);
|
|
187
|
+
else (0, $7216ca4c8308a0f9$export$599d4515591ef232)(new_href);
|
|
188
|
+
} : undefined;
|
|
149
189
|
if (!search) {
|
|
150
190
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).search = new (0, $TZSbU$DepictSearch)({
|
|
151
191
|
search_query_url_param_name: urlParamName,
|
|
@@ -154,13 +194,8 @@ function $faf794495ff8b304$export$9fac37a9c21c2f3b(props) {
|
|
|
154
194
|
enable_category_suggestions: enableCategorySuggestions ?? false,
|
|
155
195
|
// default category suggestions to false for @depict-ai/react-ui (https://linear.app/depictai/issue/FRO-401/default-enablecategorysuggestions-to-false)
|
|
156
196
|
localization: usedLocale,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if (navigateFunction) navigateFunction(new_href);
|
|
160
|
-
else (0, $7216ca4c8308a0f9$export$599d4515591ef232)(new_href);
|
|
161
|
-
}
|
|
162
|
-
} : {},
|
|
163
|
-
url_transformer: (url)=>url.pathname = (0, $TZSbU$untrack)(get_search_page_path)
|
|
197
|
+
url_transformer: (url)=>url.pathname = (0, $TZSbU$untrack)(get_search_page_path),
|
|
198
|
+
on_navigation: on_navigation
|
|
164
199
|
});
|
|
165
200
|
(0, $8071251ee4e9ffa1$export$6453cbc34515a94d)((0, $c83ba9ab79386687$export$6cb4d3a5c1ac9b43));
|
|
166
201
|
} else {
|
|
@@ -168,6 +203,17 @@ function $faf794495ff8b304$export$9fac37a9c21c2f3b(props) {
|
|
|
168
203
|
search.merchant = merchant;
|
|
169
204
|
search.localization = usedLocale;
|
|
170
205
|
}
|
|
206
|
+
if (!category) (0, $42858f023ef23dab$export$8e769ad4338a911e).category = new (0, $faf794495ff8b304$import$5090e60c224b3b76$f34314aa9505732e)({
|
|
207
|
+
market: market,
|
|
208
|
+
merchant: merchant,
|
|
209
|
+
localization: usedLocale,
|
|
210
|
+
on_navigation: on_navigation
|
|
211
|
+
});
|
|
212
|
+
else {
|
|
213
|
+
category.market = market;
|
|
214
|
+
category.merchant = merchant;
|
|
215
|
+
category.localization = usedLocale;
|
|
216
|
+
}
|
|
171
217
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[1](true);
|
|
172
218
|
} catch (e) {
|
|
173
219
|
// Make sure to not break the users app if we throw
|
|
@@ -184,7 +230,6 @@ function $faf794495ff8b304$export$9fac37a9c21c2f3b(props) {
|
|
|
184
230
|
// 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.
|
|
185
231
|
|
|
186
232
|
|
|
187
|
-
|
|
188
233
|
function $f41a371216eff80b$export$cbcd1ecdb41b1d0a() {
|
|
189
234
|
return (0, $TZSbU$createElement)("div", {
|
|
190
235
|
className: "depict aligner",
|
|
@@ -197,32 +242,7 @@ function $f41a371216eff80b$export$a7f6cffb6b8ba11c() {
|
|
|
197
242
|
console.error("No active search in the app!");
|
|
198
243
|
return;
|
|
199
244
|
}
|
|
200
|
-
|
|
201
|
-
console.error("No active search header aligner on the page!");
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
const style_props_ = (0, $TZSbU$createSignal)({
|
|
205
|
-
position: "fixed",
|
|
206
|
-
top: 0
|
|
207
|
-
});
|
|
208
|
-
if ((0, $42858f023ef23dab$export$8e769ad4338a911e).header_alignment?.clientHeight) {
|
|
209
|
-
let styles = `.depict.plp.in-header .depict-search-modal .query-input { height: ${(0, $42858f023ef23dab$export$8e769ad4338a911e).header_alignment?.clientHeight}px; }`;
|
|
210
|
-
styles += `.depict.plp.in-header .depict-search-modal-backdrop { top: ${(0, $42858f023ef23dab$export$8e769ad4338a911e).header_alignment?.clientHeight}px; }`;
|
|
211
|
-
if (!$f41a371216eff80b$var$sheet) {
|
|
212
|
-
const style = document.createElement("style");
|
|
213
|
-
style.append(styles);
|
|
214
|
-
document.head.appendChild(style);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
const class_list_ = (0, $TZSbU$createMemo)(()=>({
|
|
218
|
-
"in-header": true
|
|
219
|
-
}));
|
|
220
|
-
(0, $42858f023ef23dab$export$8e769ad4338a911e).search.modal_open = [
|
|
221
|
-
{
|
|
222
|
-
style_props_: style_props_,
|
|
223
|
-
class_list_: class_list_
|
|
224
|
-
}
|
|
225
|
-
];
|
|
245
|
+
(0, $42858f023ef23dab$export$8e769ad4338a911e).search.modal_open = true;
|
|
226
246
|
}
|
|
227
247
|
|
|
228
248
|
|
|
@@ -230,8 +250,6 @@ function $f41a371216eff80b$export$a7f6cffb6b8ba11c() {
|
|
|
230
250
|
|
|
231
251
|
|
|
232
252
|
|
|
233
|
-
|
|
234
|
-
|
|
235
253
|
function $9f8d5ef3c016c493$export$210723f5a54a7028(props) {
|
|
236
254
|
return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($9f8d5ef3c016c493$var$SolidSearchPage), props);
|
|
237
255
|
}
|
|
@@ -271,38 +289,58 @@ function $9f8d5ef3c016c493$var$SolidSearchPage(props, set_portals) {
|
|
|
271
289
|
// Todo: Do we need this?
|
|
272
290
|
get_product_id: ()=>"",
|
|
273
291
|
depict_search: depict_search,
|
|
274
|
-
product_card_template:
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
292
|
+
product_card_template: (display, info)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
|
|
293
|
+
display: display,
|
|
294
|
+
info: info,
|
|
295
|
+
react_template: props.productCard,
|
|
296
|
+
component_portals: component_portals,
|
|
297
|
+
set_portals: set_portals
|
|
298
|
+
})
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
let $f2cd62bf5f14ad67$var$render_cb;
|
|
307
|
+
function $f2cd62bf5f14ad67$export$d87c61cecb2edf0d(props) {
|
|
308
|
+
return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($f2cd62bf5f14ad67$var$SolidCategoryPage), props, "div", {}, (props)=>$f2cd62bf5f14ad67$var$render_cb?.(props));
|
|
309
|
+
}
|
|
310
|
+
function $f2cd62bf5f14ad67$var$SolidCategoryPage(props, set_portals) {
|
|
311
|
+
const depict_category = (0, $42858f023ef23dab$export$8e769ad4338a911e).category;
|
|
312
|
+
if (!depict_category) throw Error("No depict_category instance when rendering SearchPage. Did you forget to wrap your app in DepictProvider?");
|
|
313
|
+
$f2cd62bf5f14ad67$var$render_cb = (props)=>depict_category.category_id = props.categoryId;
|
|
314
|
+
$f2cd62bf5f14ad67$var$render_cb(props);
|
|
315
|
+
const component_portals = new Set();
|
|
316
|
+
return (0, $TZSbU$CategoryPage)({
|
|
317
|
+
depict_category: depict_category,
|
|
318
|
+
cols_at_size: props.columnsAtSize ?? [
|
|
319
|
+
[
|
|
320
|
+
4
|
|
321
|
+
],
|
|
322
|
+
[
|
|
323
|
+
3,
|
|
324
|
+
1024
|
|
325
|
+
],
|
|
326
|
+
[
|
|
327
|
+
2,
|
|
328
|
+
901
|
|
329
|
+
]
|
|
330
|
+
],
|
|
331
|
+
grid_spacing: props.gridSpacing ?? "2%",
|
|
332
|
+
// Todo: Do we need this?
|
|
333
|
+
get_product_id: ()=>"",
|
|
334
|
+
category_title: (0, $TZSbU$embedded_num_products),
|
|
335
|
+
show_breadcrumbs: props.showBreadcrumbs || false,
|
|
336
|
+
show_quicklinks: props.showQuicklinks || false,
|
|
337
|
+
product_card_template: (display, info)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
|
|
338
|
+
display: display,
|
|
339
|
+
info: info,
|
|
340
|
+
react_template: props.productCard,
|
|
341
|
+
component_portals: component_portals,
|
|
342
|
+
set_portals: set_portals
|
|
343
|
+
})
|
|
306
344
|
});
|
|
307
345
|
}
|
|
308
346
|
|
|
@@ -330,7 +368,7 @@ const $8aa3ab31237c8dc9$export$89c6019e4baa40b1 = ({ width: width , height: heig
|
|
|
330
368
|
};
|
|
331
369
|
|
|
332
370
|
|
|
333
|
-
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.
|
|
371
|
+
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.54";
|
|
334
372
|
|
|
335
373
|
|
|
336
374
|
|
|
@@ -372,4 +410,4 @@ const $43099132aad1ceb6$var$package_name = "@depict-ai/react-ui";
|
|
|
372
410
|
});
|
|
373
411
|
|
|
374
412
|
|
|
375
|
-
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, $c95f83f01e99fc18$export$3f37af283f8fb843 as ImagePlaceholder, $8aa3ab31237c8dc9$export$89c6019e4baa40b1 as TextPlaceholder, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version, $97603d19204ec48d$export$b8a61e5c71402559 as Navigation};
|
|
413
|
+
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, $f2cd62bf5f14ad67$export$d87c61cecb2edf0d as DepictCategoryPage, $c95f83f01e99fc18$export$3f37af283f8fb843 as ImagePlaceholder, $8aa3ab31237c8dc9$export$89c6019e4baa40b1 as TextPlaceholder, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version, $97603d19204ec48d$export$b8a61e5c71402559 as Navigation};
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
$primary-button-overrides: ();
|
|
8
8
|
$secondary-button-overrides: ();
|
|
9
9
|
|
|
10
|
+
/// Used to get the current properties of the primary button. (`Buttons.$primary-button-overrides` merged into the default properties.) This is so that parts of the button styling can be re-used in other mixins in the state they were in as the mixins get called.
|
|
11
|
+
/// @example
|
|
12
|
+
/// filter: map.get(Buttons.get-primary-button-properties(), "focus-visible-filter");
|
|
10
13
|
@function get-primary-button-properties() {
|
|
11
14
|
$primary-button-properties: (
|
|
12
15
|
"background": variables.$brand-black,
|
|
@@ -22,6 +25,9 @@ $secondary-button-overrides: ();
|
|
|
22
25
|
@return map.merge($primary-button-properties, $primary-button-overrides);
|
|
23
26
|
}
|
|
24
27
|
|
|
28
|
+
/// Used to get the current properties of the primary button. (`Buttons.$primary-button-overrides` merged into the default properties.) This is so that parts of the button styling can be re-used in other mixins in the state they were in as the mixins get called.
|
|
29
|
+
/// @example
|
|
30
|
+
/// filter: map.get(Buttons.get-secondary-button-properties(), "focus-visible-filter");
|
|
25
31
|
@function get-secondary-button-properties() {
|
|
26
32
|
$secondary-button-properties: (
|
|
27
33
|
"background": variables.$brand-lightest-grey,
|
|
@@ -36,6 +42,26 @@ $secondary-button-overrides: ();
|
|
|
36
42
|
@return map.merge($secondary-button-properties, $secondary-button-overrides);
|
|
37
43
|
}
|
|
38
44
|
|
|
45
|
+
/// Generates styling for our primary buttons, including hover, active and focus-visible states
|
|
46
|
+
///
|
|
47
|
+
/// *Please only provide options to this mixin if you want to create styling for just a specific button.*
|
|
48
|
+
///
|
|
49
|
+
/// This mixin and the SecondaryButton mixin are specialties that are trying out a way of styling that we'll probably switch to in the future where you configure the styling of different components using maps instead of calling mixins yourself with different properties, as that will reduce boilerplate. The reason we had to change these already is that the values defined here are also used in other mixins and they can't be accessed if they are only provided as arguments in mixin calls.
|
|
50
|
+
////
|
|
51
|
+
/// *For generally changing how the buttons look, override the $primary-button-overrides map with a custom map containing the properties you want to change.*
|
|
52
|
+
/// See the example below.
|
|
53
|
+
/// @example
|
|
54
|
+
/// // To override styling (see explanation in description)
|
|
55
|
+
/// Buttons.$primary-button-overrides: ("background": #3f322a, "color": rgb(240,240,240));
|
|
56
|
+
/// @param {Color} $background [map.get(get-primary-button-properties(), "background")] - The background color of the button. From this color other button states will be automatically inferred by lightening or darkening it.
|
|
57
|
+
///
|
|
58
|
+
/// @param {Color} $color [map.get(get-primary-button-properties(), "color")] - The color of the button text
|
|
59
|
+
/// @param {Border} $border [map.get(get-primary-button-properties(), "border")] - The button border
|
|
60
|
+
/// @param {Number with unit} $border-radius [map.get(get-primary-button-properties(), "border-radius")] - The button border radius
|
|
61
|
+
/// @param {Filter} $hover-filter [map.get(get-primary-button-properties(), "hover-filter")] - The filter to apply on hover
|
|
62
|
+
/// @param {Filter} $active-filter [map.get(get-primary-button-properties(), "active-filter")] - The filter to apply on active
|
|
63
|
+
/// @param {Filter} $focus-visible-filter [map.get(get-primary-button-properties(), "focus-visible-filter")] - The filter to apply on focus-visible (when the button is focused using keyboard navigation)
|
|
64
|
+
|
|
39
65
|
@mixin PrimaryButton(
|
|
40
66
|
$background: map.get(get-primary-button-properties(), "background"),
|
|
41
67
|
$color: map.get(get-primary-button-properties(), "color"),
|
|
@@ -61,6 +87,26 @@ $secondary-button-overrides: ();
|
|
|
61
87
|
}
|
|
62
88
|
}
|
|
63
89
|
|
|
90
|
+
/// Generates styling for our secondary buttons, including hover, active and focus-visible states
|
|
91
|
+
///
|
|
92
|
+
/// *Please only provide options to this mixin if you want to create styling for just a specific button.*
|
|
93
|
+
///
|
|
94
|
+
/// This mixin and the SecondaryButton mixin are specialties that are trying out a way of styling that we'll probably switch to in the future where you configure the styling of different components using maps instead of calling mixins yourself with different properties, as that will reduce boilerplate. The reason we had to change these already is that the values defined here are also used in other mixins and they can't be accessed if they are only provided as arguments in mixin calls.
|
|
95
|
+
////
|
|
96
|
+
/// *For generally changing how the buttons look, override the $secondary-button-overrides map with a custom map containing the properties you want to change.*
|
|
97
|
+
/// See the example below.
|
|
98
|
+
/// @example
|
|
99
|
+
/// // To override styling (see explanation in description)
|
|
100
|
+
/// Buttons.$secondary-button-overrides: ("border": 1px solid #afafaf, "background": white);
|
|
101
|
+
/// @param {Color} $background [map.get(get-secondary-button-properties(), "background")] - The background color of the button. From this color other button states will be automatically inferred by lightening or darkening it.
|
|
102
|
+
///
|
|
103
|
+
/// @param {Color} $color [map.get(get-secondary-button-properties(), "color")] - The color of the button text
|
|
104
|
+
/// @param {Border} $border [map.get(get-secondary-button-properties(), "border")] - The button border
|
|
105
|
+
/// @param {Number with unit} $border-radius [map.get(get-secondary-button-properties(), "border-radius")] - The button border radius
|
|
106
|
+
/// @param {Filter} $hover-filter [map.get(get-secondary-button-properties(), "hover-filter")] - The filter to apply on hover
|
|
107
|
+
/// @param {Filter} $active-filter [map.get(get-secondary-button-properties(), "active-filter")] - The filter to apply on active
|
|
108
|
+
/// @param {Filter} $focus-visible-filter [map.get(get-secondary-button-properties(), "focus-visible-filter")] - The filter to apply on focus-visible (when the button is focused using keyboard navigation)
|
|
109
|
+
|
|
64
110
|
@mixin SecondaryButton(
|
|
65
111
|
$background: map.get(get-secondary-button-properties(), "background"),
|
|
66
112
|
$color: map.get(get-secondary-button-properties(), "color"),
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
@use "../../variables";
|
|
2
2
|
@use "../../helpers/utils";
|
|
3
3
|
|
|
4
|
+
/// Base styling (PLP) that applies to both category and search pages for the PLPResults component, the component which holds the product cards.
|
|
5
|
+
/// Another part of this styling is in the ProductListingPage mixin, which takes care about the overall layout of the page (which mostly means margins and paddings).
|
|
6
|
+
|
|
4
7
|
@mixin PLPResults() {
|
|
5
8
|
.listing-page {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
|
|
6
12
|
.no-results {
|
|
7
13
|
background: white;
|
|
8
14
|
padding: 40px;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
@use "../../helpers/utils";
|
|
2
2
|
|
|
3
|
+
/// Styling that ties together the different components that are common to both Category and Search pages. Mainly takes care of margins and paddings but also sets the styling for .cards which is in both PLPResults and SearchRecommendations.
|
|
4
|
+
///
|
|
5
|
+
/// Note that for the gaps not the exact values will always be used but often multiples for different places where it's appropriate.
|
|
6
|
+
///
|
|
7
|
+
/// @param {Number with size unit} $spacing-to-filters [12px] - The spacing between the filters and content.
|
|
8
|
+
/// @param {Number with size unit} $desktop-item-gap [20px] - The vertical gap between the different items on desktop.
|
|
9
|
+
/// @param {Number with size unit} $mobile-item-gap [16px] - The vertical gap between the different items on mobile.
|
|
10
|
+
|
|
3
11
|
@mixin ProductListingPage($spacing-to-filters: 12px, $desktop-item-gap: 20px, $mobile-item-gap: 16px) {
|
|
4
12
|
.listing-page {
|
|
5
|
-
display: flex;
|
|
6
|
-
flex-direction: column;
|
|
7
13
|
padding: $desktop-item-gap calc(#{$desktop-item-gap} / 2);
|
|
8
14
|
@include mobile_sizes() {
|
|
9
15
|
padding: $mobile-item-gap calc(#{$mobile-item-gap} / 2);
|
|
@@ -55,6 +61,17 @@
|
|
|
55
61
|
}
|
|
56
62
|
}
|
|
57
63
|
|
|
64
|
+
/// Styling that ties together the different components on the SearchPage. Mainly takes care of margins and paddings.
|
|
65
|
+
///
|
|
66
|
+
/// Note that for the gaps not the exact values will always be used but often multiples for different places where it's appropriate.
|
|
67
|
+
///
|
|
68
|
+
/// @param {Number with size unit} $spacing-to-filters [12px] - The spacing between the filters and content.
|
|
69
|
+
/// @param {Number with size unit} $desktop-item-gap [20px] - The vertical gap between the different items on desktop.
|
|
70
|
+
/// @param {Number with size unit} $mobile-item-gap [16px] - The vertical gap between the different items on mobile.
|
|
71
|
+
/// @param {Boolean} $spacing-above-search-field [true] - Whether to add equal spacing above the search field as below.
|
|
72
|
+
/// @param {Number with size unit} $query-input-width [800px] - The max width of the query input field (if present)
|
|
73
|
+
/// @param {Number} $gaps-to-recs-factor [3] - The factor to multiply the gaps with to get the spacing above the recommendations.
|
|
74
|
+
|
|
58
75
|
@mixin SearchPage(
|
|
59
76
|
$spacing-to-filters: 12px,
|
|
60
77
|
$desktop-item-gap: 20px,
|
|
@@ -124,6 +141,12 @@
|
|
|
124
141
|
}
|
|
125
142
|
}
|
|
126
143
|
|
|
144
|
+
/// Styling that ties together the different components on the CategoryPage. Mainly takes care of margins and paddings.
|
|
145
|
+
///
|
|
146
|
+
/// @param {Number with size unit} $spacing-to-filters [12px] - The spacing between the filters and content.
|
|
147
|
+
/// @param {Number with size unit} $desktop-item-gap [20px] - The vertical gap between the different items on desktop.
|
|
148
|
+
/// @param {Number with size unit} $mobile-item-gap [16px] - The vertical gap between the different items on mobile.
|
|
149
|
+
|
|
127
150
|
@mixin CategoryPage($spacing-to-filters: 12px, $desktop-item-gap: 20px, $mobile-item-gap: 16px) {
|
|
128
151
|
.listing-page {
|
|
129
152
|
.quicklinks,
|
|
@@ -136,6 +159,8 @@
|
|
|
136
159
|
}
|
|
137
160
|
}
|
|
138
161
|
|
|
162
|
+
/// Internal mixin that dictates when the vertical spaces should switch to the "mobile" versions
|
|
163
|
+
|
|
139
164
|
@mixin mobile_sizes() {
|
|
140
165
|
@media (max-width: 651px) {
|
|
141
166
|
@content;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
@use "../../variables";
|
|
2
2
|
|
|
3
|
+
/// ScrollStatus shows the user how many items are left to scroll through, if they scroll at a speed that indicates that they are no longer looking at each product but rather just trying to see how many there are.
|
|
4
|
+
///
|
|
5
|
+
/// Making the background slightly frosted is something I'd love to do, but there's a bug in chrome that it doesn't work. I'd appreciate if you starred my bug report so it maybe gets fixed one day: https://bugs.chromium.org/p/chromium/issues/detail?id=1382360
|
|
6
|
+
///
|
|
7
|
+
/// @param {Color} $scroll-status-background [rgba(100, 100, 100, 0.9)] - The background color of the scroll status. I recommend setting a slightly transparent color.
|
|
8
|
+
/// @param {Number with size unit} $border-radius [variables.$border-radius * 5] - The border-radius of the scroll status.
|
|
9
|
+
|
|
3
10
|
@mixin ScrollStatus(
|
|
4
11
|
$scroll-status-background: rgba(100, 100, 100, 0.9),
|
|
5
|
-
$border-radius: calc(variables.$border-radius * 5)
|
|
12
|
+
$border-radius: calc(#{variables.$border-radius} * 5)
|
|
6
13
|
) {
|
|
7
14
|
.scroll-status {
|
|
8
15
|
pointer-events: none;
|
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
@use "./Buttons";
|
|
5
5
|
@use "sass:map";
|
|
6
6
|
|
|
7
|
+
/// Mixin that styles the SelectedFilters component, which is the component that shows the selected filters if both the sorting and filtering menus are currently hidden.
|
|
8
|
+
/// @param {Number with size unit} $border-radius [variables.$border-radius] - A local override of the border-radius variable.
|
|
9
|
+
/// @param {String} $title-color [variables.$brand-black] - The color of the text that says "Filters:" (the key of this string is `selected_filters_title_` in the locale files).
|
|
10
|
+
/// @param {String} $filter-title-transform [uppercase] - text-transform for the aforementioned "Filters:" string
|
|
11
|
+
/// @param {Number with size unit} $margin-on-desktop [0px] - Margin above/below SelectedFilters on desktop. This is set here because ExpandingContainer, our expanding component, gets confused when the margin isn't precisely on this element. Otherwise this value would be in ProductListingPage.scss.
|
|
12
|
+
/// @param {Boolean} $set-border-on-crumbs [true] - Whether to set a border on the "crumbs" (a crumb is one selected filter).
|
|
13
|
+
|
|
7
14
|
@mixin SelectedFilters(
|
|
8
15
|
$border-radius: variables.$border-radius,
|
|
9
16
|
$title-color: variables.$brand-black,
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
@use "../../helpers/supports-hover";
|
|
6
6
|
@use "sass:map";
|
|
7
7
|
|
|
8
|
+
/// Mixin copy-pasted from @depict-ai/utilishared that helps with positioning slider buttons
|
|
8
9
|
@mixin button_positioning {
|
|
9
10
|
.d-navbutton {
|
|
10
11
|
position: absolute;
|
|
@@ -47,7 +48,14 @@
|
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
|
|
51
|
+
/// Styling for sliders used in the PLP.
|
|
52
|
+
/// Most of the times slider is used for items laid out horizontally that do not fit the screen width.
|
|
53
|
+
///
|
|
54
|
+
/// Examples are the QuickLinks (used to navigate sideways or downwards in the category tree) and the SelectedFilters (if not all selected filters fit on the screen).
|
|
55
|
+
/// @param {Color} $fade-to [variables.$brand-lighter-grey] - The color the slider buttons fade to, set this to the background color behind the slider.
|
|
56
|
+
/// @param {Color} @fade-from [transparent] - The color the slider buttons fade from, you probably want to leave this at transparent.
|
|
50
57
|
@mixin SlidableItems($fade-to: variables.$brand-lighter-grey, $fade-from: rgba(238, 238, 240, 0)) {
|
|
58
|
+
// TODO: we could probably infer these colours (and maybe some more) if we add some global background color variable
|
|
51
59
|
.depict-slider {
|
|
52
60
|
width: 100%;
|
|
53
61
|
position: relative;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
@use "../../../variables";
|
|
2
2
|
@use "../../../helpers/supports-hover";
|
|
3
3
|
|
|
4
|
+
/// Styles the FloatingButtons. FloatingButtons are three buttons, one button to open sorting, one button to open filters and one button to scroll to the top that show up when scrolling upwards for a while on a mobile device not really close to the top of the page.
|
|
5
|
+
/// @param {Color} $button-background [variables.$brand-lighter-grey] - The background color of the buttons.
|
|
6
|
+
/// @param {Color} $hovered-button-background [variables.$brand-lightest-grey] - The background color of the buttons when hovered.
|
|
7
|
+
/// @param {Color} $button-border-color [variables.$brand-black] - The border color of the buttons.
|
|
8
|
+
/// @param {Color} $icon-color [variables.$brand-dark-grey] - The color of the icons.
|
|
9
|
+
/// @param {Number with unit} $bottom-distance [12px] - The distance from the bottom of the buttons to the bottom of the screen.
|
|
10
|
+
/// @param {Number with unit} $side-distance [12px] - The distance from the `$position`-side of the buttons to the `$position`-side of the screen.
|
|
11
|
+
/// @param {"left" | "right"} $position [left] - The side of the screen the buttons should be aligned to.
|
|
12
|
+
|
|
4
13
|
@mixin FloatingButtons(
|
|
5
14
|
$button-background: variables.$brand-lighter-grey,
|
|
6
15
|
$hovered-button-background: variables.$brand-lightest-grey,
|
|
@@ -8,6 +8,63 @@
|
|
|
8
8
|
@use "sass:color";
|
|
9
9
|
@use "sass:map";
|
|
10
10
|
|
|
11
|
+
/// Mixin that styles the sorting and filtering menus.
|
|
12
|
+
/// We probably want to refactor this quite soon so sorry for not writing descriptions
|
|
13
|
+
/// You'll have to look at the code to see what the params do - I hope the names are somewhat descriptive.
|
|
14
|
+
/// @param {Color} $mobile-top-level-collapse-color [variables.$brand-black] -
|
|
15
|
+
/// @param {Color} $mobile-top-level-collapse-background [#fff] -
|
|
16
|
+
/// @param {Color} $custom-input-checked-background [#fff] -
|
|
17
|
+
/// @param {Color} $custom-input-background [#fff] -
|
|
18
|
+
/// @param {Color} $custom-input-indicator-color [variables.$brand-black] -
|
|
19
|
+
/// @param {Color} $checkbox-background-color [#fff] -
|
|
20
|
+
/// @param {Color} $checkbox-checked-background-color [variables.$brand-black] -
|
|
21
|
+
/// @param {Color} $checkbox-checkmark-color [#fff] -
|
|
22
|
+
/// @param {Number with size unit} $checkbox-border-radius [if(variables.$border-radius == 0, 0, if(variables.$border-radius == 0px, 0, 2px))] -
|
|
23
|
+
/// @param {Border} $checkbox-border [1px solid variables.$brand-black] -
|
|
24
|
+
/// @param {Number with size unit} $checkbox-top-offset [0px] -
|
|
25
|
+
/// @param {Number with size unit} $checkbox-left-offset [0px] -
|
|
26
|
+
/// @param {Border} $radio-border [1px solid variables.$brand-black] -
|
|
27
|
+
/// @param {Color} $radio-background-color [#fff] -
|
|
28
|
+
/// @param {Color} $radio-selected-dot-color [variables.$brand-black] -
|
|
29
|
+
/// @param {Number with size unit} $radio-selected-dot-size [14px] -
|
|
30
|
+
/// @param {Number with size unit} $radio-selected-offset [0px] -
|
|
31
|
+
/// @param {Color} $separator-color [variables.$brand-dark-grey] -
|
|
32
|
+
/// @param {Color} $price-range-min-max-text-color [variables.$brand-dark-grey] -
|
|
33
|
+
/// @param {Color} $range-input-bg-color [variables.$brand-lightest-grey] -
|
|
34
|
+
/// @param {Color} $top-level-summary-background [variables.$brand-black] -
|
|
35
|
+
/// @param {Color} $hovered-top-level-summary-background [variables.$brand-dark-grey] -
|
|
36
|
+
/// @param {Color} $hovered-range-input-bg-color [variables.$brand-lighter-grey] -
|
|
37
|
+
/// @param {Color} $hovered-checkbox-bg [variables.$brand-lighter-grey] -
|
|
38
|
+
/// @param {false | Color} $hovered-checkbox-checked-background-color [false] -
|
|
39
|
+
/// @param {Color} $input-row-label-color [variables.$brand-dark-grey] -
|
|
40
|
+
/// @param {Color} $checked-input-row-label-color [#000] -
|
|
41
|
+
/// @param {Number} $input-row-label-font-weight [400] -
|
|
42
|
+
/// @param {Number} $checked-input-row-label-font-weight [500] -
|
|
43
|
+
/// @param {Color} $showing-selected-subfilter-count-color [variables.$brand-grey] -
|
|
44
|
+
/// @param {Color} $filter-available-products-color [variables.$brand-grey] -
|
|
45
|
+
/// @param {Color} $count-zero-input-row-label-color [rgb(194, 194, 194)] -
|
|
46
|
+
/// @param {Number with size unit} $spacing_between_input_rows [10px] -
|
|
47
|
+
/// @param {Number with size unit} $ungrouped-top-margin [25px] -
|
|
48
|
+
/// @param {Border} $hovered-checkbox-border [2px solid variables.$brand-black] -
|
|
49
|
+
/// @param {Border} $hovered-radio-border [2px solid variables.$brand-black] -
|
|
50
|
+
/// @param {Padding} $sort-and-filter-button-padding [10px 20px] -
|
|
51
|
+
/// @param {Color} $expandable-seperator-color [variables.$brand-lightest-grey] -
|
|
52
|
+
/// @param {Color} $expandable-seperator-hover-color [variables.$brand-lighter-grey] -
|
|
53
|
+
/// @param {Number with size unit} $expandable-seperator-height [1px] -
|
|
54
|
+
/// @param {Color} $filter-group-heading-color [#fff] -
|
|
55
|
+
/// @param {Color} $filter-groups-morphing-sign-color [#fff] -
|
|
56
|
+
/// @param {Number with size unit} $filter-group-summary-border-radius [4px] -
|
|
57
|
+
/// @param {Color} $sort-and-filter-modal-background [variables.$brand-lighter-grey] -
|
|
58
|
+
/// @param {Number with size unit} $filter-group-heading-padding [10px] -
|
|
59
|
+
/// @param {Number with size unit} $filter-group-summary-spacings [10px] -
|
|
60
|
+
/// @param {Number with size unit} $range-input-field-border-radius [4px] -
|
|
61
|
+
/// @param {Border} $range-input-field-border [none] -
|
|
62
|
+
/// @param {false | Number} $filter-group-title-bold [false] -
|
|
63
|
+
/// @param {Color} $view-more-clear-background [rgb(253, 253, 253)] -
|
|
64
|
+
/// @param {Color} $filter-collapsible-body-background [rgb(238, 238, 240)] -
|
|
65
|
+
/// @param {Number | Boolean} $sort-and-filter-modal-section-title-font-weight [false] -
|
|
66
|
+
/// @param {Number | Boolean} $sort-and-filter-modal-section-expanded-title-font-weight [$sort-and-filter-modal-section-title-font-weight] -
|
|
67
|
+
|
|
11
68
|
@mixin SortAndFilter(
|
|
12
69
|
$mobile-top-level-collapse-color: variables.$brand-black,
|
|
13
70
|
$mobile-top-level-collapse-background: #fff,
|
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
@use "../../../helpers/supports-hover";
|
|
7
7
|
@use "SortAndFilter";
|
|
8
8
|
|
|
9
|
+
/// A wrapper around SortAndFilter that styles the sorting and filtering menus for the white theme by providing a default set of white variables.
|
|
10
|
+
///
|
|
11
|
+
/// ### Parameters
|
|
12
|
+
/// See [SortAndFilter](#undefined-mixin-SortAndFilter) for parameters.
|
|
9
13
|
@mixin WhiteSortAndFilter(
|
|
10
14
|
$mobile-top-level-collapse-color: variables.$brand-black,
|
|
11
15
|
$mobile-top-level-collapse-background: #fff,
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
@use "../../variables";
|
|
2
2
|
@use "../../helpers/utils";
|
|
3
3
|
|
|
4
|
+
/// Toast is a small, unobtrusive, banner that appears at the bottom of the page when we clear their filters when going sideways in the category tree (or they do it manually). The Toast has a button that allows them to get their filters back (restore them) in case they want it back.
|
|
5
|
+
/// It's a general component otherwise and might also be used for other messages.
|
|
6
|
+
/// @param {Number} $z-index [variables.$base-z-index * 5] - The z-index of the Toast.
|
|
7
|
+
/// @param {Color} $progress-bar-color [variables.$brand-dark-grey] - The color of the progress bar below the toast that shows when it will auto-close.
|
|
8
|
+
|
|
4
9
|
@mixin Toast($z-index: calc(#{variables.$base-z-index} + 5), $progress-bar-color: variables.$brand-dark-grey) {
|
|
5
10
|
.depict.plp.toast {
|
|
6
11
|
position: fixed;
|