@garagem-ai/site-sdk 0.4.1 → 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 +21 -34
- package/dist/index.d.mts +51 -1
- package/dist/index.d.ts +51 -1
- package/dist/index.js +128 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +119 -0
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +212 -179
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +155 -122
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +13 -0
- package/src/react/listing-card.tsx +64 -52
- package/src/react/search-chrome.tsx +14 -12
- package/src/react/styles/search-chrome-css.generated.ts +1 -1
- package/src/react/styles/search-chrome-styles.tsx +22 -3
- package/src/studio-contract.ts +138 -0
package/dist/react.js
CHANGED
|
@@ -150,6 +150,33 @@ function cn(...parts) {
|
|
|
150
150
|
return parts.filter(Boolean).join(" ");
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
// src/react/styles/search-chrome-styles.tsx
|
|
154
|
+
var import_react = require("react");
|
|
155
|
+
|
|
156
|
+
// src/react/styles/search-chrome-css.generated.ts
|
|
157
|
+
var SEARCH_CHROME_CSS_VERSION = "0.4.2";
|
|
158
|
+
var SEARCH_CHROME_CSS = `:root{--garagem-listing-card-radius:0.75rem;--garagem-listing-card-gap:1.5rem;--garagem-listing-price-size:1.125rem;--garagem-listing-media-ratio:4 / 3;--garagem-search-control-height:2.75rem;--garagem-search-icon-size:1.25rem;--garagem-search-radius:var(--radius,0.75rem);--garagem-skeleton:var(--muted,#e7e5e4)}[data-slot="search-page"]{margin-inline:auto;max-width:80rem;padding:3rem 1.5rem}[data-slot="search-heading"]{display:flex;min-width:0;align-items:baseline;gap:0.375rem;font-size:1.25rem;font-weight:600}[data-slot="search-heading-count"]{flex-shrink:0}[data-slot="search-heading-title"]{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:inherit;font-weight:inherit}[data-slot="search-query-sort"]{display:flex;flex-direction:column;gap:1rem}@media (min-width:1024px){[data-slot="search-query-sort"]{flex-direction:row;align-items:flex-end}}[data-slot="search-query"]{flex:1;min-width:0}[data-slot="search-query-input"],[data-slot="search-sort-trigger"],[data-slot="search-toolbar-trigger"],[data-slot="search-filters-trigger"]{min-height:var(--garagem-search-control-height)}[data-slot="search-query-field"]{position:relative}[data-slot="search-query-input"]{width:100%;border-radius:var(--garagem-search-radius);border:1px solid var(--border,#e4e4e7);background:var(--background,#fff);padding:0.5rem 5.5rem 0.5rem 1rem;outline:none}[data-slot="search-query-actions"]{position:absolute;top:50%;right:0.35rem;display:flex;transform:translateY(-50%);align-items:center;gap:0.15rem}[data-slot="search-icon-button"]{display:inline-flex;height:2.25rem;width:2.25rem;cursor:pointer;align-items:center;justify-content:center;border:0;border-radius:999px;background:var(--primary,#111);color:var(--primary-foreground,#fff)}[data-slot="search-icon-button"][data-kind="clear"]{background:transparent;color:var(--muted-foreground,#737373)}[data-slot="search-icon"]{width:var(--garagem-search-icon-size);height:var(--garagem-search-icon-size);display:block}[data-slot="search-sort"]{display:flex;flex-direction:column;gap:0.25rem}[data-slot="search-sort-trigger"]{appearance:none;cursor:pointer;border-radius:var(--garagem-search-radius);border:1px solid var(--border,#e4e4e7);background:var(--background,#fff);padding:0.5rem 2.25rem 0.5rem 0.75rem;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23737373' stroke-width='2' viewBox='0 0 24 24'><path d='m6 9 6 6 6-6'/></svg>");background-repeat:no-repeat;background-position:right 0.65rem center}[data-slot="search-toolbar"]{display:flex;flex-wrap:wrap;align-items:flex-end;gap:0.5rem}[data-slot="search-toolbar-trigger"],[data-slot="search-filters-trigger"]{cursor:pointer;border-radius:var(--garagem-search-radius);border:1px solid var(--border,#e4e4e7);background:var(--background,#fff);padding:0.5rem 0.75rem;font-size:0.875rem}[data-slot="search-popover"]{position:absolute;z-index:30;margin-top:0.5rem;width:18rem;border-radius:0.75rem;border:1px solid var(--border,#e4e4e7);background:var(--background,#fff);padding:1rem;box-shadow:0 10px 30px rgb(0 0 0 / 0.12);animation:garagem-search-in 140ms ease-out}[data-slot="search-grid"],[data-slot="search-skeleton"]{display:grid;grid-template-columns:1fr;gap:var(--garagem-listing-card-gap)}@media (min-width:640px){[data-slot="search-grid"],[data-slot="search-skeleton"]{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:1024px){[data-slot="search-grid"],[data-slot="search-skeleton"]{grid-template-columns:repeat(3,minmax(0,1fr))}}[data-slot="listing-card"]{overflow:hidden;border-radius:var(--garagem-listing-card-radius);border:1px solid var(--border,#e4e4e7);background:var(--card,var(--background,#fff))}[data-slot="listing-card-price-row"]{display:inline-flex;align-items:baseline;gap:0.25rem}[data-slot="listing-card-price"]{font-size:var(--garagem-listing-price-size);font-weight:600}[data-slot="listing-card-period"]{font-size:0.75rem;color:var(--muted-foreground,#737373)}[data-slot="search-checkbox"]{appearance:none;width:1.15rem;height:1.15rem;flex-shrink:0;cursor:pointer;border:1px solid var(--primary,#111);border-radius:0.25rem;background:var(--background,#fff)}[data-slot="search-checkbox"]:checked{background-color:var(--primary,#111);background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'><path d='M5 12l5 5L20 7'/></svg>");background-repeat:no-repeat;background-position:center;background-size:0.8rem}[data-slot="search-scroll"]{max-height:12rem;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--muted-foreground,#a1a1aa) transparent}[data-slot="search-range-apply"]{display:inline-flex;min-height:2.5rem;cursor:pointer;align-items:center;justify-content:center;border:0;border-radius:var(--garagem-search-radius);background:var(--primary,#111);color:var(--primary-foreground,#fff);padding:0 0.75rem;font-size:0.75rem;font-weight:600}[data-slot="search-sheet"]{position:fixed;inset:0;z-index:40}[data-slot="search-sheet-overlay"]{position:absolute;inset:0;border:0;cursor:pointer;background:rgb(0 0 0 / 0.4);animation:garagem-search-fade 160ms ease-out}[data-slot="search-sheet-panel"]{position:absolute;top:0;right:0;display:flex;height:100dvh;width:min(22rem,100%);flex-direction:column;background:var(--background,#fff);animation:garagem-search-sheet 180ms ease-out}[data-slot="search-sheet-body"]{min-height:0;flex:1;overflow:auto;padding:1.5rem 1.5rem 0;scrollbar-width:thin}[data-slot="search-sheet-footer"]{display:flex;gap:0.5rem;border-top:1px solid var(--border,#e4e4e7);padding:1rem 1.5rem}[data-slot="search-apply-bar"]{display:flex;width:100%;gap:0.5rem}[data-slot="search-apply-bar"] > button{min-height:2.5rem;flex:1;cursor:pointer;border-radius:var(--garagem-search-radius);padding:0 1rem}[data-slot="search-apply-bar"] > button[data-kind="clear"]{border:1px solid var(--border,#e4e4e7);background:transparent}[data-slot="search-apply-bar"] > button[data-kind="apply"]{border:0;background:var(--primary,#111);color:var(--primary-foreground,#fff);font-weight:600}[data-slot="search-pagination"]{margin-top:2.5rem;display:flex;justify-content:center}[data-slot="search-pagination"] ul{display:flex;flex-wrap:wrap;justify-content:center;gap:0.25rem;padding:0;margin:0;list-style:none}[data-slot="search-pagination-item"]{display:inline-flex;width:2.25rem;height:2.25rem;align-items:center;justify-content:center;border:1px solid var(--border,#e4e4e7);border-radius:0.375rem;font-size:0.75rem;font-weight:500}@media (min-width:768px){[data-slot="search-pagination-item"]{width:2.5rem;height:2.5rem}}[data-slot="search-pagination-item"] a,[data-slot="search-pagination-item"] span{display:flex;width:100%;height:100%;align-items:center;justify-content:center;color:inherit;text-decoration:none}[data-slot="search-pagination-item"][data-current="true"]{background:var(--primary,#111);color:var(--primary-foreground,#fff)}[data-slot="search-pagination-item"][data-disabled="true"]{cursor:not-allowed;color:var(--muted-foreground,#737373)}[data-slot="search-toolbar-item"]{position:relative}[data-slot="search-body"]{margin-top:2rem;display:flex;flex-direction:column;gap:1.5rem}[data-slot="search-label"]{margin-bottom:0.25rem;display:block;font-size:0.875rem;color:var(--muted-foreground,#737373)}[data-slot="search-sheet-title"]{padding:1.5rem 1.5rem 0;font-size:1.125rem;font-weight:600}[data-slot="search-layout"]{display:grid;gap:2rem}[data-slot="search-sidebar"]{display:none}[data-slot="search-layout"] > div > [data-slot="search-filters-trigger"]{margin-bottom:1rem}@media (min-width:1024px){[data-slot="search-layout"]{grid-template-columns:280px minmax(0,1fr)}[data-slot="search-sidebar"]{display:block;position:sticky;top:1.5rem;align-self:start}[data-slot="search-layout"] > div > [data-slot="search-filters-trigger"]{display:none}}[data-slot="listing-card-link"]{display:block;color:inherit;text-decoration:none;cursor:pointer}[data-slot="listing-card-media"]{position:relative;width:100%;overflow:hidden;background:var(--muted,#f5f5f4);aspect-ratio:var(--garagem-listing-media-ratio)}[data-slot="listing-card-media"] img{height:100%;width:100%;object-fit:cover;transition:transform 0.3s}[data-slot="listing-card"]:hover [data-slot="listing-card-media"] img{transform:scale(1.05)}@media (prefers-reduced-motion:reduce){[data-slot="listing-card-media"] img{transition:none}[data-slot="listing-card"]:hover [data-slot="listing-card-media"] img{transform:none}}[data-slot="listing-card-empty"]{display:flex;height:100%;width:100%;align-items:center;justify-content:center;font-size:0.75rem;color:var(--muted-foreground,#737373)}[data-slot="listing-card-cta"]{margin-top:0.75rem}[data-slot="search-filters"]{display:flex;flex-direction:column;gap:1.25rem}[data-slot="search-filter"]{margin:0;padding:0;border:0;font-size:0.875rem}[data-slot="search-filter"] legend{margin-bottom:0.5rem;padding:0;color:var(--muted-foreground,#737373)}[data-slot="search-range-row"]{display:flex;align-items:flex-end;gap:0.5rem}[data-slot="search-range-side"]{min-width:0;flex:1}[data-slot="search-range-side"] > span:first-child{margin-bottom:0.25rem;display:block;font-size:0.75rem;color:var(--muted-foreground,#737373)}[data-slot="search-range-affix"]{position:relative;display:block}[data-slot="search-range-prefix"]{pointer-events:none;position:absolute;inset-block:0;left:0;display:flex;align-items:center;padding-left:0.75rem;color:var(--muted-foreground,#737373)}[data-slot="search-range-input"]{min-height:2.5rem;width:100%;border-radius:var(--garagem-search-radius);border:1px solid var(--border,#e4e4e7);background:var(--background,#fff);padding:0 0.75rem}[data-slot="search-range-affix"] [data-slot="search-range-input"]{padding-left:2.5rem}[data-slot="search-count-group"]{display:flex;flex-wrap:wrap;gap:0.375rem}[data-slot="search-count-choice"]{min-height:2.5rem;cursor:pointer;border-radius:var(--garagem-search-radius);border:1px solid var(--border,#e4e4e7);background:var(--background,#fff);padding:0 0.75rem;font-size:0.875rem}[data-slot="search-count-choice"][data-selected="true"]{border-color:var(--primary,#111);background:color-mix(in srgb,var(--primary,#111) 10%,transparent)}[data-slot="search-enum-list"],[data-slot="search-scroll"]{display:flex;flex-direction:column;gap:0.375rem}[data-slot="search-enum-option"]{display:flex;cursor:pointer;align-items:center;gap:0.5rem}[data-slot="listing-card-badge"]{position:absolute;left:0.75rem;top:0.75rem;border-radius:999px;background:color-mix(in srgb,var(--background,#fff) 90%,transparent);padding:0.25rem 0.5rem;font-size:0.75rem;font-weight:500}[data-slot="listing-card-body"]{padding:1rem}[data-slot="listing-card-title"]{display:-webkit-box;margin-top:0.25rem;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1;font-size:0.875rem;font-weight:500}[data-slot="listing-card-location"]{margin-top:0.125rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:0.75rem;color:var(--muted-foreground,#737373)}[data-slot="listing-card-features"]{display:flex;flex-wrap:wrap;margin-top:0.75rem;gap:0.25rem 1rem;padding:0;list-style:none;font-size:0.75rem;color:var(--muted-foreground,#737373)}[data-slot="search-skeleton-block"]{animation:garagem-search-pulse 1.2s ease-in-out infinite;background:var(--garagem-skeleton);border-radius:0.375rem}[data-slot="search-skeleton-card"]{overflow:hidden;border-radius:var(--garagem-listing-card-radius);border:1px solid var(--border,#e4e4e7)}[data-slot="search-skeleton-body"]{display:flex;flex-direction:column;gap:0.5rem;padding:1rem}[data-slot="search-skeleton-block"][data-kind="media"]{aspect-ratio:var(--garagem-listing-media-ratio)}[data-slot="search-skeleton-block"][data-kind="line-lg"]{height:1.25rem;width:50%}[data-slot="search-skeleton-block"][data-kind="line-md"]{height:1rem;width:75%}[data-slot="search-skeleton-block"][data-kind="line-sm"]{height:0.75rem;width:66.666667%}[data-slot="search-skeleton-block"][data-kind="detail-media"]{max-width:45rem;aspect-ratio:4 / 3}[data-slot="search-skeleton-block"][data-kind="detail-title"]{width:66.666667%;height:2rem;margin-top:1.5rem}@media (prefers-reduced-motion:reduce){[data-slot="search-popover"],[data-slot="search-sheet-overlay"],[data-slot="search-sheet-panel"],[data-slot="search-skeleton-block"]{animation:none}}@keyframes garagem-search-in{from{opacity:0;transform:translateY(-4px) scale(0.98)}to{opacity:1;transform:none}}@keyframes garagem-search-fade{from{opacity:0}to{opacity:1}}@keyframes garagem-search-sheet{from{transform:translateX(100%)}to{transform:none}}@keyframes garagem-search-pulse{50%{opacity:0.55}}`;
|
|
159
|
+
|
|
160
|
+
// src/react/styles/search-chrome-styles.tsx
|
|
161
|
+
var STYLE_ID = `garagem-search-chrome-${SEARCH_CHROME_CSS_VERSION}`;
|
|
162
|
+
function injectSearchChromeOnce() {
|
|
163
|
+
if (typeof document === "undefined") return;
|
|
164
|
+
if (document.getElementById(STYLE_ID)) return;
|
|
165
|
+
const el = document.createElement("style");
|
|
166
|
+
el.id = STYLE_ID;
|
|
167
|
+
el.textContent = SEARCH_CHROME_CSS;
|
|
168
|
+
document.head.appendChild(el);
|
|
169
|
+
}
|
|
170
|
+
function SearchChromeStyles() {
|
|
171
|
+
if (typeof document !== "undefined") {
|
|
172
|
+
injectSearchChromeOnce();
|
|
173
|
+
}
|
|
174
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
175
|
+
injectSearchChromeOnce();
|
|
176
|
+
}, []);
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
|
|
153
180
|
// src/react/listing-card.tsx
|
|
154
181
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
155
182
|
function isListing(value) {
|
|
@@ -166,55 +193,72 @@ function ListingCard({
|
|
|
166
193
|
const model = isListing(listing) ? toListingCardModel(listing) : listing;
|
|
167
194
|
const target = href ?? model.href;
|
|
168
195
|
const areaLabel = formatAreaM2(model.areaM2);
|
|
169
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
"
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
197
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SearchChromeStyles, {}),
|
|
198
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
199
|
+
"article",
|
|
200
|
+
{
|
|
201
|
+
"data-slot": "listing-card",
|
|
202
|
+
className: cn(className, classNames?.root),
|
|
203
|
+
style,
|
|
204
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_link.default, { href: target, "data-slot": "listing-card-link", children: [
|
|
205
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { "data-slot": "listing-card-media", className: classNames?.media, children: [
|
|
206
|
+
slots?.media ?? (model.coverSrc ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: model.coverSrc, alt: model.coverAlt }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { "data-slot": "listing-card-empty", children: "Sem foto" })),
|
|
207
|
+
slots?.badge ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
208
|
+
"span",
|
|
209
|
+
{
|
|
210
|
+
"data-slot": "listing-card-badge",
|
|
211
|
+
className: classNames?.badge,
|
|
212
|
+
children: model.businessLabel
|
|
213
|
+
}
|
|
214
|
+
)
|
|
184
215
|
] }),
|
|
185
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
216
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { "data-slot": "listing-card-body", className: classNames?.body, children: [
|
|
217
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { "data-slot": "listing-card-price-row", children: [
|
|
218
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { "data-slot": "listing-card-price", className: classNames?.price, children: model.priceLabel }),
|
|
219
|
+
model.pricePeriod ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "data-slot": "listing-card-period", children: model.pricePeriod }) : null
|
|
220
|
+
] }),
|
|
221
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { "data-slot": "listing-card-title", className: classNames?.title, children: model.title }),
|
|
222
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
223
|
+
"p",
|
|
224
|
+
{
|
|
225
|
+
"data-slot": "listing-card-location",
|
|
226
|
+
className: classNames?.location,
|
|
227
|
+
children: model.locationLabel || model.propertyType || ""
|
|
228
|
+
}
|
|
229
|
+
),
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
231
|
+
"ul",
|
|
232
|
+
{
|
|
233
|
+
"data-slot": "listing-card-features",
|
|
234
|
+
className: classNames?.features,
|
|
235
|
+
children: [
|
|
236
|
+
model.bedrooms != null ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
|
|
237
|
+
model.bedrooms,
|
|
238
|
+
" quartos"
|
|
239
|
+
] }) : null,
|
|
240
|
+
model.bathrooms != null ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
|
|
241
|
+
model.bathrooms,
|
|
242
|
+
" banheiros"
|
|
243
|
+
] }) : null,
|
|
244
|
+
model.parkingSpaces != null ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
|
|
245
|
+
model.parkingSpaces,
|
|
246
|
+
" vagas"
|
|
247
|
+
] }) : null,
|
|
248
|
+
areaLabel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: areaLabel }) : null
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
),
|
|
252
|
+
slots?.cta ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { "data-slot": "listing-card-cta", className: classNames?.cta, children: slots.cta }) : null
|
|
253
|
+
] })
|
|
210
254
|
] })
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
);
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
] });
|
|
214
258
|
}
|
|
215
259
|
|
|
216
260
|
// src/react/search-page.tsx
|
|
217
|
-
var
|
|
261
|
+
var import_react3 = require("react");
|
|
218
262
|
|
|
219
263
|
// ../search-url/types.ts
|
|
220
264
|
var SEARCH_BASE_ROUTE = "imoveis";
|
|
@@ -1153,19 +1197,8 @@ function rangeDraftFromPath(pathFilters) {
|
|
|
1153
1197
|
};
|
|
1154
1198
|
}
|
|
1155
1199
|
|
|
1156
|
-
// src/react/styles/search-chrome-css.generated.ts
|
|
1157
|
-
var SEARCH_CHROME_CSS_VERSION = "0.4.1";
|
|
1158
|
-
var SEARCH_CHROME_CSS = `:root{--garagem-listing-card-radius:0.75rem;--garagem-listing-card-gap:1.5rem;--garagem-listing-price-size:1.125rem;--garagem-listing-media-ratio:4 / 3;--garagem-search-control-height:2.75rem;--garagem-search-icon-size:1.25rem;--garagem-search-radius:var(--radius,0.75rem);--garagem-skeleton:var(--muted,#e7e5e4)}[data-slot="search-page"]{margin-inline:auto;max-width:80rem;padding:3rem 1.5rem}[data-slot="search-heading"]{display:flex;min-width:0;align-items:baseline;gap:0.375rem;font-size:1.25rem;font-weight:600}[data-slot="search-heading-count"]{flex-shrink:0}[data-slot="search-heading-title"]{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:inherit;font-weight:inherit}[data-slot="search-query-sort"]{display:flex;flex-direction:column;gap:1rem}@media (min-width:1024px){[data-slot="search-query-sort"]{flex-direction:row;align-items:flex-end}}[data-slot="search-query"]{flex:1;min-width:0}[data-slot="search-query-input"],[data-slot="search-sort-trigger"],[data-slot="search-toolbar-trigger"],[data-slot="search-filters-trigger"]{min-height:var(--garagem-search-control-height)}[data-slot="search-query-field"]{position:relative}[data-slot="search-query-input"]{width:100%;border-radius:var(--garagem-search-radius);border:1px solid var(--border,#e4e4e7);background:var(--background,#fff);padding:0.5rem 5.5rem 0.5rem 1rem;outline:none}[data-slot="search-query-actions"]{position:absolute;top:50%;right:0.35rem;display:flex;transform:translateY(-50%);align-items:center;gap:0.15rem}[data-slot="search-icon-button"]{display:inline-flex;height:2.25rem;width:2.25rem;cursor:pointer;align-items:center;justify-content:center;border:0;border-radius:999px;background:var(--primary,#111);color:var(--primary-foreground,#fff)}[data-slot="search-icon-button"][data-kind="clear"]{background:transparent;color:var(--muted-foreground,#737373)}[data-slot="search-icon"]{width:var(--garagem-search-icon-size);height:var(--garagem-search-icon-size);display:block}[data-slot="search-sort"]{display:flex;flex-direction:column;gap:0.25rem}[data-slot="search-sort-trigger"]{appearance:none;cursor:pointer;border-radius:var(--garagem-search-radius);border:1px solid var(--border,#e4e4e7);background:var(--background,#fff);padding:0.5rem 2.25rem 0.5rem 0.75rem;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23737373' stroke-width='2' viewBox='0 0 24 24'><path d='m6 9 6 6 6-6'/></svg>");background-repeat:no-repeat;background-position:right 0.65rem center}[data-slot="search-toolbar"]{display:flex;flex-wrap:wrap;align-items:flex-end;gap:0.5rem}[data-slot="search-toolbar-trigger"],[data-slot="search-filters-trigger"]{cursor:pointer;border-radius:var(--garagem-search-radius);border:1px solid var(--border,#e4e4e7);background:var(--background,#fff);padding:0.5rem 0.75rem;font-size:0.875rem}[data-slot="search-popover"]{position:absolute;z-index:30;margin-top:0.5rem;width:18rem;border-radius:0.75rem;border:1px solid var(--border,#e4e4e7);background:var(--background,#fff);padding:1rem;box-shadow:0 10px 30px rgb(0 0 0 / 0.12);animation:garagem-search-in 140ms ease-out}[data-slot="search-grid"],[data-slot="search-skeleton"]{display:grid;grid-template-columns:1fr;gap:var(--garagem-listing-card-gap)}@media (min-width:640px){[data-slot="search-grid"],[data-slot="search-skeleton"]{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:1024px){[data-slot="search-grid"],[data-slot="search-skeleton"]{grid-template-columns:repeat(3,minmax(0,1fr))}}[data-slot="listing-card"]{overflow:hidden;border-radius:var(--garagem-listing-card-radius);border:1px solid var(--border,#e4e4e7);background:var(--card,var(--background,#fff))}[data-slot="listing-card-price-row"]{display:inline-flex;align-items:baseline;gap:0.25rem}[data-slot="listing-card-price"]{font-size:var(--garagem-listing-price-size);font-weight:600}[data-slot="listing-card-period"]{font-size:0.75rem;color:var(--muted-foreground,#737373)}[data-slot="search-checkbox"]{appearance:none;width:1.15rem;height:1.15rem;flex-shrink:0;cursor:pointer;border:1px solid var(--primary,#111);border-radius:0.25rem;background:var(--background,#fff)}[data-slot="search-checkbox"]:checked{background-color:var(--primary,#111);background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'><path d='M5 12l5 5L20 7'/></svg>");background-repeat:no-repeat;background-position:center;background-size:0.8rem}[data-slot="search-scroll"]{max-height:12rem;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--muted-foreground,#a1a1aa) transparent}[data-slot="search-range-apply"]{display:inline-flex;min-height:2.5rem;cursor:pointer;align-items:center;justify-content:center;border:0;border-radius:var(--garagem-search-radius);background:var(--primary,#111);color:var(--primary-foreground,#fff);padding:0 0.75rem;font-size:0.75rem;font-weight:600}[data-slot="search-sheet"]{position:fixed;inset:0;z-index:40}[data-slot="search-sheet-overlay"]{position:absolute;inset:0;border:0;cursor:pointer;background:rgb(0 0 0 / 0.4);animation:garagem-search-fade 160ms ease-out}[data-slot="search-sheet-panel"]{position:absolute;top:0;right:0;display:flex;height:100dvh;width:min(22rem,100%);flex-direction:column;background:var(--background,#fff);animation:garagem-search-sheet 180ms ease-out}[data-slot="search-sheet-body"]{min-height:0;flex:1;overflow:auto;padding:1.5rem 1.5rem 0;scrollbar-width:thin}[data-slot="search-sheet-footer"]{display:flex;gap:0.5rem;border-top:1px solid var(--border,#e4e4e7);padding:1rem 1.5rem}[data-slot="search-apply-bar"]{display:flex;width:100%;gap:0.5rem}[data-slot="search-apply-bar"] > button{min-height:2.5rem;flex:1;cursor:pointer;border-radius:var(--garagem-search-radius);padding:0 1rem}[data-slot="search-apply-bar"] > button[data-kind="clear"]{border:1px solid var(--border,#e4e4e7);background:transparent}[data-slot="search-apply-bar"] > button[data-kind="apply"]{border:0;background:var(--primary,#111);color:var(--primary-foreground,#fff);font-weight:600}[data-slot="search-pagination"]{margin-top:2.5rem;display:flex;justify-content:center}[data-slot="search-pagination"] ul{display:flex;flex-wrap:wrap;justify-content:center;gap:0.25rem;padding:0;margin:0;list-style:none}[data-slot="search-pagination-item"]{display:inline-flex;width:2.25rem;height:2.25rem;align-items:center;justify-content:center;border:1px solid var(--border,#e4e4e7);border-radius:0.375rem;font-size:0.75rem;font-weight:500}@media (min-width:768px){[data-slot="search-pagination-item"]{width:2.5rem;height:2.5rem}}[data-slot="search-pagination-item"] a,[data-slot="search-pagination-item"] span{display:flex;width:100%;height:100%;align-items:center;justify-content:center;color:inherit;text-decoration:none}[data-slot="search-pagination-item"][data-current="true"]{background:var(--primary,#111);color:var(--primary-foreground,#fff)}[data-slot="search-pagination-item"][data-disabled="true"]{cursor:not-allowed;color:var(--muted-foreground,#737373)}[data-slot="search-toolbar-item"]{position:relative}[data-slot="search-body"]{margin-top:2rem;display:flex;flex-direction:column;gap:1.5rem}[data-slot="search-label"]{margin-bottom:0.25rem;display:block;font-size:0.875rem;color:var(--muted-foreground,#737373)}[data-slot="search-sheet-title"]{padding:1.5rem 1.5rem 0;font-size:1.125rem;font-weight:600}[data-slot="search-layout"]{display:grid;gap:2rem}[data-slot="search-sidebar"]{display:none}[data-slot="search-layout"] > div > [data-slot="search-filters-trigger"]{margin-bottom:1rem}@media (min-width:1024px){[data-slot="search-layout"]{grid-template-columns:280px minmax(0,1fr)}[data-slot="search-sidebar"]{display:block;position:sticky;top:1.5rem;align-self:start}[data-slot="search-layout"] > div > [data-slot="search-filters-trigger"]{display:none}}[data-slot="listing-card-link"]{display:block;color:inherit;text-decoration:none;cursor:pointer}[data-slot="listing-card-media"]{position:relative;width:100%;overflow:hidden;background:var(--muted,#f5f5f4);aspect-ratio:var(--garagem-listing-media-ratio)}[data-slot="listing-card-media"] img{height:100%;width:100%;object-fit:cover;transition:transform 0.3s}[data-slot="listing-card"]:hover [data-slot="listing-card-media"] img{transform:scale(1.05)}@media (prefers-reduced-motion:reduce){[data-slot="listing-card-media"] img{transition:none}[data-slot="listing-card"]:hover [data-slot="listing-card-media"] img{transform:none}}[data-slot="listing-card-empty"]{display:flex;height:100%;width:100%;align-items:center;justify-content:center;font-size:0.75rem;color:var(--muted-foreground,#737373)}[data-slot="listing-card-cta"]{margin-top:0.75rem}[data-slot="search-filters"]{display:flex;flex-direction:column;gap:1.25rem}[data-slot="search-filter"]{margin:0;padding:0;border:0;font-size:0.875rem}[data-slot="search-filter"] legend{margin-bottom:0.5rem;padding:0;color:var(--muted-foreground,#737373)}[data-slot="search-range-row"]{display:flex;align-items:flex-end;gap:0.5rem}[data-slot="search-range-side"]{min-width:0;flex:1}[data-slot="search-range-side"] > span:first-child{margin-bottom:0.25rem;display:block;font-size:0.75rem;color:var(--muted-foreground,#737373)}[data-slot="search-range-affix"]{position:relative;display:block}[data-slot="search-range-prefix"]{pointer-events:none;position:absolute;inset-block:0;left:0;display:flex;align-items:center;padding-left:0.75rem;color:var(--muted-foreground,#737373)}[data-slot="search-range-input"]{min-height:2.5rem;width:100%;border-radius:var(--garagem-search-radius);border:1px solid var(--border,#e4e4e7);background:var(--background,#fff);padding:0 0.75rem}[data-slot="search-range-affix"] [data-slot="search-range-input"]{padding-left:2.5rem}[data-slot="search-count-group"]{display:flex;flex-wrap:wrap;gap:0.375rem}[data-slot="search-count-choice"]{min-height:2.5rem;cursor:pointer;border-radius:var(--garagem-search-radius);border:1px solid var(--border,#e4e4e7);background:var(--background,#fff);padding:0 0.75rem;font-size:0.875rem}[data-slot="search-count-choice"][data-selected="true"]{border-color:var(--primary,#111);background:color-mix(in srgb,var(--primary,#111) 10%,transparent)}[data-slot="search-enum-list"],[data-slot="search-scroll"]{display:flex;flex-direction:column;gap:0.375rem}[data-slot="search-enum-option"]{display:flex;cursor:pointer;align-items:center;gap:0.5rem}[data-slot="listing-card-badge"]{position:absolute;left:0.75rem;top:0.75rem;border-radius:999px;background:color-mix(in srgb,var(--background,#fff) 90%,transparent);padding:0.25rem 0.5rem;font-size:0.75rem;font-weight:500}[data-slot="listing-card-body"]{padding:1rem}[data-slot="listing-card-title"]{display:-webkit-box;margin-top:0.25rem;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1;font-size:0.875rem;font-weight:500}[data-slot="listing-card-location"]{margin-top:0.125rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:0.75rem;color:var(--muted-foreground,#737373)}[data-slot="listing-card-features"]{display:flex;flex-wrap:wrap;margin-top:0.75rem;gap:0.25rem 1rem;padding:0;list-style:none;font-size:0.75rem;color:var(--muted-foreground,#737373)}[data-slot="search-skeleton-block"]{animation:garagem-search-pulse 1.2s ease-in-out infinite;background:var(--garagem-skeleton);border-radius:0.375rem}[data-slot="search-skeleton-card"]{overflow:hidden;border-radius:var(--garagem-listing-card-radius);border:1px solid var(--border,#e4e4e7)}[data-slot="search-skeleton-body"]{display:flex;flex-direction:column;gap:0.5rem;padding:1rem}[data-slot="search-skeleton-block"][data-kind="media"]{aspect-ratio:var(--garagem-listing-media-ratio)}[data-slot="search-skeleton-block"][data-kind="line-lg"]{height:1.25rem;width:50%}[data-slot="search-skeleton-block"][data-kind="line-md"]{height:1rem;width:75%}[data-slot="search-skeleton-block"][data-kind="line-sm"]{height:0.75rem;width:66.666667%}[data-slot="search-skeleton-block"][data-kind="detail-media"]{max-width:45rem;aspect-ratio:4 / 3}[data-slot="search-skeleton-block"][data-kind="detail-title"]{width:66.666667%;height:2rem;margin-top:1.5rem}@media (prefers-reduced-motion:reduce){[data-slot="search-popover"],[data-slot="search-sheet-overlay"],[data-slot="search-sheet-panel"],[data-slot="search-skeleton-block"]{animation:none}}@keyframes garagem-search-in{from{opacity:0;transform:translateY(-4px) scale(0.98)}to{opacity:1;transform:none}}@keyframes garagem-search-fade{from{opacity:0}to{opacity:1}}@keyframes garagem-search-sheet{from{transform:translateX(100%)}to{transform:none}}@keyframes garagem-search-pulse{50%{opacity:0.55}}`;
|
|
1159
|
-
|
|
1160
|
-
// src/react/styles/search-chrome-styles.tsx
|
|
1161
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1162
|
-
var STYLE_ID = `garagem-search-chrome-${SEARCH_CHROME_CSS_VERSION}`;
|
|
1163
|
-
function SearchChromeStyles() {
|
|
1164
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("style", { id: STYLE_ID, children: SEARCH_CHROME_CSS });
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1167
1200
|
// src/react/search-chrome.tsx
|
|
1168
|
-
var
|
|
1201
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1169
1202
|
function SearchSortSelect({
|
|
1170
1203
|
value,
|
|
1171
1204
|
onChange,
|
|
@@ -1173,16 +1206,16 @@ function SearchSortSelect({
|
|
|
1173
1206
|
className
|
|
1174
1207
|
}) {
|
|
1175
1208
|
const options = searchSortOptions(sorts);
|
|
1176
|
-
return /* @__PURE__ */ (0,
|
|
1177
|
-
/* @__PURE__ */ (0,
|
|
1178
|
-
/* @__PURE__ */ (0,
|
|
1209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { "data-slot": "search-sort", className, children: [
|
|
1210
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "data-slot": "search-label", children: "Ordenar" }),
|
|
1211
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1179
1212
|
"select",
|
|
1180
1213
|
{
|
|
1181
1214
|
id: "garagem-search-sort",
|
|
1182
1215
|
"data-slot": "search-sort-trigger",
|
|
1183
1216
|
value,
|
|
1184
1217
|
onChange: (event) => onChange(event.target.value || null),
|
|
1185
|
-
children: options.map((sort) => /* @__PURE__ */ (0,
|
|
1218
|
+
children: options.map((sort) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: sort.id, children: sort.label }, sort.id || "relevance"))
|
|
1186
1219
|
}
|
|
1187
1220
|
)
|
|
1188
1221
|
] });
|
|
@@ -1190,27 +1223,27 @@ function SearchSortSelect({
|
|
|
1190
1223
|
function ResultsSkeleton({
|
|
1191
1224
|
className
|
|
1192
1225
|
}) {
|
|
1193
|
-
return /* @__PURE__ */ (0,
|
|
1194
|
-
/* @__PURE__ */ (0,
|
|
1195
|
-
/* @__PURE__ */ (0,
|
|
1196
|
-
/* @__PURE__ */ (0,
|
|
1197
|
-
/* @__PURE__ */ (0,
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
1227
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SearchChromeStyles, {}),
|
|
1228
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { "data-slot": "search-skeleton", className, children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { "data-slot": "search-skeleton-card", children: [
|
|
1229
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { "data-slot": "search-skeleton-block", "data-kind": "media" }),
|
|
1230
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { "data-slot": "search-skeleton-body", children: [
|
|
1231
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { "data-slot": "search-skeleton-block", "data-kind": "line-lg" }),
|
|
1232
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { "data-slot": "search-skeleton-block", "data-kind": "line-md" }),
|
|
1233
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { "data-slot": "search-skeleton-block", "data-kind": "line-sm" })
|
|
1234
|
+
] })
|
|
1235
|
+
] }, i)) })
|
|
1236
|
+
] });
|
|
1201
1237
|
}
|
|
1202
1238
|
function SearchPageFallback({
|
|
1203
1239
|
className
|
|
1204
1240
|
}) {
|
|
1205
|
-
return /* @__PURE__ */ (0,
|
|
1206
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SearchChromeStyles, {}),
|
|
1207
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ResultsSkeleton, { className })
|
|
1208
|
-
] });
|
|
1241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("main", { "data-slot": "search-page", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ResultsSkeleton, { className }) });
|
|
1209
1242
|
}
|
|
1210
1243
|
|
|
1211
1244
|
// src/react/search-pagination.tsx
|
|
1212
1245
|
var import_link2 = __toESM(require("next/link"));
|
|
1213
|
-
var
|
|
1246
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1214
1247
|
function NavItem({
|
|
1215
1248
|
href,
|
|
1216
1249
|
label,
|
|
@@ -1219,13 +1252,13 @@ function NavItem({
|
|
|
1219
1252
|
onNavigate
|
|
1220
1253
|
}) {
|
|
1221
1254
|
if (disabled || !href || current) {
|
|
1222
|
-
return /* @__PURE__ */ (0,
|
|
1255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1223
1256
|
"li",
|
|
1224
1257
|
{
|
|
1225
1258
|
"data-slot": "search-pagination-item",
|
|
1226
1259
|
"data-current": current ? "true" : void 0,
|
|
1227
1260
|
"data-disabled": disabled ? "true" : void 0,
|
|
1228
|
-
children: /* @__PURE__ */ (0,
|
|
1261
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: label })
|
|
1229
1262
|
}
|
|
1230
1263
|
);
|
|
1231
1264
|
}
|
|
@@ -1237,7 +1270,7 @@ function NavItem({
|
|
|
1237
1270
|
event.preventDefault();
|
|
1238
1271
|
onNavigate(href);
|
|
1239
1272
|
}
|
|
1240
|
-
return /* @__PURE__ */ (0,
|
|
1273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { "data-slot": "search-pagination-item", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_link2.default, { href, onClick: handleClick, "aria-label": label, children: label }) });
|
|
1241
1274
|
}
|
|
1242
1275
|
function SearchPagination({
|
|
1243
1276
|
page,
|
|
@@ -1248,14 +1281,14 @@ function SearchPagination({
|
|
|
1248
1281
|
}) {
|
|
1249
1282
|
if (totalPages <= 1) return null;
|
|
1250
1283
|
const pages = paginationPages(page, totalPages, 2);
|
|
1251
|
-
return /* @__PURE__ */ (0,
|
|
1284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1252
1285
|
"nav",
|
|
1253
1286
|
{
|
|
1254
1287
|
"data-slot": "search-pagination",
|
|
1255
1288
|
className,
|
|
1256
1289
|
"aria-label": "Pagina\xE7\xE3o",
|
|
1257
|
-
children: /* @__PURE__ */ (0,
|
|
1258
|
-
/* @__PURE__ */ (0,
|
|
1290
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("ul", { children: [
|
|
1291
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1259
1292
|
NavItem,
|
|
1260
1293
|
{
|
|
1261
1294
|
href: hrefWithExplicitPage(hrefForPage(1), 1),
|
|
@@ -1264,7 +1297,7 @@ function SearchPagination({
|
|
|
1264
1297
|
onNavigate
|
|
1265
1298
|
}
|
|
1266
1299
|
),
|
|
1267
|
-
/* @__PURE__ */ (0,
|
|
1300
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1268
1301
|
NavItem,
|
|
1269
1302
|
{
|
|
1270
1303
|
href: hrefWithExplicitPage(
|
|
@@ -1276,7 +1309,7 @@ function SearchPagination({
|
|
|
1276
1309
|
onNavigate
|
|
1277
1310
|
}
|
|
1278
1311
|
),
|
|
1279
|
-
pages.map((n) => /* @__PURE__ */ (0,
|
|
1312
|
+
pages.map((n) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1280
1313
|
NavItem,
|
|
1281
1314
|
{
|
|
1282
1315
|
href: hrefWithExplicitPage(hrefForPage(n), n),
|
|
@@ -1286,7 +1319,7 @@ function SearchPagination({
|
|
|
1286
1319
|
},
|
|
1287
1320
|
n
|
|
1288
1321
|
)),
|
|
1289
|
-
/* @__PURE__ */ (0,
|
|
1322
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1290
1323
|
NavItem,
|
|
1291
1324
|
{
|
|
1292
1325
|
href: hrefForPage(Math.min(totalPages, page + 1)),
|
|
@@ -1295,7 +1328,7 @@ function SearchPagination({
|
|
|
1295
1328
|
onNavigate
|
|
1296
1329
|
}
|
|
1297
1330
|
),
|
|
1298
|
-
/* @__PURE__ */ (0,
|
|
1331
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1299
1332
|
NavItem,
|
|
1300
1333
|
{
|
|
1301
1334
|
href: hrefForPage(totalPages),
|
|
@@ -1310,9 +1343,9 @@ function SearchPagination({
|
|
|
1310
1343
|
}
|
|
1311
1344
|
|
|
1312
1345
|
// src/react/icons.tsx
|
|
1313
|
-
var
|
|
1346
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1314
1347
|
function Icon({ children, ...props }) {
|
|
1315
|
-
return /* @__PURE__ */ (0,
|
|
1348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1316
1349
|
"svg",
|
|
1317
1350
|
{
|
|
1318
1351
|
viewBox: "0 0 24 24",
|
|
@@ -1329,17 +1362,17 @@ function Icon({ children, ...props }) {
|
|
|
1329
1362
|
);
|
|
1330
1363
|
}
|
|
1331
1364
|
function SearchLensIcon(props) {
|
|
1332
|
-
return /* @__PURE__ */ (0,
|
|
1333
|
-
/* @__PURE__ */ (0,
|
|
1334
|
-
/* @__PURE__ */ (0,
|
|
1365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Icon, { ...props, children: [
|
|
1366
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "11", cy: "11", r: "7" }),
|
|
1367
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M20 20l-3.5-3.5" })
|
|
1335
1368
|
] });
|
|
1336
1369
|
}
|
|
1337
1370
|
function SearchClearIcon(props) {
|
|
1338
|
-
return /* @__PURE__ */ (0,
|
|
1371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M6 6l12 12M18 6L6 18" }) });
|
|
1339
1372
|
}
|
|
1340
1373
|
|
|
1341
1374
|
// src/react/search-query-form.tsx
|
|
1342
|
-
var
|
|
1375
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1343
1376
|
function SearchQueryForm({
|
|
1344
1377
|
value,
|
|
1345
1378
|
onChange,
|
|
@@ -1354,7 +1387,7 @@ function SearchQueryForm({
|
|
|
1354
1387
|
event.preventDefault();
|
|
1355
1388
|
onSubmit();
|
|
1356
1389
|
}
|
|
1357
|
-
return /* @__PURE__ */ (0,
|
|
1390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1358
1391
|
"form",
|
|
1359
1392
|
{
|
|
1360
1393
|
role: "search",
|
|
@@ -1362,9 +1395,9 @@ function SearchQueryForm({
|
|
|
1362
1395
|
onSubmit: handleSubmit,
|
|
1363
1396
|
className,
|
|
1364
1397
|
children: [
|
|
1365
|
-
/* @__PURE__ */ (0,
|
|
1366
|
-
/* @__PURE__ */ (0,
|
|
1367
|
-
/* @__PURE__ */ (0,
|
|
1398
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: "garagem-search-q", "data-slot": "search-label", children: "Busca" }),
|
|
1399
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { "data-slot": "search-query-field", children: [
|
|
1400
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1368
1401
|
"input",
|
|
1369
1402
|
{
|
|
1370
1403
|
id: "garagem-search-q",
|
|
@@ -1379,8 +1412,8 @@ function SearchQueryForm({
|
|
|
1379
1412
|
"data-slot": "search-query-input"
|
|
1380
1413
|
}
|
|
1381
1414
|
),
|
|
1382
|
-
/* @__PURE__ */ (0,
|
|
1383
|
-
value ? /* @__PURE__ */ (0,
|
|
1415
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { "data-slot": "search-query-actions", children: [
|
|
1416
|
+
value ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1384
1417
|
"button",
|
|
1385
1418
|
{
|
|
1386
1419
|
type: "button",
|
|
@@ -1389,17 +1422,17 @@ function SearchQueryForm({
|
|
|
1389
1422
|
onClick: onClear,
|
|
1390
1423
|
"data-slot": "search-icon-button",
|
|
1391
1424
|
"data-kind": "clear",
|
|
1392
|
-
children: clearIcon ?? /* @__PURE__ */ (0,
|
|
1425
|
+
children: clearIcon ?? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SearchClearIcon, { className: iconClassName })
|
|
1393
1426
|
}
|
|
1394
1427
|
) : null,
|
|
1395
|
-
/* @__PURE__ */ (0,
|
|
1428
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1396
1429
|
"button",
|
|
1397
1430
|
{
|
|
1398
1431
|
type: "submit",
|
|
1399
1432
|
title: "Buscar",
|
|
1400
1433
|
"aria-label": "Buscar",
|
|
1401
1434
|
"data-slot": "search-icon-button",
|
|
1402
|
-
children: searchIcon ?? /* @__PURE__ */ (0,
|
|
1435
|
+
children: searchIcon ?? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SearchLensIcon, { className: iconClassName })
|
|
1403
1436
|
}
|
|
1404
1437
|
)
|
|
1405
1438
|
] })
|
|
@@ -1410,7 +1443,7 @@ function SearchQueryForm({
|
|
|
1410
1443
|
}
|
|
1411
1444
|
|
|
1412
1445
|
// src/react/use-public-search.ts
|
|
1413
|
-
var
|
|
1446
|
+
var import_react2 = require("react");
|
|
1414
1447
|
var import_navigation = require("next/navigation");
|
|
1415
1448
|
|
|
1416
1449
|
// src/internal/url.ts
|
|
@@ -1496,36 +1529,36 @@ function usePublicSearch(options) {
|
|
|
1496
1529
|
const pathname = (0, import_navigation.usePathname)() || "/imoveis";
|
|
1497
1530
|
const searchParams = (0, import_navigation.useSearchParams)();
|
|
1498
1531
|
const search = searchParams.toString();
|
|
1499
|
-
const siteIdRef = (0,
|
|
1532
|
+
const siteIdRef = (0, import_react2.useRef)(siteId);
|
|
1500
1533
|
siteIdRef.current = siteId;
|
|
1501
1534
|
const siteIdToken = typeof siteId === "string" ? siteId : null;
|
|
1502
|
-
const [catalogId, setCatalogId] = (0,
|
|
1503
|
-
const [schema, setSchema] = (0,
|
|
1504
|
-
const [listings, setListings] = (0,
|
|
1505
|
-
const [page, setPage] = (0,
|
|
1506
|
-
const [total, setTotal] = (0,
|
|
1507
|
-
const [totalPages, setTotalPages] = (0,
|
|
1508
|
-
const [loading, setLoading] = (0,
|
|
1509
|
-
const [qDraft, setQDraft] = (0,
|
|
1510
|
-
const [staged, setStaged] = (0,
|
|
1511
|
-
const [locationNames, setLocationNames] = (0,
|
|
1535
|
+
const [catalogId, setCatalogId] = (0, import_react2.useState)(null);
|
|
1536
|
+
const [schema, setSchema] = (0, import_react2.useState)(null);
|
|
1537
|
+
const [listings, setListings] = (0, import_react2.useState)([]);
|
|
1538
|
+
const [page, setPage] = (0, import_react2.useState)(1);
|
|
1539
|
+
const [total, setTotal] = (0, import_react2.useState)(0);
|
|
1540
|
+
const [totalPages, setTotalPages] = (0, import_react2.useState)(1);
|
|
1541
|
+
const [loading, setLoading] = (0, import_react2.useState)(true);
|
|
1542
|
+
const [qDraft, setQDraft] = (0, import_react2.useState)("");
|
|
1543
|
+
const [staged, setStaged] = (0, import_react2.useState)({});
|
|
1544
|
+
const [locationNames, setLocationNames] = (0, import_react2.useState)(
|
|
1512
1545
|
null
|
|
1513
1546
|
);
|
|
1514
|
-
const parsed = (0,
|
|
1547
|
+
const parsed = (0, import_react2.useMemo)(
|
|
1515
1548
|
() => readPublicSearch(pathname, search, schema?.dictionary),
|
|
1516
1549
|
[pathname, search, schema?.dictionary]
|
|
1517
1550
|
);
|
|
1518
|
-
(0,
|
|
1551
|
+
(0, import_react2.useEffect)(() => {
|
|
1519
1552
|
setQDraft(parsed.applied.query || "");
|
|
1520
1553
|
}, [parsed.applied.query]);
|
|
1521
|
-
const resetStagedFromUrl = (0,
|
|
1554
|
+
const resetStagedFromUrl = (0, import_react2.useCallback)(() => {
|
|
1522
1555
|
setStaged({ ...parsed.pathFilters });
|
|
1523
1556
|
}, [parsed.pathFilters]);
|
|
1524
|
-
(0,
|
|
1557
|
+
(0, import_react2.useEffect)(() => {
|
|
1525
1558
|
setStaged({ ...parsed.pathFilters });
|
|
1526
1559
|
}, [parsed.pathFilters]);
|
|
1527
|
-
const locationsRef = (0,
|
|
1528
|
-
(0,
|
|
1560
|
+
const locationsRef = (0, import_react2.useRef)(null);
|
|
1561
|
+
(0, import_react2.useEffect)(() => {
|
|
1529
1562
|
if (!schema) return;
|
|
1530
1563
|
const canonical = canonicalizeSearchHref(
|
|
1531
1564
|
pathname,
|
|
@@ -1534,7 +1567,7 @@ function usePublicSearch(options) {
|
|
|
1534
1567
|
);
|
|
1535
1568
|
if (canonical) router.replace(canonical);
|
|
1536
1569
|
}, [pathname, search, schema, router]);
|
|
1537
|
-
(0,
|
|
1570
|
+
(0, import_react2.useEffect)(() => {
|
|
1538
1571
|
let active = true;
|
|
1539
1572
|
setCatalogId(null);
|
|
1540
1573
|
setSchema(null);
|
|
@@ -1549,7 +1582,7 @@ function usePublicSearch(options) {
|
|
|
1549
1582
|
active = false;
|
|
1550
1583
|
};
|
|
1551
1584
|
}, [baseUrl, siteIdToken]);
|
|
1552
|
-
(0,
|
|
1585
|
+
(0, import_react2.useEffect)(() => {
|
|
1553
1586
|
if (!catalogId) return;
|
|
1554
1587
|
const id = catalogId;
|
|
1555
1588
|
let active = true;
|
|
@@ -1593,7 +1626,7 @@ function usePublicSearch(options) {
|
|
|
1593
1626
|
active = false;
|
|
1594
1627
|
};
|
|
1595
1628
|
}, [baseUrl, catalogId]);
|
|
1596
|
-
(0,
|
|
1629
|
+
(0, import_react2.useEffect)(() => {
|
|
1597
1630
|
if (!schema || !catalogId) return;
|
|
1598
1631
|
const currentSchema = schema;
|
|
1599
1632
|
const id = catalogId;
|
|
@@ -1637,13 +1670,13 @@ function usePublicSearch(options) {
|
|
|
1637
1670
|
active = false;
|
|
1638
1671
|
};
|
|
1639
1672
|
}, [pathname, search, baseUrl, schema, catalogId]);
|
|
1640
|
-
const go = (0,
|
|
1673
|
+
const go = (0, import_react2.useCallback)(
|
|
1641
1674
|
(href) => {
|
|
1642
1675
|
if (href && href !== currentHref(pathname, search)) router.push(href);
|
|
1643
1676
|
},
|
|
1644
1677
|
[pathname, search, router]
|
|
1645
1678
|
);
|
|
1646
|
-
const applyFilter = (0,
|
|
1679
|
+
const applyFilter = (0, import_react2.useCallback)(
|
|
1647
1680
|
(filterId, value) => {
|
|
1648
1681
|
if (!schema) return;
|
|
1649
1682
|
go(
|
|
@@ -1657,17 +1690,17 @@ function usePublicSearch(options) {
|
|
|
1657
1690
|
},
|
|
1658
1691
|
[go, pathname, search, schema, parsed.pathFilters]
|
|
1659
1692
|
);
|
|
1660
|
-
const stageFilter = (0,
|
|
1693
|
+
const stageFilter = (0, import_react2.useCallback)((filterId, value) => {
|
|
1661
1694
|
setStaged((current) => applyPathFilter(current, filterId, value));
|
|
1662
1695
|
}, []);
|
|
1663
|
-
const applyStaged = (0,
|
|
1696
|
+
const applyStaged = (0, import_react2.useCallback)(() => {
|
|
1664
1697
|
if (!schema) return;
|
|
1665
1698
|
go(hrefForPathFilters(pathname, search, schema.dictionary, staged));
|
|
1666
1699
|
}, [go, pathname, search, schema, staged]);
|
|
1667
|
-
const clearStaged = (0,
|
|
1700
|
+
const clearStaged = (0, import_react2.useCallback)(() => {
|
|
1668
1701
|
setStaged((current) => clearStagedPathFilters(current));
|
|
1669
1702
|
}, []);
|
|
1670
|
-
const submitQuery = (0,
|
|
1703
|
+
const submitQuery = (0, import_react2.useCallback)(() => {
|
|
1671
1704
|
if (!schema) return;
|
|
1672
1705
|
go(
|
|
1673
1706
|
hrefForAppliedChange(pathname, search, schema.dictionary, {
|
|
@@ -1676,7 +1709,7 @@ function usePublicSearch(options) {
|
|
|
1676
1709
|
})
|
|
1677
1710
|
);
|
|
1678
1711
|
}, [go, pathname, search, schema, qDraft]);
|
|
1679
|
-
const clearQuery = (0,
|
|
1712
|
+
const clearQuery = (0, import_react2.useCallback)(() => {
|
|
1680
1713
|
setQDraft("");
|
|
1681
1714
|
if (!schema) return;
|
|
1682
1715
|
go(
|
|
@@ -1686,7 +1719,7 @@ function usePublicSearch(options) {
|
|
|
1686
1719
|
})
|
|
1687
1720
|
);
|
|
1688
1721
|
}, [go, pathname, search, schema]);
|
|
1689
|
-
const setSort = (0,
|
|
1722
|
+
const setSort = (0, import_react2.useCallback)(
|
|
1690
1723
|
(sort) => {
|
|
1691
1724
|
if (!schema) return;
|
|
1692
1725
|
go(
|
|
@@ -1698,7 +1731,7 @@ function usePublicSearch(options) {
|
|
|
1698
1731
|
},
|
|
1699
1732
|
[go, pathname, search, schema]
|
|
1700
1733
|
);
|
|
1701
|
-
const hrefForPage = (0,
|
|
1734
|
+
const hrefForPage = (0, import_react2.useCallback)(
|
|
1702
1735
|
(nextPage) => {
|
|
1703
1736
|
if (!schema) return pathname;
|
|
1704
1737
|
return hrefForAppliedChange(pathname, search, schema.dictionary, {
|
|
@@ -1738,7 +1771,7 @@ function usePublicSearch(options) {
|
|
|
1738
1771
|
}
|
|
1739
1772
|
|
|
1740
1773
|
// src/react/search-page.tsx
|
|
1741
|
-
var
|
|
1774
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1742
1775
|
function ToolbarPopover({
|
|
1743
1776
|
id,
|
|
1744
1777
|
label,
|
|
@@ -1748,8 +1781,8 @@ function ToolbarPopover({
|
|
|
1748
1781
|
popoverClassName,
|
|
1749
1782
|
children
|
|
1750
1783
|
}) {
|
|
1751
|
-
const rootRef = (0,
|
|
1752
|
-
(0,
|
|
1784
|
+
const rootRef = (0, import_react3.useRef)(null);
|
|
1785
|
+
(0, import_react3.useEffect)(() => {
|
|
1753
1786
|
if (!open) return;
|
|
1754
1787
|
function onPointer(event) {
|
|
1755
1788
|
if (!rootRef.current?.contains(event.target)) {
|
|
@@ -1766,8 +1799,8 @@ function ToolbarPopover({
|
|
|
1766
1799
|
document.removeEventListener("keydown", onKey);
|
|
1767
1800
|
};
|
|
1768
1801
|
}, [open, onOpenChange]);
|
|
1769
|
-
return /* @__PURE__ */ (0,
|
|
1770
|
-
/* @__PURE__ */ (0,
|
|
1802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { "data-slot": "search-toolbar-item", ref: rootRef, children: [
|
|
1803
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1771
1804
|
"button",
|
|
1772
1805
|
{
|
|
1773
1806
|
type: "button",
|
|
@@ -1778,7 +1811,7 @@ function ToolbarPopover({
|
|
|
1778
1811
|
children: label
|
|
1779
1812
|
}
|
|
1780
1813
|
),
|
|
1781
|
-
open ? /* @__PURE__ */ (0,
|
|
1814
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1782
1815
|
"div",
|
|
1783
1816
|
{
|
|
1784
1817
|
"data-slot": "search-popover",
|
|
@@ -1793,7 +1826,7 @@ function FiltersTrigger({
|
|
|
1793
1826
|
onClick,
|
|
1794
1827
|
className
|
|
1795
1828
|
}) {
|
|
1796
|
-
return /* @__PURE__ */ (0,
|
|
1829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1797
1830
|
"button",
|
|
1798
1831
|
{
|
|
1799
1832
|
type: "button",
|
|
@@ -1810,9 +1843,9 @@ function ApplyBar({
|
|
|
1810
1843
|
onApply,
|
|
1811
1844
|
className
|
|
1812
1845
|
}) {
|
|
1813
|
-
return /* @__PURE__ */ (0,
|
|
1814
|
-
/* @__PURE__ */ (0,
|
|
1815
|
-
/* @__PURE__ */ (0,
|
|
1846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { "data-slot": "search-apply-bar", className, children: [
|
|
1847
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "data-kind": "clear", onClick: onClear, children: "Limpar" }),
|
|
1848
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "data-kind": "apply", onClick: onApply, children: "Ver resultados" })
|
|
1816
1849
|
] });
|
|
1817
1850
|
}
|
|
1818
1851
|
function FilterSheet({
|
|
@@ -1824,9 +1857,9 @@ function FilterSheet({
|
|
|
1824
1857
|
children,
|
|
1825
1858
|
footer
|
|
1826
1859
|
}) {
|
|
1827
|
-
const onCloseRef = (0,
|
|
1860
|
+
const onCloseRef = (0, import_react3.useRef)(onClose);
|
|
1828
1861
|
onCloseRef.current = onClose;
|
|
1829
|
-
(0,
|
|
1862
|
+
(0, import_react3.useEffect)(() => {
|
|
1830
1863
|
if (!open) return;
|
|
1831
1864
|
function onKey(event) {
|
|
1832
1865
|
if (event.key === "Escape") onCloseRef.current();
|
|
@@ -1840,8 +1873,8 @@ function FilterSheet({
|
|
|
1840
1873
|
};
|
|
1841
1874
|
}, [open]);
|
|
1842
1875
|
if (!open) return null;
|
|
1843
|
-
return /* @__PURE__ */ (0,
|
|
1844
|
-
/* @__PURE__ */ (0,
|
|
1876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { "data-slot": "search-sheet", children: [
|
|
1877
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1845
1878
|
"button",
|
|
1846
1879
|
{
|
|
1847
1880
|
type: "button",
|
|
@@ -1851,7 +1884,7 @@ function FilterSheet({
|
|
|
1851
1884
|
onClick: onClose
|
|
1852
1885
|
}
|
|
1853
1886
|
),
|
|
1854
|
-
/* @__PURE__ */ (0,
|
|
1887
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1855
1888
|
"div",
|
|
1856
1889
|
{
|
|
1857
1890
|
"data-slot": "search-sheet-panel",
|
|
@@ -1860,9 +1893,9 @@ function FilterSheet({
|
|
|
1860
1893
|
"aria-modal": "true",
|
|
1861
1894
|
"aria-label": title,
|
|
1862
1895
|
children: [
|
|
1863
|
-
/* @__PURE__ */ (0,
|
|
1864
|
-
/* @__PURE__ */ (0,
|
|
1865
|
-
/* @__PURE__ */ (0,
|
|
1896
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { "data-slot": "search-sheet-title", children: title }),
|
|
1897
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { "data-slot": "search-sheet-body", children }),
|
|
1898
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { "data-slot": "search-sheet-footer", children: footer })
|
|
1866
1899
|
]
|
|
1867
1900
|
}
|
|
1868
1901
|
)
|
|
@@ -1874,8 +1907,8 @@ function SearchHeading({
|
|
|
1874
1907
|
classNames,
|
|
1875
1908
|
loading
|
|
1876
1909
|
}) {
|
|
1877
|
-
return /* @__PURE__ */ (0,
|
|
1878
|
-
!loading ? /* @__PURE__ */ (0,
|
|
1910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { "data-slot": "search-heading", className: classNames?.heading, children: [
|
|
1911
|
+
!loading ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1879
1912
|
"span",
|
|
1880
1913
|
{
|
|
1881
1914
|
"data-slot": "search-heading-count",
|
|
@@ -1883,7 +1916,7 @@ function SearchHeading({
|
|
|
1883
1916
|
children: total.toLocaleString("pt-BR")
|
|
1884
1917
|
}
|
|
1885
1918
|
) : null,
|
|
1886
|
-
/* @__PURE__ */ (0,
|
|
1919
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h1", { "data-slot": "search-heading-title", className: classNames?.headingTitle, children: title })
|
|
1887
1920
|
] });
|
|
1888
1921
|
}
|
|
1889
1922
|
function SearchPage({
|
|
@@ -1897,12 +1930,12 @@ function SearchPage({
|
|
|
1897
1930
|
listingCard: Card = ListingCard
|
|
1898
1931
|
}) {
|
|
1899
1932
|
const search = usePublicSearch({ siteId, baseUrl });
|
|
1900
|
-
const [sheetOpen, setSheetOpen] = (0,
|
|
1901
|
-
const [openToolbar, setOpenToolbar] = (0,
|
|
1902
|
-
const [rangeDraft, setRangeDraft] = (0,
|
|
1933
|
+
const [sheetOpen, setSheetOpen] = (0, import_react3.useState)(false);
|
|
1934
|
+
const [openToolbar, setOpenToolbar] = (0, import_react3.useState)(null);
|
|
1935
|
+
const [rangeDraft, setRangeDraft] = (0, import_react3.useState)(
|
|
1903
1936
|
() => rangeDraftFromPath(search.pathFilters)
|
|
1904
1937
|
);
|
|
1905
|
-
(0,
|
|
1938
|
+
(0, import_react3.useEffect)(() => {
|
|
1906
1939
|
setRangeDraft(rangeDraftFromPath(search.pathFilters));
|
|
1907
1940
|
}, [search.pathFilters]);
|
|
1908
1941
|
const filters = visibleSearchFilters(search.schema);
|
|
@@ -1935,7 +1968,7 @@ function SearchPage({
|
|
|
1935
1968
|
setOpenToolbar(null);
|
|
1936
1969
|
setSheetOpen(true);
|
|
1937
1970
|
}
|
|
1938
|
-
const closeSheet = (0,
|
|
1971
|
+
const closeSheet = (0, import_react3.useCallback)(() => {
|
|
1939
1972
|
setSheetOpen(false);
|
|
1940
1973
|
}, []);
|
|
1941
1974
|
function clearStagedFilters() {
|
|
@@ -1957,8 +1990,8 @@ function SearchPage({
|
|
|
1957
1990
|
search.applyStaged();
|
|
1958
1991
|
closeSheet();
|
|
1959
1992
|
}
|
|
1960
|
-
const results = search.loading ? /* @__PURE__ */ (0,
|
|
1961
|
-
/* @__PURE__ */ (0,
|
|
1993
|
+
const results = search.loading ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ResultsSkeleton, { className: classNames?.skeleton ?? classNames?.grid }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1994
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { "data-slot": "search-grid", className: classNames?.grid, children: search.listings.map((listing) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1962
1995
|
Card,
|
|
1963
1996
|
{
|
|
1964
1997
|
listing,
|
|
@@ -1966,7 +1999,7 @@ function SearchPage({
|
|
|
1966
1999
|
},
|
|
1967
2000
|
listing.id
|
|
1968
2001
|
)) }),
|
|
1969
|
-
/* @__PURE__ */ (0,
|
|
2002
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1970
2003
|
SearchPagination,
|
|
1971
2004
|
{
|
|
1972
2005
|
page: search.page,
|
|
@@ -1977,8 +2010,8 @@ function SearchPage({
|
|
|
1977
2010
|
}
|
|
1978
2011
|
)
|
|
1979
2012
|
] });
|
|
1980
|
-
const queryAndSort = /* @__PURE__ */ (0,
|
|
1981
|
-
/* @__PURE__ */ (0,
|
|
2013
|
+
const queryAndSort = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { "data-slot": "search-query-sort", children: [
|
|
2014
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1982
2015
|
SearchQueryForm,
|
|
1983
2016
|
{
|
|
1984
2017
|
value: search.qDraft,
|
|
@@ -1991,7 +2024,7 @@ function SearchPage({
|
|
|
1991
2024
|
clearIcon: icons?.clear
|
|
1992
2025
|
}
|
|
1993
2026
|
),
|
|
1994
|
-
/* @__PURE__ */ (0,
|
|
2027
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1995
2028
|
SearchSortSelect,
|
|
1996
2029
|
{
|
|
1997
2030
|
value: search.applied.sort || "",
|
|
@@ -2001,7 +2034,7 @@ function SearchPage({
|
|
|
2001
2034
|
}
|
|
2002
2035
|
)
|
|
2003
2036
|
] });
|
|
2004
|
-
const header = heading ?? /* @__PURE__ */ (0,
|
|
2037
|
+
const header = heading ?? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2005
2038
|
SearchHeading,
|
|
2006
2039
|
{
|
|
2007
2040
|
total: search.total,
|
|
@@ -2010,7 +2043,7 @@ function SearchPage({
|
|
|
2010
2043
|
loading: search.loading
|
|
2011
2044
|
}
|
|
2012
2045
|
);
|
|
2013
|
-
const stagedPanel = (items) => /* @__PURE__ */ (0,
|
|
2046
|
+
const stagedPanel = (items) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2014
2047
|
FilterPanel,
|
|
2015
2048
|
{
|
|
2016
2049
|
filters: items,
|
|
@@ -2021,7 +2054,7 @@ function SearchPage({
|
|
|
2021
2054
|
onRangeCommit: (id) => commitRange(id, false)
|
|
2022
2055
|
}
|
|
2023
2056
|
);
|
|
2024
|
-
const sheet = /* @__PURE__ */ (0,
|
|
2057
|
+
const sheet = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2025
2058
|
FilterSheet,
|
|
2026
2059
|
{
|
|
2027
2060
|
open: sheetOpen,
|
|
@@ -2029,7 +2062,7 @@ function SearchPage({
|
|
|
2029
2062
|
onClose: closeSheet,
|
|
2030
2063
|
overlayClassName: classNames?.dialogOverlay,
|
|
2031
2064
|
panelClassName: cn(classNames?.dialog, classNames?.dialogPanel),
|
|
2032
|
-
footer: /* @__PURE__ */ (0,
|
|
2065
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2033
2066
|
ApplyBar,
|
|
2034
2067
|
{
|
|
2035
2068
|
onClear: clearStagedFilters,
|
|
@@ -2040,19 +2073,19 @@ function SearchPage({
|
|
|
2040
2073
|
children: stagedPanel(variant === "toolbar" ? extraFilters : filters)
|
|
2041
2074
|
}
|
|
2042
2075
|
);
|
|
2043
|
-
return /* @__PURE__ */ (0,
|
|
2076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
2044
2077
|
"main",
|
|
2045
2078
|
{
|
|
2046
2079
|
"data-slot": "search-page",
|
|
2047
2080
|
"data-variant": variant,
|
|
2048
2081
|
className: cn(className, classNames?.root),
|
|
2049
2082
|
children: [
|
|
2050
|
-
/* @__PURE__ */ (0,
|
|
2051
|
-
/* @__PURE__ */ (0,
|
|
2052
|
-
/* @__PURE__ */ (0,
|
|
2083
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SearchChromeStyles, {}),
|
|
2084
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: classNames?.header, children: header }),
|
|
2085
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { "data-slot": "search-body", children: [
|
|
2053
2086
|
queryAndSort,
|
|
2054
|
-
variant === "toolbar" ? /* @__PURE__ */ (0,
|
|
2055
|
-
toolbarFilters.map((filter) => /* @__PURE__ */ (0,
|
|
2087
|
+
variant === "toolbar" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { "data-slot": "search-toolbar", className: classNames?.toolbar, children: [
|
|
2088
|
+
toolbarFilters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2056
2089
|
ToolbarPopover,
|
|
2057
2090
|
{
|
|
2058
2091
|
id: filter.id,
|
|
@@ -2061,7 +2094,7 @@ function SearchPage({
|
|
|
2061
2094
|
onOpenChange: setOpenToolbar,
|
|
2062
2095
|
triggerClassName: classNames?.toolbarTrigger,
|
|
2063
2096
|
popoverClassName: classNames?.popover,
|
|
2064
|
-
children: /* @__PURE__ */ (0,
|
|
2097
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2065
2098
|
FilterPanel,
|
|
2066
2099
|
{
|
|
2067
2100
|
filters: [filter],
|
|
@@ -2081,13 +2114,13 @@ function SearchPage({
|
|
|
2081
2114
|
},
|
|
2082
2115
|
filter.id
|
|
2083
2116
|
)),
|
|
2084
|
-
extraFilters.length > 0 ? /* @__PURE__ */ (0,
|
|
2117
|
+
extraFilters.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FiltersTrigger, { onClick: openStagedFilters }) : null
|
|
2085
2118
|
] }) : null,
|
|
2086
|
-
variant === "dialog" ? /* @__PURE__ */ (0,
|
|
2087
|
-
variant === "sidebar" ? /* @__PURE__ */ (0,
|
|
2088
|
-
/* @__PURE__ */ (0,
|
|
2119
|
+
variant === "dialog" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FiltersTrigger, { onClick: openStagedFilters }) : null,
|
|
2120
|
+
variant === "sidebar" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { "data-slot": "search-layout", children: [
|
|
2121
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("aside", { "data-slot": "search-sidebar", className: classNames?.sidebar, children: [
|
|
2089
2122
|
stagedPanel(filters),
|
|
2090
|
-
/* @__PURE__ */ (0,
|
|
2123
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2091
2124
|
ApplyBar,
|
|
2092
2125
|
{
|
|
2093
2126
|
onClear: clearStagedFilters,
|
|
@@ -2096,8 +2129,8 @@ function SearchPage({
|
|
|
2096
2129
|
}
|
|
2097
2130
|
)
|
|
2098
2131
|
] }),
|
|
2099
|
-
/* @__PURE__ */ (0,
|
|
2100
|
-
/* @__PURE__ */ (0,
|
|
2132
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
2133
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FiltersTrigger, { onClick: openStagedFilters }),
|
|
2101
2134
|
results
|
|
2102
2135
|
] })
|
|
2103
2136
|
] }) : results
|