@garagem-ai/site-sdk 0.4.0 → 0.4.2
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/README.md +29 -9
- package/dist/index.d.mts +57 -58
- package/dist/index.d.ts +57 -58
- package/dist/index.js +187 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +176 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +33 -6
- package/dist/react.d.ts +33 -6
- package/dist/react.js +573 -486
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +542 -456
- package/dist/react.mjs.map +1 -1
- package/dist/{listing-card-model-D7iR4asd.d.mts → search-engine-D4EZkNrQ.d.mts} +67 -1
- package/dist/{listing-card-model-D7iR4asd.d.ts → search-engine-D4EZkNrQ.d.ts} +67 -1
- package/package.json +9 -4
- package/src/index.ts +15 -0
- package/src/presentation.ts +7 -0
- package/src/react/filter-panel.tsx +39 -42
- package/src/react/icons.tsx +46 -0
- package/src/react/index.ts +7 -1
- package/src/react/listing-card.tsx +61 -106
- package/src/react/search-chrome.tsx +30 -27
- package/src/react/search-page.tsx +210 -111
- package/src/react/search-pagination.tsx +50 -40
- package/src/react/search-query-form.tsx +31 -26
- package/src/react/search.css +717 -0
- package/src/react/styles/index.ts +1 -0
- package/src/react/styles/search-chrome-css.generated.ts +5 -0
- package/src/react/styles/search-chrome-styles.tsx +31 -0
- package/src/react/types.ts +18 -0
- package/src/react/use-public-search.ts +7 -0
- package/src/search-engine.ts +79 -0
- package/src/studio-contract.ts +138 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import type { FormEvent, ReactElement } from "react";
|
|
3
|
+
import type { FormEvent, ReactElement, ReactNode } from "react";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { SearchClearIcon, SearchLensIcon } from "./icons";
|
|
6
6
|
|
|
7
7
|
export type SearchQueryFormProps = {
|
|
8
8
|
value: string;
|
|
@@ -10,6 +10,9 @@ export type SearchQueryFormProps = {
|
|
|
10
10
|
onSubmit: () => void;
|
|
11
11
|
onClear: () => void;
|
|
12
12
|
className?: string;
|
|
13
|
+
iconClassName?: string;
|
|
14
|
+
searchIcon?: ReactNode;
|
|
15
|
+
clearIcon?: ReactNode;
|
|
13
16
|
};
|
|
14
17
|
|
|
15
18
|
export function SearchQueryForm({
|
|
@@ -18,6 +21,9 @@ export function SearchQueryForm({
|
|
|
18
21
|
onSubmit,
|
|
19
22
|
onClear,
|
|
20
23
|
className,
|
|
24
|
+
iconClassName,
|
|
25
|
+
searchIcon,
|
|
26
|
+
clearIcon,
|
|
21
27
|
}: SearchQueryFormProps): ReactElement {
|
|
22
28
|
function handleSubmit(event: FormEvent) {
|
|
23
29
|
event.preventDefault();
|
|
@@ -29,45 +35,44 @@ export function SearchQueryForm({
|
|
|
29
35
|
role="search"
|
|
30
36
|
data-slot="search-query"
|
|
31
37
|
onSubmit={handleSubmit}
|
|
32
|
-
className={
|
|
38
|
+
className={className}
|
|
33
39
|
>
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
className="min-h-12 w-full rounded-xl border border-border bg-background px-4 pr-20 outline-none focus:border-primary"
|
|
52
|
-
/>
|
|
40
|
+
<label htmlFor="garagem-search-q" data-slot="search-label">
|
|
41
|
+
Busca
|
|
42
|
+
</label>
|
|
43
|
+
<div data-slot="search-query-field">
|
|
44
|
+
<input
|
|
45
|
+
id="garagem-search-q"
|
|
46
|
+
name="q"
|
|
47
|
+
type="text"
|
|
48
|
+
inputMode="search"
|
|
49
|
+
autoComplete="off"
|
|
50
|
+
enterKeyHint="search"
|
|
51
|
+
value={value}
|
|
52
|
+
onChange={(event) => onChange(event.target.value)}
|
|
53
|
+
placeholder="Busque por bairro, rua ou código"
|
|
54
|
+
data-slot="search-query-input"
|
|
55
|
+
/>
|
|
56
|
+
<div data-slot="search-query-actions">
|
|
53
57
|
{value ? (
|
|
54
58
|
<button
|
|
55
59
|
type="button"
|
|
56
60
|
title="Limpar busca"
|
|
57
61
|
aria-label="Limpar busca"
|
|
58
62
|
onClick={onClear}
|
|
59
|
-
|
|
63
|
+
data-slot="search-icon-button"
|
|
64
|
+
data-kind="clear"
|
|
60
65
|
>
|
|
61
|
-
|
|
66
|
+
{clearIcon ?? <SearchClearIcon className={iconClassName} />}
|
|
62
67
|
</button>
|
|
63
68
|
) : null}
|
|
64
69
|
<button
|
|
65
70
|
type="submit"
|
|
66
71
|
title="Buscar"
|
|
67
72
|
aria-label="Buscar"
|
|
68
|
-
|
|
73
|
+
data-slot="search-icon-button"
|
|
69
74
|
>
|
|
70
|
-
|
|
75
|
+
{searchIcon ?? <SearchLensIcon className={iconClassName} />}
|
|
71
76
|
</button>
|
|
72
77
|
</div>
|
|
73
78
|
</div>
|