@depict-ai/react-ui 0.0.93 → 0.0.94

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,388 +1,394 @@
1
- import { BaseProductListingConfig, BaseProviderConfig, BaseSearchProviderConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholderProps, TextPlaceholderProps } from "@depict-ai/ui";
2
- import { Display } from "@depict-ai/utilishared";
3
- import React, { ReactNode, PropsWithChildren, ReactElement } from "react";
4
- import { Locale } from "@depict-ai/ui/locales";
5
- export const version = "0.0.93";
6
- interface PLPConfig<T extends Display> extends BaseProductListingConfig {
7
- /**
8
- * The product card to use for rendering products.
9
- */
10
- productCard: DepictProductCard<T>;
11
- }
12
- /**
13
- * The Depict product card props.
14
- */
15
- export interface DepictProductCardProps<T extends Display> {
16
- /** The display data to render. */
17
- display: T | null;
18
- }
19
- /**
20
- * Depict product card to use for rendering products.
21
- */
22
- export type DepictProductCard<T extends Display> = (props: DepictProductCardProps<T>) => ReactNode;
23
- type NavigateFunction = (relativeUrl: string) => void;
24
- /**
25
- * The config for the DepictProvider.
26
- */
27
- type ProviderConfig = BaseProviderConfig & {
28
- /**
29
- * The function to use for navigating to a new page.
30
- * This function will be used internally by our components to navigate.
31
- *
32
- * You don't need to provide any in a Next.js context.
33
- *
34
- * @param relativeUrl - The relative url to navigate to.
35
- *
36
- * @example
37
- * Here is how you would use it with react-router, @reach/router, Gatsby or similar.
38
- * ```tsx
39
- * import { DepictProvider, Navigation } from "@depict-ai/react-ui";
40
- * import { useNavigate } from "react-router-dom";
41
- * // import { navigate } from "gatsby";
42
- *
43
- * function Router() {
44
- * const navigate = useNavigate();
45
- * return (
46
- * <DepictProvider
47
- * merchant="houdini"
48
- * market="en-de"
49
- * navigateFunction={navigate}
50
- * search={{
51
- * searchPagePath: "/search",
52
- * }}
53
- * >
54
- * <Routes>[...]</Routes>
55
- * </DepictProvider>
56
- * );
57
- * }
58
- * ```
59
- * @example
60
- * If you're using another library, you can define your own navigate function, that's compatible with the `NavigateFunction` type.
61
- * ```tsx
62
- * const navigateFunction = (relativeUrl: string) => {
63
- * router.push(relativeUrl);
64
- * };
65
- * ```
66
- */
67
- navigateFunction?: NavigateFunction;
68
- /**
69
- * The locale to use for the Depict components.
70
- * @default en
71
- */
72
- locale?: Locale;
73
- /**
74
- * Unique ID of the currently logged in user, if applicable.
75
- */
76
- userId?: string;
77
- /**
78
- * Custom metadata to be sent with each request to the Depict API. Only necessary if specifically instructed by Depict.
79
- */
80
- metaData?: Record<string, string>;
81
- search?: BaseSearchProviderConfig;
82
- };
83
- /**
84
- * The DepictProvider is a wrapper component that should be used to wrap any component that uses Depict components.
85
- *
86
- * Make sure it's mounted on every page where the search modal should be available.
87
- *
88
- * @param props - The props for the DepictProvider.
89
- *
90
- * @example
91
- * ```tsx
92
- * const App = () => { *
93
- * return (
94
- * <DepictProvider
95
- * merchant="YOUR_MERCHANT"
96
- * market="YOUR_MARKET"
97
- * search={{
98
- * searchPagePath: "/search",
99
- * }}
100
- * >
101
- * <App />
102
- * </DepictProvider>
103
- * );
104
- * };
105
- * ```
106
- * @returns {JSX.Element} The DepictProvider.
107
- */
108
- export function DepictProvider(props: PropsWithChildren<ProviderConfig>): import("react").FunctionComponentElement<{
109
- children?: import("react").ReactNode;
110
- }>;
111
- /**
112
- * A component used to align other Depict components to.
113
- * @example
114
- * Align the search modal
115
- * ```tsx
116
- * import React from "react";
117
- * import { ComponentAligner, useSearchModal } from "@depict-ai/react-ui";
118
- *
119
- * const App = () => {
120
- * const ref = React.createRef();
121
- *
122
- * const { open } = useSearchModal({
123
- * location: "aligned",
124
- * alignerRef: ref,
125
- * });
126
- *
127
- * return (
128
- * <div>
129
- * <ComponentAligner ref={ref} />
130
- * <button onClick={open}>Open</button>
131
- * </div>
132
- * );
133
- * };
134
- * ```
135
- * @returns {JSX.Element}
136
- */
137
- export const ComponentAligner: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
138
- interface SearchPageConfig<T extends Display> extends BaseSearchPageConfig, PLPConfig<T> {
139
- }
140
- /**
141
- * SearchPage is a component that renders a Depict search results page.
142
- * @param props - The props for the search page.
143
- *
144
- * @example
145
- * ```tsx
146
- * import { DepictProductCard, ImagePlaceholder, Display, SearchPage } from '@depict-ai/react-ui'
147
- *
148
- * function Search() {
149
- * return <SearchPage productCard={MyCustomSearchProductCard} />
150
- * }
151
- *
152
- * interface MyCustomDisplay extends Display {}
153
- *
154
- * export const MyCustomSearchProductCard: DepictProductCard<MyCustomDisplay> = ({
155
- * display,
156
- * }) => {
157
- * if (!display) {
158
- * return <ImagePlaceholder aspectRatio={3 / 4} />
159
- * }
160
- *
161
- * return (
162
- * <>
163
- * <MyCustomProductCard
164
- * product={{
165
- * id: display.product_id,
166
- * name: display.title,
167
- * description: display.title,
168
- * images: [{ url: display.image_url }],
169
- * price: {
170
- * value: display.sale_price,
171
- * },
172
- * }}
173
- * />
174
- * </>
175
- * )
176
- * }
177
- *
178
- * ```
179
- */
180
- export function SearchPage<T extends Display>(props: SearchPageConfig<T>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
181
- interface CategoryPageConfig<T extends Display> extends BaseCategoryPageConfig, PLPConfig<T> {
182
- /**
183
- * The category id to show.
184
- */
185
- categoryId: string;
186
- /**
187
- * categoryTitlePlugin is an optional plugin that can be used to customize the title of the category page.
188
- * @default CategoryTitle
189
- *
190
- * @example
191
- * ```tsx
192
- * <CategoryPage categoryId="jeans" productCard={MyCustomCategoryProductCard} categoryTitlePlugin={CategoryTitle} />
193
- * ```
194
- */
195
- categoryTitlePlugin?: typeof CategoryTitle | typeof embedded_num_products;
196
- }
197
- /**
198
- * CategoryPage is a component that renders a Depict category page.
199
- * @param props the props for the category page.
200
- *
201
- * @example
202
- * ```tsx
203
- * import { DepictProductCard, ImagePlaceholder, Display, CategoryPage } from '@depict-ai/react-ui'
204
- *
205
- * function Category() {
206
- * return <CategoryPage categoryId="jeans" productCard={MyCustomCategoryProductCard} />
207
- * }
208
- *
209
- * interface MyCustomDisplay extends Display {}
210
- *
211
- * export const MyCustomCategoryProductCard: DepictProductCard<MyCustomDisplay> = ({
212
- * display,
213
- * }) => {
214
- * if (!display) {
215
- * return <ImagePlaceholder aspectRatio={3 / 4} />
216
- * }
217
- *
218
- * return (
219
- * <>
220
- * <MyCustomProductCard
221
- * product={{
222
- * id: display.product_id,
223
- * name: display.title,
224
- * description: display.title,
225
- * images: [{ url: display.image_url }],
226
- * price: {
227
- * value: display.sale_price,
228
- * },
229
- * }}
230
- * />
231
- * </>
232
- * )
233
- * }
234
- * ```
235
- */
236
- export function CategoryPage<T extends Display>(props: CategoryPageConfig<T>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
237
- /**
238
- * BreadCrumbs is the "trail" in the header of a category page.
239
- */
240
- export function BreadCrumbs(): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
241
- /**
242
- * QuickLinks is a component enabling the user to go sideways and downwards in the category tree.
243
- */
244
- export function QuickLinks(): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
245
- /**
246
- * A placeholder image that can be used in place of an image that is loading.
247
- * @param props
248
- * @returns
249
- */
250
- export const ImagePlaceholder: React.FC<ImagePlaceholderProps>;
251
- /** A placeholder text that can be used in place of a text that is loading. */
252
- export const TextPlaceholder: React.FC<TextPlaceholderProps>;
253
- /**
254
- * Parameters to configure the search modal.
255
- */
256
- interface UseSearchModalParams {
257
- /**
258
- * How the modal should be opened.
259
- * Will default to "centered" if nothing else is specified.
260
- * - "centered" - The modal will be opened in the center of the screen.
261
- * - "aligned" - The modal will be opened aligned to the alignerRef element.
262
- */
263
- location?: ModalLocation;
264
- /**
265
- * The ref to the element that the modal should be aligned to.
266
- * This is only used when location is "aligned".
267
- * @default undefined
268
- * @example
269
- * ```tsx
270
- import React from "react";
271
- import { ComponentAligner, useSearchModal } from "@depict-ai/react-ui";
272
-
273
- const App = () => {
274
- const ref = React.createRef();
275
-
276
- const { open } = useSearchModal({
277
- location: "aligned",
278
- alignerRef: ref,
279
- });
280
-
281
- return (
282
- <div>
283
- <ComponentAligner ref={ref} />
284
- <button onClick={open}>Open</button>
285
- </div>
286
- );
287
- };
288
- * ```
289
- */
290
- alignerRef?: React.RefObject<HTMLElement>;
291
- }
292
- type OpenModal = () => void;
293
- /**
294
- * How the modal should be opened.
295
- */
296
- type ModalLocation = "centered" | "aligned";
297
- interface UseSearchModalReturn {
298
- open: OpenModal;
299
- }
300
- /**
301
- * Hook used to open the search modal.
302
- * @example
303
- * Open a centered modal:
304
- * ```tsx
305
- * import React from "react";
306
- * import { useSearchModal } from "@depict-ai/react-ui";
307
- *
308
- * const App = () => {
309
- * const { open } = useSearchModal({
310
- * location: "centered",
311
- * });
312
- *
313
- * return (
314
- * <div>
315
- * <button onClick={open}>Open</button>
316
- * </div>
317
- * );
318
- * };
319
- * ```
320
- * @returns {JSX.Element}
321
- */
322
- export function useSearchModal(params?: UseSearchModalParams): UseSearchModalReturn;
323
- interface SearchFieldProps {
324
- /**
325
- * A reference to the DOM element that the modal should be aligned to.
326
- *
327
- * The top of the modal will be aligned to the top of the element.
328
- *
329
- * The height of the search field in the modal will be the same as the height of the element.
330
- * If not provided, the modal will be aligned to the search field itself.
331
- */
332
- alignerRef?: React.RefObject<HTMLElement>;
333
- }
334
- interface UseSearchFieldReturn {
335
- /**
336
- * A React component that renders the search field.
337
- */
338
- SearchField: () => ReactElement;
339
- }
340
- /**
341
- * Hook used to configure the Depict search field.
342
- * @example
343
- * Render a search field that opens a modal aligned to the search field itself:
344
- * ```tsx
345
- * import React from "react";
346
- * import { useSearchField } from "@depict-ai/react-ui";
347
- *
348
- * const App = () => {
349
- * const { SearchField } = useSearchField();
350
- *
351
- * return (
352
- * <div>
353
- * <SearchField />
354
- * </div>
355
- * );
356
- * };
357
- * ```
358
- * @example
359
- * Render a search field that opens a modal aligned another DOM element:
360
- * ```tsx
361
- * import React from "react";
362
- * import { ComponentAligner, useSearchField } from "@depict-ai/react-ui";
363
- *
364
- * const App = () => {
365
- * const ref = useRef(null);
366
- * const { SearchField } = useSearchField({
367
- * alignerRef: ref
368
- * });
369
- *
370
- * return (
371
- * <div>
372
- * <ComponentAligner ref={ref} />
373
- * <SearchField />
374
- * </div>
375
- * );
376
- * };
377
- * ```
378
- * @returns {JSX.Element}
379
- */
380
- export const useSearchField: (props?: SearchFieldProps) => UseSearchFieldReturn;
381
- /**
382
- * Helper function to navigate to a new page depending on the navigation library used.
383
- */
384
- export const Navigation: {
385
- nextRouterNavigation: (router: import("next/router").NextRouter) => (relativeUrl: string) => void;
386
- };
387
- export { CategoryTitle, embedded_num_products as EmbeddedNumProducts } from "@depict-ai/ui";
388
- export type { Locale } from "@depict-ai/ui/locales";
1
+ import { BaseProductListingConfig, BaseProviderConfig, BaseSearchProviderConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholderProps, TextPlaceholderProps } from "@depict-ai/ui";
2
+ import { Display } from "@depict-ai/utilishared";
3
+ import React, { ReactNode, PropsWithChildren, ReactElement } from "react";
4
+ import { Locale } from "@depict-ai/ui/locales";
5
+ export const version = "0.0.94";
6
+ interface PLPConfig<T extends Display> extends BaseProductListingConfig {
7
+ /**
8
+ * The product card to use for rendering products.
9
+ */
10
+ productCard: DepictProductCard<T>;
11
+ }
12
+ /**
13
+ * The Depict product card props.
14
+ */
15
+ export interface DepictProductCardProps<T extends Display> {
16
+ /** The display data to render. */
17
+ display: T | null;
18
+ }
19
+ /**
20
+ * Depict product card to use for rendering products.
21
+ */
22
+ export type DepictProductCard<T extends Display> = (props: DepictProductCardProps<T>) => ReactNode;
23
+ /**
24
+ * relativeUrl: The relative url to navigate to.
25
+ * replace: Whether to replace the current url or push a new one.
26
+ */
27
+ type NavigateFunction = (relativeUrl: string, { replace }: {
28
+ replace: any;
29
+ }) => void;
30
+ /**
31
+ * The config for the DepictProvider.
32
+ */
33
+ type ProviderConfig = BaseProviderConfig & {
34
+ /**
35
+ * The function to use for navigating to a new page.
36
+ * This function will be used internally by our components to navigate.
37
+ *
38
+ * You don't need to provide any in a Next.js context.
39
+ *
40
+ * @param relativeUrl - The relative url to navigate to.
41
+ *
42
+ * @example
43
+ * Here is how you would use it with react-router, @reach/router, Gatsby or similar.
44
+ * ```tsx
45
+ * import { DepictProvider, Navigation } from "@depict-ai/react-ui";
46
+ * import { useNavigate } from "react-router-dom";
47
+ * // import { navigate } from "gatsby";
48
+ *
49
+ * function Router() {
50
+ * const navigate = useNavigate();
51
+ * return (
52
+ * <DepictProvider
53
+ * merchant="houdini"
54
+ * market="en-de"
55
+ * navigateFunction={navigate}
56
+ * search={{
57
+ * searchPagePath: "/search",
58
+ * }}
59
+ * >
60
+ * <Routes>[...]</Routes>
61
+ * </DepictProvider>
62
+ * );
63
+ * }
64
+ * ```
65
+ * @example
66
+ * If you're using another library, you can define your own navigate function, that's compatible with the `NavigateFunction` type.
67
+ * ```tsx
68
+ * const navigateFunction = (relativeUrl: string) => {
69
+ * router.push(relativeUrl);
70
+ * };
71
+ * ```
72
+ */
73
+ navigateFunction?: NavigateFunction;
74
+ /**
75
+ * The locale to use for the Depict components.
76
+ * @default en
77
+ */
78
+ locale?: Locale;
79
+ /**
80
+ * Unique ID of the currently logged in user, if applicable.
81
+ */
82
+ userId?: string;
83
+ /**
84
+ * Custom metadata to be sent with each request to the Depict API. Only necessary if specifically instructed by Depict.
85
+ */
86
+ metaData?: Record<string, string>;
87
+ search?: BaseSearchProviderConfig;
88
+ };
89
+ /**
90
+ * The DepictProvider is a wrapper component that should be used to wrap any component that uses Depict components.
91
+ *
92
+ * Make sure it's mounted on every page where the search modal should be available.
93
+ *
94
+ * @param props - The props for the DepictProvider.
95
+ *
96
+ * @example
97
+ * ```tsx
98
+ * const App = () => { *
99
+ * return (
100
+ * <DepictProvider
101
+ * merchant="YOUR_MERCHANT"
102
+ * market="YOUR_MARKET"
103
+ * search={{
104
+ * searchPagePath: "/search",
105
+ * }}
106
+ * >
107
+ * <App />
108
+ * </DepictProvider>
109
+ * );
110
+ * };
111
+ * ```
112
+ * @returns {JSX.Element} The DepictProvider.
113
+ */
114
+ export function DepictProvider(props: PropsWithChildren<ProviderConfig>): import("react").FunctionComponentElement<{
115
+ children?: import("react").ReactNode;
116
+ }>;
117
+ /**
118
+ * A component used to align other Depict components to.
119
+ * @example
120
+ * Align the search modal
121
+ * ```tsx
122
+ * import React from "react";
123
+ * import { ComponentAligner, useSearchModal } from "@depict-ai/react-ui";
124
+ *
125
+ * const App = () => {
126
+ * const ref = React.createRef();
127
+ *
128
+ * const { open } = useSearchModal({
129
+ * location: "aligned",
130
+ * alignerRef: ref,
131
+ * });
132
+ *
133
+ * return (
134
+ * <div>
135
+ * <ComponentAligner ref={ref} />
136
+ * <button onClick={open}>Open</button>
137
+ * </div>
138
+ * );
139
+ * };
140
+ * ```
141
+ * @returns {JSX.Element}
142
+ */
143
+ export const ComponentAligner: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
144
+ interface SearchPageConfig<T extends Display> extends BaseSearchPageConfig, PLPConfig<T> {
145
+ }
146
+ /**
147
+ * SearchPage is a component that renders a Depict search results page.
148
+ * @param props - The props for the search page.
149
+ *
150
+ * @example
151
+ * ```tsx
152
+ * import { DepictProductCard, ImagePlaceholder, Display, SearchPage } from '@depict-ai/react-ui'
153
+ *
154
+ * function Search() {
155
+ * return <SearchPage productCard={MyCustomSearchProductCard} />
156
+ * }
157
+ *
158
+ * interface MyCustomDisplay extends Display {}
159
+ *
160
+ * export const MyCustomSearchProductCard: DepictProductCard<MyCustomDisplay> = ({
161
+ * display,
162
+ * }) => {
163
+ * if (!display) {
164
+ * return <ImagePlaceholder aspectRatio={3 / 4} />
165
+ * }
166
+ *
167
+ * return (
168
+ * <>
169
+ * <MyCustomProductCard
170
+ * product={{
171
+ * id: display.product_id,
172
+ * name: display.title,
173
+ * description: display.title,
174
+ * images: [{ url: display.image_url }],
175
+ * price: {
176
+ * value: display.sale_price,
177
+ * },
178
+ * }}
179
+ * />
180
+ * </>
181
+ * )
182
+ * }
183
+ *
184
+ * ```
185
+ */
186
+ export function SearchPage<T extends Display>(props: SearchPageConfig<T>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
187
+ interface CategoryPageConfig<T extends Display> extends BaseCategoryPageConfig, PLPConfig<T> {
188
+ /**
189
+ * The category id to show.
190
+ */
191
+ categoryId: string;
192
+ /**
193
+ * categoryTitlePlugin is an optional plugin that can be used to customize the title of the category page.
194
+ * @default CategoryTitle
195
+ *
196
+ * @example
197
+ * ```tsx
198
+ * <CategoryPage categoryId="jeans" productCard={MyCustomCategoryProductCard} categoryTitlePlugin={CategoryTitle} />
199
+ * ```
200
+ */
201
+ categoryTitlePlugin?: typeof CategoryTitle | typeof embedded_num_products;
202
+ }
203
+ /**
204
+ * CategoryPage is a component that renders a Depict category page.
205
+ * @param props the props for the category page.
206
+ *
207
+ * @example
208
+ * ```tsx
209
+ * import { DepictProductCard, ImagePlaceholder, Display, CategoryPage } from '@depict-ai/react-ui'
210
+ *
211
+ * function Category() {
212
+ * return <CategoryPage categoryId="jeans" productCard={MyCustomCategoryProductCard} />
213
+ * }
214
+ *
215
+ * interface MyCustomDisplay extends Display {}
216
+ *
217
+ * export const MyCustomCategoryProductCard: DepictProductCard<MyCustomDisplay> = ({
218
+ * display,
219
+ * }) => {
220
+ * if (!display) {
221
+ * return <ImagePlaceholder aspectRatio={3 / 4} />
222
+ * }
223
+ *
224
+ * return (
225
+ * <>
226
+ * <MyCustomProductCard
227
+ * product={{
228
+ * id: display.product_id,
229
+ * name: display.title,
230
+ * description: display.title,
231
+ * images: [{ url: display.image_url }],
232
+ * price: {
233
+ * value: display.sale_price,
234
+ * },
235
+ * }}
236
+ * />
237
+ * </>
238
+ * )
239
+ * }
240
+ * ```
241
+ */
242
+ export function CategoryPage<T extends Display>(props: CategoryPageConfig<T>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
243
+ /**
244
+ * BreadCrumbs is the "trail" in the header of a category page.
245
+ */
246
+ export function BreadCrumbs(): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
247
+ /**
248
+ * QuickLinks is a component enabling the user to go sideways and downwards in the category tree.
249
+ */
250
+ export function QuickLinks(): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
251
+ /**
252
+ * A placeholder image that can be used in place of an image that is loading.
253
+ * @param props
254
+ * @returns
255
+ */
256
+ export const ImagePlaceholder: React.FC<ImagePlaceholderProps>;
257
+ /** A placeholder text that can be used in place of a text that is loading. */
258
+ export const TextPlaceholder: React.FC<TextPlaceholderProps>;
259
+ /**
260
+ * Parameters to configure the search modal.
261
+ */
262
+ interface UseSearchModalParams {
263
+ /**
264
+ * How the modal should be opened.
265
+ * Will default to "centered" if nothing else is specified.
266
+ * - "centered" - The modal will be opened in the center of the screen.
267
+ * - "aligned" - The modal will be opened aligned to the alignerRef element.
268
+ */
269
+ location?: ModalLocation;
270
+ /**
271
+ * The ref to the element that the modal should be aligned to.
272
+ * This is only used when location is "aligned".
273
+ * @default undefined
274
+ * @example
275
+ * ```tsx
276
+ import React from "react";
277
+ import { ComponentAligner, useSearchModal } from "@depict-ai/react-ui";
278
+
279
+ const App = () => {
280
+ const ref = React.createRef();
281
+
282
+ const { open } = useSearchModal({
283
+ location: "aligned",
284
+ alignerRef: ref,
285
+ });
286
+
287
+ return (
288
+ <div>
289
+ <ComponentAligner ref={ref} />
290
+ <button onClick={open}>Open</button>
291
+ </div>
292
+ );
293
+ };
294
+ * ```
295
+ */
296
+ alignerRef?: React.RefObject<HTMLElement>;
297
+ }
298
+ type OpenModal = () => void;
299
+ /**
300
+ * How the modal should be opened.
301
+ */
302
+ type ModalLocation = "centered" | "aligned";
303
+ interface UseSearchModalReturn {
304
+ open: OpenModal;
305
+ }
306
+ /**
307
+ * Hook used to open the search modal.
308
+ * @example
309
+ * Open a centered modal:
310
+ * ```tsx
311
+ * import React from "react";
312
+ * import { useSearchModal } from "@depict-ai/react-ui";
313
+ *
314
+ * const App = () => {
315
+ * const { open } = useSearchModal({
316
+ * location: "centered",
317
+ * });
318
+ *
319
+ * return (
320
+ * <div>
321
+ * <button onClick={open}>Open</button>
322
+ * </div>
323
+ * );
324
+ * };
325
+ * ```
326
+ * @returns {JSX.Element}
327
+ */
328
+ export function useSearchModal(params?: UseSearchModalParams): UseSearchModalReturn;
329
+ interface SearchFieldProps {
330
+ /**
331
+ * A reference to the DOM element that the modal should be aligned to.
332
+ *
333
+ * The top of the modal will be aligned to the top of the element.
334
+ *
335
+ * The height of the search field in the modal will be the same as the height of the element.
336
+ * If not provided, the modal will be aligned to the search field itself.
337
+ */
338
+ alignerRef?: React.RefObject<HTMLElement>;
339
+ }
340
+ interface UseSearchFieldReturn {
341
+ /**
342
+ * A React component that renders the search field.
343
+ */
344
+ SearchField: () => ReactElement;
345
+ }
346
+ /**
347
+ * Hook used to configure the Depict search field.
348
+ * @example
349
+ * Render a search field that opens a modal aligned to the search field itself:
350
+ * ```tsx
351
+ * import React from "react";
352
+ * import { useSearchField } from "@depict-ai/react-ui";
353
+ *
354
+ * const App = () => {
355
+ * const { SearchField } = useSearchField();
356
+ *
357
+ * return (
358
+ * <div>
359
+ * <SearchField />
360
+ * </div>
361
+ * );
362
+ * };
363
+ * ```
364
+ * @example
365
+ * Render a search field that opens a modal aligned another DOM element:
366
+ * ```tsx
367
+ * import React from "react";
368
+ * import { ComponentAligner, useSearchField } from "@depict-ai/react-ui";
369
+ *
370
+ * const App = () => {
371
+ * const ref = useRef(null);
372
+ * const { SearchField } = useSearchField({
373
+ * alignerRef: ref
374
+ * });
375
+ *
376
+ * return (
377
+ * <div>
378
+ * <ComponentAligner ref={ref} />
379
+ * <SearchField />
380
+ * </div>
381
+ * );
382
+ * };
383
+ * ```
384
+ * @returns {JSX.Element}
385
+ */
386
+ export const useSearchField: (props?: SearchFieldProps) => UseSearchFieldReturn;
387
+ /**
388
+ * Helper function to navigate to a new page depending on the navigation library used.
389
+ */
390
+ export const Navigation: {
391
+ nextRouterNavigation: (router: import("next/router").NextRouter) => (relativeUrl: string) => void;
392
+ };
393
+ export { CategoryTitle, embedded_num_products as EmbeddedNumProducts } from "@depict-ai/ui";
394
+ export type { Locale } from "@depict-ai/ui/locales";