📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Match styles to the Select component
Blue Mouse951fee35079b
diff --git a/web/app/ui/MultiSelect.tsx b/web/app/ui/MultiSelect.tsxindex acf72655e..f327a9322 100644--- a/web/app/ui/MultiSelect.tsx+++ b/web/app/ui/MultiSelect.tsx@@ -1,4 +1,4 @@-import { ChevronDownIcon } from '@heroicons/react/24/solid'+import { CheckIcon, ChevronUpDownIcon } from '@heroicons/react/24/solid'import cx from 'clsx'import _includes from 'lodash/includes'import _isEmpty from 'lodash/isEmpty'@@ -91,12 +91,11 @@ const MultiSelect = ({ref={dropdownRef}className={cx('relative flex w-full flex-col', className)}>- {/* Search input as the dropdown trigger */}<div className='relative'><inputref={inputRef}type='text'- className='w-full cursor-text rounded-md border border-gray-300 bg-white py-2 pr-8 pl-3 text-sm transition-colors ring-inset placeholder:text-gray-400 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 focus:outline-hidden dark:border-gray-700 dark:bg-slate-800 dark:text-gray-50 dark:placeholder:text-gray-500'+ className='w-full cursor-text rounded-md border-0 bg-white py-2 pr-10 pl-3 text-sm font-medium ring-1 ring-gray-300 transition-colors ring-inset placeholder:text-gray-400 hover:bg-gray-50 focus:ring-2 focus:ring-slate-900 focus:outline-hidden dark:bg-slate-900 dark:text-gray-50 dark:ring-slate-700/80 dark:placeholder:text-gray-500 dark:hover:bg-slate-800 dark:focus:ring-slate-300'placeholder={placeholder}value={searchValue}onChange={handleInputChange}@@ -104,80 +103,72 @@ const MultiSelect = ({onKeyDown={handleKeyDown}/><span className='pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2'>- <ChevronDownIcon- className={cx('h-5 w-5 text-gray-400 transition-transform', {- 'rotate-180': isOpen,- })}+ <ChevronUpDownIcon+ className='h-5 w-5 text-gray-400'aria-hidden='true'/></span>- {/* Dropdown menu */}- {isOpen ? (- <div className='absolute top-full z-50 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-sm shadow-lg ring-1 ring-black/10 focus:outline-hidden dark:bg-slate-800'>- {/* Options list */}- <div className='px-1'>- {_isEmpty(items) ? (- <div className='px-3 py-2 text-gray-500 dark:text-gray-400'>- No options available- </div>- ) : (- _map(items, (item) => {- const isSelected = _includes(label, item)- return (- <button- type='button'- key={- keyExtractor- ? `${keyExtractor(item)}select`- : `${item}select`- }- onClick={() => handleSelectItem(item)}- className={cx(- 'relative flex w-full cursor-pointer items-center gap-2 rounded-md py-2 pr-4 pl-3 text-left text-sm transition-colors select-none',- {- 'bg-indigo-50 dark:bg-indigo-900/30': isSelected,- 'hover:bg-gray-100 dark:hover:bg-slate-700':- !isSelected,- 'text-gray-900 dark:text-white': isSelected,- 'text-gray-700 dark:text-gray-50': !isSelected,- },- )}- >- <span className='flex min-w-0 flex-1 items-center gap-2'>- {itemExtractor ? itemExtractor(item) : item}- </span>- {isSelected ? (- <span className='ml-auto flex h-4 w-4 shrink-0 items-center justify-center'>- <svg- className='h-4 w-4 text-indigo-600 dark:text-indigo-400'- viewBox='0 0 20 20'- fill='currentColor'- >- <path- fillRule='evenodd'- d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z'- clipRule='evenodd'- />- </svg>- </span>- ) : null}- </button>- )- })- )}+ <div+ className={cx(+ 'absolute top-full z-30 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-sm ring-1 ring-black/10 focus:outline-hidden dark:bg-slate-900 dark:ring-slate-700/80',+ 'transition-opacity duration-100 ease-in',+ isOpen ? 'opacity-100' : 'pointer-events-none opacity-0',+ )}+ >+ {_isEmpty(items) ? (+ <div className='mx-1 px-3 py-2 text-gray-500 dark:text-gray-400'>+ No options available</div>- </div>- ) : null}+ ) : (+ _map(items, (item) => {+ const isSelected = _includes(label, item)+ return (+ <button+ type='button'+ key={+ keyExtractor+ ? `${keyExtractor(item)}select`+ : `${item}select`+ }+ onClick={() => handleSelectItem(item)}+ className={cx(+ 'relative mx-1 flex w-[calc(100%-0.5rem)] cursor-pointer items-center rounded-md py-2 pr-4 pl-8 text-left text-sm transition-colors select-none',+ {+ 'bg-gray-200 dark:bg-slate-800/80': isSelected,+ 'hover:bg-gray-100 dark:hover:bg-slate-800/80':+ !isSelected,+ 'text-gray-900 dark:text-white': isSelected,+ 'text-gray-700 dark:text-gray-50': !isSelected,+ },+ )}+ >+ {isSelected ? (+ <span className='absolute inset-y-0 left-0 flex items-center pl-1.5 text-gray-600 dark:text-gray-300'>+ <CheckIcon className='h-5 w-5' aria-hidden='true' />+ </span>+ ) : null}+ <span+ className={cx('block truncate', {+ 'font-semibold': isSelected,+ 'font-normal': !isSelected,+ })}+ >+ {itemExtractor ? itemExtractor(item) : item}+ </span>+ </button>+ )+ })+ )}+ </div></div>- {/* Selected items displayed below the selector */}{!_isEmpty(label) ? (<div className='mt-2 flex flex-wrap gap-2'>{_map(label, (item) => (<spankey={keyExtractor ? keyExtractor(item) : item}- className='inline-flex items-center gap-1.5 rounded-md bg-gray-100 py-1.5 pr-2 pl-2.5 text-sm font-medium text-gray-700 dark:bg-slate-700 dark:text-gray-200'+ className='inline-flex items-center gap-1.5 rounded-md bg-gray-100 py-1.5 pr-2 pl-2.5 text-sm font-medium text-gray-700 dark:bg-slate-800 dark:text-gray-200'><span className='flex items-center gap-1.5'>{labelExtractor ? labelExtractor(item) : item}@@ -189,7 +180,7 @@ const MultiSelect = ({e.stopPropagation()onRemove(item)}}- className='inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-gray-400 hover:bg-gray-200 hover:text-gray-600 focus:bg-gray-300 focus:text-gray-700 focus:outline-hidden dark:text-gray-400 dark:hover:bg-slate-600 dark:hover:text-gray-200'+ className='inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-gray-400 transition-colors hover:bg-gray-200 hover:text-gray-600 focus:bg-gray-300 focus:text-gray-700 focus:outline-hidden dark:text-gray-400 dark:hover:bg-slate-700 dark:hover:text-gray-200'><span className='sr-only'>Remove</span><svg@@ -210,7 +201,6 @@ const MultiSelect = ({</div>) : null}- {/* Hint text */}{hint ? (<p className='mt-2 text-sm whitespace-pre-line text-gray-500 dark:text-gray-300'>{hint}