@depict-ai/react-ui 1.5.19 → 2.0.0
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 +149 -69
- package/ES10/index.d.ts +64 -21
- package/ES10/index.js +152 -74
- package/README.md +2 -1
- package/dist/main.js +293 -0
- package/dist/module.js +285 -0
- 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 +117 -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 +95 -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/plain-css-fallback-styling.css +1 -1
- package/dist/styles/variables.scss +47 -0
- package/latest/index.cjs +145 -68
- package/latest/index.d.ts +64 -21
- package/latest/index.js +148 -73
- package/package.json +9 -9
- package/server/ES10/index.cjs +125 -1
- package/server/ES10/index.d.ts +64 -21
- package/server/ES10/index.js +127 -5
- package/server/latest/index.cjs +122 -1
- package/server/latest/index.d.ts +64 -21
- package/server/latest/index.js +124 -5
package/server/latest/index.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { createElement as $eOXet$createElement, useRef as $eOXet$useRef, Fragment as $eOXet$Fragment } from "react";
|
|
2
|
-
import { ImagePlaceholder as $eOXet$ImagePlaceholder, TextPlaceholder as $eOXet$TextPlaceholder } from "@depict-ai/ui/latest";
|
|
3
|
-
import { renderToString as $eOXet$renderToString, generateHydrationScript as $eOXet$generateHydrationScript } from "solid-js/web";
|
|
1
|
+
import { createElement as $eOXet$createElement, useRef as $eOXet$useRef, Fragment as $eOXet$Fragment, useEffect as $eOXet$useEffect, Component as $eOXet$Component } from "react";
|
|
2
|
+
import { ImagePlaceholder as $eOXet$ImagePlaceholder, TextPlaceholder as $eOXet$TextPlaceholder, RecommendationGrid as $eOXet$RecommendationGrid, defaultColsAtSize as $eOXet$defaultColsAtSize, defaultGridSpacing as $eOXet$defaultGridSpacing, ProductCardError as $eOXet$ProductCardError } from "@depict-ai/ui/latest";
|
|
3
|
+
import { renderToString as $eOXet$renderToString, generateHydrationScript as $eOXet$generateHydrationScript, isServer as $eOXet$isServer } from "solid-js/web";
|
|
4
|
+
import { untrack as $eOXet$untrack, getOwner as $eOXet$getOwner, runWithOwner as $eOXet$runWithOwner, onCleanup as $eOXet$onCleanup } from "solid-js";
|
|
5
|
+
import { renderToString as $eOXet$renderToString1 } from "react-dom/server";
|
|
6
|
+
import { jsx as $eOXet$jsx } from "react/jsx-runtime";
|
|
7
|
+
import { createPortal as $eOXet$createPortal } from "react-dom";
|
|
4
8
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
5
9
|
register_es_version("react-ui", "latest");
|
|
6
10
|
function $4568c09979447ab1$export$4b564d7f5a1b1d43({
|
|
@@ -20,7 +24,110 @@ function $4568c09979447ab1$export$4b564d7f5a1b1d43({
|
|
|
20
24
|
}
|
|
21
25
|
}));
|
|
22
26
|
}
|
|
23
|
-
|
|
27
|
+
class $d5c9e1f3545b4984$export$d0f82e3ef89b1f22 extends (0, $eOXet$Component) {
|
|
28
|
+
constructor(props) {
|
|
29
|
+
super(props);
|
|
30
|
+
this.state = {
|
|
31
|
+
hasError: false
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
static getDerivedStateFromError() {
|
|
35
|
+
// Update state so the next render will show the fallback UI.
|
|
36
|
+
return {
|
|
37
|
+
hasError: true
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
componentDidCatch(error) {
|
|
41
|
+
this.props.on_error(error);
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
if (this.state.hasError)
|
|
45
|
+
// You can render any custom fallback UI
|
|
46
|
+
return $eOXet$createElement("div", {
|
|
47
|
+
children: "Component failed"
|
|
48
|
+
});
|
|
49
|
+
return this.props.children;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async function $75f1064c8b836348$export$79c79419c1ef0081({
|
|
53
|
+
display: display,
|
|
54
|
+
component_portals: component_portals,
|
|
55
|
+
set_portals: set_portals,
|
|
56
|
+
react_template: react_template
|
|
57
|
+
}) {
|
|
58
|
+
let set_react_has_ran_hooks;
|
|
59
|
+
let was_cleaned_up = false;
|
|
60
|
+
const react_has_ran_hooks = new Promise(r => set_react_has_ran_hooks = r);
|
|
61
|
+
const solid_container = document.createElement("div");
|
|
62
|
+
const owner = $eOXet$getOwner();
|
|
63
|
+
const reactProductCard = $eOXet$jsx(props => {
|
|
64
|
+
// Sneak in a hook into their product card component to know once react has finished rendering and running hooks
|
|
65
|
+
$eOXet$useEffect(set_react_has_ran_hooks, []);
|
|
66
|
+
return react_template(props);
|
|
67
|
+
}, {
|
|
68
|
+
display: display
|
|
69
|
+
});
|
|
70
|
+
const reactProductCardInErrorBoundary = $eOXet$jsx((0, $d5c9e1f3545b4984$export$d0f82e3ef89b1f22), {
|
|
71
|
+
children: reactProductCard,
|
|
72
|
+
on_error: error => $eOXet$runWithOwner(owner, () => {
|
|
73
|
+
if (was_cleaned_up) return; // Would infinite loop if we'd throw after we've already been cleaned up. That is because the `ErrorBoundary` won't be "registered" with the cleaned-up owner anymore so react would hear about the throw and attempt to re-render the error boundary or something which would throw again, etc.
|
|
74
|
+
throw new (0, $eOXet$ProductCardError)(error);
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
const portal = $eOXet$createPortal(reactProductCardInErrorBoundary, solid_container);
|
|
78
|
+
component_portals.add(portal);
|
|
79
|
+
set_portals([...component_portals]);
|
|
80
|
+
$eOXet$onCleanup(() => {
|
|
81
|
+
was_cleaned_up = true;
|
|
82
|
+
// 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
|
|
83
|
+
component_portals.delete(portal);
|
|
84
|
+
// Updating i.e. the merchant will cause a setState call while rendering the DepictProvider component which is illegal because it usually infinite loops react apps. In our case it doesn't though, so we just evade detection by doing it a microtask later. See also https://github.com/facebook/react/issues/18178#issuecomment-595846312
|
|
85
|
+
queueMicrotask(() => set_portals([...component_portals]));
|
|
86
|
+
});
|
|
87
|
+
await react_has_ran_hooks; // After React has created elements it still takes some time to actually connect the refs and run the hooks. We don't want to replace placeholders before then.
|
|
88
|
+
return [solid_container];
|
|
89
|
+
}
|
|
90
|
+
function $8bee51f55543fe0c$export$bd8acc07a8bae229(props, set_portals) {
|
|
91
|
+
const component_portals = new Set();
|
|
92
|
+
return $eOXet$RecommendationGrid({
|
|
93
|
+
get recommendations() {
|
|
94
|
+
return props.recommendations;
|
|
95
|
+
},
|
|
96
|
+
product_card_template: display => {
|
|
97
|
+
if (0, $eOXet$isServer)
|
|
98
|
+
// This function can't be async on the server
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
return {
|
|
101
|
+
t: $eOXet$renderToString1($eOXet$createElement(() => props.productCard({
|
|
102
|
+
display: display
|
|
103
|
+
})))
|
|
104
|
+
};
|
|
105
|
+
return $75f1064c8b836348$export$79c79419c1ef0081({
|
|
106
|
+
display: display,
|
|
107
|
+
react_template: $eOXet$untrack(() => props.productCard),
|
|
108
|
+
component_portals: component_portals,
|
|
109
|
+
set_portals: set_portals
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
get cols_at_size() {
|
|
113
|
+
return props.columnsAtSize || (0, $eOXet$defaultColsAtSize);
|
|
114
|
+
},
|
|
115
|
+
get grid_spacing() {
|
|
116
|
+
return props.gridSpacing ?? (0, $eOXet$defaultGridSpacing);
|
|
117
|
+
},
|
|
118
|
+
get view_more_button() {
|
|
119
|
+
const {
|
|
120
|
+
viewMoreButton: viewMoreButton
|
|
121
|
+
} = props;
|
|
122
|
+
return viewMoreButton ? {
|
|
123
|
+
text: viewMoreButton.text,
|
|
124
|
+
start_rows: viewMoreButton.startRows ?? 2,
|
|
125
|
+
rows_per_click: viewMoreButton.rowsPerClick
|
|
126
|
+
} : undefined;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "2.0.0";
|
|
24
131
|
function $2b1fdeb83610500f$export$9fac37a9c21c2f3b(props) {
|
|
25
132
|
return props.children;
|
|
26
133
|
}
|
|
@@ -44,6 +151,11 @@ function $2b1fdeb83610500f$export$466cdc317043f6cb() {
|
|
|
44
151
|
children: []
|
|
45
152
|
});
|
|
46
153
|
}
|
|
154
|
+
function $2b1fdeb83610500f$export$82cfdc85a4d15688() {
|
|
155
|
+
return $eOXet$createElement("div", {
|
|
156
|
+
children: []
|
|
157
|
+
});
|
|
158
|
+
}
|
|
47
159
|
function $2b1fdeb83610500f$export$80e99ee6b29cadd2() {
|
|
48
160
|
return $eOXet$createElement("div", {
|
|
49
161
|
className: "depict aligner",
|
|
@@ -63,6 +175,13 @@ function $2b1fdeb83610500f$export$3f37af283f8fb843(raw_react_props) {
|
|
|
63
175
|
wrapper_type: "span"
|
|
64
176
|
});
|
|
65
177
|
}
|
|
178
|
+
function $2b1fdeb83610500f$export$b0a773486c1c2312(props) {
|
|
179
|
+
return $4568c09979447ab1$export$4b564d7f5a1b1d43({
|
|
180
|
+
solid_component: (0, $8bee51f55543fe0c$export$bd8acc07a8bae229),
|
|
181
|
+
props: props,
|
|
182
|
+
wrapper_type: "section"
|
|
183
|
+
});
|
|
184
|
+
}
|
|
66
185
|
function $2b1fdeb83610500f$export$89c6019e4baa40b1(raw_react_props) {
|
|
67
186
|
const react_props = {
|
|
68
187
|
...raw_react_props,
|
|
@@ -110,4 +229,4 @@ function $2b1fdeb83610500f$export$6501da23a2770fc() {
|
|
|
110
229
|
}
|
|
111
230
|
};
|
|
112
231
|
}
|
|
113
|
-
export { $2b1fdeb83610500f$export$9fac37a9c21c2f3b as DepictProvider, $2b1fdeb83610500f$export$a54ec244c8863715 as SearchPage, $2b1fdeb83610500f$export$f7d2f673fc2f091d as CategoryPage, $2b1fdeb83610500f$export$5646050d516e06bc as BreadCrumbs, $2b1fdeb83610500f$export$466cdc317043f6cb as QuickLinks, $2b1fdeb83610500f$export$80e99ee6b29cadd2 as ComponentAligner, $2b1fdeb83610500f$export$3f37af283f8fb843 as ImagePlaceholder, $2b1fdeb83610500f$export$89c6019e4baa40b1 as TextPlaceholder, $2b1fdeb83610500f$export$9bb30bbe003b82e0 as useSearchField, $2b1fdeb83610500f$export$a7f6cffb6b8ba11c as openModal, $2b1fdeb83610500f$export$912994940e660d32 as useSearchModal, $2b1fdeb83610500f$export$38b98fae14bd1f64 as usePerformanceClient, $2b1fdeb83610500f$export$6501da23a2770fc as useFetchRecommendations, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version };
|
|
232
|
+
export { $2b1fdeb83610500f$export$9fac37a9c21c2f3b as DepictProvider, $2b1fdeb83610500f$export$a54ec244c8863715 as SearchPage, $2b1fdeb83610500f$export$f7d2f673fc2f091d as CategoryPage, $2b1fdeb83610500f$export$5646050d516e06bc as BreadCrumbs, $2b1fdeb83610500f$export$466cdc317043f6cb as QuickLinks, $2b1fdeb83610500f$export$82cfdc85a4d15688 as RecommendationSlider, $2b1fdeb83610500f$export$80e99ee6b29cadd2 as ComponentAligner, $2b1fdeb83610500f$export$3f37af283f8fb843 as ImagePlaceholder, $2b1fdeb83610500f$export$b0a773486c1c2312 as RecommendationGrid, $2b1fdeb83610500f$export$89c6019e4baa40b1 as TextPlaceholder, $2b1fdeb83610500f$export$9bb30bbe003b82e0 as useSearchField, $2b1fdeb83610500f$export$a7f6cffb6b8ba11c as openModal, $2b1fdeb83610500f$export$912994940e660d32 as useSearchModal, $2b1fdeb83610500f$export$38b98fae14bd1f64 as usePerformanceClient, $2b1fdeb83610500f$export$6501da23a2770fc as useFetchRecommendations, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version };
|