-
-
+ item.id == templateID)!.title } : null}
- onChange={data => onChangeTemplateID(data ? data.value : null)}
+ idFunc={item => String(item.id)}
+ labelValueFunc={item => item.title}
+ labelOptionFunc={item => item.title}
+ onChange={item => onChangeTemplateID(item?.id ?? null)}
/>
- onChangeFilterCategory(data ? templateSchema?.cstByID.get(data?.value) ?? null : null)}
- isClearable
+ className='grow'
+ idFunc={cst => String(cst.id)}
+ labelValueFunc={cst => cst.term_raw}
+ labelOptionFunc={cst => cst.term_raw}
+ onChange={cst => onChangeFilterCategory(cst)}
/>
void;
+ onChange: (newValue: number | null) => void;
filter?: (userID: number) => boolean;
placeholder?: string;
noBorder?: boolean;
+ noAnonymous?: boolean;
+ hidden?: boolean;
}
function compareUsers(a: IUserInfo, b: IUserInfo) {
@@ -33,10 +32,8 @@ function compareUsers(a: IUserInfo, b: IUserInfo) {
}
export function SelectUser({
- className,
filter,
- value,
- onChange,
+ noAnonymous,
placeholder = 'Выберите пользователя',
...restProps
}: SelectUserProps) {
@@ -46,28 +43,16 @@ export function SelectUser({
const items = filter ? users.filter(user => filter(user.id)) : users;
const sorted = [
...items.filter(user => !!user.first_name || !!user.last_name).sort(compareUsers),
- ...items.filter(user => !user.first_name && !user.last_name)
- ];
- const options = sorted.map(user => ({
- value: user.id,
- label: getUserLabel(user.id)
- }));
-
- function filterLabel(option: { value: string | undefined; label: string }, query: string) {
- const user = items.find(item => item.id === Number(option.value));
- return !user ? false : matchUser(user, query);
- }
+ ...(!noAnonymous ? items.filter(user => !user.first_name && !user.last_name) : [])
+ ].map(user => user.id);
return (
- {
- if (data?.value !== undefined) onChange(data.value);
- }}
- filterOption={filterLabel}
+ String(user)}
+ labelValueFunc={user => getUserLabel(user)}
+ labelOptionFunc={user => getUserLabel(user)}
{...restProps}
/>
);
diff --git a/rsconcept/frontend/src/features/users/models/user-api.ts b/rsconcept/frontend/src/features/users/models/user-api.ts
deleted file mode 100644
index daf5ddcb..00000000
--- a/rsconcept/frontend/src/features/users/models/user-api.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Module: API for formal representation for Users.
- */
-
-import { TextMatcher } from '@/utils/utils';
-
-import { type IUserInfo } from '../backend/types';
-
-/**
- * Checks if a given target {@link IConstituenta} matches the specified query using the provided matching mode.
- *
- * @param target - The target object to be matched.
- * @param query - The query string used for matching.
- * @param mode - The matching mode to determine which properties to include in the matching process.
- */
-export function matchUser(target: IUserInfo, query: string): boolean {
- const matcher = new TextMatcher(query);
- return matcher.test(target.last_name) || matcher.test(target.first_name);
-}
diff --git a/rsconcept/frontend/src/index.css b/rsconcept/frontend/src/index.css
index 62ce947e..484512f6 100644
--- a/rsconcept/frontend/src/index.css
+++ b/rsconcept/frontend/src/index.css
@@ -26,6 +26,21 @@
outline: 2px solid hotpink !important;
} */
+:root {
+ /* --radius: 0.625rem; */
+ --primary: oklch(20.5% 0 0deg);
+ --primary-foreground: oklch(98.5% 0 0deg);
+ --secondary: oklch(97% 0 0deg);
+ --secondary-foreground: oklch(20.5% 0 0deg);
+}
+
+.dark {
+ --primary: oklch(92.2% 0 0deg);
+ --primary-foreground: oklch(20.5% 0 0deg);
+ --secondary: oklch(26.9% 0 0deg);
+ --secondary-foreground: oklch(98.5% 0 0deg);
+}
+
@theme inline {
/* stylelint-disable-next-line custom-property-pattern */
--color-*: initial;
@@ -54,6 +69,9 @@
--color-ok-600: var(--clr-ok-600);
+ --color-selected: var(--clr-sec-200);
+ --color-selected-foreground: var(--clr-prim-999);
+
/* stylelint-disable-next-line custom-property-pattern */
--z-index-*: initial;
--z-index-bottom: 0;
@@ -80,38 +98,9 @@
--duration-fade: 300ms;
--duration-dropdown: 200ms;
--duration-select: 100ms;
-}
-/* ========= shadcn theme ============ */
+ /* ========= shadcn theme ============ */
-:root {
- /* --radius: 0.625rem; */
- --primary: oklch(20.5% 0 0deg);
- --primary-foreground: oklch(98.5% 0 0deg);
- --secondary: oklch(97% 0 0deg);
- --secondary-foreground: oklch(20.5% 0 0deg);
-
- --chart-1: oklch(64.6% 0.222 41.116deg);
- --chart-2: oklch(60% 0.118 184.704deg);
- --chart-3: oklch(39.8% 0.07 227.392deg);
- --chart-4: oklch(82.8% 0.189 84.429deg);
- --chart-5: oklch(76.9% 0.188 70.08deg);
-}
-
-.dark {
- --primary: oklch(92.2% 0 0deg);
- --primary-foreground: oklch(20.5% 0 0deg);
- --secondary: oklch(26.9% 0 0deg);
- --secondary-foreground: oklch(98.5% 0 0deg);
-
- --chart-1: oklch(48.8% 0.243 264.376deg);
- --chart-2: oklch(69.6% 0.17 162.48deg);
- --chart-3: oklch(76.9% 0.188 70.08deg);
- --chart-4: oklch(62.7% 0.265 303.9deg);
- --chart-5: oklch(64.5% 0.246 16.439deg);
-}
-
-@theme inline {
/* --radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
diff --git a/rsconcept/frontend/src/styling/components.css b/rsconcept/frontend/src/styling/components.css
index 8926b614..607a58c4 100644
--- a/rsconcept/frontend/src/styling/components.css
+++ b/rsconcept/frontend/src/styling/components.css
@@ -228,7 +228,7 @@
}
}
-@utility cc-select-popover {
+@utility cc-animate-popover {
transform-origin: var(--radix-select-content-transform-origin);
&[data-state='open'] {