Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

improvement(access-control): migrate access management pickers to Combobox (#8832)

Andrew Huang81116d9ab1cb
diff --git a/frontend/src/components/roles/RoleOption.tsx b/frontend/src/components/roles/RoleOption.tsx
index 8939e29be7..6c65da0b17 100644
--- a/frontend/src/components/roles/RoleOption.tsx
+++ b/frontend/src/components/roles/RoleOption.tsx
@@ -1,6 +1,23 @@
import { components, OptionProps } from "react-select";
import { CheckIcon } from "lucide-react";
+export const RoleOptionContent = ({
+ role
+}: {
+ role: { name: string; description?: string | undefined };
+}) => (
+ <div className="min-w-0">
+ <p className="truncate">{role.name}</p>
+ {role.description ? (
+ <p className="text-xs leading-4 break-words whitespace-normal text-muted">
+ {role.description}
+ </p>
+ ) : (
+ <p className="text-xs leading-4 text-muted/50">No Description</p>
+ )}
+ </div>
+);
+
export const RoleOption = ({
isSelected,
children,
diff --git a/frontend/src/pages/admin/AccessManagementPage/components/AddServerAdminModal.tsx b/frontend/src/pages/admin/AccessManagementPage/components/AddServerAdminModal.tsx
index a066f0e741..9eaf6ff540 100644
--- a/frontend/src/pages/admin/AccessManagementPage/components/AddServerAdminModal.tsx
+++ b/frontend/src/pages/admin/AccessManagementPage/components/AddServerAdminModal.tsx
@@ -6,6 +6,7 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import {
Button,
+ Combobox,
Dialog,
DialogContent,
DialogDescription,
@@ -14,8 +15,7 @@ import {
DialogTitle,
Field,
FieldError,
- FieldLabel,
- FilterableSelect
+ FieldLabel
} from "@app/components/v3";
import { useDebounce } from "@app/hooks";
import { useAdminGetUsers, useAdminGrantServerAdminAccess } from "@app/hooks/api";
@@ -93,17 +93,18 @@ const Content = ({ onClose }: ContentProps) => {
render={({ field, fieldState: { error } }) => (
<Field>
<FieldLabel htmlFor={userSelectId}>User</FieldLabel>
- <FilterableSelect
- inputId={userSelectId}
+ <Combobox
+ id={userSelectId}
isLoading={searchUserFilter !== debouncedSearchTerm || isPending}
- className="w-full"
placeholder="Search users..."
+ searchAriaLabel="Search users"
options={users}
getOptionLabel={(user) => getUserLabel(user)}
getOptionValue={(user) => user.id}
value={field.value}
- onChange={field.onChange}
- onInputChange={(value) => {
+ isClearable={false}
+ onValueChange={field.onChange}
+ onSearchChange={(value) => {
setSearchUserFilter(value);
if (!value) setDebouncedSearchTerm("");
}}
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupLinkForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupLinkForm.tsx
index 37615d2535..57aca1a947 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupLinkForm.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupLinkForm.tsx
@@ -5,15 +5,8 @@ import { useNavigate } from "@tanstack/react-router";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { RoleOption } from "@app/components/roles";
-import {
- Button,
- DialogFooter,
- Field,
- FieldError,
- FieldLabel,
- FilterableSelect
-} from "@app/components/v3";
+import { RoleOptionContent } from "@app/components/roles";
+import { Button, Combobox, DialogFooter, Field, FieldError, FieldLabel } from "@app/components/v3";
import { useOrganization } from "@app/context";
import { useScopeVariant } from "@app/hooks";
import { useGetOrgRoles } from "@app/hooks/api";
@@ -85,11 +78,13 @@ export const OrgGroupLinkForm = ({ onClose }: Props) => {
render={({ field: { onChange, value }, fieldState: { error } }) => (
<Field>
<FieldLabel htmlFor="group">Group</FieldLabel>
- <FilterableSelect
- inputId="group"
+ <Combobox
+ id="group"
value={value}
- onChange={onChange}
+ isClearable={false}
+ onValueChange={onChange}
placeholder="Select group..."
+ searchAriaLabel="Search groups"
autoFocus
isError={Boolean(error)}
options={rootOrgGroups ?? []}
@@ -107,16 +102,19 @@ export const OrgGroupLinkForm = ({ onClose }: Props) => {
render={({ field: { onChange, value }, fieldState: { error } }) => (
<Field>
<FieldLabel htmlFor="role">Role</FieldLabel>
- <FilterableSelect
- inputId="role"
+ <Combobox
+ id="role"
value={value}
- onChange={onChange}
+ isClearable={false}
+ onValueChange={onChange}
options={roles ?? []}
placeholder="Select role..."
+ searchAriaLabel="Search roles"
isError={Boolean(error)}
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
- components={{ Option: RoleOption }}
+ renderOption={(option) => <RoleOptionContent role={option} />}
/>
<FieldError>{error?.message}</FieldError>
</Field>
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupModal.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupModal.tsx
index a85b48ad0d..73b1a1985d 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupModal.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupModal.tsx
@@ -6,9 +6,10 @@ import { InfoIcon } from "lucide-react";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { RoleOption } from "@app/components/roles";
+import { RoleOptionContent } from "@app/components/roles";
import {
Button,
+ Combobox,
Dialog,
DialogContent,
DialogDescription,
@@ -18,7 +19,6 @@ import {
Field,
FieldError,
FieldLabel,
- FilterableSelect,
Input,
Tabs,
TabsContent,
@@ -190,16 +190,19 @@ export const OrgGroupModal = ({
render={({ field: { onChange, value }, fieldState: { error } }) => (
<Field>
<FieldLabel htmlFor="role">{isCreateMode ? "Role" : "Update Role"}</FieldLabel>
- <FilterableSelect
- inputId="role"
+ <Combobox
+ id="role"
options={roles}
placeholder="Select role..."
- onChange={onChange}
- value={value}
+ searchAriaLabel="Search roles"
+ isClearable={false}
+ onValueChange={onChange}
+ value={roles?.find((role) => role.slug === value?.slug) ?? value}
isError={Boolean(error)}
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
- components={{ Option: RoleOption }}
+ renderOption={(option) => <RoleOptionContent role={option} />}
/>
<FieldError>{error?.message}</FieldError>
</Field>
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/CreateOrgIdentitySheet.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/CreateOrgIdentitySheet.tsx
index 1ebc172502..12574af395 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/CreateOrgIdentitySheet.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/CreateOrgIdentitySheet.tsx
@@ -6,14 +6,14 @@ import { z } from "zod";
import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
-import { RoleOption } from "@app/components/roles";
+import { RoleOptionContent } from "@app/components/roles";
import {
Button,
+ Combobox,
Field,
FieldContent,
FieldError,
FieldLabel,
- FilterableSelect,
Input,
Sheet,
SheetContent,
@@ -158,14 +158,17 @@ const CreateOrgIdentityForm = ({ onClose }: { onClose: () => void }) => {
<Field>
<FieldLabel>Role</FieldLabel>
<FieldContent>
- <FilterableSelect
+ <Combobox
placeholder="Select role..."
+ searchAriaLabel="Search roles"
options={roles}
- onChange={onChange}
+ isClearable={false}
+ onValueChange={onChange}
value={value}
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
- components={{ Option: RoleOption }}
+ renderOption={(option) => <RoleOptionContent role={option} />}
isError={Boolean(error)}
/>
</FieldContent>
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx
index 1b71f8a24f..c2b7afd7f5 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx
@@ -13,13 +13,13 @@ import {
AlertDescription,
Button,
Checkbox,
+ Combobox,
Field,
FieldContent,
FieldDescription,
FieldError,
FieldGroup,
FieldLabel,
- FilterableSelect,
GatewayPicker,
Input,
Select,
@@ -545,20 +545,20 @@ export const IdentityKubernetesAuthForm = ({
render={({ field: { onChange }, fieldState: { error } }) => (
<Field>
<FieldLabel htmlFor="kubernetes-configuration">Configuration</FieldLabel>
- <FilterableSelect<ConfigurationOption>
- inputId="kubernetes-configuration"
+ <Combobox<ConfigurationOption>
+ id="kubernetes-configuration"
value={selectedConfiguration}
options={configurationOptions}
- groupBy="group"
+ includeMissingSelectedOptions={false}
+ getOptionGroup={(option) => option.group}
getOptionLabel={(option) => option.label}
getOptionValue={(option) => option.value}
placeholder="Select or search configurations..."
+ searchAriaLabel="Search configurations"
isLoading={isTemplatesLoading}
isError={Boolean(error || errors.templateId)}
- onChange={(option) => {
- const selectedOption = option as ConfigurationOption | null;
- if (!selectedOption) return;
-
+ isClearable={false}
+ onValueChange={(selectedOption) => {
if (selectedOption.value === "custom") {
onChange("custom");
setValue("templateId", "");
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityLdapAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityLdapAuthForm.tsx
index 39fcf4786d..0690189123 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityLdapAuthForm.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityLdapAuthForm.tsx
@@ -19,6 +19,7 @@ import {
AlertDescription,
AlertTitle,
Button,
+ Combobox,
Field,
FieldContent,
FieldDescription,
@@ -26,7 +27,6 @@ import {
FieldGroup,
FieldLabel,
FieldTitle,
- FilterableSelect,
IconButton,
Input,
RadioGroup,
@@ -545,20 +545,19 @@ export const IdentityLdapAuthForm = ({
render={({ field: { onChange }, fieldState: { error } }) => (
<Field>
<FieldLabel htmlFor="ldap-configuration">Configuration</FieldLabel>
- <FilterableSelect<ConfigurationOption>
- inputId="ldap-configuration"
+ <Combobox<ConfigurationOption>
+ id="ldap-configuration"
value={selectedConfiguration}
options={configurationOptions}
- groupBy="group"
+ getOptionGroup={(option) => option.group}
getOptionLabel={(option) => option.label}
getOptionValue={(option) => option.value}
placeholder="Select or search configurations..."
+ searchAriaLabel="Search configurations"
isLoading={isTemplatesLoading}
isError={Boolean(error || errors.templateId)}
- onChange={(option) => {
- const selectedOption = option as ConfigurationOption | null;
- if (!selectedOption) return;
-
+ isClearable={false}
+ onValueChange={(selectedOption) => {
if (selectedOption.value === "custom") {
onChange("custom");
setValue("templateId", "");
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOidcAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOidcAuthForm.tsx
index 427496989c..7fe0c3c3dd 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOidcAuthForm.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOidcAuthForm.tsx
@@ -8,11 +8,11 @@ import { createNotification } from "@app/components/notifications";
import { BashGlobPatternTooltip } from "@app/components/permissions";
import {
Button,
+ Combobox,
Field,
FieldError,
FieldGroup,
FieldLabel,
- FilterableSelect,
IconButton,
Input,
Tabs,
@@ -407,20 +407,19 @@ export const IdentityOidcAuthForm = ({
render={({ field: { onChange }, fieldState: { error } }) => (
<Field>
<FieldLabel htmlFor="oidc-configuration">Configuration</FieldLabel>
- <FilterableSelect<ConfigurationOption>
- inputId="oidc-configuration"
+ <Combobox<ConfigurationOption>
+ id="oidc-configuration"
value={selectedConfiguration}
options={configurationOptions}
- groupBy="group"
+ getOptionGroup={(option) => option.group}
getOptionLabel={(option) => option.label}
getOptionValue={(option) => option.value}
placeholder="Select or search configurations..."
+ searchAriaLabel="Search configurations"
isLoading={isTemplatesLoading}
isError={Boolean(error || errors.templateId)}
- onChange={(option) => {
- const selectedOption = option as ConfigurationOption | null;
- if (!selectedOption) return;
-
+ isClearable={false}
+ onValueChange={(selectedOption) => {
if (selectedOption.value === "custom") {
onChange("custom");
setValue("templateId", "");
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/OrgIdentityLinkForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/OrgIdentityLinkForm.tsx
index d3b1bd5ae7..9a65299fd7 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/OrgIdentityLinkForm.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/OrgIdentityLinkForm.tsx
@@ -5,14 +5,14 @@ import { useNavigate } from "@tanstack/react-router";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { RoleOption } from "@app/components/roles";
+import { RoleOptionContent } from "@app/components/roles";
import {
Button,
+ Combobox,
Field,
FieldContent,
FieldError,
FieldLabel,
- FilterableSelect,
SheetFooter
} from "@app/components/v3";
import { useOrganization } from "@app/context";
@@ -91,11 +91,12 @@ export const OrgIdentityLinkForm = ({ onClose }: Props) => {
<Field>
<FieldLabel>Machine Identity</FieldLabel>
<FieldContent>
- <FilterableSelect
+ <Combobox
value={value}
- onChange={onChange}
+ isClearable={false}
+ onValueChange={onChange}
placeholder="Select machine identity..."
- // onInputChange={setSearchValue}
+ searchAriaLabel="Search machine identities"
autoFocus
options={rootOrgIdentities}
getOptionValue={(option) => option.id}
@@ -115,14 +116,17 @@ export const OrgIdentityLinkForm = ({ onClose }: Props) => {
<Field>
<FieldLabel>Role</FieldLabel>
<FieldContent>
- <FilterableSelect
+ <Combobox
value={value}
- onChange={onChange}
+ isClearable={false}
+ onValueChange={onChange}
options={roles}
placeholder="Select role..."
+ searchAriaLabel="Search roles"
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
- components={{ Option: RoleOption }}
+ renderOption={(option) => <RoleOptionContent role={option} />}
isError={Boolean(error)}
/>
</FieldContent>
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/OrgIdentityModal.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/OrgIdentityModal.tsx
index 160165a921..887a068d33 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/OrgIdentityModal.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/OrgIdentityModal.tsx
@@ -7,9 +7,10 @@ import { z } from "zod";
import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
-import { RoleOption } from "@app/components/roles";
+import { RoleOptionContent } from "@app/components/roles";
import {
Button,
+ Combobox,
DialogBody,
DialogFooter,
Field,
@@ -17,7 +18,6 @@ import {
FieldDescription,
FieldError,
FieldLabel,
- FilterableSelect,
IconButton,
Input,
Label,
@@ -179,14 +179,17 @@ export const OrgIdentityModal = ({ popUp, handlePopUpToggle }: Props) => {
<Field>
<FieldLabel>{`${popUp?.identity?.data ? "Update " : ""}Role`}</FieldLabel>
<FieldContent>
- <FilterableSelect
+ <Combobox
placeholder="Select role..."
+ searchAriaLabel="Search roles"
options={roles}
- onChange={onChange}
- value={value}
+ isClearable={false}
+ onValueChange={onChange}
+ value={roles?.find((role) => role.slug === value?.slug) ?? value}
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
- components={{ Option: RoleOption }}
+ renderOption={(option) => <RoleOptionContent role={option} />}
isError={Boolean(error)}
/>
</FieldContent>
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModal.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModal.tsx
index 41a2b72ef0..59e883ff9f 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModal.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModal.tsx
@@ -1,13 +1,13 @@
import { useMemo, useState } from "react";
import { Controller, useForm } from "react-hook-form";
-import { components, MultiValueGenericProps, OptionProps } from "react-select";
-import { CheckIcon, HardDriveIcon, UserIcon } from "lucide-react";
+import { HardDriveIcon, UserIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import {
Alert,
AlertDescription,
Button,
+ Combobox,
Dialog,
DialogContent,
DialogDescription,
@@ -16,8 +16,7 @@ import {
DialogTitle,
Field,
FieldError,
- FieldLabel,
- FilterableSelect
+ FieldLabel
} from "@app/components/v3";
import { useDebounce, useScopeVariant } from "@app/hooks";
import {
@@ -58,33 +57,28 @@ const getTypeLabel = (type: AddMemberType) =>
// Dropdown row: type icon + name/username with the email inline (muted). Both texts get min-w-0 +
// truncate so a long name or email is ellipsized rather than wrapping or pushing the checkmark off.
-const MemberOptionRow = ({ isSelected, ...props }: OptionProps<MemberOption>) => {
- const { type, label, email } = props.data;
+const MemberOptionRow = ({ option }: { option: MemberOption }) => {
+ const { type, label, email } = option;
const Icon = getOptionIcon(type);
return (
- <components.Option isSelected={isSelected} {...props}>
- <div className="flex items-center gap-2">
- <Icon className="size-4 shrink-0 text-muted" />
- <span className="min-w-0 truncate">{label}</span>
- {email && email !== label && <span className="min-w-0 truncate text-muted">{email}</span>}
- {isSelected && <CheckIcon className="ml-auto size-4 shrink-0" />}
- </div>
- </components.Option>
+ <div className="flex items-center gap-2">
+ <Icon className="size-4 shrink-0 text-muted" />
+ <span className="min-w-0 truncate">{label}</span>
+ {email && email !== label && <span className="min-w-0 truncate text-muted">{email}</span>}
+ </div>
);
};
// Selected chip/badge: type icon + label (the remove button is left to the shared component).
-const MemberMultiValueLabel = ({ children, ...props }: MultiValueGenericProps<MemberOption>) => {
- const Icon = getOptionIcon(props.data.type);
+const MemberMultiValueLabel = ({ option }: { option: MemberOption }) => {
+ const Icon = getOptionIcon(option.type);
return (
- <components.MultiValueLabel {...props}>
- <div className="flex items-center gap-1">
- <Icon className="size-3 shrink-0 text-muted" />
- <span className="truncate">{children}</span>
- </div>
- </components.MultiValueLabel>
+ <span className="flex items-center gap-1">
+ <Icon className="size-3 shrink-0 text-muted" />
+ <span className="truncate">{option.label}</span>
+ </span>
);
};
@@ -256,29 +250,27 @@ export const AddGroupMembersModal = ({
<FieldLabel htmlFor="add-group-members">
{isOidcManageGroupMembershipsEnabled ? "Machine Identities" : "Members"}
</FieldLabel>
- <FilterableSelect
- inputId="add-group-members"
- isMulti
+ <Combobox
+ id="add-group-members"
+ multiple
placeholder={
isOidcManageGroupMembershipsEnabled
? "Search and select machine identities..."
: "Search and select users or machine identities..."
}
+ searchAriaLabel="Search members"
value={value}
- onChange={onChange}
+ onValueChange={onChange}
options={memberOptions}
- groupBy="type"
- getGroupHeaderLabel={getTypeLabel}
+ getOptionGroup={(option) => getTypeLabel(option.type)}
getOptionValue={(option) => `${option.type}:${option.id}`}
getOptionLabel={(option) => option.label}
- filterOption={() => true}
- onInputChange={(val, meta) => {
- if (meta.action === "input-change") setSearch(val);
- }}
+ onSearchChange={setSearch}
isLoading={isUsersFetching || isIdentitiesFetching}
- components={{ Option: MemberOptionRow, MultiValueLabel: MemberMultiValueLabel }}
+ renderOption={(option) => <MemberOptionRow option={option} />}
+ renderValue={(option) => <MemberMultiValueLabel option={option} />}
isError={Boolean(error)}
- noOptionsMessage={noOptionsMessage}
+ emptyMessage={noOptionsMessage}
/>
<FieldError>{error?.message}</FieldError>
</Field>
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupCreateUpdateModal.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupCreateUpdateModal.tsx
index 8796bcc6d7..a631ec3bc1 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupCreateUpdateModal.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupCreateUpdateModal.tsx
@@ -5,9 +5,10 @@ import slugify from "@sindresorhus/slugify";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { RoleOption } from "@app/components/roles";
+import { RoleOptionContent } from "@app/components/roles";
import {
Button,
+ Combobox,
Dialog,
DialogContent,
DialogFooter,
@@ -16,7 +17,6 @@ import {
Field,
FieldError,
FieldLabel,
- FilterableSelect,
Input
} from "@app/components/v3";
import { useOrganization } from "@app/context";
@@ -177,16 +177,19 @@ export const GroupCreateUpdateModal = ({ popUp, handlePopUpClose, handlePopUpTog
render={({ field: { onChange, value }, fieldState: { error } }) => (
<Field>
<FieldLabel htmlFor="role">Role</FieldLabel>
- <FilterableSelect
- inputId="role"
+ <Combobox
+ id="role"
options={roles}
placeholder="Select role..."
- onChange={onChange}
- value={value}
+ searchAriaLabel="Search roles"
+ isClearable={false}
+ onValueChange={onChange}
+ value={roles?.find((role) => role.slug === value?.slug) ?? value}
isError={Boolean(error)}
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
- components={{ Option: RoleOption }}
+ renderOption={(option) => <RoleOptionContent role={option} />}
/>
<FieldError>{error?.message}</FieldError>
</Field>
diff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateGroupsSection.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateGroupsSection.tsx
index 7ece25723e..6e02b615f9 100644
--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateGroupsSection.tsx
+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateGroupsSection.tsx
@@ -14,6 +14,7 @@ import {
CardDescription,
CardHeader,
CardTitle,
+ Combobox,
Dialog,
DialogContent,
DialogDescription,
@@ -26,7 +27,6 @@ import {
Field,
FieldError,
FieldLabel,
- FilterableSelect,
IconButton,
Table,
TableBody,
@@ -279,22 +279,19 @@ export const ProjectTemplateGroupsSection = ({ projectTemplate }: Props) => {
return (
<Field className="mb-0 max-w-[786px]">
- <FilterableSelect
- isMulti
+ <Combobox
+ multiple
isDisabled={!isAllowed}
options={allOptions}
value={selectedValues}
- onChange={(selected) => {
- field.onChange(
- (selected as { slug: string; name: string }[]).map(
- (s) => s.slug
- )
- );
+ onValueChange={(selected) => {
+ field.onChange(selected.map((s) => s.slug));
}}
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
placeholder="Select roles..."
- menuPosition="fixed"
+ searchAriaLabel="Search roles"
/>
{error?.message && <FieldError>{error.message}</FieldError>}
</Field>
@@ -355,15 +352,17 @@ export const ProjectTemplateGroupsSection = ({ projectTemplate }: Props) => {
render={({ field }) => (
<Field>
<FieldLabel>Select groups</FieldLabel>
- <FilterableSelect
- isMulti
+ <Combobox
+ multiple
options={availableOrgGroups}
value={field.value}
- onChange={field.onChange}
+ onValueChange={field.onChange}
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
placeholder="Select one or more groups..."
- noOptionsMessage={() =>
+ searchAriaLabel="Search groups"
+ emptyMessage={() =>
availableOrgGroups.length === 0
? "All organization groups have been added"
: "No matching groups found"
@@ -381,14 +380,16 @@ export const ProjectTemplateGroupsSection = ({ projectTemplate }: Props) => {
render={({ field }) => (
<Field>
<FieldLabel>Select roles</FieldLabel>
- <FilterableSelect
- isMulti
+ <Combobox
+ multiple
options={availableRoles}
value={field.value}
- onChange={field.onChange}
+ onValueChange={field.onChange}
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
placeholder="Select roles..."
+ searchAriaLabel="Search roles"
/>
{addGroupErrors.roles?.message && (
<FieldError>{addGroupErrors.roles.message}</FieldError>
diff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateIdentitiesSection.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateIdentitiesSection.tsx
index 7a7cfaada3..2c34edbf5e 100644
--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateIdentitiesSection.tsx
+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateIdentitiesSection.tsx
@@ -15,6 +15,7 @@ import {
CardDescription,
CardHeader,
CardTitle,
+ Combobox,
Dialog,
DialogContent,
DialogDescription,
@@ -27,7 +28,6 @@ import {
Field,
FieldError,
FieldLabel,
- FilterableSelect,
IconButton,
Input,
OrgIcon,
@@ -397,22 +397,19 @@ export const ProjectTemplateIdentitiesSection = ({ projectTemplate }: Props) =>
return (
<Field className="mb-0 max-w-[786px]">
- <FilterableSelect
- isMulti
+ <Combobox
+ multiple
isDisabled={!isAllowed}
options={allOptions}
value={selectedValues}
- onChange={(selected) => {
- field.onChange(
- (selected as { slug: string; name: string }[]).map(
- (s) => s.slug
- )
- );
+ onValueChange={(selected) => {
+ field.onChange(selected.map((s) => s.slug));
}}
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
placeholder="Select roles..."
- menuPosition="fixed"
+ searchAriaLabel="Search roles"
/>
{error?.message && <FieldError>{error.message}</FieldError>}
</Field>
@@ -545,14 +542,16 @@ export const ProjectTemplateIdentitiesSection = ({ projectTemplate }: Props) =>
render={({ field }) => (
<Field>
<FieldLabel>Select roles</FieldLabel>
- <FilterableSelect
- isMulti
+ <Combobox
+ multiple
options={availableRoles}
value={field.value}
- onChange={field.onChange}
+ onValueChange={field.onChange}
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
placeholder="Select roles..."
+ searchAriaLabel="Search roles"
/>
{addProjectIdentityErrors.roles?.message && (
<FieldError>{addProjectIdentityErrors.roles.message}</FieldError>
@@ -583,17 +582,18 @@ export const ProjectTemplateIdentitiesSection = ({ projectTemplate }: Props) =>
render={({ field: { onChange, value }, fieldState: { error } }) => (
<Field>
<FieldLabel>Machine Identity</FieldLabel>
- <FilterableSelect
+ <Combobox
value={value}
- onChange={onChange}
+ isClearable={false}
+ onValueChange={onChange}
isLoading={isSearchingIdentities}
placeholder="Select machine identity..."
+ searchAriaLabel="Search machine identities"
autoFocus
options={availableOrgIdentities}
getOptionValue={(option) => option.id}
getOptionLabel={(option) => option.name}
- onInputChange={(newValue) => setIdentitySearchInput(newValue)}
- filterOption={() => true}
+ onSearchChange={(newValue) => setIdentitySearchInput(newValue)}
/>
{error?.message && <FieldError>{error.message}</FieldError>}
</Field>
@@ -605,14 +605,16 @@ export const ProjectTemplateIdentitiesSection = ({ projectTemplate }: Props) =>
render={({ field }) => (
<Field className="mt-4">
<FieldLabel>Select roles</FieldLabel>
- <FilterableSelect
- isMulti
+ <Combobox
+ multiple
options={availableRoles}
value={field.value}
- onChange={field.onChange}
+ onValueChange={field.onChange}
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
placeholder="Select roles..."
+ searchAriaLabel="Search roles"
/>
{addOrgIdentityErrors.roles?.message && (
<FieldError>{addOrgIdentityErrors.roles.message}</FieldError>
diff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateUsersSection.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateUsersSection.tsx
index 92bafd38e5..af69ab632f 100644
--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateUsersSection.tsx
+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateUsersSection.tsx
@@ -14,6 +14,7 @@ import {
CardDescription,
CardHeader,
CardTitle,
+ Combobox,
Dialog,
DialogContent,
DialogDescription,
@@ -26,7 +27,6 @@ import {
Field,
FieldError,
FieldLabel,
- FilterableSelect,
IconButton,
Table,
TableBody,
@@ -280,22 +280,19 @@ export const ProjectTemplateUsersSection = ({ projectTemplate }: Props) => {
return (
<Field className="mb-0 max-w-[786px]">
- <FilterableSelect
- isMulti
+ <Combobox
+ multiple
isDisabled={!isAllowed}
options={allOptions}
value={selectedValues}
- onChange={(selected) => {
- field.onChange(
- (selected as { slug: string; name: string }[]).map(
- (s) => s.slug
- )
- );
+ onValueChange={(selected) => {
+ field.onChange(selected.map((s) => s.slug));
}}
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
placeholder="Select roles..."
- menuPosition="fixed"
+ searchAriaLabel="Search roles"
/>
{error?.message && <FieldError>{error.message}</FieldError>}
</Field>
@@ -356,13 +353,17 @@ export const ProjectTemplateUsersSection = ({ projectTemplate }: Props) => {
render={({ field }) => (
<Field>
<FieldLabel>Select users</FieldLabel>
- <FilterableSelect
- isMulti
+ <Combobox
+ multiple
options={availableOrgUsers}
value={field.value}
- onChange={field.onChange}
+ onValueChange={field.onChange}
+ getOptionValue={(option) => option.value}
+ getOptionKeywords={(option) => [option.value]}
+ getOptionLabel={(option) => option.label}
placeholder="Select one or more users..."
- noOptionsMessage={() =>
+ searchAriaLabel="Search users"
+ emptyMessage={() =>
availableOrgUsers.length === 0
? "All organization members have been added"
: "No matching users found"
@@ -380,14 +381,16 @@ export const ProjectTemplateUsersSection = ({ projectTemplate }: Props) => {
render={({ field }) => (
<Field>
<FieldLabel>Select roles</FieldLabel>
- <FilterableSelect
- isMulti
+ <Combobox
+ multiple
options={availableRoles}
value={field.value}
- onChange={field.onChange}
+ onValueChange={field.onChange}
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
placeholder="Select roles..."
+ searchAriaLabel="Search roles"
/>
{addUserErrors.roles?.message && (
<FieldError>{addUserErrors.roles.message}</FieldError>
diff --git a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupModal.tsx b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupModal.tsx
index 534afbb00c..c21f5c0625 100644
--- a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupModal.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupModal.tsx
@@ -6,12 +6,13 @@ import { ArrowRightIcon, CircleAlertIcon } from "lucide-react";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { RoleOption } from "@app/components/roles";
+import { RoleOptionContent } from "@app/components/roles";
import {
Alert,
AlertDescription,
AlertTitle,
Button,
+ Combobox,
Dialog,
DialogContent,
DialogDescription,
@@ -22,7 +23,6 @@ import {
FieldDescription,
FieldError,
FieldLabel,
- FilterableSelect,
Skeleton
} from "@app/components/v3";
import { useOrganization, useProject } from "@app/context";
@@ -206,24 +206,21 @@ const Content = ({ onClose }: { onClose: () => void }) => {
render={({ field: { onChange, value }, fieldState: { error } }) => (
<Field>
<FieldLabel htmlFor="group">Group</FieldLabel>
- <FilterableSelect
- inputId="group"
+ <Combobox
+ id="group"
value={value}
- onChange={onChange}
+ isClearable={false}
+ onValueChange={onChange}
placeholder="Select group..."
+ searchAriaLabel="Search groups"
autoFocus
isError={Boolean(error)}
isLoading={isGroupsFetching || searchInput !== debouncedSearch}
options={isGroupsFetching ? [] : filteredGroupMembershipOrgs}
- onInputChange={(newValue, actionMeta) => {
- if (actionMeta.action === "input-change") {
- setSearchInput(newValue);
- }
- }}
- filterOption={() => true}
+ onSearchChange={setSearchInput}
getOptionValue={(option) => option.id}
getOptionLabel={(option) => option.name}
- noOptionsMessage={noOptionsMessage}
+ emptyMessage={noOptionsMessage}
/>
<FieldDescription>
{isGroupListTruncated ? "Search by name to find groups that are not listed." : null}
@@ -238,16 +235,19 @@ const Content = ({ onClose }: { onClose: () => void }) => {
render={({ field: { onChange, value }, fieldState: { error } }) => (
<Field>
<FieldLabel htmlFor="role">Role</FieldLabel>
- <FilterableSelect
- inputId="role"
+ <Combobox
+ id="role"
value={value}
- onChange={onChange}
+ isClearable={false}
+ onValueChange={onChange}
options={roles ?? []}
placeholder="Select role..."
+ searchAriaLabel="Search roles"
isError={Boolean(error)}
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
- components={{ Option: RoleOption }}
+ renderOption={(option) => <RoleOptionContent role={option} />}
/>
<FieldError>{error?.message}</FieldError>
</Field>
diff --git a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/components/CreateProjectIdentity/CreateProjectIdentityForm.tsx b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/components/CreateProjectIdentity/CreateProjectIdentityForm.tsx
index 733db37288..93dcd7a9d3 100644
--- a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/components/CreateProjectIdentity/CreateProjectIdentityForm.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/components/CreateProjectIdentity/CreateProjectIdentityForm.tsx
@@ -5,14 +5,14 @@ import { useQuery, useQueryClient } from "@tanstack/react-query";
import { useNavigate } from "@tanstack/react-router";
import { createNotification } from "@app/components/notifications";
-import { RoleOption } from "@app/components/roles";
+import { RoleOptionContent } from "@app/components/roles";
import {
Button,
+ Combobox,
Field,
FieldContent,
FieldError,
FieldLabel,
- FilterableSelect,
Input,
SheetFooter,
Skeleton,
@@ -334,10 +334,12 @@ const ProjectIdentityFormContent = ({
<Field>
<FieldLabel>Machine Identity</FieldLabel>
<FieldContent>
- <FilterableSelect
+ <Combobox
value={value || null}
- onChange={(newValue) => onChange(newValue || undefined)}
+ isClearable={false}
+ onValueChange={onChange}
placeholder="Select machine identity..."
+ searchAriaLabel="Search machine identities"
options={assignableIdentities}
getOptionValue={(option) => option.id}
getOptionLabel={(option) => option.name}
@@ -357,14 +359,17 @@ const ProjectIdentityFormContent = ({
<Field>
<FieldLabel>Role</FieldLabel>
<FieldContent>
- <FilterableSelect
+ <Combobox
value={value}
- onChange={onChange}
+ isClearable={false}
+ onValueChange={onChange}
options={roles}
placeholder="Select role..."
+ searchAriaLabel="Search roles"
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
- components={{ Option: RoleOption }}
+ renderOption={(option) => <RoleOptionContent role={option} />}
isError={Boolean(error)}
/>
</FieldContent>
diff --git a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/components/CreateProjectIdentity/PolicyTemplateSelect.tsx b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/components/CreateProjectIdentity/PolicyTemplateSelect.tsx
index 91248d129f..4b4b6c9e61 100644
--- a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/components/CreateProjectIdentity/PolicyTemplateSelect.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/components/CreateProjectIdentity/PolicyTemplateSelect.tsx
@@ -1,8 +1,7 @@
import { useFormContext, useWatch } from "react-hook-form";
-import { components, OptionProps } from "react-select";
-import { CheckIcon, InfoIcon } from "lucide-react";
+import { InfoIcon } from "lucide-react";
-import { FilterableSelect, Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";
+import { Combobox, Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";
import { ProjectPermissionSub } from "@app/context";
import { ProjectType } from "@app/hooks/api/projects/types";
import {
@@ -41,36 +40,30 @@ const PermissionsTooltip = ({ permissions }: { permissions: TemplatePermission[]
</div>
);
-const TemplateOptionRow = ({ isSelected, children, ...props }: OptionProps<TemplateOption>) => (
- <components.Option isSelected={isSelected} {...props}>
- <div className="flex flex-row items-center justify-between gap-2">
- <div className="min-w-0 flex-1">
- <p className="truncate">{children}</p>
- <p className="text-xs leading-4 break-words whitespace-normal text-muted">
- {props.data.description}
- </p>
- </div>
- <div className="flex shrink-0 items-center gap-2">
- <span className="flex size-4 items-center justify-center">
- {isSelected && <CheckIcon className="size-4" />}
- </span>
- <Tooltip>
- <TooltipTrigger
- type="button"
- onClick={(e) => {
- e.preventDefault();
- e.stopPropagation();
- }}
- >
- <InfoIcon className="size-4 text-muted hover:text-foreground" />
- </TooltipTrigger>
- <TooltipContent side="left" align="start" className="max-w-sm">
- <PermissionsTooltip permissions={props.data.permissions} />
- </TooltipContent>
- </Tooltip>
- </div>
+const TemplateOptionRow = ({ option }: { option: TemplateOption }) => (
+ <div className="flex flex-row items-center justify-between gap-2">
+ <div className="min-w-0 flex-1">
+ <p className="truncate">{option.name}</p>
+ <p className="text-xs leading-4 break-words whitespace-normal text-muted">
+ {option.description}
+ </p>
</div>
- </components.Option>
+ <Tooltip>
+ <TooltipTrigger
+ type="button"
+ className="shrink-0"
+ onClick={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ }}
+ >
+ <InfoIcon className="size-4 text-muted hover:text-foreground" />
+ </TooltipTrigger>
+ <TooltipContent side="left" align="start" className="max-w-sm">
+ <PermissionsTooltip permissions={option.permissions} />
+ </TooltipContent>
+ </Tooltip>
+ </div>
);
type Props = {
@@ -90,18 +83,20 @@ export const PolicyTemplateSelect = ({ projectType }: Props) => {
const value = options.filter((option) => templateIds.includes(option.id));
return (
- <FilterableSelect
- isMulti
+ <Combobox
+ multiple
value={value}
options={options}
placeholder="Select additional privileges..."
+ searchAriaLabel="Search additional privileges"
getOptionValue={(option) => option.id}
+ getOptionKeywords={(option) => [option.id]}
getOptionLabel={(option) => option.name}
- components={{ Option: TemplateOptionRow }}
- onChange={(newValue) =>
+ renderOption={(option) => <TemplateOptionRow option={option} />}
+ onValueChange={(newValue) =>
setValue(
"templateIds",
- (newValue as TemplateOption[]).map((option) => option.id),
+ newValue.map((option) => option.id),
{ shouldDirty: true }
)
}
diff --git a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/AddMemberModal.tsx b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/AddMemberModal.tsx
index 2baba0037b..828c0ff1b0 100644
--- a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/AddMemberModal.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/AddMemberModal.tsx
@@ -7,13 +7,13 @@ import { CircleAlertIcon, RefreshCwIcon } from "lucide-react";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { RoleOption } from "@app/components/roles";
+import { RoleOptionContent } from "@app/components/roles";
import {
Alert,
AlertDescription,
AlertTitle,
Button,
- CreatableSelect,
+ Combobox,
Dialog,
DialogContent,
DialogDescription,
@@ -23,8 +23,7 @@ import {
Field,
FieldContent,
FieldError,
- FieldLabel,
- FilterableSelect
+ FieldLabel
} from "@app/components/v3";
import {
OrgPermissionMemberActions,
@@ -313,62 +312,65 @@ export const AddMemberModal = ({ popUp, handlePopUpToggle }: Props) => {
</FieldLabel>
<FieldContent>
{canInviteNewMembers ? (
- <CreatableSelect
- /* eslint-disable-next-line react/no-unstable-nested-components */
- noOptionsMessage={() => (
- <>
- {!projectInviteList.list.length && (
- <p>
- All organization members are already assigned to{" "}
- {projectsHidden ? productLabel : "this project"}.
- </p>
- )}
- <p>
- Invite new users to your organization by typing out their email address.
- </p>
- </>
- )}
- onCreateOption={(inputValue) =>
- append({ label: inputValue, value: inputValue, isNewInvitee: true })
- }
- formatCreateLabel={(inputValue) => `Invite "${inputValue}"`}
- isValidNewOption={(input) =>
- Boolean(input) &&
- isValidEmail(input) &&
- !orgUsers
- ?.flatMap(({ user }) => {
- const emails: string[] = [];
-
- if (user.email) {
- emails.push(user.email);
- }
-
- if (user.username) {
- emails.push(user.username);
- }
-
- return emails;
- })
- .includes(input)
+ <Combobox
+ listFooter={
+ projectInviteList.list.length ? undefined : (
+ <>
+ All organization members are already assigned to{" "}
+ {projectsHidden ? productLabel : "this project"}.
+ </>
+ )
}
+ creation={{
+ mode: "inline",
+ onCreate: (inputValue) =>
+ append({ label: inputValue, value: inputValue, isNewInvitee: true }),
+ formatLabel: (inputValue) => `Invite "${inputValue}"`,
+ emptyLabel:
+ "Invite new users to your organization by typing out their email address.",
+ isValid: (input) =>
+ Boolean(input) &&
+ isValidEmail(input) &&
+ !orgUsers
+ ?.flatMap(({ user }) => {
+ const emails: string[] = [];
+
+ if (user.email) {
+ emails.push(user.email);
+ }
+
+ if (user.username) {
+ emails.push(user.username);
+ }
+
+ return emails;
+ })
+ .includes(input)
+ }}
placeholder="Add one or more users..."
- isMulti
+ searchAriaLabel="Search users"
+ multiple
name="members"
options={projectInviteList.list}
value={field.value}
- onChange={field.onChange}
+ onValueChange={field.onChange}
+ getOptionValue={(option) => option.value}
+ getOptionLabel={(option) => option.label}
isError={!!errors.orgMemberships?.length}
isLoading={isReferenceDataLoading}
isDisabled={!canAddMembers || hasReferenceDataError}
/>
) : (
- <FilterableSelect
+ <Combobox
placeholder="Add one or more users..."
- isMulti
+ searchAriaLabel="Search users"
+ multiple
name="members"
options={projectInviteList.list}
value={field.value}
- onChange={field.onChange}
+ onValueChange={field.onChange}
+ getOptionValue={(option) => option.value}
+ getOptionLabel={(option) => option.label}
isError={!!errors.orgMemberships?.length}
isLoading={isReferenceDataLoading}
isDisabled={!canAddMembers || hasReferenceDataError}
@@ -386,14 +388,16 @@ export const AddMemberModal = ({ popUp, handlePopUpToggle }: Props) => {
<Field>
<FieldLabel className="sr-only">Select roles</FieldLabel>
<FieldContent>
- <FilterableSelect
+ <Combobox
options={filteredRoles}
- components={{ Option: RoleOption }}
+ renderOption={(option) => <RoleOptionContent role={option} />}
placeholder="Select roles..."
+ searchAriaLabel="Search roles"
value={value}
- onChange={onChange}
- isMulti
+ onValueChange={onChange}
+ multiple
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
isError={Boolean(error)}
isLoading={isReferenceDataLoading}
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/InviteMembersModal/InviteMembersModal.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/InviteMembersModal/InviteMembersModal.tsx
index 0a0f23fc36..669d124750 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/InviteMembersModal/InviteMembersModal.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/InviteMembersModal/InviteMembersModal.tsx
@@ -5,9 +5,10 @@ import { InfoIcon, SendHorizontalIcon } from "lucide-react";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { RoleOption } from "@app/components/roles";
+import { RoleOptionContent } from "@app/components/roles";
import {
Button,
+ Combobox,
Dialog,
DialogContent,
DialogDescription,
@@ -18,7 +19,6 @@ import {
Field,
FieldError,
FieldLabel,
- FilterableSelect,
Tooltip,
TooltipContent,
TooltipTrigger
@@ -210,17 +210,21 @@ export const InviteMembersModal = ({ popUp, handlePopUpToggle, experimentVariant
</TooltipContent>
</Tooltip>
</FieldLabel>
- <FilterableSelect
- inputId="invite-members-project-role"
+ <Combobox
+ id="invite-members-project-role"
isLoading={Boolean(projectId) && isProjectRolesLoading}
- value={value}
- onChange={onChange}
+ value={filteredRoles.find((role) => role.slug === value?.slug) ?? value}
+ isClearable={false}
+ onValueChange={onChange}
options={filteredRoles}
+ includeMissingSelectedOptions={false}
getOptionValue={(option) => option.slug}
+ getOptionKeywords={(option) => [option.slug]}
getOptionLabel={(option) => option.name}
placeholder="Select role..."
+ searchAriaLabel="Search roles"
isError={Boolean(error)}
- components={{ Option: RoleOption }}
+ renderOption={(option) => <RoleOptionContent role={option} />}
/>
<FieldError>{error?.message}</FieldError>
</Field>