|
5 | 5 | <meta charset="utf-8"> |
6 | 6 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
7 | 7 | <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script> |
| 8 | + <style type="text/tailwindcss"> |
| 9 | + @custom-variant dark (&:where(.dark, .dark *)); |
| 10 | +
|
| 11 | + @theme { |
| 12 | + --animate-spin-loader: spin 0.5s linear infinite; |
| 13 | +
|
| 14 | + --background-image-select: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e"); |
| 15 | + --background-image-checkbox: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e"); |
| 16 | + } |
| 17 | + </style> |
8 | 18 |
|
9 | 19 | < script defer src= "https://cdn.jsdelivr.net/npm/@ryangjchandler/[email protected]/dist/cdn.min.js"></ script> |
10 | 20 | <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tippy.js@6/dist/tippy.min.css" /> |
@@ -96,7 +106,7 @@ class="rounded-md ring-1 ring-inset"> |
96 | 106 | <div class="flex grow items-center justify-center border-b border-gray-200"> |
97 | 107 | <x-kit::popover class=""> |
98 | 108 | <x-kit::button class="rounded-md ring-1 ring-inset" color="white" x-ref="trigger" |
99 | | - x-on:click.stop="open = !open"> |
| 109 | + x-on:click="open = !open"> |
100 | 110 | Click me |
101 | 111 | <x-slot:icon-right> |
102 | 112 | <iconify-icon icon="heroicons:chevron-up-down"></iconify-icon> |
@@ -175,6 +185,76 @@ class="mt-auto flex w-full flex-col rounded-lg border border-gray-200 bg-white s |
175 | 185 | </x-kit::popover> |
176 | 186 | </div> |
177 | 187 | </div> |
| 188 | + <div class="flex flex-col"> |
| 189 | + <div class="p-3"> |
| 190 | + <h1 class="font-semibold">Combobox</h1> |
| 191 | + </div> |
| 192 | + <div class="flex grow items-center justify-center border-b border-gray-200"> |
| 193 | + <x-kit::popover x-data="{ |
| 194 | + search: '', |
| 195 | + values: [], |
| 196 | + options: Array.from({ length: 11 }, (_, i) => 'Option ' + i), |
| 197 | + get filteredOptions() { |
| 198 | + const search = this.search.toLowerCase(); |
| 199 | + |
| 200 | + if (search) { |
| 201 | + return this.options.filter((option) => option.toLowerCase().includes(search)); |
| 202 | + } |
| 203 | + |
| 204 | + return this.options; |
| 205 | + } |
| 206 | + }"> |
| 207 | + <x-kit::button class="rounded-md ring-1 ring-inset" color="white" x-ref="trigger" |
| 208 | + x-on:click="open = !open"> |
| 209 | + Click me |
| 210 | + <x-slot:icon-right> |
| 211 | + <iconify-icon icon="heroicons:chevron-up-down"></iconify-icon> |
| 212 | + </x-slot:icon-right> |
| 213 | + </x-kit::button> |
| 214 | + |
| 215 | + <x-kit::popover.content class="z-20 p-3 md:p-0" x-anchor.bottom-end.offset.5="$refs.trigger" |
| 216 | + x-transition.origin.top=""> |
| 217 | + <div |
| 218 | + class="mt-auto flex w-full flex-col rounded-lg border border-gray-200 bg-white shadow-lg md:max-w-72"> |
| 219 | + |
| 220 | + <div class="p-1"> |
| 221 | + <x-kit::input.parent color="gray" class="outline-0! rounded-md ring-1 ring-inset"> |
| 222 | + <x-kit::input size="sm" color="transparent" placeholder="Search" |
| 223 | + x-model="search"> |
| 224 | + <x-slot:icon> |
| 225 | + <iconify-icon icon="lucide:search"></iconify-icon> |
| 226 | + </x-slot:icon> |
| 227 | + </x-kit::input> |
| 228 | + <x-kit::button color="white" |
| 229 | + class="m-0.5 rounded font-semibold ring-1 ring-inset" size="xs"> |
| 230 | + <x-slot:icon-right> |
| 231 | + <iconify-icon icon="lucide:plus"></iconify-icon> |
| 232 | + </x-slot:icon-right> |
| 233 | + New |
| 234 | + </x-kit::button> |
| 235 | + </x-kit::input.parent> |
| 236 | + </div> |
| 237 | + |
| 238 | + <div class="flex max-h-full flex-col gap-0.5 overflow-auto p-1 md:max-h-56"> |
| 239 | + <template x-for="option in filteredOptions" x-bind:key="option"> |
| 240 | + <div class="flex gap-0.5"> |
| 241 | + <x-kit::button.radio class="w-full rounded-md" type="checkbox" |
| 242 | + x-model="values" x-bind:value="option" name="combobox" |
| 243 | + size="sm"> |
| 244 | + <span x-text="option"></span> |
| 245 | + <x-slot:icon-right class="invisible ml-auto peer-checked/input:visible"> |
| 246 | + <iconify-icon icon="lucide:check"></iconify-icon> |
| 247 | + </x-slot:icon-right> |
| 248 | + </x-kit::button.radio> |
| 249 | + </div> |
| 250 | + </template> |
| 251 | + </div> |
| 252 | + |
| 253 | + </div> |
| 254 | + </x-kit::popover.content> |
| 255 | + </x-kit::popover> |
| 256 | + </div> |
| 257 | + </div> |
178 | 258 |
|
179 | 259 | <div class="isolate flex flex-col"> |
180 | 260 | <div class="p-3"> |
|
0 commit comments