|
10 | 10 | export let customColor: string = ''; |
11 | 11 | export let color: 'blue' | 'green' | 'red' | 'yellow' | 'purple' | 'default' | 'custom' = 'default'; |
12 | 12 | export let innerDivClass: string = 'p-4'; |
| 13 | + export let searchClass: string = 'relative mt-1'; |
| 14 | + export let svgDivClass: string = 'absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none'; |
| 15 | + export let svgClass: string = 'w-5 h-5 text-gray-500 dark:text-gray-400'; |
| 16 | + export let inputClass: string = 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-80 pl-10 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500'; |
| 17 | +
|
| 18 | + let inputCls = twMerge(inputClass, $$props.classInput); |
| 19 | + let svgDivCls = twMerge(svgDivClass, $$props.classSvgDiv); |
13 | 20 |
|
14 | 21 | const colors = { |
15 | 22 | default: 'text-gray-500 dark:text-gray-400', |
|
27 | 34 | </script> |
28 | 35 |
|
29 | 36 | <div class={divClass}> |
30 | | - <div class="{innerDivClass}"> |
| 37 | + <div class={innerDivClass}> |
31 | 38 | <label for="table-search" class="sr-only">Search</label> |
32 | | - <div class="relative mt-1"> |
33 | | - <div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"> |
34 | | - <svg class="w-5 h-5 text-gray-500 dark:text-gray-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> |
35 | | - <path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" /> |
36 | | - </svg> |
| 39 | + <div class={searchClass}> |
| 40 | + <div class={svgDivCls}> |
| 41 | + <slot name="svgSearch"> |
| 42 | + <svg class={svgClass} fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> |
| 43 | + <path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" /> |
| 44 | + </svg> |
| 45 | + </slot> |
37 | 46 | </div> |
38 | | - <input bind:value={inputValue} type="text" id="table-search" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-80 pl-10 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" {placeholder} /> |
| 47 | + <input bind:value={inputValue} type="text" id="table-search" class={inputCls} {placeholder} /> |
39 | 48 | </div> |
40 | 49 | <slot name="header" /> |
41 | 50 | </div> |
|
0 commit comments