@depict-ai/react-ui 0.0.26 → 0.0.27

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import { PropsWithChildren, ReactNode } from "react";
2
- import { SDKColsAtSize, SDKGridSpacing } from "@depict-ai/ui";
3
2
  import { Display } from "@depict-ai/utilishared";
3
+ import { SDKColsAtSize, SDKGridSpacing } from "@depict-ai/ui";
4
4
  export function DepictSearchField(): jsx.Element;
5
5
  interface SearchConfig {
6
6
  merchant: string;
@@ -9,13 +9,22 @@ interface SearchConfig {
9
9
  url_param_name?: string;
10
10
  enable_category_suggestions?: boolean;
11
11
  }
12
- export function DepictProvider(props: PropsWithChildren<SearchConfig>): any;
13
- export function DepictSearchHeader(): any;
12
+ export function DepictProvider(props: PropsWithChildren<SearchConfig>): import("react").FunctionComponentElement<{
13
+ children?: import("react").ReactNode;
14
+ }>;
15
+ export function DepictSearchHeader(): import("react").DetailedReactHTMLElement<{
16
+ className: string;
17
+ ref: (e: HTMLElement | null) => HTMLElement | null;
18
+ }, HTMLElement>;
14
19
  export function openModal(): void;
15
20
  interface SearchPageConfig<T extends Display> {
16
- productCard: (display: T) => ReactNode;
21
+ productCard: DepictProductCard<T>;
17
22
  columnsAtSize?: SDKColsAtSize;
18
23
  gridSpacing?: SDKGridSpacing;
19
24
  includeInputField?: boolean;
20
25
  }
21
26
  export function DepictSearchPage<T extends Display>(opts: SearchPageConfig<T>): jsx.Element;
27
+ export interface DepictProductCardProps<T extends Display> {
28
+ display?: T;
29
+ }
30
+ export type DepictProductCard<T extends Display> = (props: DepictProductCardProps<T>) => ReactNode;
package/dist/main.js CHANGED
@@ -17,6 +17,7 @@ $parcel$export(module.exports, "DepictSearchHeader", () => $20bf907adee775ba$exp
17
17
  $parcel$export(module.exports, "DepictSearchPage", () => $a6bedbe4b4d6d027$export$210723f5a54a7028);
18
18
  // This is where the actual source of your React stuff should live
19
19
  // Note, if you add an export here, also add one in src-server/main.ts
20
+ // TypeScript refuses to build when these are defined in SearchPage and re-exported here
20
21
 
21
22
 
22
23
  const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
@@ -253,7 +254,7 @@ function $a6bedbe4b4d6d027$var$SolidSearchPage(props, set_portals) {
253
254
  // Todo: Do we need this?
254
255
  get_product_id: ()=>"",
255
256
  depict_search: depict_search,
256
- product_card_template: async (display)=>{
257
+ product_card_template: async (display, info)=>{
257
258
  const solid_container = document.createElement("div");
258
259
  const react_has_rendered = new Promise((r)=>{
259
260
  const m_o = new MutationObserver(()=>{
@@ -264,7 +265,10 @@ function $a6bedbe4b4d6d027$var$SolidSearchPage(props, set_portals) {
264
265
  childList: true
265
266
  });
266
267
  });
267
- const reactProductCard = (0, $4GYXz$reactjsxruntime.jsx)(props.productCard, display);
268
+ const is_placeholder = info.rendering_options.type === "placeholder";
269
+ const reactProductCard = (0, $4GYXz$reactjsxruntime.jsx)(props.productCard, {
270
+ display: is_placeholder ? null : display
271
+ });
268
272
  const portal = $4GYXz$reactdom.createPortal(reactProductCard, solid_container);
269
273
  component_portals.add(portal);
270
274
  set_portals([
package/dist/module.js CHANGED
@@ -8,6 +8,7 @@ import {createPortal as $TZSbU$createPortal} from "react-dom";
8
8
 
9
9
  // This is where the actual source of your React stuff should live
10
10
  // Note, if you add an export here, also add one in src-server/main.ts
11
+ // TypeScript refuses to build when these are defined in SearchPage and re-exported here
11
12
 
12
13
 
13
14
  const $42858f023ef23dab$export$8e769ad4338a911e = {
@@ -244,7 +245,7 @@ function $9f8d5ef3c016c493$var$SolidSearchPage(props, set_portals) {
244
245
  // Todo: Do we need this?
245
246
  get_product_id: ()=>"",
246
247
  depict_search: depict_search,
247
- product_card_template: async (display)=>{
248
+ product_card_template: async (display, info)=>{
248
249
  const solid_container = document.createElement("div");
249
250
  const react_has_rendered = new Promise((r)=>{
250
251
  const m_o = new MutationObserver(()=>{
@@ -255,7 +256,10 @@ function $9f8d5ef3c016c493$var$SolidSearchPage(props, set_portals) {
255
256
  childList: true
256
257
  });
257
258
  });
258
- const reactProductCard = (0, $TZSbU$jsx)(props.productCard, display);
259
+ const is_placeholder = info.rendering_options.type === "placeholder";
260
+ const reactProductCard = (0, $TZSbU$jsx)(props.productCard, {
261
+ display: is_placeholder ? null : display
262
+ });
259
263
  const portal = $TZSbU$createPortal(reactProductCard, solid_container);
260
264
  component_portals.add(portal);
261
265
  set_portals([
@@ -1,5 +1,7 @@
1
1
  export function DepictProvider(props: any): any;
2
2
  export function DepictSearchField(): any;
3
3
  export function DepictSearchPage(): any;
4
- export function DepictSearchHeader(): any;
4
+ export function DepictSearchHeader(): import("react").DetailedReactHTMLElement<{
5
+ className: string;
6
+ }, HTMLElement>;
5
7
  export function openModal(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/react-ui",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "packageManager": "yarn@3.2.2",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/main.js",
@@ -99,6 +99,8 @@
99
99
  "@parcel/resolver-default": "^2.8.0",
100
100
  "@parcel/transformer-sass": "latest",
101
101
  "@types/node": "^18.11.11",
102
+ "@types/react": "^18.0.26",
103
+ "@types/react-dom": "^18.0.9",
102
104
  "babel-preset-solid": "latest",
103
105
  "jest": "^29.3.1",
104
106
  "jest-haste-map": "^29.3.1",