@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.
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
 
3
- import type { FormEvent, ReactElement } from "react";
3
+ import type { FormEvent, ReactElement, ReactNode } from "react";
4
4
 
5
- import { cn } from "./cn";
5
+ import { SearchClearIcon, SearchLensIcon } from "./icons";
6
6
 
7
7
  export type SearchQueryFormProps = {
8
8
  value: string;
@@ -10,6 +10,9 @@ export type SearchQueryFormProps = {
10
10
  onSubmit: () => void;
11
11
  onClear: () => void;
12
12
  className?: string;
13
+ iconClassName?: string;
14
+ searchIcon?: ReactNode;
15
+ clearIcon?: ReactNode;
13
16
  };
14
17
 
15
18
  export function SearchQueryForm({
@@ -18,6 +21,9 @@ export function SearchQueryForm({
18
21
  onSubmit,
19
22
  onClear,
20
23
  className,
24
+ iconClassName,
25
+ searchIcon,
26
+ clearIcon,
21
27
  }: SearchQueryFormProps): ReactElement {
22
28
  function handleSubmit(event: FormEvent) {
23
29
  event.preventDefault();
@@ -29,45 +35,44 @@ export function SearchQueryForm({
29
35
  role="search"
30
36
  data-slot="search-query"
31
37
  onSubmit={handleSubmit}
32
- className={cn("flex items-end gap-2", className)}
38
+ className={className}
33
39
  >
34
- <div className="min-w-0 flex-1">
35
- <label
36
- htmlFor="garagem-search-q"
37
- className="mb-1 block text-sm text-muted-foreground"
38
- >
39
- Busca
40
- </label>
41
- <div className="relative">
42
- <input
43
- id="garagem-search-q"
44
- name="q"
45
- type="search"
46
- autoComplete="off"
47
- enterKeyHint="search"
48
- value={value}
49
- onChange={(event) => onChange(event.target.value)}
50
- placeholder="Busque por bairro, rua ou código"
51
- className="min-h-12 w-full rounded-xl border border-border bg-background px-4 pr-20 outline-none focus:border-primary"
52
- />
40
+ <label htmlFor="garagem-search-q" data-slot="search-label">
41
+ Busca
42
+ </label>
43
+ <div data-slot="search-query-field">
44
+ <input
45
+ id="garagem-search-q"
46
+ name="q"
47
+ type="text"
48
+ inputMode="search"
49
+ autoComplete="off"
50
+ enterKeyHint="search"
51
+ value={value}
52
+ onChange={(event) => onChange(event.target.value)}
53
+ placeholder="Busque por bairro, rua ou código"
54
+ data-slot="search-query-input"
55
+ />
56
+ <div data-slot="search-query-actions">
53
57
  {value ? (
54
58
  <button
55
59
  type="button"
56
60
  title="Limpar busca"
57
61
  aria-label="Limpar busca"
58
62
  onClick={onClear}
59
- 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"
63
+ data-slot="search-icon-button"
64
+ data-kind="clear"
60
65
  >
61
- ×
66
+ {clearIcon ?? <SearchClearIcon className={iconClassName} />}
62
67
  </button>
63
68
  ) : null}
64
69
  <button
65
70
  type="submit"
66
71
  title="Buscar"
67
72
  aria-label="Buscar"
68
- 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"
73
+ data-slot="search-icon-button"
69
74
  >
70
- ⌕
75
+ {searchIcon ?? <SearchLensIcon className={iconClassName} />}
71
76
  </button>
72
77
  </div>
73
78
  </div>