@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
package/dist/react.d.mts
CHANGED
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
import { ReactNode, CSSProperties, ReactElement } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { r as Listing, t as ListingCardModel, e as SearchUi, j as SearchPathFilters, A as AppliedSearchQuery, y as LocationNameTables, E as SearchUiFilter } from './search-engine-D4EZkNrQ.mjs';
|
|
3
3
|
|
|
4
4
|
type SearchPageVariant = "toolbar" | "dialog" | "sidebar";
|
|
5
5
|
type SearchPageClassNames = {
|
|
6
6
|
root?: string;
|
|
7
7
|
header?: string;
|
|
8
|
+
heading?: string;
|
|
9
|
+
headingCount?: string;
|
|
10
|
+
headingTitle?: string;
|
|
8
11
|
toolbar?: string;
|
|
12
|
+
toolbarTrigger?: string;
|
|
13
|
+
popover?: string;
|
|
9
14
|
query?: string;
|
|
15
|
+
sort?: string;
|
|
16
|
+
icon?: string;
|
|
10
17
|
sidebar?: string;
|
|
11
18
|
dialog?: string;
|
|
19
|
+
dialogOverlay?: string;
|
|
20
|
+
dialogPanel?: string;
|
|
12
21
|
grid?: string;
|
|
13
22
|
card?: string;
|
|
14
23
|
pagination?: string;
|
|
15
24
|
applyBar?: string;
|
|
25
|
+
skeleton?: string;
|
|
26
|
+
checkbox?: string;
|
|
27
|
+
};
|
|
28
|
+
type SearchPageIcons = {
|
|
29
|
+
search?: ReactNode;
|
|
30
|
+
clear?: ReactNode;
|
|
16
31
|
};
|
|
17
32
|
type ListingCardClassNames = {
|
|
18
33
|
root?: string;
|
|
@@ -68,6 +83,7 @@ type PublicSearchState = {
|
|
|
68
83
|
setSort: (sort: string | null) => void;
|
|
69
84
|
hrefForPage: (page: number) => string;
|
|
70
85
|
go: (href: string) => void;
|
|
86
|
+
locationNames: LocationNameTables | null;
|
|
71
87
|
};
|
|
72
88
|
|
|
73
89
|
declare function ListingCard({ listing, href, className, classNames, slots, style, }: ListingCardProps): ReactElement;
|
|
@@ -79,17 +95,21 @@ type SearchPageProps = {
|
|
|
79
95
|
className?: string;
|
|
80
96
|
classNames?: SearchPageClassNames;
|
|
81
97
|
heading?: ReactNode;
|
|
98
|
+
icons?: SearchPageIcons;
|
|
82
99
|
listingCard?: typeof ListingCard;
|
|
83
100
|
};
|
|
84
|
-
declare function SearchPage({ siteId, baseUrl, variant, className, classNames, heading, listingCard: Card, }: SearchPageProps): ReactElement;
|
|
101
|
+
declare function SearchPage({ siteId, baseUrl, variant, className, classNames, heading, icons, listingCard: Card, }: SearchPageProps): ReactElement;
|
|
102
|
+
|
|
103
|
+
declare function SearchChromeStyles(): ReactElement | null;
|
|
85
104
|
|
|
86
105
|
type SearchPaginationProps = {
|
|
87
106
|
page: number;
|
|
88
107
|
totalPages: number;
|
|
89
108
|
hrefForPage: (page: number) => string;
|
|
109
|
+
onNavigate?: (href: string) => void;
|
|
90
110
|
className?: string;
|
|
91
111
|
};
|
|
92
|
-
declare function SearchPagination({ page, totalPages, hrefForPage, className, }: SearchPaginationProps): ReactElement | null;
|
|
112
|
+
declare function SearchPagination({ page, totalPages, hrefForPage, onNavigate, className, }: SearchPaginationProps): ReactElement | null;
|
|
93
113
|
|
|
94
114
|
type SearchQueryFormProps = {
|
|
95
115
|
value: string;
|
|
@@ -97,9 +117,13 @@ type SearchQueryFormProps = {
|
|
|
97
117
|
onSubmit: () => void;
|
|
98
118
|
onClear: () => void;
|
|
99
119
|
className?: string;
|
|
120
|
+
iconClassName?: string;
|
|
121
|
+
searchIcon?: ReactNode;
|
|
122
|
+
clearIcon?: ReactNode;
|
|
100
123
|
};
|
|
101
|
-
declare function SearchQueryForm({ value, onChange, onSubmit, onClear, className, }: SearchQueryFormProps): ReactElement;
|
|
124
|
+
declare function SearchQueryForm({ value, onChange, onSubmit, onClear, className, iconClassName, searchIcon, clearIcon, }: SearchQueryFormProps): ReactElement;
|
|
102
125
|
|
|
126
|
+
type RangeCommitSource = "blur" | "enter" | "apply";
|
|
103
127
|
type FilterPanelProps = {
|
|
104
128
|
filters: SearchUiFilter[];
|
|
105
129
|
pathFilters: SearchPathFilters;
|
|
@@ -109,7 +133,7 @@ type FilterPanelProps = {
|
|
|
109
133
|
max: string;
|
|
110
134
|
}>;
|
|
111
135
|
onRangePatch: (filterId: string, side: "min" | "max", value: string) => void;
|
|
112
|
-
onRangeCommit: (filterId: string) => void;
|
|
136
|
+
onRangeCommit: (filterId: string, source?: RangeCommitSource) => void;
|
|
113
137
|
};
|
|
114
138
|
declare function FilterPanel({ filters, pathFilters, onChange, rangeDraft, onRangePatch, onRangeCommit, }: FilterPanelProps): ReactElement;
|
|
115
139
|
declare function rangeDraftFromPath(pathFilters: SearchPathFilters): Record<string, {
|
|
@@ -130,7 +154,10 @@ declare function SearchSortSelect({ value, onChange, sorts, className, }: Search
|
|
|
130
154
|
declare function ResultsSkeleton({ className, }: {
|
|
131
155
|
className?: string;
|
|
132
156
|
}): ReactElement;
|
|
157
|
+
declare function SearchPageFallback({ className, }: {
|
|
158
|
+
className?: string;
|
|
159
|
+
}): ReactElement;
|
|
133
160
|
|
|
134
161
|
declare function usePublicSearch(options: UsePublicSearchOptions): PublicSearchState;
|
|
135
162
|
|
|
136
|
-
export { FilterPanel, ListingCard, type ListingCardClassNames, type ListingCardProps, type ListingCardSlots, type PublicSearchState, ResultsSkeleton, SearchPage, type SearchPageClassNames, type SearchPageProps, type SearchPageVariant, SearchPagination, SearchQueryForm, SearchSortSelect, type SiteIdInput, type UsePublicSearchOptions, rangeDraftFromPath, usePublicSearch };
|
|
163
|
+
export { FilterPanel, ListingCard, type ListingCardClassNames, type ListingCardProps, type ListingCardSlots, type PublicSearchState, ResultsSkeleton, SearchChromeStyles, SearchPage, type SearchPageClassNames, SearchPageFallback, type SearchPageIcons, type SearchPageProps, type SearchPageVariant, SearchPagination, SearchQueryForm, SearchSortSelect, type SiteIdInput, type UsePublicSearchOptions, rangeDraftFromPath, usePublicSearch };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
import { ReactNode, CSSProperties, ReactElement } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { r as Listing, t as ListingCardModel, e as SearchUi, j as SearchPathFilters, A as AppliedSearchQuery, y as LocationNameTables, E as SearchUiFilter } from './search-engine-D4EZkNrQ.js';
|
|
3
3
|
|
|
4
4
|
type SearchPageVariant = "toolbar" | "dialog" | "sidebar";
|
|
5
5
|
type SearchPageClassNames = {
|
|
6
6
|
root?: string;
|
|
7
7
|
header?: string;
|
|
8
|
+
heading?: string;
|
|
9
|
+
headingCount?: string;
|
|
10
|
+
headingTitle?: string;
|
|
8
11
|
toolbar?: string;
|
|
12
|
+
toolbarTrigger?: string;
|
|
13
|
+
popover?: string;
|
|
9
14
|
query?: string;
|
|
15
|
+
sort?: string;
|
|
16
|
+
icon?: string;
|
|
10
17
|
sidebar?: string;
|
|
11
18
|
dialog?: string;
|
|
19
|
+
dialogOverlay?: string;
|
|
20
|
+
dialogPanel?: string;
|
|
12
21
|
grid?: string;
|
|
13
22
|
card?: string;
|
|
14
23
|
pagination?: string;
|
|
15
24
|
applyBar?: string;
|
|
25
|
+
skeleton?: string;
|
|
26
|
+
checkbox?: string;
|
|
27
|
+
};
|
|
28
|
+
type SearchPageIcons = {
|
|
29
|
+
search?: ReactNode;
|
|
30
|
+
clear?: ReactNode;
|
|
16
31
|
};
|
|
17
32
|
type ListingCardClassNames = {
|
|
18
33
|
root?: string;
|
|
@@ -68,6 +83,7 @@ type PublicSearchState = {
|
|
|
68
83
|
setSort: (sort: string | null) => void;
|
|
69
84
|
hrefForPage: (page: number) => string;
|
|
70
85
|
go: (href: string) => void;
|
|
86
|
+
locationNames: LocationNameTables | null;
|
|
71
87
|
};
|
|
72
88
|
|
|
73
89
|
declare function ListingCard({ listing, href, className, classNames, slots, style, }: ListingCardProps): ReactElement;
|
|
@@ -79,17 +95,21 @@ type SearchPageProps = {
|
|
|
79
95
|
className?: string;
|
|
80
96
|
classNames?: SearchPageClassNames;
|
|
81
97
|
heading?: ReactNode;
|
|
98
|
+
icons?: SearchPageIcons;
|
|
82
99
|
listingCard?: typeof ListingCard;
|
|
83
100
|
};
|
|
84
|
-
declare function SearchPage({ siteId, baseUrl, variant, className, classNames, heading, listingCard: Card, }: SearchPageProps): ReactElement;
|
|
101
|
+
declare function SearchPage({ siteId, baseUrl, variant, className, classNames, heading, icons, listingCard: Card, }: SearchPageProps): ReactElement;
|
|
102
|
+
|
|
103
|
+
declare function SearchChromeStyles(): ReactElement | null;
|
|
85
104
|
|
|
86
105
|
type SearchPaginationProps = {
|
|
87
106
|
page: number;
|
|
88
107
|
totalPages: number;
|
|
89
108
|
hrefForPage: (page: number) => string;
|
|
109
|
+
onNavigate?: (href: string) => void;
|
|
90
110
|
className?: string;
|
|
91
111
|
};
|
|
92
|
-
declare function SearchPagination({ page, totalPages, hrefForPage, className, }: SearchPaginationProps): ReactElement | null;
|
|
112
|
+
declare function SearchPagination({ page, totalPages, hrefForPage, onNavigate, className, }: SearchPaginationProps): ReactElement | null;
|
|
93
113
|
|
|
94
114
|
type SearchQueryFormProps = {
|
|
95
115
|
value: string;
|
|
@@ -97,9 +117,13 @@ type SearchQueryFormProps = {
|
|
|
97
117
|
onSubmit: () => void;
|
|
98
118
|
onClear: () => void;
|
|
99
119
|
className?: string;
|
|
120
|
+
iconClassName?: string;
|
|
121
|
+
searchIcon?: ReactNode;
|
|
122
|
+
clearIcon?: ReactNode;
|
|
100
123
|
};
|
|
101
|
-
declare function SearchQueryForm({ value, onChange, onSubmit, onClear, className, }: SearchQueryFormProps): ReactElement;
|
|
124
|
+
declare function SearchQueryForm({ value, onChange, onSubmit, onClear, className, iconClassName, searchIcon, clearIcon, }: SearchQueryFormProps): ReactElement;
|
|
102
125
|
|
|
126
|
+
type RangeCommitSource = "blur" | "enter" | "apply";
|
|
103
127
|
type FilterPanelProps = {
|
|
104
128
|
filters: SearchUiFilter[];
|
|
105
129
|
pathFilters: SearchPathFilters;
|
|
@@ -109,7 +133,7 @@ type FilterPanelProps = {
|
|
|
109
133
|
max: string;
|
|
110
134
|
}>;
|
|
111
135
|
onRangePatch: (filterId: string, side: "min" | "max", value: string) => void;
|
|
112
|
-
onRangeCommit: (filterId: string) => void;
|
|
136
|
+
onRangeCommit: (filterId: string, source?: RangeCommitSource) => void;
|
|
113
137
|
};
|
|
114
138
|
declare function FilterPanel({ filters, pathFilters, onChange, rangeDraft, onRangePatch, onRangeCommit, }: FilterPanelProps): ReactElement;
|
|
115
139
|
declare function rangeDraftFromPath(pathFilters: SearchPathFilters): Record<string, {
|
|
@@ -130,7 +154,10 @@ declare function SearchSortSelect({ value, onChange, sorts, className, }: Search
|
|
|
130
154
|
declare function ResultsSkeleton({ className, }: {
|
|
131
155
|
className?: string;
|
|
132
156
|
}): ReactElement;
|
|
157
|
+
declare function SearchPageFallback({ className, }: {
|
|
158
|
+
className?: string;
|
|
159
|
+
}): ReactElement;
|
|
133
160
|
|
|
134
161
|
declare function usePublicSearch(options: UsePublicSearchOptions): PublicSearchState;
|
|
135
162
|
|
|
136
|
-
export { FilterPanel, ListingCard, type ListingCardClassNames, type ListingCardProps, type ListingCardSlots, type PublicSearchState, ResultsSkeleton, SearchPage, type SearchPageClassNames, type SearchPageProps, type SearchPageVariant, SearchPagination, SearchQueryForm, SearchSortSelect, type SiteIdInput, type UsePublicSearchOptions, rangeDraftFromPath, usePublicSearch };
|
|
163
|
+
export { FilterPanel, ListingCard, type ListingCardClassNames, type ListingCardProps, type ListingCardSlots, type PublicSearchState, ResultsSkeleton, SearchChromeStyles, SearchPage, type SearchPageClassNames, SearchPageFallback, type SearchPageIcons, type SearchPageProps, type SearchPageVariant, SearchPagination, SearchQueryForm, SearchSortSelect, type SiteIdInput, type UsePublicSearchOptions, rangeDraftFromPath, usePublicSearch };
|