From 9e9fe45d0372087f4758aec9bfb038c8be00bd01 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Fri, 23 Oct 2026 15:26:12 +0900 Subject: [PATCH] =?UTF-8?q?261023=5F03=5FENH:=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=EC=A0=9D=ED=8A=B8=C2=B7=ED=95=84=ED=84=B0=20=EC=84=A0=ED=83=9D?= =?UTF-8?q?=20=EA=B2=80=EC=83=89=EC=9D=84=20=EB=B6=80=EB=B6=84=20=EB=AC=B8?= =?UTF-8?q?=EC=9E=90=EC=97=B4=20=EC=9D=BC=EC=B9=98=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 5 +++++ src/components/common/KriAutoComplete.tsx | 19 ++++++++++++++++-- .../common/multi-select/MultiSelect.tsx | 2 ++ .../multi-select/MultiSelectContent.tsx | 20 +++++++++++++++++-- src/components/common/multi-select/index.ts | 1 + src/components/common/multi-select/types.ts | 2 ++ src/components/project/ProjectSelector.tsx | 2 ++ src/components/report/FilterPopup.tsx | 4 ++++ 8 files changed, 51 insertions(+), 4 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 5d5b5bc..ea8c723 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -313,6 +313,11 @@ When implementing or changing frontend UI, use this order: - `kri-auto-complete` exposes `optionTooltip?: 'singleLine' | 'wrap'` and `optionTooltipClassName?: string` on `KriSingleSelect`, `KriMultiSelect`, and `MultiSelect`. It is off by default, preserving existing behavior. - When enabled, hovering an option shows its full `label` in a right-side tooltip. `singleLine` stays on one line until the available viewport width; `wrap` wraps at 28rem. The item depends on the shadcn `tooltip` component and provides its own `TooltipProvider`. +### KriAutoComplete Search Match + +- `kri-auto-complete` exposes `searchMatch?: 'fuzzy' | 'contains'` on `KriSingleSelect`, `KriMultiSelect`, and `MultiSelect`. It defaults to `fuzzy` (cmdk's default subsequence scoring), preserving existing behavior. +- `contains` keeps only options whose label or value contains the search text as a case-insensitive substring, in the original option order. It applies only when `searchMode` is `filter`. + ### KriEditor SMS Preview - `changeSmsType` reports `SMS | LMS | MMS`. Update consumer callbacks to handle `MMS`; this widens the previous callback contract. diff --git a/src/components/common/KriAutoComplete.tsx b/src/components/common/KriAutoComplete.tsx index cec733e..a070c18 100644 --- a/src/components/common/KriAutoComplete.tsx +++ b/src/components/common/KriAutoComplete.tsx @@ -3,14 +3,25 @@ import * as React from 'react' import { cn } from '@/lib/utils' import { MultiSelect } from '@/components/common/multi-select' -import type { MultiSelectOption, MultiSelectOptionTooltip, MultiSelectRef } from '@/components/common/multi-select' +import type { + MultiSelectOption, + MultiSelectOptionTooltip, + MultiSelectRef, + MultiSelectSearchMatch, +} from '@/components/common/multi-select' -export type { MultiSelectOption, MultiSelectOptionTooltip, MultiSelectRef } from '@/components/common/multi-select' +export type { + MultiSelectOption, + MultiSelectOptionTooltip, + MultiSelectRef, + MultiSelectSearchMatch, +} from '@/components/common/multi-select' export interface KriAutoCompleteBaseProps { items: T[] searchable?: boolean searchMode?: 'filter' | 'inputOnly' + searchMatch?: MultiSelectSearchMatch resetScrollOnSearch?: boolean defaultSearchValue?: string onSearchValueChange?: (value: string) => void @@ -59,6 +70,7 @@ export function KriMultiSelect({ onChange, searchable = true, searchMode = 'filter', + searchMatch = 'fuzzy', resetScrollOnSearch = false, defaultSearchValue = '', onSearchValueChange, @@ -102,6 +114,7 @@ export function KriMultiSelect({ badgeClassName={badgeClassName} searchable={searchable} searchMode={searchMode} + searchMatch={searchMatch} resetScrollOnSearch={resetScrollOnSearch} defaultSearchValue={defaultSearchValue} onSearchValueChange={onSearchValueChange} @@ -140,6 +153,7 @@ function KriSingleSelectInner({ onChange, searchable = true, searchMode = 'filter', + searchMatch = 'fuzzy', resetScrollOnSearch = false, defaultSearchValue = '', onSearchValueChange, @@ -220,6 +234,7 @@ function KriSingleSelectInner({ badgeClassName={badgeClassName} searchable={searchable} searchMode={searchMode} + searchMatch={searchMatch} resetScrollOnSearch={resetScrollOnSearch} defaultSearchValue={defaultSearchValue} onSearchValueChange={onSearchValueChange} diff --git a/src/components/common/multi-select/MultiSelect.tsx b/src/components/common/multi-select/MultiSelect.tsx index 53c7207..0a13d0c 100644 --- a/src/components/common/multi-select/MultiSelect.tsx +++ b/src/components/common/multi-select/MultiSelect.tsx @@ -30,6 +30,7 @@ function MultiSelectInner( hideSelectAll = false, searchable = true, searchMode = 'filter', + searchMatch = 'fuzzy', resetScrollOnSearch = false, defaultSearchValue = '', onSearchValueChange, @@ -202,6 +203,7 @@ function MultiSelectInner( selectedValues={selectedValues} searchable={searchable} searchMode={searchMode} + searchMatch={searchMatch} resetScrollOnSearch={resetScrollOnSearch} searchValue={searchValue} onSearchValueChange={handleSearchChange} diff --git a/src/components/common/multi-select/MultiSelectContent.tsx b/src/components/common/multi-select/MultiSelectContent.tsx index 27957f5..98e3fda 100644 --- a/src/components/common/multi-select/MultiSelectContent.tsx +++ b/src/components/common/multi-select/MultiSelectContent.tsx @@ -13,14 +13,26 @@ import { } from '@/components/ui/command' import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip' import { cn } from '@/lib/utils' -import type { MultiSelectGroup, MultiSelectOption, MultiSelectOptionTooltip, MultiSelectOptions } from './types' +import type { + MultiSelectGroup, + MultiSelectOption, + MultiSelectOptionTooltip, + MultiSelectOptions, + MultiSelectSearchMatch, +} from './types' import { isGroupedOptions } from './utils' +// Case-insensitive substring match; equal scores keep the original option order. +function containsFilter(value: string, search: string) { + return value.toLowerCase().includes(search.toLowerCase()) ? 1 : 0 +} + interface MultiSelectContentProps { options: MultiSelectOptions selectedValues: string[] searchable: boolean searchMode: 'filter' | 'inputOnly' + searchMatch?: MultiSelectSearchMatch searchValue: string resetScrollOnSearch?: boolean onSearchValueChange: (value: string) => void @@ -134,6 +146,7 @@ export function MultiSelectContent({ selectedValues, searchable, searchMode, + searchMatch = 'fuzzy', searchValue, resetScrollOnSearch = false, onSearchValueChange, @@ -164,7 +177,10 @@ export function MultiSelectContent({ const tooltip = optionTooltip ? { mode: optionTooltip, className: optionTooltipClassName } : undefined const content = ( - + {searchable ? ( = MultiSelectOption[] | MultiSele export type MultiSelectSelectionMode = 'single' | 'multiple' export type MultiSelectVariant = 'default' | 'secondary' | 'destructive' | 'inverted' export type MultiSelectOptionTooltip = 'singleLine' | 'wrap' +export type MultiSelectSearchMatch = 'fuzzy' | 'contains' export interface MultiSelectResponsiveSettings { maxCount?: number @@ -65,6 +66,7 @@ export interface MultiSelectProps hideSelectAll?: boolean searchable?: boolean searchMode?: 'filter' | 'inputOnly' + searchMatch?: MultiSelectSearchMatch resetScrollOnSearch?: boolean defaultSearchValue?: string onSearchValueChange?: (value: string) => void diff --git a/src/components/project/ProjectSelector.tsx b/src/components/project/ProjectSelector.tsx index 12375eb..f5b3f19 100644 --- a/src/components/project/ProjectSelector.tsx +++ b/src/components/project/ProjectSelector.tsx @@ -49,6 +49,8 @@ export function ProjectSelector() { className="h-8 min-h-8 rounded-[39px] border-[#d0d0d0] bg-kart-soft px-[22px] py-0 text-sm shadow-none" spanClassName="text-sm [&_span]:text-kart-text" searchable + // Legacy Dropdown search: case-insensitive substring, not fuzzy. + searchMatch="contains" resetScrollOnSearch // Legacy react-tooltip: full "(pkey) title" on hover, right side, 65% opacity. optionTooltip="singleLine" diff --git a/src/components/report/FilterPopup.tsx b/src/components/report/FilterPopup.tsx index 92a894d..36ace14 100644 --- a/src/components/report/FilterPopup.tsx +++ b/src/components/report/FilterPopup.tsx @@ -243,6 +243,8 @@ function FilterLineRow({ className="h-[38px] min-h-[38px] rounded-[4px] border-[#d0d0d0] text-sm" spanClassName="text-sm" searchable + // Legacy Dropdown search: case-insensitive substring, not fuzzy. + searchMatch="contains" preventDeselect hideOptionCheck // Legacy QuestionSelect tooltip: full title on hover. @@ -305,6 +307,8 @@ function FilterLineRow({ badgeClassName="text-xs" maxSelected={multi ? undefined : 1} hideSelectAll={!multi} + // Legacy ValueSelect search: case-insensitive substring. + searchMatch="contains" // Legacy ValueSelect tooltip: full label on hover. optionTooltip="singleLine" optionTooltipClassName="opacity-65"