@depict-ai/react-ui 1.5.20 → 2.0.1
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 +152 -69
- package/ES10/index.d.ts +549 -37
- package/ES10/index.js +155 -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 +148 -68
- package/latest/index.d.ts +549 -37
- package/latest/index.js +151 -73
- package/package.json +9 -9
- package/server/ES10/index.cjs +128 -1
- package/server/ES10/index.d.ts +549 -37
- package/server/ES10/index.js +130 -5
- package/server/latest/index.cjs +125 -1
- package/server/latest/index.d.ts +549 -37
- package/server/latest/index.js +127 -5
package/ES10/index.cjs
CHANGED
|
@@ -4,10 +4,11 @@ var $2kiy7$solidjs = require("solid-js");
|
|
|
4
4
|
var $2kiy7$react = require("react");
|
|
5
5
|
var $2kiy7$depictaiuilocales = require("@depict-ai/ui/locales/ES10");
|
|
6
6
|
var $2kiy7$solidjsweb = require("solid-js/web");
|
|
7
|
-
var $2kiy7$reactjsxruntime = require("react/jsx-runtime");
|
|
8
|
-
var $2kiy7$reactdom = require("react-dom");
|
|
9
7
|
var $2kiy7$solidjsstore = require("solid-js/store");
|
|
10
8
|
var $2kiy7$depictaidpc = require("@depict-ai/dpc/ES10");
|
|
9
|
+
var $2kiy7$reactjsxruntime = require("react/jsx-runtime");
|
|
10
|
+
var $2kiy7$reactdom = require("react-dom");
|
|
11
|
+
var $2kiy7$reactdomserver = require("react-dom/server");
|
|
11
12
|
require("../multi_import_deduplicator.cjs").register_es_version("react-ui", "ES10");
|
|
12
13
|
function $parcel$export(e, n, v, s) {
|
|
13
14
|
Object.defineProperty(e, n, {
|
|
@@ -25,6 +26,8 @@ $parcel$export(module.exports, "CategoryPage", () => $15691268d8df90a9$export$f7
|
|
|
25
26
|
$parcel$export(module.exports, "SearchPage", () => $735104b46c50160f$export$a54ec244c8863715);
|
|
26
27
|
$parcel$export(module.exports, "ImagePlaceholder", () => $95af6193353bea10$export$3f37af283f8fb843);
|
|
27
28
|
$parcel$export(module.exports, "TextPlaceholder", () => $07e1b96355935829$export$89c6019e4baa40b1);
|
|
29
|
+
$parcel$export(module.exports, "RecommendationGrid", () => $8f89f8a832210d6b$export$b0a773486c1c2312);
|
|
30
|
+
$parcel$export(module.exports, "RecommendationSlider", () => $745b83c12baac3c0$export$82cfdc85a4d15688);
|
|
28
31
|
$parcel$export(module.exports, "useSearchModal", () => $0991f250194bf9f3$export$912994940e660d32);
|
|
29
32
|
$parcel$export(module.exports, "useSearchField", () => $fea6ed5be1bf2b27$export$9bb30bbe003b82e0);
|
|
30
33
|
$parcel$export(module.exports, "useFetchRecommendations", () => $2ea1d71b29581906$export$6501da23a2770fc);
|
|
@@ -35,7 +38,7 @@ $parcel$export(module.exports, "version", () => $efbdd2dab4314170$export$83d89fb
|
|
|
35
38
|
$parcel$export(module.exports, "Navigation", () => $0d3a2413fdeb34b9$export$b8a61e5c71402559);
|
|
36
39
|
/*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
|
|
37
40
|
// Note, if you add an export here, also add one in src-server/main.ts
|
|
38
|
-
const $efbdd2dab4314170$export$83d89fbfd8236492 = "
|
|
41
|
+
const $efbdd2dab4314170$export$83d89fbfd8236492 = "2.0.1";
|
|
39
42
|
const $ef516b1f92253963$export$8e769ad4338a911e = {
|
|
40
43
|
usedLocale: $2kiy7$solidjs.createSignal((0, $2kiy7$depictaiuilocales.defaultLocale)),
|
|
41
44
|
search_instances: new Map(),
|
|
@@ -55,31 +58,6 @@ const $ef516b1f92253963$export$8e769ad4338a911e = {
|
|
|
55
58
|
category_meta_title_suffix: $2kiy7$solidjs.createSignal(),
|
|
56
59
|
disable_override_query_id: $2kiy7$solidjs.createSignal()
|
|
57
60
|
};
|
|
58
|
-
class $e9048b15cf1e8792$export$d0f82e3ef89b1f22 extends (0, $2kiy7$react.Component) {
|
|
59
|
-
constructor(props) {
|
|
60
|
-
super(props);
|
|
61
|
-
this.state = {
|
|
62
|
-
hasError: false
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
static getDerivedStateFromError() {
|
|
66
|
-
// Update state so the next render will show the fallback UI.
|
|
67
|
-
return {
|
|
68
|
-
hasError: true
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
componentDidCatch(error) {
|
|
72
|
-
this.props.on_error(error);
|
|
73
|
-
}
|
|
74
|
-
render() {
|
|
75
|
-
if (this.state.hasError)
|
|
76
|
-
// You can render any custom fallback UI
|
|
77
|
-
return $2kiy7$react.createElement("div", {
|
|
78
|
-
children: "Component failed"
|
|
79
|
-
});
|
|
80
|
-
return this.props.children;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
61
|
let $e7ba61a7074c02d3$var$run_on_href_change;
|
|
84
62
|
let $e7ba61a7074c02d3$var$old_href = location.href;
|
|
85
63
|
function $e7ba61a7074c02d3$export$74f3924c5027fe1d(cb) {
|
|
@@ -156,45 +134,6 @@ function $e7ba61a7074c02d3$export$e5139bbbb9a05035(component, is_set) {
|
|
|
156
134
|
});
|
|
157
135
|
};
|
|
158
136
|
}
|
|
159
|
-
async function $e7ba61a7074c02d3$export$79c79419c1ef0081(_ref2) {
|
|
160
|
-
let {
|
|
161
|
-
display: display,
|
|
162
|
-
component_portals: component_portals,
|
|
163
|
-
set_portals: set_portals,
|
|
164
|
-
react_template: react_template
|
|
165
|
-
} = _ref2;
|
|
166
|
-
let set_react_has_ran_hooks;
|
|
167
|
-
let was_cleaned_up = false;
|
|
168
|
-
const react_has_ran_hooks = new Promise(r => set_react_has_ran_hooks = r);
|
|
169
|
-
const solid_container = document.createElement("div");
|
|
170
|
-
const owner = $2kiy7$solidjs.getOwner();
|
|
171
|
-
const reactProductCard = $2kiy7$reactjsxruntime.jsx(props => {
|
|
172
|
-
// Sneak in a hook into their product card component to know once react has finished rendering and running hooks
|
|
173
|
-
$2kiy7$react.useEffect(set_react_has_ran_hooks, []);
|
|
174
|
-
return react_template(props);
|
|
175
|
-
}, {
|
|
176
|
-
display: display
|
|
177
|
-
});
|
|
178
|
-
const reactProductCardInErrorBoundary = $2kiy7$reactjsxruntime.jsx((0, $e9048b15cf1e8792$export$d0f82e3ef89b1f22), {
|
|
179
|
-
children: reactProductCard,
|
|
180
|
-
on_error: error => $2kiy7$solidjs.runWithOwner(owner, () => {
|
|
181
|
-
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.
|
|
182
|
-
throw new (0, $2kiy7$depictaiui.ProductCardError)(error);
|
|
183
|
-
})
|
|
184
|
-
});
|
|
185
|
-
const portal = $2kiy7$reactdom.createPortal(reactProductCardInErrorBoundary, solid_container);
|
|
186
|
-
component_portals.add(portal);
|
|
187
|
-
set_portals([...component_portals]);
|
|
188
|
-
$2kiy7$solidjs.onCleanup(() => {
|
|
189
|
-
was_cleaned_up = true;
|
|
190
|
-
// 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
|
|
191
|
-
component_portals.delete(portal);
|
|
192
|
-
// 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
|
|
193
|
-
queueMicrotask(() => set_portals([...component_portals]));
|
|
194
|
-
});
|
|
195
|
-
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.
|
|
196
|
-
return [solid_container];
|
|
197
|
-
}
|
|
198
137
|
let $abe6528d061993d2$var$set = false;
|
|
199
138
|
let $abe6528d061993d2$var$padding_animation;
|
|
200
139
|
function $abe6528d061993d2$export$6453cbc34515a94d() {
|
|
@@ -546,6 +485,70 @@ function $fe70497a7dcbe63d$export$f4d89133c6985668(type, stateKey, componentName
|
|
|
546
485
|
});
|
|
547
486
|
return instance.instance;
|
|
548
487
|
}
|
|
488
|
+
class $e9048b15cf1e8792$export$d0f82e3ef89b1f22 extends (0, $2kiy7$react.Component) {
|
|
489
|
+
constructor(props) {
|
|
490
|
+
super(props);
|
|
491
|
+
this.state = {
|
|
492
|
+
hasError: false
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
static getDerivedStateFromError() {
|
|
496
|
+
// Update state so the next render will show the fallback UI.
|
|
497
|
+
return {
|
|
498
|
+
hasError: true
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
componentDidCatch(error) {
|
|
502
|
+
this.props.on_error(error);
|
|
503
|
+
}
|
|
504
|
+
render() {
|
|
505
|
+
if (this.state.hasError)
|
|
506
|
+
// You can render any custom fallback UI
|
|
507
|
+
return $2kiy7$react.createElement("div", {
|
|
508
|
+
children: "Component failed"
|
|
509
|
+
});
|
|
510
|
+
return this.props.children;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
async function $99405615baa3d774$export$79c79419c1ef0081(_ref) {
|
|
514
|
+
let {
|
|
515
|
+
display: display,
|
|
516
|
+
component_portals: component_portals,
|
|
517
|
+
set_portals: set_portals,
|
|
518
|
+
react_template: react_template
|
|
519
|
+
} = _ref;
|
|
520
|
+
let set_react_has_ran_hooks;
|
|
521
|
+
let was_cleaned_up = false;
|
|
522
|
+
const react_has_ran_hooks = new Promise(r => set_react_has_ran_hooks = r);
|
|
523
|
+
const solid_container = document.createElement("div");
|
|
524
|
+
const owner = $2kiy7$solidjs.getOwner();
|
|
525
|
+
const reactProductCard = $2kiy7$reactjsxruntime.jsx(props => {
|
|
526
|
+
// Sneak in a hook into their product card component to know once react has finished rendering and running hooks
|
|
527
|
+
$2kiy7$react.useEffect(set_react_has_ran_hooks, []);
|
|
528
|
+
return react_template(props);
|
|
529
|
+
}, {
|
|
530
|
+
display: display
|
|
531
|
+
});
|
|
532
|
+
const reactProductCardInErrorBoundary = $2kiy7$reactjsxruntime.jsx((0, $e9048b15cf1e8792$export$d0f82e3ef89b1f22), {
|
|
533
|
+
children: reactProductCard,
|
|
534
|
+
on_error: error => $2kiy7$solidjs.runWithOwner(owner, () => {
|
|
535
|
+
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.
|
|
536
|
+
throw new (0, $2kiy7$depictaiui.ProductCardError)(error);
|
|
537
|
+
})
|
|
538
|
+
});
|
|
539
|
+
const portal = $2kiy7$reactdom.createPortal(reactProductCardInErrorBoundary, solid_container);
|
|
540
|
+
component_portals.add(portal);
|
|
541
|
+
set_portals([...component_portals]);
|
|
542
|
+
$2kiy7$solidjs.onCleanup(() => {
|
|
543
|
+
was_cleaned_up = true;
|
|
544
|
+
// 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
|
|
545
|
+
component_portals.delete(portal);
|
|
546
|
+
// 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
|
|
547
|
+
queueMicrotask(() => set_portals([...component_portals]));
|
|
548
|
+
});
|
|
549
|
+
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.
|
|
550
|
+
return [solid_container];
|
|
551
|
+
}
|
|
549
552
|
const $735104b46c50160f$var$rendered_components_with_state_key = new Set();
|
|
550
553
|
function $735104b46c50160f$export$a54ec244c8863715(props) {
|
|
551
554
|
return $e7ba61a7074c02d3$export$f6e64e17bd69eeef({
|
|
@@ -610,7 +613,7 @@ function $735104b46c50160f$var$SolidSearchPage(props, set_portals) {
|
|
|
610
613
|
return (_props$gridSpacing = props.gridSpacing) !== null && _props$gridSpacing !== void 0 ? _props$gridSpacing : (0, $2kiy7$depictaiui.defaultGridSpacing);
|
|
611
614
|
},
|
|
612
615
|
depict_search: depict_search(),
|
|
613
|
-
product_card_template: display => $
|
|
616
|
+
product_card_template: display => $99405615baa3d774$export$79c79419c1ef0081({
|
|
614
617
|
display: display,
|
|
615
618
|
react_template: $2kiy7$solidjs.untrack(() => props.productCard),
|
|
616
619
|
component_portals: component_portals,
|
|
@@ -691,7 +694,7 @@ function $15691268d8df90a9$var$SolidCategoryPage(props, set_portals) {
|
|
|
691
694
|
get show_quicklinks() {
|
|
692
695
|
return props.showQuicklinks;
|
|
693
696
|
},
|
|
694
|
-
product_card_template: display => $
|
|
697
|
+
product_card_template: display => $99405615baa3d774$export$79c79419c1ef0081({
|
|
695
698
|
display: display,
|
|
696
699
|
react_template: $2kiy7$solidjs.untrack(() => props.productCard),
|
|
697
700
|
component_portals: component_portals,
|
|
@@ -759,6 +762,86 @@ const $07e1b96355935829$export$89c6019e4baa40b1 = raw_react_props => {
|
|
|
759
762
|
}
|
|
760
763
|
});
|
|
761
764
|
};
|
|
765
|
+
function $745b83c12baac3c0$export$82cfdc85a4d15688(props) {
|
|
766
|
+
return $e7ba61a7074c02d3$export$f6e64e17bd69eeef({
|
|
767
|
+
solid_component: $745b83c12baac3c0$export$5abb40edfde2a843,
|
|
768
|
+
props: props
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
function $745b83c12baac3c0$export$5abb40edfde2a843(props, set_portals) {
|
|
772
|
+
const component_portals = new Set();
|
|
773
|
+
return $2kiy7$depictaiui.RecommendationSlider({
|
|
774
|
+
get recommendations() {
|
|
775
|
+
return props.recommendations;
|
|
776
|
+
},
|
|
777
|
+
product_card_template: display => $99405615baa3d774$export$79c79419c1ef0081({
|
|
778
|
+
display: display,
|
|
779
|
+
react_template: $2kiy7$solidjs.untrack(() => props.productCard),
|
|
780
|
+
component_portals: component_portals,
|
|
781
|
+
set_portals: set_portals
|
|
782
|
+
}),
|
|
783
|
+
get cols_at_size() {
|
|
784
|
+
return props.columnsAtSize || (0, $2kiy7$depictaiui.defaultColsAtSize);
|
|
785
|
+
},
|
|
786
|
+
get grid_spacing() {
|
|
787
|
+
var _props$gridSpacing;
|
|
788
|
+
return (_props$gridSpacing = props.gridSpacing) !== null && _props$gridSpacing !== void 0 ? _props$gridSpacing : (0, $2kiy7$depictaiui.defaultGridSpacing);
|
|
789
|
+
}
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
function $27d583018ba6e604$export$bd8acc07a8bae229(props, set_portals) {
|
|
793
|
+
const component_portals = new Set();
|
|
794
|
+
return $2kiy7$depictaiui.RecommendationGrid({
|
|
795
|
+
get recommendations() {
|
|
796
|
+
return props.recommendations;
|
|
797
|
+
},
|
|
798
|
+
product_card_template: display => {
|
|
799
|
+
if (0, $2kiy7$solidjsweb.isServer)
|
|
800
|
+
// This function can't be async on the server
|
|
801
|
+
// @ts-ignore
|
|
802
|
+
return {
|
|
803
|
+
t: $2kiy7$reactdomserver.renderToString($2kiy7$react.createElement(() => props.productCard({
|
|
804
|
+
display: display
|
|
805
|
+
})))
|
|
806
|
+
};
|
|
807
|
+
return $99405615baa3d774$export$79c79419c1ef0081({
|
|
808
|
+
display: display,
|
|
809
|
+
react_template: $2kiy7$solidjs.untrack(() => props.productCard),
|
|
810
|
+
component_portals: component_portals,
|
|
811
|
+
set_portals: set_portals
|
|
812
|
+
});
|
|
813
|
+
},
|
|
814
|
+
get cols_at_size() {
|
|
815
|
+
return props.columnsAtSize || (0, $2kiy7$depictaiui.defaultColsAtSize);
|
|
816
|
+
},
|
|
817
|
+
get grid_spacing() {
|
|
818
|
+
var _props$gridSpacing;
|
|
819
|
+
return (_props$gridSpacing = props.gridSpacing) !== null && _props$gridSpacing !== void 0 ? _props$gridSpacing : (0, $2kiy7$depictaiui.defaultGridSpacing);
|
|
820
|
+
},
|
|
821
|
+
get max_rows() {
|
|
822
|
+
return props.maxRows;
|
|
823
|
+
},
|
|
824
|
+
get view_more_button() {
|
|
825
|
+
var _viewMoreButton$start;
|
|
826
|
+
const {
|
|
827
|
+
viewMoreButton: viewMoreButton
|
|
828
|
+
} = props;
|
|
829
|
+
return viewMoreButton ? {
|
|
830
|
+
text: viewMoreButton.text,
|
|
831
|
+
start_rows: (_viewMoreButton$start = viewMoreButton.startRows) !== null && _viewMoreButton$start !== void 0 ? _viewMoreButton$start : 2,
|
|
832
|
+
rows_per_click: viewMoreButton.rowsPerClick
|
|
833
|
+
} : undefined;
|
|
834
|
+
}
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
function $8f89f8a832210d6b$export$b0a773486c1c2312(props) {
|
|
838
|
+
return $e7ba61a7074c02d3$export$f6e64e17bd69eeef({
|
|
839
|
+
solid_component: (0, $27d583018ba6e604$export$bd8acc07a8bae229),
|
|
840
|
+
props: props,
|
|
841
|
+
hydrate_function_when_ssr: (0, $2kiy7$solidjsweb.hydrate),
|
|
842
|
+
wrapper_type: "section"
|
|
843
|
+
});
|
|
844
|
+
}
|
|
762
845
|
const $205fe657e57228d5$export$d69d8daa20eae175 = createOpenModalParams => {
|
|
763
846
|
const {
|
|
764
847
|
location = "centered",
|