User validation in the user picker component

Hey everyone, I’m trying to understand is it real to validate user before select in the UserPicker component? I’m trying to have some restrictions for this action, but I’m not sure that it’s possible.

For example:

  • I want to have an option to add or not to add a user which is deactivated right now.

I know that I can try to do this filtering before customFieldType:edit onSubmit method, but in ui it will be presented anyway, what could be non-obvious for user.

Code:

import ForgeUI, {
  CustomFieldEdit,
  UserPicker,
  useProductContext,
} from "@forge/ui";

export const Edit = () => {
  const {
    extensionContext: { fieldValue },
  } = useProductContext();

  const onSubmit = (values) => {
    // filtering could be here but we have wrong UI then 
    return values.users.map((user) => ({
      accountId: user,
    }));
  };

  return (
    <CustomFieldEdit onSubmit={onSubmit}>
      <UserPicker
        label="User"
        name="users"
        isMulti
        defaultValue={
          Array.isArray(fieldValue)
            ? fieldValue.map((obj) => obj.accountId)
            : []
        }
      />
    </CustomFieldEdit>
  );
};