@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/dist/react.mjs CHANGED
@@ -8,13 +8,19 @@ var SEARCH_CSS_VARS = {
8
8
  cardRadius: "--garagem-listing-card-radius",
9
9
  cardGap: "--garagem-listing-card-gap",
10
10
  priceSize: "--garagem-listing-price-size",
11
- mediaRatio: "--garagem-listing-media-ratio"
11
+ mediaRatio: "--garagem-listing-media-ratio",
12
+ controlHeight: "--garagem-search-control-height",
13
+ iconSize: "--garagem-search-icon-size",
14
+ skeleton: "--garagem-skeleton"
12
15
  };
13
16
  var SEARCH_CSS_RECIPE = `:root {
14
17
  ${SEARCH_CSS_VARS.cardRadius}: 0.75rem;
15
18
  ${SEARCH_CSS_VARS.cardGap}: 1.5rem;
16
19
  ${SEARCH_CSS_VARS.priceSize}: 1.125rem;
17
20
  ${SEARCH_CSS_VARS.mediaRatio}: 4 / 3;
21
+ ${SEARCH_CSS_VARS.controlHeight}: 2.75rem;
22
+ ${SEARCH_CSS_VARS.iconSize}: 1.25rem;
23
+ ${SEARCH_CSS_VARS.skeleton}: var(--muted, #e7e5e4);
18
24
  }
19
25
  `;
20
26
  function formatListingPrice(amount, locale = "pt-BR", currency = "BRL") {
@@ -99,8 +105,35 @@ function cn(...parts) {
99
105
  return parts.filter(Boolean).join(" ");
100
106
  }
101
107
 
108
+ // src/react/styles/search-chrome-styles.tsx
109
+ import { useLayoutEffect } from "react";
110
+
111
+ // src/react/styles/search-chrome-css.generated.ts
112
+ var SEARCH_CHROME_CSS_VERSION = "0.4.2";
113
+ 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}}`;
114
+
115
+ // src/react/styles/search-chrome-styles.tsx
116
+ var STYLE_ID = `garagem-search-chrome-${SEARCH_CHROME_CSS_VERSION}`;
117
+ function injectSearchChromeOnce() {
118
+ if (typeof document === "undefined") return;
119
+ if (document.getElementById(STYLE_ID)) return;
120
+ const el = document.createElement("style");
121
+ el.id = STYLE_ID;
122
+ el.textContent = SEARCH_CHROME_CSS;
123
+ document.head.appendChild(el);
124
+ }
125
+ function SearchChromeStyles() {
126
+ if (typeof document !== "undefined") {
127
+ injectSearchChromeOnce();
128
+ }
129
+ useLayoutEffect(() => {
130
+ injectSearchChromeOnce();
131
+ }, []);
132
+ return null;
133
+ }
134
+
102
135
  // src/react/listing-card.tsx
103
- import { jsx, jsxs } from "react/jsx-runtime";
136
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
104
137
  function isListing(value) {
105
138
  return "priceVisibility" in value && "businessType" in value && "title" in value;
106
139
  }
@@ -115,142 +148,73 @@ function ListingCard({
115
148
  const model = isListing(listing) ? toListingCardModel(listing) : listing;
116
149
  const target = href ?? model.href;
117
150
  const areaLabel = formatAreaM2(model.areaM2);
118
- return /* @__PURE__ */ jsx(
119
- "article",
120
- {
121
- "data-slot": "listing-card",
122
- className: cn(
123
- "group overflow-hidden rounded-[var(--garagem-listing-card-radius,0.75rem)] border border-border bg-background",
124
- className,
125
- classNames?.root
126
- ),
127
- style,
128
- children: /* @__PURE__ */ jsxs(
129
- Link,
130
- {
131
- href: target,
132
- className: "block cursor-pointer",
133
- "data-slot": "listing-card-link",
134
- children: [
135
- /* @__PURE__ */ jsxs(
136
- "div",
151
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
152
+ /* @__PURE__ */ jsx(SearchChromeStyles, {}),
153
+ /* @__PURE__ */ jsx(
154
+ "article",
155
+ {
156
+ "data-slot": "listing-card",
157
+ className: cn(className, classNames?.root),
158
+ style,
159
+ children: /* @__PURE__ */ jsxs(Link, { href: target, "data-slot": "listing-card-link", children: [
160
+ /* @__PURE__ */ jsxs("div", { "data-slot": "listing-card-media", className: classNames?.media, children: [
161
+ slots?.media ?? (model.coverSrc ? /* @__PURE__ */ jsx("img", { src: model.coverSrc, alt: model.coverAlt }) : /* @__PURE__ */ jsx("div", { "data-slot": "listing-card-empty", children: "Sem foto" })),
162
+ slots?.badge ?? /* @__PURE__ */ jsx(
163
+ "span",
137
164
  {
138
- "data-slot": "listing-card-media",
139
- className: cn(
140
- "relative w-full overflow-hidden bg-muted",
141
- classNames?.media
142
- ),
143
- style: { aspectRatio: "var(--garagem-listing-media-ratio, 4 / 3)" },
144
- children: [
145
- slots?.media ?? (model.coverSrc ? /* @__PURE__ */ jsx(
146
- "img",
147
- {
148
- src: model.coverSrc,
149
- alt: model.coverAlt,
150
- className: "h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"
151
- }
152
- ) : /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center text-xs text-muted-foreground", children: "Sem foto" })),
153
- slots?.badge ?? /* @__PURE__ */ jsx(
154
- "span",
155
- {
156
- "data-slot": "listing-card-badge",
157
- className: cn(
158
- "absolute left-3 top-3 rounded-full bg-background/90 px-2 py-1 text-xs font-medium",
159
- classNames?.badge
160
- ),
161
- children: model.businessLabel
162
- }
163
- )
164
- ]
165
+ "data-slot": "listing-card-badge",
166
+ className: classNames?.badge,
167
+ children: model.businessLabel
168
+ }
169
+ )
170
+ ] }),
171
+ /* @__PURE__ */ jsxs("div", { "data-slot": "listing-card-body", className: classNames?.body, children: [
172
+ /* @__PURE__ */ jsxs("div", { "data-slot": "listing-card-price-row", children: [
173
+ /* @__PURE__ */ jsx("p", { "data-slot": "listing-card-price", className: classNames?.price, children: model.priceLabel }),
174
+ model.pricePeriod ? /* @__PURE__ */ jsx("span", { "data-slot": "listing-card-period", children: model.pricePeriod }) : null
175
+ ] }),
176
+ /* @__PURE__ */ jsx("h3", { "data-slot": "listing-card-title", className: classNames?.title, children: model.title }),
177
+ /* @__PURE__ */ jsx(
178
+ "p",
179
+ {
180
+ "data-slot": "listing-card-location",
181
+ className: classNames?.location,
182
+ children: model.locationLabel || model.propertyType || ""
165
183
  }
166
184
  ),
167
185
  /* @__PURE__ */ jsxs(
168
- "div",
186
+ "ul",
169
187
  {
170
- "data-slot": "listing-card-body",
171
- className: cn("p-4", classNames?.body),
188
+ "data-slot": "listing-card-features",
189
+ className: classNames?.features,
172
190
  children: [
173
- /* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [
174
- /* @__PURE__ */ jsx(
175
- "p",
176
- {
177
- "data-slot": "listing-card-price",
178
- className: cn("font-semibold tracking-tight", classNames?.price),
179
- style: {
180
- fontSize: "var(--garagem-listing-price-size, 1.125rem)"
181
- },
182
- children: model.priceLabel
183
- }
184
- ),
185
- model.pricePeriod ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: model.pricePeriod }) : null
186
- ] }),
187
- /* @__PURE__ */ jsx(
188
- "h3",
189
- {
190
- "data-slot": "listing-card-title",
191
- className: cn(
192
- "mt-1 line-clamp-1 text-sm font-medium",
193
- classNames?.title
194
- ),
195
- children: model.title
196
- }
197
- ),
198
- /* @__PURE__ */ jsx(
199
- "p",
200
- {
201
- "data-slot": "listing-card-location",
202
- className: cn(
203
- "mt-0.5 line-clamp-1 text-xs text-muted-foreground",
204
- classNames?.location
205
- ),
206
- children: model.locationLabel || model.propertyType || ""
207
- }
208
- ),
209
- /* @__PURE__ */ jsxs(
210
- "ul",
211
- {
212
- "data-slot": "listing-card-features",
213
- className: cn(
214
- "mt-3 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",
215
- classNames?.features
216
- ),
217
- children: [
218
- model.bedrooms != null ? /* @__PURE__ */ jsxs("li", { children: [
219
- model.bedrooms,
220
- " quartos"
221
- ] }) : null,
222
- model.bathrooms != null ? /* @__PURE__ */ jsxs("li", { children: [
223
- model.bathrooms,
224
- " banheiros"
225
- ] }) : null,
226
- model.parkingSpaces != null ? /* @__PURE__ */ jsxs("li", { children: [
227
- model.parkingSpaces,
228
- " vagas"
229
- ] }) : null,
230
- areaLabel ? /* @__PURE__ */ jsx("li", { children: areaLabel }) : null
231
- ]
232
- }
233
- ),
234
- slots?.cta ? /* @__PURE__ */ jsx(
235
- "div",
236
- {
237
- "data-slot": "listing-card-cta",
238
- className: cn("mt-3", classNames?.cta),
239
- children: slots.cta
240
- }
241
- ) : null
191
+ model.bedrooms != null ? /* @__PURE__ */ jsxs("li", { children: [
192
+ model.bedrooms,
193
+ " quartos"
194
+ ] }) : null,
195
+ model.bathrooms != null ? /* @__PURE__ */ jsxs("li", { children: [
196
+ model.bathrooms,
197
+ " banheiros"
198
+ ] }) : null,
199
+ model.parkingSpaces != null ? /* @__PURE__ */ jsxs("li", { children: [
200
+ model.parkingSpaces,
201
+ " vagas"
202
+ ] }) : null,
203
+ areaLabel ? /* @__PURE__ */ jsx("li", { children: areaLabel }) : null
242
204
  ]
243
205
  }
244
- )
245
- ]
246
- }
247
- )
248
- }
249
- );
206
+ ),
207
+ slots?.cta ? /* @__PURE__ */ jsx("div", { "data-slot": "listing-card-cta", className: classNames?.cta, children: slots.cta }) : null
208
+ ] })
209
+ ] })
210
+ }
211
+ )
212
+ ] });
250
213
  }
251
214
 
252
215
  // src/react/search-page.tsx
253
216
  import {
217
+ useCallback as useCallback2,
254
218
  useEffect as useEffect2,
255
219
  useRef as useRef2,
256
220
  useState as useState2
@@ -942,6 +906,54 @@ function countFacetChoices(options) {
942
906
  }
943
907
  return out;
944
908
  }
909
+ var FEMININE_HEADING = /(casa|cobertura|kitnet|loja|sala|fazenda|chácara|chacara)s?$/i;
910
+ function pluralizePt(label) {
911
+ const text = label.trim();
912
+ if (!text || /s$/i.test(text)) return text;
913
+ if (/il$/i.test(text)) return `${text.slice(0, -1)}is`;
914
+ if (/m$/i.test(text)) return `${text.slice(0, -1)}ns`;
915
+ return `${text}s`;
916
+ }
917
+ function headingLocationSuffix(location) {
918
+ if (!location) return "";
919
+ if (location.street && location.neighborhood) {
920
+ return `${location.street}, ${location.neighborhood}`;
921
+ }
922
+ if (location.neighborhood && location.city) {
923
+ return `${location.neighborhood}, ${location.city}`;
924
+ }
925
+ if (location.city && location.state) {
926
+ return `${location.city} - ${location.state}`;
927
+ }
928
+ return location.city || location.neighborhood || location.street || location.state || "";
929
+ }
930
+ function searchResultsHeading(pathFilters, dictionary, locationNames) {
931
+ const types = [].concat(pathFilters.propertyType || []).filter(Boolean);
932
+ let noun = "Im\xF3veis";
933
+ let found = "encontrados";
934
+ if (types.length === 1) {
935
+ const id = String(types[0]);
936
+ const option = dictionary?.propertyTypes?.find(
937
+ (entry) => entry.id === id || entry.slug === id
938
+ );
939
+ const label = option?.label;
940
+ if (label) {
941
+ noun = pluralizePt(label.charAt(0).toUpperCase() + label.slice(1));
942
+ if (FEMININE_HEADING.test(id) || FEMININE_HEADING.test(label)) {
943
+ found = "encontradas";
944
+ }
945
+ }
946
+ }
947
+ const place = locationNames ? headingLocationSuffix(
948
+ displayPathLocation(pathFilters.location, locationNames)
949
+ ) : "";
950
+ if (place) return `${noun} ${found} em ${place}`;
951
+ return `${noun} ${found}`;
952
+ }
953
+ function hrefWithExplicitPage(href, page) {
954
+ if (page !== 1 || /(?:\?|&)page=/.test(href)) return href;
955
+ return href.includes("?") ? `${href}&page=1` : `${href}?page=1`;
956
+ }
945
957
  function paginationPages(currentPage, totalPages, padding) {
946
958
  if (totalPages < 1) return [];
947
959
  const current = Math.min(Math.max(1, currentPage), totalPages);
@@ -965,10 +977,9 @@ function RangeFields({
965
977
  const patch = (side, raw) => {
966
978
  onRangePatch(filter.id, side, isPrice ? formatGroupedInteger(raw) : raw);
967
979
  };
968
- const inputClass = "min-h-10 w-full rounded-lg border border-border bg-background px-3";
969
- return /* @__PURE__ */ jsxs2("fieldset", { className: "text-sm", children: [
970
- /* @__PURE__ */ jsx2("legend", { className: "mb-1 text-muted-foreground", children: filter.label }),
971
- /* @__PURE__ */ jsxs2("div", { className: "flex gap-2", children: [
980
+ return /* @__PURE__ */ jsxs2("fieldset", { "data-slot": "search-filter", children: [
981
+ /* @__PURE__ */ jsx2("legend", { children: filter.label }),
982
+ /* @__PURE__ */ jsxs2("div", { "data-slot": "search-range-row", children: [
972
983
  /* @__PURE__ */ jsx2(
973
984
  RangeSide,
974
985
  {
@@ -976,9 +987,9 @@ function RangeFields({
976
987
  label: "M\xEDn",
977
988
  isPrice,
978
989
  value: draft.min,
979
- inputClass,
980
990
  onPatch: (raw) => patch("min", raw),
981
- onCommit: () => onRangeCommit(filter.id)
991
+ onCommit: () => onRangeCommit(filter.id, "blur"),
992
+ onEnter: () => onRangeCommit(filter.id, "enter")
982
993
  }
983
994
  ),
984
995
  /* @__PURE__ */ jsx2(
@@ -988,9 +999,18 @@ function RangeFields({
988
999
  label: "M\xE1x",
989
1000
  isPrice,
990
1001
  value: draft.max,
991
- inputClass,
992
1002
  onPatch: (raw) => patch("max", raw),
993
- onCommit: () => onRangeCommit(filter.id)
1003
+ onCommit: () => onRangeCommit(filter.id, "blur"),
1004
+ onEnter: () => onRangeCommit(filter.id, "enter")
1005
+ }
1006
+ ),
1007
+ /* @__PURE__ */ jsx2(
1008
+ "button",
1009
+ {
1010
+ type: "button",
1011
+ "data-slot": "search-range-apply",
1012
+ onClick: () => onRangeCommit(filter.id, "apply"),
1013
+ children: "Atualizar"
994
1014
  }
995
1015
  )
996
1016
  ] })
@@ -1001,9 +1021,9 @@ function RangeSide({
1001
1021
  label,
1002
1022
  isPrice,
1003
1023
  value,
1004
- inputClass,
1005
1024
  onPatch,
1006
- onCommit
1025
+ onCommit,
1026
+ onEnter
1007
1027
  }) {
1008
1028
  const input = /* @__PURE__ */ jsx2(
1009
1029
  "input",
@@ -1018,15 +1038,18 @@ function RangeSide({
1018
1038
  onChange: (event) => onPatch(event.target.value),
1019
1039
  onBlur: onCommit,
1020
1040
  onKeyDown: (event) => {
1021
- if (event.key === "Enter") onCommit();
1041
+ if (event.key === "Enter") {
1042
+ event.preventDefault();
1043
+ onEnter();
1044
+ }
1022
1045
  },
1023
- className: isPrice ? `${inputClass} pl-10` : inputClass
1046
+ "data-slot": "search-range-input"
1024
1047
  }
1025
1048
  );
1026
- return /* @__PURE__ */ jsxs2("label", { className: "min-w-0 flex-1", htmlFor: id, children: [
1027
- /* @__PURE__ */ jsx2("span", { className: "mb-1 block text-xs text-muted-foreground", children: label }),
1028
- isPrice ? /* @__PURE__ */ jsxs2("span", { className: "relative block", children: [
1029
- /* @__PURE__ */ jsx2("span", { className: "pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 text-muted-foreground", children: "R$" }),
1049
+ return /* @__PURE__ */ jsxs2("label", { "data-slot": "search-range-side", htmlFor: id, children: [
1050
+ /* @__PURE__ */ jsx2("span", { children: label }),
1051
+ isPrice ? /* @__PURE__ */ jsxs2("span", { "data-slot": "search-range-affix", children: [
1052
+ /* @__PURE__ */ jsx2("span", { "data-slot": "search-range-prefix", children: "R$" }),
1030
1053
  input
1031
1054
  ] }) : input
1032
1055
  ] });
@@ -1038,17 +1061,15 @@ function CountFields({
1038
1061
  }) {
1039
1062
  const selected = pathFilterValue(pathFilters, filter.id);
1040
1063
  const choices = countFacetChoices(filter.options);
1041
- return /* @__PURE__ */ jsxs2("fieldset", { className: "text-sm", children: [
1042
- /* @__PURE__ */ jsx2("legend", { className: "mb-2 text-muted-foreground", children: filter.label }),
1043
- /* @__PURE__ */ jsx2("div", { className: "flex flex-wrap gap-1.5", role: "group", children: choices.map((choice) => /* @__PURE__ */ jsx2(
1064
+ return /* @__PURE__ */ jsxs2("fieldset", { "data-slot": "search-filter", children: [
1065
+ /* @__PURE__ */ jsx2("legend", { children: filter.label }),
1066
+ /* @__PURE__ */ jsx2("div", { "data-slot": "search-count-group", role: "group", children: choices.map((choice) => /* @__PURE__ */ jsx2(
1044
1067
  "button",
1045
1068
  {
1046
1069
  type: "button",
1070
+ "data-slot": "search-count-choice",
1071
+ "data-selected": selected === choice.id ? "true" : void 0,
1047
1072
  onClick: () => onChange(filter.id, Number(choice.id)),
1048
- className: cn(
1049
- "min-h-10 cursor-pointer rounded-lg border px-3 text-sm hover:bg-muted",
1050
- selected === choice.id && "border-primary bg-primary/10"
1051
- ),
1052
1073
  children: choice.label
1053
1074
  },
1054
1075
  choice.id
@@ -1062,36 +1083,20 @@ function EnumFields({
1062
1083
  }) {
1063
1084
  const options = filter.options || [];
1064
1085
  const scroll = options.length > 8;
1065
- return /* @__PURE__ */ jsxs2("fieldset", { className: "text-sm", children: [
1066
- /* @__PURE__ */ jsx2("legend", { className: "mb-2 text-muted-foreground", children: filter.label }),
1067
- /* @__PURE__ */ jsx2(
1068
- "div",
1069
- {
1070
- className: cn(
1071
- "flex flex-col gap-1.5",
1072
- scroll && "max-h-48 overflow-y-auto"
1073
- ),
1074
- children: options.map((option) => /* @__PURE__ */ jsxs2(
1075
- "label",
1076
- {
1077
- className: "flex cursor-pointer items-center gap-2",
1078
- children: [
1079
- /* @__PURE__ */ jsx2(
1080
- "input",
1081
- {
1082
- type: "checkbox",
1083
- checked: pathFilterHasOption(pathFilters, filter.id, option.id),
1084
- onChange: () => onChange(filter.id, option.id),
1085
- className: "cursor-pointer"
1086
- }
1087
- ),
1088
- /* @__PURE__ */ jsx2("span", { children: option.label })
1089
- ]
1090
- },
1091
- option.id
1092
- ))
1093
- }
1094
- )
1086
+ return /* @__PURE__ */ jsxs2("fieldset", { "data-slot": "search-filter", children: [
1087
+ /* @__PURE__ */ jsx2("legend", { children: filter.label }),
1088
+ /* @__PURE__ */ jsx2("div", { "data-slot": scroll ? "search-scroll" : "search-enum-list", children: options.map((option) => /* @__PURE__ */ jsxs2("label", { "data-slot": "search-enum-option", children: [
1089
+ /* @__PURE__ */ jsx2(
1090
+ "input",
1091
+ {
1092
+ type: "checkbox",
1093
+ "data-slot": "search-checkbox",
1094
+ checked: pathFilterHasOption(pathFilters, filter.id, option.id),
1095
+ onChange: () => onChange(filter.id, option.id)
1096
+ }
1097
+ ),
1098
+ /* @__PURE__ */ jsx2("span", { children: option.label })
1099
+ ] }, option.id)) })
1095
1100
  ] });
1096
1101
  }
1097
1102
  function FilterPanel({
@@ -1102,7 +1107,7 @@ function FilterPanel({
1102
1107
  onRangePatch,
1103
1108
  onRangeCommit
1104
1109
  }) {
1105
- return /* @__PURE__ */ jsx2("div", { className: "flex flex-col gap-5", "data-slot": "search-filters", children: filters.map((filter) => {
1110
+ return /* @__PURE__ */ jsx2("div", { "data-slot": "search-filters", children: filters.map((filter) => {
1106
1111
  if (filter.type === "range") {
1107
1112
  return /* @__PURE__ */ jsx2(
1108
1113
  RangeFields,
@@ -1153,7 +1158,7 @@ function rangeDraftFromPath(pathFilters) {
1153
1158
  }
1154
1159
 
1155
1160
  // src/react/search-chrome.tsx
1156
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1161
+ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1157
1162
  function SearchSortSelect({
1158
1163
  value,
1159
1164
  onChange,
@@ -1161,15 +1166,15 @@ function SearchSortSelect({
1161
1166
  className
1162
1167
  }) {
1163
1168
  const options = searchSortOptions(sorts);
1164
- return /* @__PURE__ */ jsxs3("label", { className: cn("text-sm", className), children: [
1165
- /* @__PURE__ */ jsx3("span", { className: "mb-1 block text-muted-foreground", children: "Ordenar" }),
1169
+ return /* @__PURE__ */ jsxs3("label", { "data-slot": "search-sort", className, children: [
1170
+ /* @__PURE__ */ jsx3("span", { "data-slot": "search-label", children: "Ordenar" }),
1166
1171
  /* @__PURE__ */ jsx3(
1167
1172
  "select",
1168
1173
  {
1169
1174
  id: "garagem-search-sort",
1175
+ "data-slot": "search-sort-trigger",
1170
1176
  value,
1171
1177
  onChange: (event) => onChange(event.target.value || null),
1172
- className: "min-h-10 cursor-pointer rounded-lg border border-border bg-background px-3",
1173
1178
  children: options.map((sort) => /* @__PURE__ */ jsx3("option", { value: sort.id, children: sort.label }, sort.id || "relevance"))
1174
1179
  }
1175
1180
  )
@@ -1178,37 +1183,22 @@ function SearchSortSelect({
1178
1183
  function ResultsSkeleton({
1179
1184
  className
1180
1185
  }) {
1181
- return /* @__PURE__ */ jsx3(
1182
- "div",
1183
- {
1184
- "data-slot": "search-skeleton",
1185
- className: cn(
1186
- "grid grid-cols-1 gap-[var(--garagem-listing-card-gap,1.5rem)] sm:grid-cols-2 lg:grid-cols-3",
1187
- className
1188
- ),
1189
- children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsxs3(
1190
- "div",
1191
- {
1192
- className: "overflow-hidden rounded-[var(--garagem-listing-card-radius,0.75rem)] border border-border",
1193
- children: [
1194
- /* @__PURE__ */ jsx3(
1195
- "div",
1196
- {
1197
- className: "animate-pulse bg-muted",
1198
- style: { aspectRatio: "4 / 3" }
1199
- }
1200
- ),
1201
- /* @__PURE__ */ jsxs3("div", { className: "space-y-2 p-4", children: [
1202
- /* @__PURE__ */ jsx3("div", { className: "h-5 w-1/2 animate-pulse rounded bg-muted" }),
1203
- /* @__PURE__ */ jsx3("div", { className: "h-4 w-3/4 animate-pulse rounded bg-muted" }),
1204
- /* @__PURE__ */ jsx3("div", { className: "h-3 w-2/3 animate-pulse rounded bg-muted" })
1205
- ] })
1206
- ]
1207
- },
1208
- i
1209
- ))
1210
- }
1211
- );
1186
+ return /* @__PURE__ */ jsxs3(Fragment2, { children: [
1187
+ /* @__PURE__ */ jsx3(SearchChromeStyles, {}),
1188
+ /* @__PURE__ */ jsx3("div", { "data-slot": "search-skeleton", className, children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsxs3("div", { "data-slot": "search-skeleton-card", children: [
1189
+ /* @__PURE__ */ jsx3("div", { "data-slot": "search-skeleton-block", "data-kind": "media" }),
1190
+ /* @__PURE__ */ jsxs3("div", { "data-slot": "search-skeleton-body", children: [
1191
+ /* @__PURE__ */ jsx3("div", { "data-slot": "search-skeleton-block", "data-kind": "line-lg" }),
1192
+ /* @__PURE__ */ jsx3("div", { "data-slot": "search-skeleton-block", "data-kind": "line-md" }),
1193
+ /* @__PURE__ */ jsx3("div", { "data-slot": "search-skeleton-block", "data-kind": "line-sm" })
1194
+ ] })
1195
+ ] }, i)) })
1196
+ ] });
1197
+ }
1198
+ function SearchPageFallback({
1199
+ className
1200
+ }) {
1201
+ return /* @__PURE__ */ jsx3("main", { "data-slot": "search-page", children: /* @__PURE__ */ jsx3(ResultsSkeleton, { className }) });
1212
1202
  }
1213
1203
 
1214
1204
  // src/react/search-pagination.tsx
@@ -1219,78 +1209,83 @@ function NavItem({
1219
1209
  label,
1220
1210
  disabled,
1221
1211
  current,
1222
- className
1212
+ onNavigate
1223
1213
  }) {
1224
- const itemClass = cn(
1225
- "inline-flex size-8 cursor-pointer items-center justify-center rounded-md border text-xs font-medium md:size-9",
1226
- current && "bg-primary text-primary-foreground",
1227
- disabled && "cursor-not-allowed text-muted-foreground",
1228
- className
1229
- );
1230
1214
  if (disabled || !href || current) {
1231
- return /* @__PURE__ */ jsx4("li", { className: itemClass, children: /* @__PURE__ */ jsx4("span", { className: "flex size-full items-center justify-center", children: label }) });
1215
+ return /* @__PURE__ */ jsx4(
1216
+ "li",
1217
+ {
1218
+ "data-slot": "search-pagination-item",
1219
+ "data-current": current ? "true" : void 0,
1220
+ "data-disabled": disabled ? "true" : void 0,
1221
+ children: /* @__PURE__ */ jsx4("span", { children: label })
1222
+ }
1223
+ );
1232
1224
  }
1233
- return /* @__PURE__ */ jsx4("li", { className: itemClass, children: /* @__PURE__ */ jsx4(
1234
- Link2,
1235
- {
1236
- href,
1237
- className: "flex size-full items-center justify-center",
1238
- "aria-label": label,
1239
- children: label
1225
+ function handleClick(event) {
1226
+ if (!onNavigate || !href) return;
1227
+ if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0) {
1228
+ return;
1240
1229
  }
1241
- ) });
1230
+ event.preventDefault();
1231
+ onNavigate(href);
1232
+ }
1233
+ return /* @__PURE__ */ jsx4("li", { "data-slot": "search-pagination-item", children: /* @__PURE__ */ jsx4(Link2, { href, onClick: handleClick, "aria-label": label, children: label }) });
1242
1234
  }
1243
1235
  function SearchPagination({
1244
1236
  page,
1245
1237
  totalPages,
1246
1238
  hrefForPage,
1239
+ onNavigate,
1247
1240
  className
1248
1241
  }) {
1249
1242
  if (totalPages <= 1) return null;
1250
- const mobile = paginationPages(page, totalPages, 1);
1251
- const desktop = paginationPages(page, totalPages, 2);
1243
+ const pages = paginationPages(page, totalPages, 2);
1252
1244
  return /* @__PURE__ */ jsx4(
1253
1245
  "nav",
1254
1246
  {
1255
1247
  "data-slot": "search-pagination",
1256
- className: cn("mt-10 flex justify-center", className),
1248
+ className,
1257
1249
  "aria-label": "Pagina\xE7\xE3o",
1258
- children: /* @__PURE__ */ jsxs4("ul", { className: "flex gap-0.5 md:gap-1", children: [
1259
- /* @__PURE__ */ jsx4(NavItem, { href: hrefForPage(1), label: "\u2039\u2039", disabled: page <= 1 }),
1250
+ children: /* @__PURE__ */ jsxs4("ul", { children: [
1260
1251
  /* @__PURE__ */ jsx4(
1261
1252
  NavItem,
1262
1253
  {
1263
- href: hrefForPage(Math.max(1, page - 1)),
1264
- label: "\u2039",
1265
- disabled: page <= 1
1254
+ href: hrefWithExplicitPage(hrefForPage(1), 1),
1255
+ label: "\u2039\u2039",
1256
+ disabled: page <= 1,
1257
+ onNavigate
1266
1258
  }
1267
1259
  ),
1268
- mobile.map((n) => /* @__PURE__ */ jsx4(
1260
+ /* @__PURE__ */ jsx4(
1269
1261
  NavItem,
1270
1262
  {
1271
- href: hrefForPage(n),
1272
- label: String(n),
1273
- current: n === page,
1274
- className: "md:hidden"
1275
- },
1276
- `m-${n}`
1277
- )),
1278
- desktop.map((n) => /* @__PURE__ */ jsx4(
1263
+ href: hrefWithExplicitPage(
1264
+ hrefForPage(Math.max(1, page - 1)),
1265
+ Math.max(1, page - 1)
1266
+ ),
1267
+ label: "\u2039",
1268
+ disabled: page <= 1,
1269
+ onNavigate
1270
+ }
1271
+ ),
1272
+ pages.map((n) => /* @__PURE__ */ jsx4(
1279
1273
  NavItem,
1280
1274
  {
1281
- href: hrefForPage(n),
1275
+ href: hrefWithExplicitPage(hrefForPage(n), n),
1282
1276
  label: String(n),
1283
1277
  current: n === page,
1284
- className: "hidden md:inline-flex"
1278
+ onNavigate
1285
1279
  },
1286
- `d-${n}`
1280
+ n
1287
1281
  )),
1288
1282
  /* @__PURE__ */ jsx4(
1289
1283
  NavItem,
1290
1284
  {
1291
1285
  href: hrefForPage(Math.min(totalPages, page + 1)),
1292
1286
  label: "\u203A",
1293
- disabled: page >= totalPages
1287
+ disabled: page >= totalPages,
1288
+ onNavigate
1294
1289
  }
1295
1290
  ),
1296
1291
  /* @__PURE__ */ jsx4(
@@ -1298,7 +1293,8 @@ function SearchPagination({
1298
1293
  {
1299
1294
  href: hrefForPage(totalPages),
1300
1295
  label: "\u203A\u203A",
1301
- disabled: page >= totalPages
1296
+ disabled: page >= totalPages,
1297
+ onNavigate
1302
1298
  }
1303
1299
  )
1304
1300
  ] })
@@ -1306,73 +1302,102 @@ function SearchPagination({
1306
1302
  );
1307
1303
  }
1308
1304
 
1309
- // src/react/search-query-form.tsx
1305
+ // src/react/icons.tsx
1310
1306
  import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1307
+ function Icon({ children, ...props }) {
1308
+ return /* @__PURE__ */ jsx5(
1309
+ "svg",
1310
+ {
1311
+ viewBox: "0 0 24 24",
1312
+ fill: "none",
1313
+ stroke: "currentColor",
1314
+ strokeWidth: 2,
1315
+ strokeLinecap: "round",
1316
+ strokeLinejoin: "round",
1317
+ "aria-hidden": true,
1318
+ "data-slot": "search-icon",
1319
+ ...props,
1320
+ children
1321
+ }
1322
+ );
1323
+ }
1324
+ function SearchLensIcon(props) {
1325
+ return /* @__PURE__ */ jsxs5(Icon, { ...props, children: [
1326
+ /* @__PURE__ */ jsx5("circle", { cx: "11", cy: "11", r: "7" }),
1327
+ /* @__PURE__ */ jsx5("path", { d: "M20 20l-3.5-3.5" })
1328
+ ] });
1329
+ }
1330
+ function SearchClearIcon(props) {
1331
+ return /* @__PURE__ */ jsx5(Icon, { ...props, children: /* @__PURE__ */ jsx5("path", { d: "M6 6l12 12M18 6L6 18" }) });
1332
+ }
1333
+
1334
+ // src/react/search-query-form.tsx
1335
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1311
1336
  function SearchQueryForm({
1312
1337
  value,
1313
1338
  onChange,
1314
1339
  onSubmit,
1315
1340
  onClear,
1316
- className
1341
+ className,
1342
+ iconClassName,
1343
+ searchIcon,
1344
+ clearIcon
1317
1345
  }) {
1318
1346
  function handleSubmit(event) {
1319
1347
  event.preventDefault();
1320
1348
  onSubmit();
1321
1349
  }
1322
- return /* @__PURE__ */ jsx5(
1350
+ return /* @__PURE__ */ jsxs6(
1323
1351
  "form",
1324
1352
  {
1325
1353
  role: "search",
1326
1354
  "data-slot": "search-query",
1327
1355
  onSubmit: handleSubmit,
1328
- className: cn("flex items-end gap-2", className),
1329
- children: /* @__PURE__ */ jsxs5("div", { className: "min-w-0 flex-1", children: [
1330
- /* @__PURE__ */ jsx5(
1331
- "label",
1332
- {
1333
- htmlFor: "garagem-search-q",
1334
- className: "mb-1 block text-sm text-muted-foreground",
1335
- children: "Busca"
1336
- }
1337
- ),
1338
- /* @__PURE__ */ jsxs5("div", { className: "relative", children: [
1339
- /* @__PURE__ */ jsx5(
1356
+ className,
1357
+ children: [
1358
+ /* @__PURE__ */ jsx6("label", { htmlFor: "garagem-search-q", "data-slot": "search-label", children: "Busca" }),
1359
+ /* @__PURE__ */ jsxs6("div", { "data-slot": "search-query-field", children: [
1360
+ /* @__PURE__ */ jsx6(
1340
1361
  "input",
1341
1362
  {
1342
1363
  id: "garagem-search-q",
1343
1364
  name: "q",
1344
- type: "search",
1365
+ type: "text",
1366
+ inputMode: "search",
1345
1367
  autoComplete: "off",
1346
1368
  enterKeyHint: "search",
1347
1369
  value,
1348
1370
  onChange: (event) => onChange(event.target.value),
1349
1371
  placeholder: "Busque por bairro, rua ou c\xF3digo",
1350
- className: "min-h-12 w-full rounded-xl border border-border bg-background px-4 pr-20 outline-none focus:border-primary"
1372
+ "data-slot": "search-query-input"
1351
1373
  }
1352
1374
  ),
1353
- value ? /* @__PURE__ */ jsx5(
1354
- "button",
1355
- {
1356
- type: "button",
1357
- title: "Limpar busca",
1358
- "aria-label": "Limpar busca",
1359
- onClick: onClear,
1360
- className: "absolute right-10 top-1/2 -translate-y-1/2 cursor-pointer rounded-md px-2 py-1 text-sm text-muted-foreground hover:text-foreground",
1361
- children: "\xD7"
1362
- }
1363
- ) : null,
1364
- /* @__PURE__ */ jsx5(
1365
- "button",
1366
- {
1367
- type: "submit",
1368
- title: "Buscar",
1369
- "aria-label": "Buscar",
1370
- className: "absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer rounded-md px-2 py-1 text-sm font-medium hover:bg-muted",
1371
- children: "\u2315"
1372
- }
1373
- )
1375
+ /* @__PURE__ */ jsxs6("div", { "data-slot": "search-query-actions", children: [
1376
+ value ? /* @__PURE__ */ jsx6(
1377
+ "button",
1378
+ {
1379
+ type: "button",
1380
+ title: "Limpar busca",
1381
+ "aria-label": "Limpar busca",
1382
+ onClick: onClear,
1383
+ "data-slot": "search-icon-button",
1384
+ "data-kind": "clear",
1385
+ children: clearIcon ?? /* @__PURE__ */ jsx6(SearchClearIcon, { className: iconClassName })
1386
+ }
1387
+ ) : null,
1388
+ /* @__PURE__ */ jsx6(
1389
+ "button",
1390
+ {
1391
+ type: "submit",
1392
+ title: "Buscar",
1393
+ "aria-label": "Buscar",
1394
+ "data-slot": "search-icon-button",
1395
+ children: searchIcon ?? /* @__PURE__ */ jsx6(SearchLensIcon, { className: iconClassName })
1396
+ }
1397
+ )
1398
+ ] })
1374
1399
  ] })
1375
- ] })
1400
+ ]
1376
1401
  }
1377
1402
  );
1378
1403
  }
@@ -1476,6 +1501,9 @@ function usePublicSearch(options) {
1476
1501
  const [loading, setLoading] = useState(true);
1477
1502
  const [qDraft, setQDraft] = useState("");
1478
1503
  const [staged, setStaged] = useState({});
1504
+ const [locationNames, setLocationNames] = useState(
1505
+ null
1506
+ );
1479
1507
  const parsed = useMemo(
1480
1508
  () => readPublicSearch(pathname, search, schema?.dictionary),
1481
1509
  [pathname, search, schema?.dictionary]
@@ -1519,6 +1547,7 @@ function usePublicSearch(options) {
1519
1547
  const id = catalogId;
1520
1548
  let active = true;
1521
1549
  locationsRef.current = null;
1550
+ setLocationNames(null);
1522
1551
  setSchema(null);
1523
1552
  setListings([]);
1524
1553
  setLoading(true);
@@ -1541,10 +1570,12 @@ function usePublicSearch(options) {
1541
1570
  }
1542
1571
  if (!active) return;
1543
1572
  locationsRef.current = locations;
1573
+ setLocationNames(locations);
1544
1574
  setSchema(nextSchema);
1545
1575
  } catch {
1546
1576
  if (active) {
1547
1577
  locationsRef.current = null;
1578
+ setLocationNames(null);
1548
1579
  setSchema(null);
1549
1580
  setLoading(false);
1550
1581
  }
@@ -1694,44 +1725,75 @@ function usePublicSearch(options) {
1694
1725
  clearQuery,
1695
1726
  setSort,
1696
1727
  hrefForPage,
1697
- go
1728
+ go,
1729
+ locationNames
1698
1730
  };
1699
1731
  }
1700
1732
 
1701
1733
  // src/react/search-page.tsx
1702
- import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1734
+ import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1703
1735
  function ToolbarPopover({
1736
+ id,
1704
1737
  label,
1738
+ open,
1739
+ onOpenChange,
1740
+ triggerClassName,
1741
+ popoverClassName,
1705
1742
  children
1706
1743
  }) {
1707
- const [open, setOpen] = useState2(false);
1708
- return /* @__PURE__ */ jsxs6("div", { className: "relative", children: [
1709
- /* @__PURE__ */ jsx6(
1744
+ const rootRef = useRef2(null);
1745
+ useEffect2(() => {
1746
+ if (!open) return;
1747
+ function onPointer(event) {
1748
+ if (!rootRef.current?.contains(event.target)) {
1749
+ onOpenChange(null);
1750
+ }
1751
+ }
1752
+ function onKey(event) {
1753
+ if (event.key === "Escape") onOpenChange(null);
1754
+ }
1755
+ document.addEventListener("mousedown", onPointer);
1756
+ document.addEventListener("keydown", onKey);
1757
+ return () => {
1758
+ document.removeEventListener("mousedown", onPointer);
1759
+ document.removeEventListener("keydown", onKey);
1760
+ };
1761
+ }, [open, onOpenChange]);
1762
+ return /* @__PURE__ */ jsxs7("div", { "data-slot": "search-toolbar-item", ref: rootRef, children: [
1763
+ /* @__PURE__ */ jsx7(
1710
1764
  "button",
1711
1765
  {
1712
1766
  type: "button",
1713
- onClick: () => setOpen((value) => !value),
1714
- className: "min-h-10 cursor-pointer rounded-lg border border-border px-3 text-sm hover:bg-muted",
1767
+ "data-slot": "search-toolbar-trigger",
1768
+ className: triggerClassName,
1769
+ "aria-expanded": open,
1770
+ onClick: () => onOpenChange(open ? null : id),
1715
1771
  children: label
1716
1772
  }
1717
1773
  ),
1718
- open ? /* @__PURE__ */ jsx6("div", { className: "absolute z-20 mt-2 w-72 rounded-xl border border-border bg-background p-4 shadow-lg", children }) : null
1774
+ open ? /* @__PURE__ */ jsx7(
1775
+ "div",
1776
+ {
1777
+ "data-slot": "search-popover",
1778
+ className: popoverClassName,
1779
+ role: "dialog",
1780
+ children
1781
+ }
1782
+ ) : null
1719
1783
  ] });
1720
1784
  }
1721
1785
  function FiltersTrigger({
1722
1786
  onClick,
1723
1787
  className
1724
1788
  }) {
1725
- return /* @__PURE__ */ jsx6(
1789
+ return /* @__PURE__ */ jsx7(
1726
1790
  "button",
1727
1791
  {
1728
1792
  type: "button",
1729
1793
  title: "Filtros",
1794
+ "data-slot": "search-filters-trigger",
1730
1795
  onClick,
1731
- className: cn(
1732
- "min-h-10 cursor-pointer rounded-lg border border-border px-3 text-sm hover:bg-muted",
1733
- className
1734
- ),
1796
+ className,
1735
1797
  children: "Filtros"
1736
1798
  }
1737
1799
  );
@@ -1741,27 +1803,82 @@ function ApplyBar({
1741
1803
  onApply,
1742
1804
  className
1743
1805
  }) {
1744
- return /* @__PURE__ */ jsxs6("div", { className: cn("mt-6 flex gap-2", className), children: [
1745
- /* @__PURE__ */ jsx6(
1806
+ return /* @__PURE__ */ jsxs7("div", { "data-slot": "search-apply-bar", className, children: [
1807
+ /* @__PURE__ */ jsx7("button", { type: "button", "data-kind": "clear", onClick: onClear, children: "Limpar" }),
1808
+ /* @__PURE__ */ jsx7("button", { type: "button", "data-kind": "apply", onClick: onApply, children: "Ver resultados" })
1809
+ ] });
1810
+ }
1811
+ function FilterSheet({
1812
+ open,
1813
+ title,
1814
+ onClose,
1815
+ overlayClassName,
1816
+ panelClassName,
1817
+ children,
1818
+ footer
1819
+ }) {
1820
+ const onCloseRef = useRef2(onClose);
1821
+ onCloseRef.current = onClose;
1822
+ useEffect2(() => {
1823
+ if (!open) return;
1824
+ function onKey(event) {
1825
+ if (event.key === "Escape") onCloseRef.current();
1826
+ }
1827
+ document.addEventListener("keydown", onKey);
1828
+ const previous = document.body.style.overflow;
1829
+ document.body.style.overflow = "hidden";
1830
+ return () => {
1831
+ document.removeEventListener("keydown", onKey);
1832
+ document.body.style.overflow = previous;
1833
+ };
1834
+ }, [open]);
1835
+ if (!open) return null;
1836
+ return /* @__PURE__ */ jsxs7("div", { "data-slot": "search-sheet", children: [
1837
+ /* @__PURE__ */ jsx7(
1746
1838
  "button",
1747
1839
  {
1748
1840
  type: "button",
1749
- onClick: onClear,
1750
- className: "min-h-10 flex-1 cursor-pointer rounded-lg border border-border px-4 hover:bg-muted",
1751
- children: "Limpar"
1841
+ "aria-label": "Fechar filtros",
1842
+ "data-slot": "search-sheet-overlay",
1843
+ className: overlayClassName,
1844
+ onClick: onClose
1752
1845
  }
1753
1846
  ),
1754
- /* @__PURE__ */ jsx6(
1755
- "button",
1847
+ /* @__PURE__ */ jsxs7(
1848
+ "div",
1756
1849
  {
1757
- type: "button",
1758
- onClick: onApply,
1759
- className: "min-h-10 flex-1 cursor-pointer rounded-lg bg-primary px-4 font-semibold text-primary-foreground hover:opacity-90",
1760
- children: "Ver resultados"
1850
+ "data-slot": "search-sheet-panel",
1851
+ className: panelClassName,
1852
+ role: "dialog",
1853
+ "aria-modal": "true",
1854
+ "aria-label": title,
1855
+ children: [
1856
+ /* @__PURE__ */ jsx7("p", { "data-slot": "search-sheet-title", children: title }),
1857
+ /* @__PURE__ */ jsx7("div", { "data-slot": "search-sheet-body", children }),
1858
+ /* @__PURE__ */ jsx7("div", { "data-slot": "search-sheet-footer", children: footer })
1859
+ ]
1761
1860
  }
1762
1861
  )
1763
1862
  ] });
1764
1863
  }
1864
+ function SearchHeading({
1865
+ total,
1866
+ title,
1867
+ classNames,
1868
+ loading
1869
+ }) {
1870
+ return /* @__PURE__ */ jsxs7("div", { "data-slot": "search-heading", className: classNames?.heading, children: [
1871
+ !loading ? /* @__PURE__ */ jsx7(
1872
+ "span",
1873
+ {
1874
+ "data-slot": "search-heading-count",
1875
+ className: classNames?.headingCount,
1876
+ children: total.toLocaleString("pt-BR")
1877
+ }
1878
+ ) : null,
1879
+ /* @__PURE__ */ jsx7("h1", { "data-slot": "search-heading-title", className: classNames?.headingTitle, children: title })
1880
+ ] });
1881
+ }
1765
1882
  function SearchPage({
1766
1883
  siteId,
1767
1884
  baseUrl,
@@ -1769,11 +1886,12 @@ function SearchPage({
1769
1886
  className,
1770
1887
  classNames,
1771
1888
  heading,
1889
+ icons,
1772
1890
  listingCard: Card = ListingCard
1773
1891
  }) {
1774
1892
  const search = usePublicSearch({ siteId, baseUrl });
1775
- const dialogRef = useRef2(null);
1776
- const [mobileFiltersOpen, setMobileFiltersOpen] = useState2(false);
1893
+ const [sheetOpen, setSheetOpen] = useState2(false);
1894
+ const [openToolbar, setOpenToolbar] = useState2(null);
1777
1895
  const [rangeDraft, setRangeDraft] = useState2(
1778
1896
  () => rangeDraftFromPath(search.pathFilters)
1779
1897
  );
@@ -1784,6 +1902,11 @@ function SearchPage({
1784
1902
  const toolbarIds = new Set(toolbarFilterIds(search.schema));
1785
1903
  const toolbarFilters = filters.filter((filter) => toolbarIds.has(filter.id));
1786
1904
  const extraFilters = filters.filter((filter) => !toolbarIds.has(filter.id));
1905
+ const headingTitle = searchResultsHeading(
1906
+ search.pathFilters,
1907
+ search.schema?.dictionary,
1908
+ search.locationNames
1909
+ );
1787
1910
  function patchRange(filterId, side, value) {
1788
1911
  setRangeDraft((prev) => ({
1789
1912
  ...prev,
@@ -1802,9 +1925,12 @@ function SearchPage({
1802
1925
  function openStagedFilters() {
1803
1926
  search.resetStagedFromUrl();
1804
1927
  setRangeDraft(rangeDraftFromPath(search.pathFilters));
1805
- if (variant === "sidebar") setMobileFiltersOpen(true);
1806
- else dialogRef.current?.showModal();
1928
+ setOpenToolbar(null);
1929
+ setSheetOpen(true);
1807
1930
  }
1931
+ const closeSheet = useCallback2(() => {
1932
+ setSheetOpen(false);
1933
+ }, []);
1808
1934
  function clearStagedFilters() {
1809
1935
  const keepIds = variant === "toolbar" ? [...toolbarIds] : [];
1810
1936
  const source = variant === "toolbar" ? search.pathFilters : search.staged;
@@ -1822,68 +1948,62 @@ function SearchPage({
1822
1948
  }
1823
1949
  function applyStagedAndClose() {
1824
1950
  search.applyStaged();
1825
- dialogRef.current?.close();
1826
- setMobileFiltersOpen(false);
1827
- }
1828
- const results = search.loading ? /* @__PURE__ */ jsx6(ResultsSkeleton, { className: classNames?.grid }) : /* @__PURE__ */ jsxs6(Fragment, { children: [
1829
- /* @__PURE__ */ jsxs6("p", { className: "mb-4 text-sm text-muted-foreground", children: [
1830
- search.total,
1831
- " ",
1832
- search.total === 1 ? "im\xF3vel encontrado" : "im\xF3veis encontrados"
1833
- ] }),
1834
- /* @__PURE__ */ jsx6(
1835
- "div",
1951
+ closeSheet();
1952
+ }
1953
+ const results = search.loading ? /* @__PURE__ */ jsx7(ResultsSkeleton, { className: classNames?.skeleton ?? classNames?.grid }) : /* @__PURE__ */ jsxs7(Fragment3, { children: [
1954
+ /* @__PURE__ */ jsx7("div", { "data-slot": "search-grid", className: classNames?.grid, children: search.listings.map((listing) => /* @__PURE__ */ jsx7(
1955
+ Card,
1836
1956
  {
1837
- "data-slot": "search-grid",
1838
- className: cn(
1839
- "grid grid-cols-1 gap-[var(--garagem-listing-card-gap,1.5rem)] sm:grid-cols-2 lg:grid-cols-3",
1840
- classNames?.grid
1841
- ),
1842
- children: search.listings.map((listing) => /* @__PURE__ */ jsx6(
1843
- Card,
1844
- {
1845
- listing,
1846
- className: classNames?.card
1847
- },
1848
- listing.id
1849
- ))
1850
- }
1851
- ),
1852
- /* @__PURE__ */ jsx6(
1957
+ listing,
1958
+ className: classNames?.card
1959
+ },
1960
+ listing.id
1961
+ )) }),
1962
+ /* @__PURE__ */ jsx7(
1853
1963
  SearchPagination,
1854
1964
  {
1855
1965
  page: search.page,
1856
1966
  totalPages: search.totalPages,
1857
1967
  hrefForPage: search.hrefForPage,
1968
+ onNavigate: search.go,
1858
1969
  className: classNames?.pagination
1859
1970
  }
1860
1971
  )
1861
1972
  ] });
1862
- const queryAndSort = /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-4 lg:flex-row lg:items-end", children: [
1863
- /* @__PURE__ */ jsx6(
1973
+ const queryAndSort = /* @__PURE__ */ jsxs7("div", { "data-slot": "search-query-sort", children: [
1974
+ /* @__PURE__ */ jsx7(
1864
1975
  SearchQueryForm,
1865
1976
  {
1866
1977
  value: search.qDraft,
1867
1978
  onChange: search.setQDraft,
1868
1979
  onSubmit: search.submitQuery,
1869
1980
  onClear: search.clearQuery,
1870
- className: cn("flex-1", classNames?.query)
1981
+ className: classNames?.query,
1982
+ iconClassName: classNames?.icon,
1983
+ searchIcon: icons?.search,
1984
+ clearIcon: icons?.clear
1871
1985
  }
1872
1986
  ),
1873
- /* @__PURE__ */ jsx6(
1987
+ /* @__PURE__ */ jsx7(
1874
1988
  SearchSortSelect,
1875
1989
  {
1876
1990
  value: search.applied.sort || "",
1877
1991
  onChange: search.setSort,
1878
- sorts: search.schema?.sorts
1992
+ sorts: search.schema?.sorts,
1993
+ className: classNames?.sort
1879
1994
  }
1880
1995
  )
1881
1996
  ] });
1882
- const header = heading ?? /* @__PURE__ */ jsxs6(Fragment, { children: [
1883
- /* @__PURE__ */ jsx6("p", { className: "text-xs uppercase tracking-widest text-primary", children: "Busca de im\xF3veis" }),
1884
- /* @__PURE__ */ jsx6("h1", { className: "mt-3 text-4xl font-semibold tracking-tight", children: "Encontre seu pr\xF3ximo im\xF3vel" })
1885
- ] });
1886
- const stagedPanel = (items) => /* @__PURE__ */ jsx6(
1997
+ const header = heading ?? /* @__PURE__ */ jsx7(
1998
+ SearchHeading,
1999
+ {
2000
+ total: search.total,
2001
+ title: headingTitle,
2002
+ classNames,
2003
+ loading: search.loading
2004
+ }
2005
+ );
2006
+ const stagedPanel = (items) => /* @__PURE__ */ jsx7(
1887
2007
  FilterPanel,
1888
2008
  {
1889
2009
  filters: items,
@@ -1894,124 +2014,88 @@ function SearchPage({
1894
2014
  onRangeCommit: (id) => commitRange(id, false)
1895
2015
  }
1896
2016
  );
1897
- return /* @__PURE__ */ jsxs6(
2017
+ const sheet = /* @__PURE__ */ jsx7(
2018
+ FilterSheet,
2019
+ {
2020
+ open: sheetOpen,
2021
+ title: "Filtros",
2022
+ onClose: closeSheet,
2023
+ overlayClassName: classNames?.dialogOverlay,
2024
+ panelClassName: cn(classNames?.dialog, classNames?.dialogPanel),
2025
+ footer: /* @__PURE__ */ jsx7(
2026
+ ApplyBar,
2027
+ {
2028
+ onClear: clearStagedFilters,
2029
+ onApply: applyStagedAndClose,
2030
+ className: classNames?.applyBar
2031
+ }
2032
+ ),
2033
+ children: stagedPanel(variant === "toolbar" ? extraFilters : filters)
2034
+ }
2035
+ );
2036
+ return /* @__PURE__ */ jsxs7(
1898
2037
  "main",
1899
2038
  {
1900
2039
  "data-slot": "search-page",
1901
2040
  "data-variant": variant,
1902
- className: cn(
1903
- "mx-auto max-w-7xl px-6 py-12",
1904
- className,
1905
- classNames?.root
1906
- ),
2041
+ className: cn(className, classNames?.root),
1907
2042
  children: [
1908
- /* @__PURE__ */ jsx6("div", { className: classNames?.header, children: header }),
1909
- /* @__PURE__ */ jsxs6("div", { className: "mt-8 space-y-6", children: [
2043
+ /* @__PURE__ */ jsx7(SearchChromeStyles, {}),
2044
+ /* @__PURE__ */ jsx7("div", { className: classNames?.header, children: header }),
2045
+ /* @__PURE__ */ jsxs7("div", { "data-slot": "search-body", children: [
1910
2046
  queryAndSort,
1911
- variant === "toolbar" ? /* @__PURE__ */ jsxs6(
1912
- "div",
1913
- {
1914
- "data-slot": "search-toolbar",
1915
- className: cn(
1916
- "flex flex-wrap items-end gap-2",
1917
- classNames?.toolbar
1918
- ),
1919
- children: [
1920
- toolbarFilters.map((filter) => /* @__PURE__ */ jsx6(ToolbarPopover, { label: filter.label, children: /* @__PURE__ */ jsx6(
2047
+ variant === "toolbar" ? /* @__PURE__ */ jsxs7("div", { "data-slot": "search-toolbar", className: classNames?.toolbar, children: [
2048
+ toolbarFilters.map((filter) => /* @__PURE__ */ jsx7(
2049
+ ToolbarPopover,
2050
+ {
2051
+ id: filter.id,
2052
+ label: filter.label,
2053
+ open: openToolbar === filter.id,
2054
+ onOpenChange: setOpenToolbar,
2055
+ triggerClassName: classNames?.toolbarTrigger,
2056
+ popoverClassName: classNames?.popover,
2057
+ children: /* @__PURE__ */ jsx7(
1921
2058
  FilterPanel,
1922
2059
  {
1923
2060
  filters: [filter],
1924
2061
  pathFilters: search.pathFilters,
1925
- onChange: search.applyFilter,
2062
+ onChange: (id, value) => {
2063
+ search.applyFilter(id, value);
2064
+ if (filter.type !== "range") setOpenToolbar(null);
2065
+ },
1926
2066
  rangeDraft,
1927
2067
  onRangePatch: patchRange,
1928
- onRangeCommit: (id) => commitRange(id, true)
1929
- }
1930
- ) }, filter.id)),
1931
- extraFilters.length > 0 ? /* @__PURE__ */ jsx6(FiltersTrigger, { onClick: openStagedFilters }) : null
1932
- ]
1933
- }
1934
- ) : null,
1935
- variant === "dialog" ? /* @__PURE__ */ jsx6(FiltersTrigger, { onClick: openStagedFilters }) : null,
1936
- variant === "sidebar" ? /* @__PURE__ */ jsxs6("div", { className: "grid gap-8 lg:grid-cols-[280px_minmax(0,1fr)]", children: [
1937
- /* @__PURE__ */ jsxs6(
1938
- "aside",
1939
- {
1940
- "data-slot": "search-sidebar",
1941
- className: cn(
1942
- "hidden lg:sticky lg:top-6 lg:block lg:self-start",
1943
- classNames?.sidebar
1944
- ),
1945
- children: [
1946
- stagedPanel(filters),
1947
- /* @__PURE__ */ jsx6(
1948
- ApplyBar,
1949
- {
1950
- onClear: clearStagedFilters,
1951
- onApply: search.applyStaged,
1952
- className: classNames?.applyBar
2068
+ onRangeCommit: (id, source) => {
2069
+ commitRange(id, true);
2070
+ if (source === "apply") setOpenToolbar(null);
1953
2071
  }
1954
- )
1955
- ]
1956
- }
1957
- ),
1958
- /* @__PURE__ */ jsxs6("div", { children: [
1959
- /* @__PURE__ */ jsx6(
1960
- FiltersTrigger,
1961
- {
1962
- onClick: openStagedFilters,
1963
- className: "mb-4 lg:hidden"
1964
- }
1965
- ),
1966
- results
1967
- ] })
1968
- ] }) : results
1969
- ] }),
1970
- variant !== "sidebar" ? /* @__PURE__ */ jsxs6(
1971
- "dialog",
1972
- {
1973
- ref: dialogRef,
1974
- className: cn(
1975
- "w-[min(32rem,calc(100%-2rem))] rounded-2xl border border-border bg-background p-6 shadow-xl",
1976
- classNames?.dialog
1977
- ),
1978
- children: [
1979
- /* @__PURE__ */ jsx6("p", { className: "mb-4 text-lg font-semibold", children: "Filtros" }),
1980
- stagedPanel(variant === "toolbar" ? extraFilters : filters),
1981
- /* @__PURE__ */ jsx6(
2072
+ }
2073
+ )
2074
+ },
2075
+ filter.id
2076
+ )),
2077
+ extraFilters.length > 0 ? /* @__PURE__ */ jsx7(FiltersTrigger, { onClick: openStagedFilters }) : null
2078
+ ] }) : null,
2079
+ variant === "dialog" ? /* @__PURE__ */ jsx7(FiltersTrigger, { onClick: openStagedFilters }) : null,
2080
+ variant === "sidebar" ? /* @__PURE__ */ jsxs7("div", { "data-slot": "search-layout", children: [
2081
+ /* @__PURE__ */ jsxs7("aside", { "data-slot": "search-sidebar", className: classNames?.sidebar, children: [
2082
+ stagedPanel(filters),
2083
+ /* @__PURE__ */ jsx7(
1982
2084
  ApplyBar,
1983
2085
  {
1984
2086
  onClear: clearStagedFilters,
1985
- onApply: applyStagedAndClose,
2087
+ onApply: search.applyStaged,
1986
2088
  className: classNames?.applyBar
1987
2089
  }
1988
2090
  )
1989
- ]
1990
- }
1991
- ) : null,
1992
- variant === "sidebar" && mobileFiltersOpen ? /* @__PURE__ */ jsxs6("div", { className: "fixed inset-0 z-40 lg:hidden", children: [
1993
- /* @__PURE__ */ jsx6(
1994
- "button",
1995
- {
1996
- type: "button",
1997
- "aria-label": "Fechar filtros",
1998
- className: "absolute inset-0 bg-black/40",
1999
- onClick: () => setMobileFiltersOpen(false)
2000
- }
2001
- ),
2002
- /* @__PURE__ */ jsxs6("div", { className: "absolute inset-y-0 right-0 w-[min(22rem,100%)] overflow-y-auto bg-background p-6", children: [
2003
- /* @__PURE__ */ jsx6("p", { className: "mb-4 text-lg font-semibold", children: "Filtros" }),
2004
- stagedPanel(filters),
2005
- /* @__PURE__ */ jsx6(
2006
- ApplyBar,
2007
- {
2008
- onClear: clearStagedFilters,
2009
- onApply: applyStagedAndClose,
2010
- className: classNames?.applyBar
2011
- }
2012
- )
2013
- ] })
2014
- ] }) : null
2091
+ ] }),
2092
+ /* @__PURE__ */ jsxs7("div", { children: [
2093
+ /* @__PURE__ */ jsx7(FiltersTrigger, { onClick: openStagedFilters }),
2094
+ results
2095
+ ] })
2096
+ ] }) : results
2097
+ ] }),
2098
+ sheet
2015
2099
  ]
2016
2100
  }
2017
2101
  );
@@ -2020,7 +2104,9 @@ export {
2020
2104
  FilterPanel,
2021
2105
  ListingCard,
2022
2106
  ResultsSkeleton,
2107
+ SearchChromeStyles,
2023
2108
  SearchPage,
2109
+ SearchPageFallback,
2024
2110
  SearchPagination,
2025
2111
  SearchQueryForm,
2026
2112
  SearchSortSelect,