Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Update AddEdit to use item based structure (#1404)

Leendert de Borstf7d0030fabc9
diff --git a/apps/mobile-app/app/(tabs)/items/add-edit.tsx b/apps/mobile-app/app/(tabs)/items/add-edit.tsx
index c80fa48fd..41ec81d99 100644
--- a/apps/mobile-app/app/(tabs)/items/add-edit.tsx
+++ b/apps/mobile-app/app/(tabs)/items/add-edit.tsx
@@ -10,8 +10,8 @@ import { StyleSheet, View, Alert, Keyboard, Platform, ScrollView, KeyboardAvoidi
import Toast from 'react-native-toast-message';
import { CreateIdentityGenerator, CreateUsernameEmailGenerator, Gender, Identity, IdentityHelperUtils, convertAgeRangeToBirthdateOptions } from '@/utils/dist/core/identity-generator';
-import type { Attachment, Item, ItemField, TotpCode, ItemType } from '@/utils/dist/core/models/vault';
-import { ItemTypes, getSystemFieldsForItemType, FieldKey } from '@/utils/dist/core/models/vault';
+import type { Attachment, Item, ItemField, TotpCode, ItemType, FieldType } from '@/utils/dist/core/models/vault';
+import { ItemTypes, getSystemFieldsForItemType, getOptionalFieldsForItemType, isFieldShownByDefault, getSystemField, fieldAppliesToType, FieldCategories, FieldTypes } from '@/utils/dist/core/models/vault';
import type { FaviconExtractModel } from '@/utils/dist/core/models/webapi';
import { CreatePasswordGenerator, PasswordGenerator } from '@/utils/dist/core/password-generator';
import emitter from '@/utils/EventEmitter';
@@ -20,11 +20,15 @@ import { extractServiceNameFromUrl } from '@/utils/UrlUtility';
import { useColors } from '@/hooks/useColorScheme';
import { useVaultMutate } from '@/hooks/useVaultMutate';
+import { AddFieldMenu, type OptionalSection } from '@/components/form/AddFieldMenu';
import { AdvancedPasswordField } from '@/components/form/AdvancedPasswordField';
import { EmailDomainField } from '@/components/form/EmailDomainField';
import { FormField, FormFieldRef } from '@/components/form/FormField';
+import { FormSection } from '@/components/form/FormSection';
+import { HiddenField } from '@/components/form/HiddenField';
import { AttachmentUploader } from '@/components/items/details/AttachmentUploader';
import { TotpEditor } from '@/components/items/details/TotpEditor';
+import { ItemTypeSelector } from '@/components/items/ItemTypeSelector';
import LoadingOverlay from '@/components/LoadingOverlay';
import { ThemedContainer } from '@/components/themed/ThemedContainer';
import { ThemedText } from '@/components/themed/ThemedText';
@@ -34,24 +38,41 @@ import { useAuth } from '@/context/AuthContext';
import { useDb } from '@/context/DbContext';
import { useWebApi } from '@/context/WebApiContext';
-type ItemMode = 'random' | 'manual';
+// Valid item types from the shared model
+const VALID_ITEM_TYPES: ItemType[] = [ItemTypes.Login, ItemTypes.Alias, ItemTypes.CreditCard, ItemTypes.Note];
-// Default item type for mobile app - currently only Login/Alias type is supported
-const DEFAULT_ITEM_TYPE: ItemType = ItemTypes.Alias;
+// Default item type for new items
+const DEFAULT_ITEM_TYPE: ItemType = ItemTypes.Login;
+
+/**
+ * Temporary custom field definition (before persisting to database).
+ */
+type CustomFieldDefinition = {
+ tempId: string;
+ label: string;
+ fieldType: FieldType;
+ isHidden: boolean;
+ displayOrder: number;
+};
/**
* Add or edit an item screen.
*/
-export default function AddEditItemScreen() : React.ReactNode {
- const { id, serviceUrl } = useLocalSearchParams<{ id: string, serviceUrl?: string }>();
+export default function AddEditItemScreen(): React.ReactNode {
+ const { id, serviceUrl, itemType: itemTypeParam } = useLocalSearchParams<{
+ id: string;
+ serviceUrl?: string;
+ itemType?: string;
+ }>();
const router = useRouter();
const colors = useColors();
const dbContext = useDb();
const authContext = useAuth();
- const [mode, setMode] = useState<ItemMode>('random');
const { executeVaultMutation, syncStatus } = useVaultMutate();
const navigation = useNavigation();
const webApi = useWebApi();
+ const { t } = useTranslation();
+
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
const itemNameRef = useRef<FormFieldRef>(null);
const [isSyncing, setIsSyncing] = useState(false);
@@ -62,7 +83,6 @@ export default function AddEditItemScreen() : React.ReactNode {
const [originalTotpCodeIds, setOriginalTotpCodeIds] = useState<string[]>([]);
const [passkeyIdsMarkedForDeletion, setPasskeyIdsMarkedForDeletion] = useState<string[]>([]);
const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);
- const { t } = useTranslation();
// Item state
const [item, setItem] = useState<Item | null>(null);
@@ -70,6 +90,22 @@ export default function AddEditItemScreen() : React.ReactNode {
// Form state for dynamic fields - key is FieldKey, value is the field value
const [fieldValues, setFieldValues] = useState<Record<string, string | string[]>>({});
+ // Custom field definitions (temporary until saved)
+ const [customFields, setCustomFields] = useState<CustomFieldDefinition[]>([]);
+
+ // UI visibility state
+ const [show2FA, setShow2FA] = useState(false);
+ const [showAttachments, setShowAttachments] = useState(false);
+
+ // Track manually added optional fields
+ const [manuallyAddedFields, setManuallyAddedFields] = useState<Set<string>>(new Set());
+
+ // Track fields that had values initially (edit mode)
+ const [initiallyVisibleFields, setInitiallyVisibleFields] = useState<Set<string>>(new Set());
+
+ // Track if alias was already auto-generated
+ const aliasGeneratedRef = useRef(false);
+
// Track last generated values to avoid overwriting manual entries
const [lastGeneratedValues, setLastGeneratedValues] = useState<{
username: string | null;
@@ -92,6 +128,117 @@ export default function AddEditItemScreen() : React.ReactNode {
return getSystemFieldsForItemType(item.ItemType);
}, [item]);
+ /**
+ * Optional system fields for the current item type.
+ */
+ const optionalSystemFields = useMemo(() => {
+ if (!item) {
+ return [];
+ }
+ return getOptionalFieldsForItemType(item.ItemType);
+ }, [item]);
+
+ /**
+ * The notes field (notes.content) - handled separately.
+ */
+ const notesField = useMemo(() => {
+ return applicableSystemFields.find(field => field.FieldKey === 'notes.content');
+ }, [applicableSystemFields]);
+
+ /**
+ * Set of field keys that are currently visible.
+ */
+ const visibleFieldKeys = useMemo(() => {
+ const keys = new Set<string>();
+ // Add fields that are shown by default
+ applicableSystemFields.forEach(field => {
+ if (item && isFieldShownByDefault(field, item.ItemType)) {
+ keys.add(field.FieldKey);
+ }
+ });
+ // Add manually added fields
+ manuallyAddedFields.forEach(key => keys.add(key));
+ // Add fields that were initially visible
+ initiallyVisibleFields.forEach(key => keys.add(key));
+ // Add fields with current values
+ Object.keys(fieldValues).forEach(key => {
+ const value = fieldValues[key];
+ if (value && (Array.isArray(value) ? value.length > 0 : value.toString().trim() !== '')) {
+ keys.add(key);
+ }
+ });
+ return keys;
+ }, [item, applicableSystemFields, manuallyAddedFields, initiallyVisibleFields, fieldValues]);
+
+ /**
+ * Check if a field should be shown.
+ */
+ const shouldShowField = useCallback((field: { FieldKey: string }) => {
+ if (!item) {
+ return false;
+ }
+ if (manuallyAddedFields.has(field.FieldKey)) {
+ return true;
+ }
+ if (initiallyVisibleFields.has(field.FieldKey)) {
+ return true;
+ }
+ const systemField = applicableSystemFields.find(f => f.FieldKey === field.FieldKey);
+ if (!systemField) {
+ return true; // Custom fields are always shown
+ }
+ return isFieldShownByDefault(systemField, item.ItemType);
+ }, [item, applicableSystemFields, manuallyAddedFields, initiallyVisibleFields]);
+
+ /**
+ * Primary fields (like URL) that should be shown in the name block.
+ */
+ const primaryFields = useMemo(() => {
+ return applicableSystemFields.filter(field => field.Category === FieldCategories.Primary);
+ }, [applicableSystemFields]);
+
+ /**
+ * Group system fields by category for organized rendering.
+ */
+ const groupedSystemFields = useMemo(() => {
+ const groups: Record<string, typeof applicableSystemFields> = {};
+
+ applicableSystemFields.forEach(field => {
+ // Skip notes, metadata, and primary fields
+ if (field.Category === FieldCategories.Notes ||
+ field.Category === FieldCategories.Metadata ||
+ field.Category === FieldCategories.Primary) {
+ return;
+ }
+
+ const category = field.Category;
+ if (!groups[category]) {
+ groups[category] = [];
+ }
+ groups[category].push(field);
+ });
+
+ return groups;
+ }, [applicableSystemFields]);
+
+ /**
+ * Check if alias fields are shown by default for the current item type.
+ */
+ const aliasFieldsShownByDefault = useMemo(() => {
+ if (!item) {
+ return false;
+ }
+ const aliasField = applicableSystemFields.find(f => f.FieldKey === 'alias.first_name');
+ return aliasField ? isFieldShownByDefault(aliasField, item.ItemType) : false;
+ }, [item, applicableSystemFields]);
+
+ /**
+ * Check if login fields exist for the current item type (determines 2FA support).
+ */
+ const hasLoginFields = useMemo(() => {
+ return applicableSystemFields.some(f => f.FieldKey === 'login.username' || f.FieldKey === 'login.password');
+ }, [applicableSystemFields]);
+
/**
* Handle field value change.
*/
@@ -106,7 +253,7 @@ export default function AddEditItemScreen() : React.ReactNode {
/**
* Generate a random identity.
*/
- const generateRandomIdentity = useCallback(async () : Promise<Identity> => {
+ const generateRandomIdentity = useCallback(async (): Promise<Identity> => {
const identityLanguage = await dbContext.sqliteClient!.getEffectiveIdentityLanguage();
const identityGenerator = CreateIdentityGenerator(identityLanguage);
@@ -117,25 +264,135 @@ export default function AddEditItemScreen() : React.ReactNode {
return identityGenerator.generateRandomIdentity(genderPreference, birthdateOptions);
}, [dbContext.sqliteClient]);
+ /**
+ * Initialize the password generator with settings from user's vault.
+ */
+ const initializePasswordGenerator = useCallback(async (): Promise<PasswordGenerator> => {
+ const passwordSettings = await dbContext.sqliteClient!.getPasswordSettings();
+ return CreatePasswordGenerator(passwordSettings);
+ }, [dbContext.sqliteClient]);
+
+ /**
+ * Generate a random alias and password.
+ */
+ const generateRandomAlias = useCallback(async (): Promise<void> => {
+ const passwordGenerator = await initializePasswordGenerator();
+ const identity = await generateRandomIdentity();
+ const password = passwordGenerator.generateRandomPassword();
+ const defaultEmailDomain = await dbContext.sqliteClient!.getDefaultEmailDomain();
+ const email = defaultEmailDomain ? `${identity.emailPrefix}@${defaultEmailDomain}` : identity.emailPrefix;
+
+ // Check current values
+ const currentUsername = (fieldValues['login.username'] as string) ?? '';
+ const currentPassword = (fieldValues['login.password'] as string) ?? '';
+ const currentEmail = (fieldValues['login.email'] as string) ?? '';
+
+ const newValues: Record<string, string | string[]> = { ...fieldValues };
+
+ // Only overwrite email if it's empty or matches the last generated value
+ if (!currentEmail || currentEmail === lastGeneratedValues.email) {
+ newValues['login.email'] = email;
+ }
+
+ // Always update alias identity fields
+ newValues['alias.first_name'] = identity.firstName;
+ newValues['alias.last_name'] = identity.lastName;
+ newValues['alias.gender'] = identity.gender;
+ newValues['alias.birthdate'] = IdentityHelperUtils.normalizeBirthDate(identity.birthDate.toISOString());
+
+ // Only overwrite username if it's empty or matches the last generated value
+ if (!currentUsername || currentUsername === lastGeneratedValues.username) {
+ newValues['login.username'] = identity.nickName;
+ }
+
+ // Only overwrite password if it's empty or matches the last generated value
+ if (!currentPassword || currentPassword === lastGeneratedValues.password) {
+ newValues['login.password'] = password;
+ setIsPasswordVisible(true);
+ }
+
+ setFieldValues(newValues);
+ setHasUnsavedChanges(true);
+
+ // Update tracking with new generated values
+ setLastGeneratedValues({
+ username: identity.nickName,
+ password: password,
+ email: email
+ });
+ }, [fieldValues, initializePasswordGenerator, generateRandomIdentity, dbContext.sqliteClient, lastGeneratedValues]);
+
+ /**
+ * Generate a random username.
+ */
+ const generateRandomUsername = useCallback(async (): Promise<void> => {
+ try {
+ const firstName = (fieldValues['alias.first_name'] as string) ?? '';
+ const lastName = (fieldValues['alias.last_name'] as string) ?? '';
+ const birthDate = (fieldValues['alias.birthdate'] as string) ?? '';
+
+ let username: string;
+
+ if (!firstName && !lastName && !birthDate) {
+ const randomIdentity = await generateRandomIdentity();
+ username = randomIdentity.nickName;
+ } else {
+ const usernameEmailGenerator = CreateUsernameEmailGenerator();
+
+ let gender = Gender.Other;
+ try {
+ gender = (fieldValues['alias.gender'] as string) as Gender;
+ } catch {
+ // Gender parsing failed, default to other
+ }
+
+ let parsedBirthDate = new Date(birthDate);
+ if (!birthDate || isNaN(parsedBirthDate.getTime())) {
+ parsedBirthDate = new Date();
+ }
+
+ const identity: Identity = {
+ firstName,
+ lastName,
+ nickName: '',
+ gender,
+ birthDate: parsedBirthDate,
+ emailPrefix: (fieldValues['login.email'] as string) ?? '',
+ };
+
+ username = usernameEmailGenerator.generateUsername(identity);
+ }
+
+ handleFieldChange('login.username', username);
+ setLastGeneratedValues(prev => ({ ...prev, username }));
+ } catch (error) {
+ console.error('Error generating random username:', error);
+ }
+ }, [fieldValues, generateRandomIdentity, handleFieldChange]);
+
/**
* Prevent accidental dismissal when there are unsaved changes.
*/
- usePreventRemove(hasUnsavedChanges, ({ data }) : void => {
+ usePreventRemove(hasUnsavedChanges, ({ data }): void => {
Alert.alert(
- t('credentials.unsavedChanges.title'),
- t('credentials.unsavedChanges.message'),
+ t('items.unsavedChanges.title'),
+ t('items.unsavedChanges.message'),
[
{
text: t('common.cancel'),
style: 'cancel',
- /** Cancel button handler. */
- onPress: () : void => {}
+ /**
+ * Do nothing
+ */
+ onPress: (): void => {}
},
{
- text: t('credentials.unsavedChanges.discard'),
+ text: t('items.unsavedChanges.discard'),
style: 'destructive',
- /** Discard button handler. */
- onPress: () : void => {
+ /**
+ * Discard unsaved changes and navigate back
+ */
+ onPress: (): void => {
setHasUnsavedChanges(false);
navigation.dispatch(data.action);
},
@@ -147,7 +404,7 @@ export default function AddEditItemScreen() : React.ReactNode {
/**
* Load an existing item from the database in edit mode.
*/
- const loadExistingItem = useCallback(async () : Promise<void> => {
+ const loadExistingItem = useCallback(async (): Promise<void> => {
try {
const existingItem = await dbContext.sqliteClient!.getItemById(id);
if (existingItem) {
@@ -155,40 +412,57 @@ export default function AddEditItemScreen() : React.ReactNode {
// Initialize field values from existing fields
const initialValues: Record<string, string | string[]> = {};
+ const existingCustomFields: CustomFieldDefinition[] = [];
+ const fieldsWithValues = new Set<string>();
+
existingItem.Fields.forEach((field) => {
initialValues[field.FieldKey] = field.Value;
+ fieldsWithValues.add(field.FieldKey);
+
+ // Check if it's a custom field
+ if (field.IsCustomField) {
+ existingCustomFields.push({
+ tempId: field.FieldKey,
+ label: field.Label,
+ fieldType: field.FieldType,
+ isHidden: field.IsHidden,
+ displayOrder: field.DisplayOrder
+ });
+ }
});
// Normalize birthdate if present
- if (initialValues[FieldKey.AliasBirthdate]) {
- initialValues[FieldKey.AliasBirthdate] = IdentityHelperUtils.normalizeBirthDate(
- initialValues[FieldKey.AliasBirthdate] as string
+ if (initialValues['alias.birthdate']) {
+ initialValues['alias.birthdate'] = IdentityHelperUtils.normalizeBirthDate(
+ initialValues['alias.birthdate'] as string
);
}
setFieldValues(initialValues);
-
- // Check if alias fields have values to set mode
- const hasAliasFields = initialValues[FieldKey.AliasFirstName] || initialValues[FieldKey.AliasLastName];
- if (hasAliasFields) {
- setMode('manual');
- }
+ setCustomFields(existingCustomFields);
+ setInitiallyVisibleFields(fieldsWithValues);
// Load attachments for this item
const itemAttachments = await dbContext.sqliteClient!.getAttachmentsForItem(id);
setAttachments(itemAttachments);
setOriginalAttachmentIds(itemAttachments.map(a => a.Id));
+ if (itemAttachments.length > 0) {
+ setShowAttachments(true);
+ }
// Load TOTP codes for this item
const itemTotpCodes = await dbContext.sqliteClient!.getTotpCodesForItem(id);
setTotpCodes(itemTotpCodes);
setOriginalTotpCodeIds(itemTotpCodes.map(tc => tc.Id));
+ if (itemTotpCodes.length > 0) {
+ setShow2FA(true);
+ }
}
} catch (err) {
console.error('Error loading item:', err);
Toast.show({
type: 'error',
- text1: t('credentials.errors.loadFailed'),
+ text1: t('items.errors.loadFailed'),
text2: t('auth.errors.enterPassword')
});
}
@@ -198,13 +472,15 @@ export default function AddEditItemScreen() : React.ReactNode {
* On mount, load an existing item if we're in edit mode, or initialize new item.
*/
useEffect(() => {
- /** Initialize the component by loading settings and handling initial state. */
+ /**
+ * Initialize the component
+ */
const initializeComponent = async (): Promise<void> => {
if (authContext.isOffline) {
setTimeout(() => {
Toast.show({
type: 'error',
- text1: t('credentials.offlineMessage'),
+ text1: t('items.offlineMessage'),
position: 'bottom'
});
}, 100);
@@ -225,10 +501,15 @@ export default function AddEditItemScreen() : React.ReactNode {
itemUrl = decodedUrl;
}
+ // Determine effective type from URL param or default
+ const effectiveType: ItemType = (itemTypeParam && VALID_ITEM_TYPES.includes(itemTypeParam as ItemType))
+ ? itemTypeParam as ItemType
+ : DEFAULT_ITEM_TYPE;
+
const newItem: Item = {
Id: crypto.randomUUID().toUpperCase(),
Name: serviceName,
- ItemType: DEFAULT_ITEM_TYPE,
+ ItemType: effectiveType,
FolderId: null,
Fields: [],
CreatedAt: new Date().toISOString(),
@@ -241,7 +522,7 @@ export default function AddEditItemScreen() : React.ReactNode {
if (itemUrl) {
setFieldValues(prev => ({
...prev,
- [FieldKey.LoginUrl]: itemUrl
+ 'login.url': itemUrl
}));
}
@@ -253,111 +534,174 @@ export default function AddEditItemScreen() : React.ReactNode {
};
initializeComponent();
- }, [id, isEditMode, serviceUrl, loadExistingItem, authContext.isOffline, router, t]);
+ }, [id, isEditMode, serviceUrl, itemTypeParam, loadExistingItem, authContext.isOffline, router, t]);
/**
- * Initialize the password generator with settings from user's vault.
+ * Auto-generate alias when alias fields are shown by default in create mode.
*/
- const initializePasswordGenerator = useCallback(async () : Promise<PasswordGenerator> => {
- const passwordSettings = await dbContext.sqliteClient!.getPasswordSettings();
- return CreatePasswordGenerator(passwordSettings);
- }, [dbContext.sqliteClient]);
+ useEffect(() => {
+ if (!isEditMode && aliasFieldsShownByDefault && item && dbContext?.sqliteClient && !aliasGeneratedRef.current) {
+ aliasGeneratedRef.current = true;
+ void generateRandomAlias();
+ }
+ }, [isEditMode, aliasFieldsShownByDefault, item, dbContext?.sqliteClient, generateRandomAlias]);
/**
- * Generate a random alias and password.
+ * Handle item type change.
*/
- const generateRandomAlias = useCallback(async (): Promise<void> => {
- const passwordGenerator = await initializePasswordGenerator();
- const identity = await generateRandomIdentity();
- const password = passwordGenerator.generateRandomPassword();
- const defaultEmailDomain = await dbContext.sqliteClient!.getDefaultEmailDomain();
- const email = defaultEmailDomain ? `${identity.emailPrefix}@${defaultEmailDomain}` : identity.emailPrefix;
+ const handleTypeChange = useCallback((newType: ItemType) => {
+ if (!item) {
+ return;
+ }
- // Check current values
- const currentUsername = (fieldValues[FieldKey.LoginUsername] as string) ?? '';
- const currentPassword = (fieldValues[FieldKey.LoginPassword] as string) ?? '';
- const currentEmail = (fieldValues[FieldKey.LoginEmail] as string) ?? '';
+ const oldType = item.ItemType;
+
+ // Clear field values that don't apply to the new type
+ if (oldType !== newType) {
+ setFieldValues(prev => {
+ const newValues: Record<string, string | string[]> = {};
+ Object.entries(prev).forEach(([key, value]) => {
+ const systemField = getSystemField(key);
+ if (systemField) {
+ if (fieldAppliesToType(systemField, newType)) {
+ newValues[key] = value;
+ }
+ } else {
+ // Custom fields are always kept
+ newValues[key] = value;
+ }
+ });
+ return newValues;
+ });
- const newValues: Record<string, string | string[]> = { ...fieldValues };
+ // Clear manually added fields that don't apply to new type
+ setManuallyAddedFields(prev => {
+ const newSet = new Set<string>();
+ prev.forEach(fieldKey => {
+ const systemField = getSystemField(fieldKey);
+ if (!systemField || fieldAppliesToType(systemField, newType)) {
+ newSet.add(fieldKey);
+ }
+ });
+ return newSet;
+ });
- // Only overwrite email if it's empty or matches the last generated value
- if (!currentEmail || currentEmail === lastGeneratedValues.email) {
- newValues[FieldKey.LoginEmail] = email;
+ // Clear initially visible fields that don't apply to new type (edit mode)
+ if (isEditMode) {
+ setInitiallyVisibleFields(prev => {
+ const newSet = new Set<string>();
+ prev.forEach(fieldKey => {
+ const systemField = getSystemField(fieldKey);
+ if (!systemField || fieldAppliesToType(systemField, newType)) {
+ newSet.add(fieldKey);
+ }
+ });
+ return newSet;
+ });
+ }
}
- // Always update alias identity fields
- newValues[FieldKey.AliasFirstName] = identity.firstName;
- newValues[FieldKey.AliasLastName] = identity.lastName;
- newValues[FieldKey.AliasGender] = identity.gender;
- newValues[FieldKey.AliasBirthdate] = IdentityHelperUtils.normalizeBirthDate(identity.birthDate.toISOString());
+ // Reset alias generated flag
+ aliasGeneratedRef.current = false;
- // Only overwrite username if it's empty or matches the last generated value
- if (!currentUsername || currentUsername === lastGeneratedValues.username) {
- newValues[FieldKey.LoginUsername] = identity.nickName;
- }
+ setItem({
+ ...item,
+ ItemType: newType,
+ Fields: []
+ });
- // Only overwrite password if it's empty or matches the last generated value
- if (!currentPassword || currentPassword === lastGeneratedValues.password) {
- newValues[FieldKey.LoginPassword] = password;
- setIsPasswordVisible(true);
+ if (Platform.OS === 'ios' || Platform.OS === 'android') {
+ Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
}
+ }, [item, isEditMode]);
- setFieldValues(newValues);
+ /**
+ * Handle adding an optional system field.
+ */
+ const handleAddOptionalField = useCallback((fieldKey: string): void => {
+ setManuallyAddedFields(prev => new Set(prev).add(fieldKey));
setHasUnsavedChanges(true);
-
- // Update tracking with new generated values
- setLastGeneratedValues({
- username: identity.nickName,
- password: password,
- email: email
- });
- }, [fieldValues, initializePasswordGenerator, generateRandomIdentity, dbContext.sqliteClient, lastGeneratedValues]);
+ }, []);
/**
- * Clear all alias fields.
+ * Handle removing an optional field.
*/
- const clearAliasFields = useCallback(() => {
- setFieldValues(prev => ({
- ...prev,
- [FieldKey.AliasFirstName]: '',
- [FieldKey.AliasLastName]: '',
- [FieldKey.AliasGender]: '',
- [FieldKey.AliasBirthdate]: '',
- }));
+ const handleRemoveOptionalField = useCallback((fieldKey: string): void => {
+ setManuallyAddedFields(prev => {
+ const newSet = new Set(prev);
+ newSet.delete(fieldKey);
+ return newSet;
+ });
+ setFieldValues(prev => {
+ const newValues = { ...prev };
+ delete newValues[fieldKey];
+ return newValues;
+ });
setHasUnsavedChanges(true);
}, []);
/**
- * Check if any alias fields have values.
+ * Add custom field handler.
*/
- const hasAliasValues = useMemo(() => {
- return !!(
- fieldValues[FieldKey.AliasFirstName] ||
- fieldValues[FieldKey.AliasLastName] ||
- fieldValues[FieldKey.AliasGender] ||
- fieldValues[FieldKey.AliasBirthdate]
- );
- }, [fieldValues]);
+ const handleAddCustomField = useCallback((label: string, fieldType: FieldType) => {
+ const tempId = crypto.randomUUID();
+ const newField: CustomFieldDefinition = {
+ tempId,
+ label,
+ fieldType,
+ isHidden: false,
+ displayOrder: applicableSystemFields.length + customFields.length + 1
+ };
+
+ setCustomFields(prev => [...prev, newField]);
+ setHasUnsavedChanges(true);
+ }, [applicableSystemFields.length, customFields.length]);
/**
- * Handle the generate random alias button press.
+ * Delete custom field handler.
*/
- const handleGenerateRandomAlias = useCallback(async (): Promise<void> => {
- if (Platform.OS === 'ios' || Platform.OS === 'android') {
- Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
- }
+ const handleDeleteCustomField = useCallback((tempId: string) => {
+ setCustomFields(prev => prev.filter(f => f.tempId !== tempId));
+ setFieldValues(prev => {
+ const newValues = { ...prev };
+ delete newValues[tempId];
+ return newValues;
+ });
+ setHasUnsavedChanges(true);
+ }, []);
- if (hasAliasValues) {
- clearAliasFields();
- } else {
- await generateRandomAlias();
+ /**
+ * Optional sections for AddFieldMenu.
+ */
+ const optionalSections = useMemo((): OptionalSection[] => {
+ const sections: OptionalSection[] = [];
+ // 2FA - only for types with login fields
+ if (hasLoginFields) {
+ sections.push({
+ key: '2fa',
+ isVisible: show2FA,
+ /**
+ * Show the 2FA section
+ */
+ onAdd: () => setShow2FA(true)
+ });
}
- }, [generateRandomAlias, clearAliasFields, hasAliasValues]);
+ // Attachments - always available
+ sections.push({
+ key: 'attachments',
+ isVisible: showAttachments,
+ /**
+ * Show the attachments section
+ */
+ onAdd: () => setShowAttachments(true)
+ });
+ return sections;
+ }, [hasLoginFields, show2FA, showAttachments]);
/**
- * Submit the form for either creating or updating an item.
+ * Submit the form.
*/
- const onSubmit = useCallback(async () : Promise<void> => {
+ const onSubmit = useCallback(async (): Promise<void> => {
if (isSaveDisabled || !item) {
return;
}
@@ -366,11 +710,6 @@ export default function AddEditItemScreen() : React.ReactNode {
Keyboard.dismiss();
setIsSyncing(true);
- // If we're creating a new item and mode is random, generate random values first
- if (!isEditMode && mode === 'random') {
- await generateRandomAlias();
- }
-
// Build the fields array from fieldValues
const fields: ItemField[] = [];
@@ -392,8 +731,26 @@ export default function AddEditItemScreen() : React.ReactNode {
}
});
+ // Add custom fields
+ customFields.forEach(customField => {
+ const value = fieldValues[customField.tempId];
+
+ if (value && (Array.isArray(value) ? value.length > 0 : value.toString().trim() !== '')) {
+ fields.push({
+ FieldKey: customField.tempId,
+ Label: customField.label,
+ FieldType: customField.fieldType,
+ Value: value,
+ IsHidden: customField.isHidden,
+ DisplayOrder: customField.displayOrder,
+ IsCustomField: true,
+ EnableHistory: false
+ });
+ }
+ });
+
// Normalize birthdate if present
- const birthdateField = fields.find(f => f.FieldKey === FieldKey.AliasBirthdate);
+ const birthdateField = fields.find(f => f.FieldKey === 'alias.birthdate');
if (birthdateField && typeof birthdateField.Value === 'string') {
birthdateField.Value = IdentityHelperUtils.normalizeBirthDate(birthdateField.Value);
}
@@ -408,7 +765,7 @@ export default function AddEditItemScreen() : React.ReactNode {
};
// Extract favicon from URL if present
- const urlValue = fieldValues[FieldKey.LoginUrl];
+ const urlValue = fieldValues['login.url'];
const urlString = Array.isArray(urlValue) ? urlValue[0] : urlValue;
if (urlString && urlString !== 'https://' && urlString !== 'http://') {
try {
@@ -445,7 +802,9 @@ export default function AddEditItemScreen() : React.ReactNode {
emitter.emit('credentialChanged', itemToSave.Id);
},
{
- /** Handle successful vault mutation. */
+ /**
+ * Handle successful save
+ */
onSuccess: () => {
setHasUnsavedChanges(false);
@@ -460,13 +819,13 @@ export default function AddEditItemScreen() : React.ReactNode {
if (isEditMode) {
Toast.show({
type: 'success',
- text1: t('credentials.toasts.credentialUpdated'),
+ text1: t('items.toasts.itemUpdated'),
position: 'bottom'
});
} else {
Toast.show({
type: 'success',
- text1: t('credentials.toasts.credentialCreated'),
+ text1: t('items.toasts.itemCreated'),
position: 'bottom'
});
router.push(`/items/${itemToSave.Id}`);
@@ -474,11 +833,13 @@ export default function AddEditItemScreen() : React.ReactNode {
}, 100);
}
},
- /** Handle error during vault mutation. */
+ /**
+ * Handle error saving item
+ */
onError: (error) => {
Toast.show({
type: 'error',
- text1: t('credentials.errors.saveFailed'),
+ text1: t('items.errors.saveFailed'),
text2: error.message,
position: 'bottom'
});
@@ -487,60 +848,12 @@ export default function AddEditItemScreen() : React.ReactNode {
setIsSaveDisabled(false);
}
});
- }, [isEditMode, id, serviceUrl, router, executeVaultMutation, dbContext.sqliteClient, mode, generateRandomAlias, webApi, isSaveDisabled, item, fieldValues, applicableSystemFields, t, originalAttachmentIds, attachments, originalTotpCodeIds, totpCodes, passkeyIdsMarkedForDeletion]);
-
- /**
- * Generate a random username based on current identity fields.
- */
- const generateRandomUsername = useCallback(async () : Promise<void> => {
- try {
- const firstName = (fieldValues[FieldKey.AliasFirstName] as string) ?? '';
- const lastName = (fieldValues[FieldKey.AliasLastName] as string) ?? '';
- const birthDate = (fieldValues[FieldKey.AliasBirthdate] as string) ?? '';
-
- let username: string;
-
- if (!firstName && !lastName && !birthDate) {
- const randomIdentity = await generateRandomIdentity();
- username = randomIdentity.nickName;
- } else {
- const usernameEmailGenerator = CreateUsernameEmailGenerator();
-
- let gender = Gender.Other;
- try {
- gender = (fieldValues[FieldKey.AliasGender] as string) as Gender;
- } catch {
- // Gender parsing failed, default to other
- }
-
- let parsedBirthDate = new Date(birthDate);
- if (!birthDate || isNaN(parsedBirthDate.getTime())) {
- parsedBirthDate = new Date();
- }
-
- const identity: Identity = {
- firstName,
- lastName,
- nickName: '',
- gender,
- birthDate: parsedBirthDate,
- emailPrefix: (fieldValues[FieldKey.LoginEmail] as string) ?? '',
- };
-
- username = usernameEmailGenerator.generateUsername(identity);
- }
-
- handleFieldChange(FieldKey.LoginUsername, username);
- setLastGeneratedValues(prev => ({ ...prev, username }));
- } catch (error) {
- console.error('Error generating random username:', error);
- }
- }, [fieldValues, generateRandomIdentity, handleFieldChange]);
+ }, [isEditMode, id, serviceUrl, router, executeVaultMutation, dbContext.sqliteClient, webApi, isSaveDisabled, item, fieldValues, applicableSystemFields, customFields, t, originalAttachmentIds, attachments, originalTotpCodeIds, totpCodes, passkeyIdsMarkedForDeletion]);
/**
* Handle the delete button press.
*/
- const handleDelete = async () : Promise<void> => {
+ const handleDelete = async (): Promise<void> => {
if (!id) {
return;
}
@@ -548,8 +861,8 @@ export default function AddEditItemScreen() : React.ReactNode {
Keyboard.dismiss();
Alert.alert(
- t('credentials.deleteCredential'),
- t('credentials.deleteConfirm'),
+ t('items.deleteItem'),
+ t('items.deleteConfirm'),
[
{
text: t('common.cancel'),
@@ -558,8 +871,10 @@ export default function AddEditItemScreen() : React.ReactNode {
{
text: t('common.delete'),
style: "destructive",
- /** Delete the item. */
- onPress: async () : Promise<void> => {
+ /**
+ * Delete the item
+ */
+ onPress: async (): Promise<void> => {
setIsSyncing(true);
await executeVaultMutation(async () => {
@@ -571,7 +886,7 @@ export default function AddEditItemScreen() : React.ReactNode {
setTimeout(() => {
Toast.show({
type: 'success',
- text1: t('credentials.toasts.credentialDeleted'),
+ text1: t('items.toasts.itemDeleted'),
position: 'bottom'
});
}, 200);
@@ -585,6 +900,37 @@ export default function AddEditItemScreen() : React.ReactNode {
);
};
+ /**
+ * Handle cancel button press.
+ */
+ const handleCancel = useCallback((): void => {
+ if (hasUnsavedChanges) {
+ Alert.alert(
+ t('items.unsavedChanges.title'),
+ t('items.unsavedChanges.message'),
+ [
+ {
+ text: t('common.cancel'),
+ style: 'cancel',
+ },
+ {
+ text: t('items.unsavedChanges.discard'),
+ style: 'destructive',
+ /**
+ * Discard unsaved changes and navigate back
+ */
+ onPress: (): void => {
+ setHasUnsavedChanges(false);
+ router.back();
+ },
+ },
+ ]
+ );
+ } else {
+ router.back();
+ }
+ }, [hasUnsavedChanges, router, t]);
+
/**
* Get the top padding for the container.
*/
@@ -596,6 +942,118 @@ export default function AddEditItemScreen() : React.ReactNode {
return iosVersion >= 26 ? 72 : 52;
};
+ /**
+ * Get category title for display.
+ */
+ const getCategoryTitle = useCallback((category: string): string => {
+ switch (category) {
+ case FieldCategories.Login:
+ return t('items.loginCredentials');
+ case FieldCategories.Alias:
+ return t('items.alias');
+ case FieldCategories.Card:
+ return t('itemTypes.creditCard.cardInformation');
+ default:
+ return category;
+ }
+ }, [t]);
+
+ /**
+ * Render a field input based on field type.
+ */
+ const renderFieldInput = useCallback((
+ fieldKey: string,
+ label: string,
+ fieldType: FieldType,
+ isHidden: boolean,
+ _isMultiValue: boolean,
+ onRemove?: () => void
+ ): React.ReactNode => {
+ const value = fieldValues[fieldKey] || '';
+ const stringValue = Array.isArray(value) ? value[0] || '' : value;
+
+ switch (fieldType) {
+ case FieldTypes.Password:
+ return (
+ <AdvancedPasswordField
+ value={stringValue}
+ onChangeText={(val) => handleFieldChange(fieldKey, val)}
+ label={label}
+ showPassword={isPasswordVisible}
+ onShowPasswordChange={setIsPasswordVisible}
+ isNewCredential={!isEditMode}
+ onRemove={onRemove}
+ />
+ );
+
+ case FieldTypes.Hidden:
+ return (
+ <HiddenField
+ value={stringValue}
+ onChangeText={(val) => handleFieldChange(fieldKey, val)}
+ label={label}
+ keyboardType={fieldKey === 'card.pin' || fieldKey === 'card.cvv' ? 'numeric' : 'default'}
+ onRemove={onRemove}
+ />
+ );
+
+ case FieldTypes.Email:
+ return (
+ <EmailDomainField
+ value={stringValue}
+ onChange={(val) => handleFieldChange(fieldKey, val)}
+ label={label}
+ onRemove={onRemove}
+ />
+ );
+
+ case FieldTypes.TextArea:
+ return (
+ <FormField
+ value={stringValue}
+ onChangeText={(val) => handleFieldChange(fieldKey, val)}
+ label={label}
+ multiline
+ numberOfLines={4}
+ textAlignVertical="top"
+ onRemove={onRemove}
+ />
+ );
+
+ case FieldTypes.Text:
+ case FieldTypes.URL:
+ case FieldTypes.Phone:
+ case FieldTypes.Number:
+ case FieldTypes.Date:
+ default:
+ // Use username field with regenerate button for login.username when alias fields are shown
+ if (fieldKey === 'login.username' && aliasFieldsShownByDefault) {
+ return (
+ <FormField
+ value={stringValue}
+ onChangeText={(val) => handleFieldChange(fieldKey, val)}
+ label={label}
+ buttons={[{
+ icon: "refresh",
+ onPress: generateRandomUsername
+ }]}
+ onRemove={onRemove}
+ />
+ );
+ }
+ return (
+ <FormField
+ value={stringValue}
+ onChangeText={(val) => handleFieldChange(fieldKey, val)}
+ label={label}
+ placeholder={fieldKey === 'alias.birthdate' ? t('items.birthDatePlaceholder') : undefined}
+ keyboardType={fieldType === FieldTypes.Phone || fieldType === FieldTypes.Number ? 'numeric' : 'default'}
+ onRemove={onRemove}
+ />
+ );
+ }
+ }, [fieldValues, handleFieldChange, isPasswordVisible, isEditMode, aliasFieldsShownByDefault, generateRandomUsername, t]);
+
const styles = StyleSheet.create({
container: {
flex: 1,
@@ -617,25 +1075,6 @@ export default function AddEditItemScreen() : React.ReactNode {
color: colors.errorText,
fontWeight: '600',
},
- generateButton: {
- alignItems: 'center',
- borderRadius: 8,
- flexDirection: 'row',
- marginBottom: 8,
- paddingHorizontal: 12,
- paddingVertical: 8,
- },
- generateButtonPrimary: {
- backgroundColor: colors.primary,
- },
- generateButtonSecondary: {
- backgroundColor: colors.textMuted,
- },
- generateButtonText: {
- color: colors.primarySurfaceText,
- fontWeight: '600',
- marginLeft: 6,
- },
headerLeftButton: {
paddingHorizontal: 8,
},
@@ -648,81 +1087,90 @@ export default function AddEditItemScreen() : React.ReactNode {
headerRightButtonDisabled: {
opacity: 0.5,
},
- modeButton: {
- alignItems: 'center',
- borderRadius: 6,
- flex: 1,
+ passkeyContainer: {
+ backgroundColor: colors.background,
+ borderColor: colors.accentBorder,
+ borderRadius: 8,
+ borderWidth: 1,
+ marginBottom: 8,
+ marginTop: 8,
+ padding: 12,
+ },
+ passkeyDeletedContainer: {
+ backgroundColor: colors.errorBackground,
+ borderColor: colors.errorBorder,
+ },
+ passkeyHeader: {
+ alignItems: 'flex-start',
flexDirection: 'row',
- gap: 6,
- justifyContent: 'center',
- padding: 8,
},
- modeButtonActive: {
- backgroundColor: colors.primary,
+ passkeyHeaderRight: {
+ flex: 1,
+ },
+ passkeyHelpText: {
+ color: colors.textMuted,
+ fontSize: 11,
+ marginTop: 4,
},
- modeButtonText: {
+ passkeyIcon: {
+ marginRight: 8,
+ marginTop: 2,
+ },
+ passkeyTitleRow: {
+ alignItems: 'center',
+ flexDirection: 'row',
+ justifyContent: 'space-between',
+ marginBottom: 4,
+ },
+ passkeyTitle: {
color: colors.text,
+ fontSize: 14,
fontWeight: '600',
},
- modeButtonTextActive: {
- color: colors.primarySurfaceText,
+ passkeyTitleDeleted: {
+ color: colors.errorText,
},
- modeSelector: {
- backgroundColor: colors.accentBackground,
- borderRadius: 8,
+ sectionHeader: {
+ alignItems: 'center',
flexDirection: 'row',
- marginBottom: 16,
- padding: 4,
- },
- section: {
- backgroundColor: colors.accentBackground,
- borderRadius: 8,
- marginBottom: 24,
- padding: 16,
+ justifyContent: 'space-between',
},
sectionTitle: {
color: colors.text,
fontSize: 18,
fontWeight: '600',
- marginBottom: 10,
+ },
+ sectionTitleWithBadge: {
+ alignItems: 'center',
+ flexDirection: 'row',
+ gap: 8,
+ },
+ addEmailBadge: {
+ alignItems: 'center',
+ borderColor: colors.accentBorder,
+ borderRadius: 12,
+ borderStyle: 'dashed',
+ borderWidth: 1,
+ flexDirection: 'row',
+ gap: 4,
+ paddingHorizontal: 8,
+ paddingVertical: 4,
+ },
+ addEmailBadgeText: {
+ color: colors.textMuted,
+ fontSize: 12,
+ fontWeight: '500',
},
});
- /**
- * Handle cancel button press with unsaved changes check.
- */
- const handleCancel = useCallback(() : void => {
- if (hasUnsavedChanges) {
- Alert.alert(
- t('credentials.unsavedChanges.title'),
- t('credentials.unsavedChanges.message'),
- [
- {
- text: t('common.cancel'),
- style: 'cancel',
- },
- {
- text: t('credentials.unsavedChanges.discard'),
- style: 'destructive',
- /** Discard button handler. */
- onPress: () : void => {
- setHasUnsavedChanges(false);
- router.back();
- },
- },
- ]
- );
- } else {
- router.back();
- }
- }, [hasUnsavedChanges, router, t]);
-
// Set header buttons
useEffect(() => {
navigation.setOptions({
...(Platform.OS === 'ios' && {
- /** Header left button. */
- headerLeft: () : React.ReactNode => (
+ /**
+ * Show the cancel button
+ */
+ headerLeft: (): React.ReactNode => (
<RobustPressable
onPress={handleCancel}
style={styles.headerLeftButton}
@@ -731,7 +1179,9 @@ export default function AddEditItemScreen() : React.ReactNode {
</RobustPressable>
),
}),
- /** Header right button. */
+ /**
+ * Show the save button
+ */
headerRight: () => (
<RobustPressable
onPress={onSubmit}
@@ -746,7 +1196,7 @@ export default function AddEditItemScreen() : React.ReactNode {
</RobustPressable>
),
});
- }, [navigation, mode, onSubmit, colors.primary, isEditMode, router, styles.headerLeftButton, styles.headerLeftButtonText, styles.headerRightButton, styles.headerRightButtonDisabled, isSaveDisabled, t, handleCancel]);
+ }, [navigation, onSubmit, colors.primary, isEditMode, router, styles.headerLeftButton, styles.headerLeftButtonText, styles.headerRightButton, styles.headerRightButtonDisabled, isSaveDisabled, t, handleCancel]);
// Check for passkeys (in edit mode)
const hasPasskey = useMemo(() => {
@@ -759,7 +1209,7 @@ export default function AddEditItemScreen() : React.ReactNode {
return (
<>
- <Stack.Screen options={{ title: isEditMode ? t('credentials.editCredential') : t('credentials.addCredential') }} />
+ <Stack.Screen options={{ title: isEditMode ? t('items.editItem') : t('items.addItem') }} />
{(isSyncing) && (
<LoadingOverlay status={syncStatus} />
)}
@@ -775,39 +1225,16 @@ export default function AddEditItemScreen() : React.ReactNode {
keyboardShouldPersistTaps="handled"
showsVerticalScrollIndicator={false}
>
- {!isEditMode && (
- <View style={styles.modeSelector}>
- <RobustPressable
- style={[styles.modeButton, mode === 'random' && styles.modeButtonActive]}
- onPress={() => setMode('random')}
- >
- <MaterialIcons
- name="auto-fix-high"
- size={20}
- color={mode === 'random' ? colors.primarySurfaceText : colors.text}
- />
- <ThemedText style={[styles.modeButtonText, mode === 'random' && styles.modeButtonTextActive]}>
- {t('credentials.randomAlias')}
- </ThemedText>
- </RobustPressable>
- <RobustPressable
- style={[styles.modeButton, mode === 'manual' && styles.modeButtonActive]}
- onPress={() => setMode('manual')}
- >
- <MaterialIcons
- name="person"
- size={20}
- color={mode === 'manual' ? colors.primarySurfaceText : colors.text}
- />
- <ThemedText style={[styles.modeButtonText, mode === 'manual' && styles.modeButtonTextActive]}>
- {t('credentials.manual')}
- </ThemedText>
- </RobustPressable>
- </View>
- )}
-
- <View style={styles.section}>
- <ThemedText style={styles.sectionTitle}>{t('credentials.service')}</ThemedText>
+ {/* Item Type Selector */}
+ <ItemTypeSelector
+ selectedType={item.ItemType}
+ isEditMode={isEditMode}
+ onTypeChange={handleTypeChange}
+ onRegenerateAlias={aliasFieldsShownByDefault ? generateRandomAlias : undefined}
+ />
+
+ {/* Item Name and Primary Fields Section */}
+ <FormSection title={t('items.service')}>
<FormField
ref={itemNameRef}
value={item.Name ?? ''}
@@ -815,239 +1242,262 @@ export default function AddEditItemScreen() : React.ReactNode {
setItem(prev => prev ? { ...prev, Name: value } : prev);
setHasUnsavedChanges(true);
}}
- label={t('credentials.serviceName')}
+ label={t('items.serviceName')}
required
/>
- <FormField
- value={(fieldValues[FieldKey.LoginUrl] as string) ?? 'https://'}
- onChangeText={(value) => handleFieldChange(FieldKey.LoginUrl, value)}
- label={t('credentials.serviceUrl')}
- />
- </View>
- {(mode === 'manual' || isEditMode) && (
- <>
- <View style={styles.section}>
- <ThemedText style={styles.sectionTitle}>{t('credentials.loginCredentials')}</ThemedText>
-
- {hasPasskey ? (
- <>
- {/* When passkey exists: username, passkey, email, password */}
- <FormField
- value={(fieldValues[FieldKey.LoginUsername] as string) ?? ''}
- onChangeText={(value) => handleFieldChange(FieldKey.LoginUsername, value)}
- label={t('credentials.username')}
- buttons={[{
- icon: "refresh",
- onPress: generateRandomUsername
- }]}
+ {/* Primary fields (like URL) */}
+ {primaryFields.map(field => (
+ <View key={field.FieldKey}>
+ {renderFieldInput(
+ field.FieldKey,
+ t(`fieldLabels.${field.FieldKey}`, { defaultValue: t('items.serviceUrl') }),
+ field.FieldType,
+ field.IsHidden,
+ field.IsMultiValue
+ )}
+ </View>
+ ))}
+ </FormSection>
+
+ {/* Passkey Section - only in edit mode for items with passkeys */}
+ {isEditMode && hasPasskey && (
+ <FormSection title={t('passkeys.passkey')}>
+ {!passkeyIdsMarkedForDeletion.length ? (
+ <View style={styles.passkeyContainer}>
+ <View style={styles.passkeyHeader}>
+ <MaterialIcons
+ name="vpn-key"
+ size={20}
+ color={colors.primary}
+ style={styles.passkeyIcon}
/>
- {!passkeyIdsMarkedForDeletion.length && (
- <View style={{
- backgroundColor: colors.background,
- borderColor: colors.accentBorder,
- borderRadius: 8,
- borderWidth: 1,
- marginTop: 8,
- marginBottom: 8,
- padding: 12,
- }}>
- <View style={{ flexDirection: 'row', alignItems: 'flex-start' }}>
+ <View style={styles.passkeyHeaderRight}>
+ <View style={styles.passkeyTitleRow}>
+ <ThemedText style={styles.passkeyTitle}>
+ {t('passkeys.passkey')}
+ </ThemedText>
+ <RobustPressable
+ onPress={() => setPasskeyIdsMarkedForDeletion(['passkey'])}
+ style={{
+ padding: 6,
+ borderRadius: 4,
+ backgroundColor: colors.destructive + '15'
+ }}
+ >
<MaterialIcons
- name="vpn-key"
- size={20}
- color={colors.primary}
- style={{ marginRight: 8, marginTop: 2 }}
+ name="delete"
+ size={18}
+ color={colors.destructive}
/>
- <View style={{ flex: 1 }}>
- <View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginBottom: 4 }}>
- <ThemedText style={{ color: colors.text, fontSize: 14, fontWeight: '600' }}>
- {t('passkeys.passkey')}
- </ThemedText>
- <RobustPressable
- onPress={() => setPasskeyIdsMarkedForDeletion(['passkey'])}
- style={{
- padding: 6,
- borderRadius: 4,
- backgroundColor: colors.destructive + '15'
- }}
- >
- <MaterialIcons
- name="delete"
- size={18}
- color={colors.destructive}
- />
- </RobustPressable>
- </View>
- <ThemedText style={{ color: colors.textMuted, fontSize: 11, marginTop: 4 }}>
- {t('passkeys.helpText')}
- </ThemedText>
- </View>
- </View>
+ </RobustPressable>
</View>
- )}
- {passkeyIdsMarkedForDeletion.length > 0 && (
- <View style={{
- backgroundColor: colors.errorBackground,
- borderColor: colors.errorBorder,
- borderRadius: 8,
- borderWidth: 1,
- marginTop: 8,
- marginBottom: 8,
- padding: 12,
- }}>
- <View style={{ flexDirection: 'row', alignItems: 'flex-start' }}>
+ <ThemedText style={styles.passkeyHelpText}>
+ {t('passkeys.helpText')}
+ </ThemedText>
+ </View>
+ </View>
+ </View>
+ ) : (
+ <View style={[styles.passkeyContainer, styles.passkeyDeletedContainer]}>
+ <View style={styles.passkeyHeader}>
+ <MaterialIcons
+ name="vpn-key"
+ size={20}
+ color={colors.errorText}
+ style={styles.passkeyIcon}
+ />
+ <View style={styles.passkeyHeaderRight}>
+ <View style={styles.passkeyTitleRow}>
+ <ThemedText style={[styles.passkeyTitle, styles.passkeyTitleDeleted]}>
+ {t('passkeys.passkeyMarkedForDeletion')}
+ </ThemedText>
+ <RobustPressable
+ onPress={() => setPasskeyIdsMarkedForDeletion([])}
+ style={{ padding: 4 }}
+ >
<MaterialIcons
- name="vpn-key"
- size={20}
- color={colors.errorText}
- style={{ marginRight: 8, marginTop: 2 }}
+ name="undo"
+ size={18}
+ color={colors.textMuted}
/>
- <View style={{ flex: 1 }}>
- <View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginBottom: 4 }}>
- <ThemedText style={{ color: colors.errorText, fontSize: 14, fontWeight: '600' }}>
- {t('passkeys.passkeyMarkedForDeletion')}
- </ThemedText>
- <RobustPressable
- onPress={() => setPasskeyIdsMarkedForDeletion([])}
- style={{ padding: 4 }}
- >
- <MaterialIcons
- name="undo"
- size={18}
- color={colors.textMuted}
- />
- </RobustPressable>
- </View>
- <ThemedText style={{ color: colors.errorText, fontSize: 11 }}>
- {t('passkeys.passkeyWillBeDeleted')}
- </ThemedText>
- </View>
- </View>
+ </RobustPressable>
</View>
- )}
- <EmailDomainField
- value={(fieldValues[FieldKey.LoginEmail] as string) ?? ''}
- onChange={(newValue) => handleFieldChange(FieldKey.LoginEmail, newValue)}
- label={t('credentials.email')}
- />
- <AdvancedPasswordField
- value={(fieldValues[FieldKey.LoginPassword] as string) ?? ''}
- onChangeText={(value) => handleFieldChange(FieldKey.LoginPassword, value)}
- label={t('credentials.password')}
- showPassword={isPasswordVisible}
- onShowPasswordChange={setIsPasswordVisible}
- isNewCredential={!isEditMode}
- />
- </>
- ) : (
- <>
- {/* When no passkey: email, username, password */}
- <EmailDomainField
- value={(fieldValues[FieldKey.LoginEmail] as string) ?? ''}
- onChange={(newValue) => handleFieldChange(FieldKey.LoginEmail, newValue)}
- label={t('credentials.email')}
- />
- <FormField
- value={(fieldValues[FieldKey.LoginUsername] as string) ?? ''}
- onChangeText={(value) => handleFieldChange(FieldKey.LoginUsername, value)}
- label={t('credentials.username')}
- buttons={[{
- icon: "refresh",
- onPress: generateRandomUsername
- }]}
- />
- <AdvancedPasswordField
- value={(fieldValues[FieldKey.LoginPassword] as string) ?? ''}
- onChangeText={(value) => handleFieldChange(FieldKey.LoginPassword, value)}
- label={t('credentials.password')}
- showPassword={isPasswordVisible}
- onShowPasswordChange={setIsPasswordVisible}
- isNewCredential={!isEditMode}
- />
- </>
- )}
- </View>
-
- <View style={styles.section}>
- <ThemedText style={styles.sectionTitle}>{t('credentials.alias')}</ThemedText>
- <RobustPressable
- style={[
- styles.generateButton,
- hasAliasValues ? styles.generateButtonSecondary : styles.generateButtonPrimary
- ]}
- onPress={handleGenerateRandomAlias}
- >
- <MaterialIcons
- name={hasAliasValues ? "clear" : "auto-fix-high"}
- size={20}
- color="#fff"
- />
- <ThemedText style={styles.generateButtonText}>
- {hasAliasValues ? t('credentials.clearAliasFields') : t('credentials.generateRandomAlias')}
- </ThemedText>
- </RobustPressable>
- <FormField
- value={(fieldValues[FieldKey.AliasFirstName] as string) ?? ''}
- onChangeText={(value) => handleFieldChange(FieldKey.AliasFirstName, value)}
- label={t('credentials.firstName')}
- />
- <FormField
- value={(fieldValues[FieldKey.AliasLastName] as string) ?? ''}
- onChangeText={(value) => handleFieldChange(FieldKey.AliasLastName, value)}
- label={t('credentials.lastName')}
- />
- <FormField
- value={(fieldValues[FieldKey.AliasGender] as string) ?? ''}
- onChangeText={(value) => handleFieldChange(FieldKey.AliasGender, value)}
- label={t('credentials.gender')}
- />
- <FormField
- value={(fieldValues[FieldKey.AliasBirthdate] as string) ?? ''}
- onChangeText={(value) => handleFieldChange(FieldKey.AliasBirthdate, value)}
- label={t('credentials.birthDate')}
- placeholder={t('credentials.birthDatePlaceholder')}
- />
- </View>
+ <ThemedText style={[styles.passkeyHelpText, { color: colors.errorText }]}>
+ {t('passkeys.passkeyWillBeDeleted')}
+ </ThemedText>
+ </View>
+ </View>
+ </View>
+ )}
+ </FormSection>
+ )}
- <View style={styles.section}>
- <ThemedText style={styles.sectionTitle}>{t('credentials.metadata')}</ThemedText>
-
- <FormField
- value={(fieldValues[FieldKey.NotesContent] as string) ?? ''}
- onChangeText={(value) => handleFieldChange(FieldKey.NotesContent, value)}
- label={t('credentials.notes')}
- multiline={true}
- numberOfLines={4}
- textAlignVertical="top"
- />
- </View>
+ {/* Render fields grouped by category */}
+ {Object.keys(groupedSystemFields).map(category => {
+ const categoryFields = groupedSystemFields[category];
+ const visibleFields = categoryFields.filter(field => shouldShowField(field));
+
+ // Find email field for potential "+ Email" button (only for Login category)
+ const emailField = category === FieldCategories.Login
+ ? categoryFields.find(f => f.FieldKey === 'login.email')
+ : null;
+ const showEmailAddButton = emailField && !shouldShowField(emailField);
+
+ // Sort login fields: email first, then username, then password
+ const sortedVisibleFields = category === FieldCategories.Login
+ ? [...visibleFields].sort((a, b) => {
+ const order: Record<string, number> = {
+ 'login.email': 0,
+ 'login.username': 1,
+ 'login.password': 2
+ };
+ const aOrder = order[a.FieldKey] ?? 99;
+ const bOrder = order[b.FieldKey] ?? 99;
+ return aOrder - bOrder;
+ })
+ : visibleFields;
+
+ // Don't render category section if no visible fields and no add button
+ if (sortedVisibleFields.length === 0 && !showEmailAddButton) {
+ return null;
+ }
+
+ return (
+ <FormSection
+ key={category}
+ title={
+ <View style={styles.sectionHeader}>
+ <View style={styles.sectionTitleWithBadge}>
+ <ThemedText style={styles.sectionTitle}>
+ {getCategoryTitle(category)}
+ </ThemedText>
+ {showEmailAddButton && (
+ <RobustPressable
+ onPress={() => handleAddOptionalField('login.email')}
+ style={styles.addEmailBadge}
+ >
+ <MaterialIcons name="add" size={14} color={colors.textMuted} />
+ <ThemedText style={styles.addEmailBadgeText}>
+ {t('items.email')}
+ </ThemedText>
+ </RobustPressable>
+ )}
+ </View>
+ {/* Section action: Regenerate button for Alias category */}
+ {category === FieldCategories.Alias && aliasFieldsShownByDefault && (
+ <RobustPressable onPress={generateRandomAlias} style={{ padding: 4 }}>
+ <MaterialIcons name="refresh" size={20} color={colors.textMuted} />
+ </RobustPressable>
+ )}
+ </View>
+ }
+ >
+ {sortedVisibleFields.map(field => {
+ const canRemoveField = item && manuallyAddedFields.has(field.FieldKey) &&
+ !isFieldShownByDefault(field, item.ItemType);
+
+ return (
+ <View key={field.FieldKey}>
+ {renderFieldInput(
+ field.FieldKey,
+ t(`fieldLabels.${field.FieldKey}`, { defaultValue: field.FieldKey }),
+ field.FieldType,
+ field.IsHidden,
+ field.IsMultiValue,
+ canRemoveField ? (): void => handleRemoveOptionalField(field.FieldKey) : undefined
+ )}
+ </View>
+ );
+ })}
+ </FormSection>
+ );
+ })}
+
+ {/* Custom Fields Section */}
+ {customFields.length > 0 && (
+ <FormSection title={t('itemTypes.customFields')}>
+ {customFields.map(field => (
+ <View key={field.tempId}>
+ {renderFieldInput(
+ field.tempId,
+ field.label,
+ field.fieldType,
+ field.isHidden,
+ false,
+ () => handleDeleteCustomField(field.tempId)
+ )}
+ </View>
+ ))}
+ </FormSection>
+ )}
- <View style={styles.section}>
- <TotpEditor
- totpCodes={totpCodes}
- onTotpCodesChange={setTotpCodes}
- originalTotpCodeIds={originalTotpCodeIds}
- />
- </View>
+ {/* Notes Section */}
+ {notesField && visibleFieldKeys.has('notes.content') && (
+ <FormSection
+ title={t('items.notes')}
+ actions={
+ !shouldShowField(notesField) ? (
+ <RobustPressable
+ onPress={() => handleRemoveOptionalField('notes.content')}
+ style={{ padding: 4 }}
+ >
+ <MaterialIcons name="close" size={18} color={colors.textMuted} />
+ </RobustPressable>
+ ) : undefined
+ }
+ >
+ {renderFieldInput(
+ notesField.FieldKey,
+ '', // No label - FormSection title is sufficient
+ notesField.FieldType,
+ notesField.IsHidden,
+ notesField.IsMultiValue
+ )}
+ </FormSection>
+ )}
- <View style={styles.section}>
- <ThemedText style={styles.sectionTitle}>{t('credentials.attachments')}</ThemedText>
+ {/* 2FA TOTP Section - only for types with login fields */}
+ {show2FA && hasLoginFields && (
+ <FormSection title={t('common.twoFactorAuthentication')}>
+ <TotpEditor
+ totpCodes={totpCodes}
+ onTotpCodesChange={setTotpCodes}
+ originalTotpCodeIds={originalTotpCodeIds}
+ />
+ </FormSection>
+ )}
- <AttachmentUploader
- attachments={attachments}
- onAttachmentsChange={setAttachments}
- />
- </View>
+ {/* Attachments Section */}
+ {showAttachments && (
+ <FormSection title={t('items.attachments')}>
+ <AttachmentUploader
+ attachments={attachments}
+ onAttachmentsChange={setAttachments}
+ />
+ </FormSection>
+ )}
- {isEditMode && (
- <RobustPressable
- style={styles.deleteButton}
- onPress={handleDelete}
- >
- <ThemedText style={styles.deleteButtonText}>{t('credentials.deleteCredential')}</ThemedText>
- </RobustPressable>
- )}
- </>
+ {/* Add Field Menu */}
+ <AddFieldMenu
+ optionalSystemFields={optionalSystemFields}
+ visibleFieldKeys={visibleFieldKeys}
+ optionalSections={optionalSections}
+ callbacks={{
+ onAddSystemField: handleAddOptionalField,
+ onAddCustomField: handleAddCustomField
+ }}
+ />
+
+ {/* Delete Button (edit mode only) */}
+ {isEditMode && (
+ <View style={{ marginTop: 24 }}>
+ <RobustPressable
+ style={styles.deleteButton}
+ onPress={handleDelete}
+ >
+ <ThemedText style={styles.deleteButtonText}>{t('items.deleteItem')}</ThemedText>
+ </RobustPressable>
+ </View>
)}
</ScrollView>
</KeyboardAvoidingView>
diff --git a/apps/mobile-app/components/form/AddFieldMenu.tsx b/apps/mobile-app/components/form/AddFieldMenu.tsx
new file mode 100644
index 000000000..9b5156ba4
--- /dev/null
+++ b/apps/mobile-app/components/form/AddFieldMenu.tsx
@@ -0,0 +1,491 @@
+import MaterialIcons from '@expo/vector-icons/MaterialIcons';
+import React, { useState, useMemo, useCallback } from 'react';
+import { useTranslation } from 'react-i18next';
+import { View, StyleSheet, Modal, TextInput, ScrollView } from 'react-native';
+
+import type { FieldType, SystemFieldDefinition } from '@/utils/dist/core/models/vault';
+import { FieldCategories } from '@/utils/dist/core/models/vault';
+
+import { useColors } from '@/hooks/useColorScheme';
+
+import { ThemedText } from '@/components/themed/ThemedText';
+import { RobustPressable } from '@/components/ui/RobustPressable';
+
+/**
+ * Configuration for an optional section (not field-based).
+ */
+export type OptionalSection = {
+ /** Unique key for this section */
+ key: string;
+ /** Whether this section is currently visible */
+ isVisible: boolean;
+ /** Callback to add/show this section */
+ onAdd: () => void;
+};
+
+/**
+ * Callbacks for adding custom fields.
+ */
+type AddFieldMenuCallbacks = {
+ /** Callback when a system field is added */
+ onAddSystemField: (fieldKey: string) => void;
+ /** Callback when a custom field is added */
+ onAddCustomField: (label: string, fieldType: FieldType) => void;
+};
+
+type AddFieldMenuProps = {
+ /**
+ * Optional system fields for the current item type.
+ * These are fields with ShowByDefault: false that can be added via the menu.
+ */
+ optionalSystemFields: SystemFieldDefinition[];
+ /**
+ * Field keys that are currently visible (either have a value or were manually added).
+ */
+ visibleFieldKeys: Set<string>;
+ /**
+ * Optional sections (like 2FA, Attachments) that are not field-based.
+ */
+ optionalSections: OptionalSection[];
+ /**
+ * Callbacks for adding fields.
+ */
+ callbacks: AddFieldMenuCallbacks;
+};
+
+/**
+ * Menu option for internal use.
+ */
+type MenuOption = {
+ key: string;
+ label: string;
+ icon: keyof typeof MaterialIcons.glyphMap;
+ action: () => void;
+};
+
+/**
+ * Get icon for a field category.
+ */
+const getFieldIcon = (category: string): keyof typeof MaterialIcons.glyphMap => {
+ switch (category) {
+ case FieldCategories.Notes:
+ return 'description';
+ case FieldCategories.Login:
+ return 'vpn-key';
+ case FieldCategories.Alias:
+ return 'person';
+ case FieldCategories.Card:
+ return 'credit-card';
+ default:
+ return 'add';
+ }
+};
+
+/**
+ * Get icon for optional sections.
+ */
+const getSectionIcon = (key: string): keyof typeof MaterialIcons.glyphMap => {
+ switch (key) {
+ case '2fa':
+ return 'lock';
+ case 'attachments':
+ return 'attach-file';
+ default:
+ return 'add';
+ }
+};
+
+/**
+ * Available field types for custom fields.
+ */
+const FIELD_TYPE_OPTIONS: { value: FieldType; labelKey: string }[] = [
+ { value: 'Text', labelKey: 'itemTypes.fieldTypes.text' },
+ { value: 'Hidden', labelKey: 'itemTypes.fieldTypes.hidden' },
+ { value: 'Email', labelKey: 'itemTypes.fieldTypes.email' },
+ { value: 'URL', labelKey: 'itemTypes.fieldTypes.url' },
+ { value: 'Phone', labelKey: 'itemTypes.fieldTypes.phone' },
+ { value: 'Number', labelKey: 'itemTypes.fieldTypes.number' },
+ { value: 'Date', labelKey: 'itemTypes.fieldTypes.date' },
+ { value: 'TextArea', labelKey: 'itemTypes.fieldTypes.textArea' },
+];
+
+/**
+ * A dropdown menu for adding optional fields and sections to an item.
+ * Dynamically determines which options to show based on system field registry
+ * and current field visibility.
+ */
+export const AddFieldMenu: React.FC<AddFieldMenuProps> = ({
+ optionalSystemFields,
+ visibleFieldKeys,
+ optionalSections,
+ callbacks,
+}) => {
+ const { t } = useTranslation();
+ const colors = useColors();
+ const [isOpen, setIsOpen] = useState(false);
+ const [showCustomFieldModal, setShowCustomFieldModal] = useState(false);
+ const [customFieldLabel, setCustomFieldLabel] = useState('');
+ const [customFieldType, setCustomFieldType] = useState<FieldType>('Text');
+
+ const styles = StyleSheet.create({
+ addButton: {
+ alignItems: 'center',
+ borderColor: colors.accentBorder,
+ borderRadius: 8,
+ borderStyle: 'dashed',
+ borderWidth: 2,
+ flexDirection: 'row',
+ justifyContent: 'center',
+ paddingVertical: 12,
+ },
+ addButtonText: {
+ color: colors.textMuted,
+ fontSize: 14,
+ fontWeight: '600',
+ marginLeft: 8,
+ },
+ customFieldModalButtons: {
+ flexDirection: 'row',
+ gap: 12,
+ },
+ customFieldModalButton: {
+ alignItems: 'center',
+ borderRadius: 8,
+ flex: 1,
+ paddingVertical: 12,
+ },
+ customFieldModalButtonPrimary: {
+ backgroundColor: colors.primary,
+ },
+ customFieldModalButtonSecondary: {
+ backgroundColor: colors.accentBackground,
+ borderColor: colors.accentBorder,
+ borderWidth: 1,
+ },
+ customFieldModalButtonText: {
+ fontWeight: '600',
+ },
+ customFieldModalButtonTextPrimary: {
+ color: colors.primarySurfaceText,
+ },
+ customFieldModalButtonTextSecondary: {
+ color: colors.text,
+ },
+ customFieldModalContent: {
+ backgroundColor: colors.background,
+ borderRadius: 12,
+ padding: 20,
+ },
+ customFieldModalInput: {
+ backgroundColor: colors.accentBackground,
+ borderColor: colors.accentBorder,
+ borderRadius: 8,
+ borderWidth: 1,
+ color: colors.text,
+ fontSize: 16,
+ marginBottom: 16,
+ paddingHorizontal: 12,
+ paddingVertical: 10,
+ },
+ customFieldModalLabel: {
+ color: colors.text,
+ fontSize: 14,
+ fontWeight: '600',
+ marginBottom: 8,
+ },
+ customFieldModalOverlay: {
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
+ flex: 1,
+ justifyContent: 'center',
+ padding: 20,
+ },
+ fieldTypeChip: {
+ backgroundColor: colors.accentBackground,
+ borderColor: colors.accentBorder,
+ borderRadius: 16,
+ borderWidth: 1,
+ marginRight: 8,
+ paddingHorizontal: 14,
+ paddingVertical: 8,
+ },
+ fieldTypeChipSelected: {
+ backgroundColor: colors.primary,
+ borderColor: colors.primary,
+ },
+ fieldTypeChipText: {
+ color: colors.text,
+ fontSize: 14,
+ },
+ fieldTypeChipTextSelected: {
+ color: colors.primarySurfaceText,
+ },
+ fieldTypeContainer: {
+ flexDirection: 'row',
+ paddingBottom: 16,
+ },
+ fieldTypeScrollView: {
+ marginBottom: 16,
+ },
+ customFieldModalTitle: {
+ color: colors.text,
+ fontSize: 18,
+ fontWeight: '700',
+ marginBottom: 16,
+ textAlign: 'center',
+ },
+ menuContainer: {
+ backgroundColor: colors.background,
+ borderColor: colors.accentBorder,
+ borderRadius: 12,
+ borderWidth: 1,
+ },
+ menuOption: {
+ alignItems: 'center',
+ borderBottomColor: colors.accentBorder,
+ borderBottomWidth: 1,
+ flexDirection: 'row',
+ paddingHorizontal: 16,
+ paddingVertical: 14,
+ },
+ menuOptionIcon: {
+ marginRight: 12,
+ },
+ menuOptionText: {
+ color: colors.text,
+ fontSize: 16,
+ fontWeight: '500',
+ },
+ modalOverlay: {
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
+ flex: 1,
+ justifyContent: 'flex-end',
+ paddingBottom: 40,
+ paddingHorizontal: 20,
+ },
+ });
+
+ /**
+ * Handle adding a system field and closing menu.
+ */
+ const handleAddSystemField = useCallback((fieldKey: string): void => {
+ callbacks.onAddSystemField(fieldKey);
+ setIsOpen(false);
+ }, [callbacks]);
+
+ /**
+ * Handle adding an optional section and closing menu.
+ */
+ const handleAddSection = useCallback((onAdd: () => void): void => {
+ onAdd();
+ setIsOpen(false);
+ }, []);
+
+ /**
+ * Handle opening the custom field modal.
+ */
+ const handleOpenCustomFieldModal = useCallback((): void => {
+ setShowCustomFieldModal(true);
+ setIsOpen(false);
+ }, []);
+
+ /**
+ * Handle adding the custom field.
+ */
+ const handleAddCustomField = useCallback((): void => {
+ if (!customFieldLabel.trim()) {
+ return;
+ }
+
+ callbacks.onAddCustomField(customFieldLabel, customFieldType);
+ setCustomFieldLabel('');
+ setCustomFieldType('Text');
+ setShowCustomFieldModal(false);
+ }, [customFieldLabel, customFieldType, callbacks]);
+
+ /**
+ * Handle closing the custom field modal.
+ */
+ const handleCloseCustomFieldModal = useCallback((): void => {
+ setCustomFieldLabel('');
+ setCustomFieldType('Text');
+ setShowCustomFieldModal(false);
+ }, []);
+
+ /**
+ * Build menu options based on optional system fields and sections.
+ */
+ const menuOptions = useMemo((): MenuOption[] => {
+ const options: MenuOption[] = [];
+
+ // Add optional system fields that are not currently visible
+ optionalSystemFields.forEach(field => {
+ if (!visibleFieldKeys.has(field.FieldKey)) {
+ options.push({
+ key: field.FieldKey,
+ label: t(`fieldLabels.${field.FieldKey}`, { defaultValue: field.FieldKey }),
+ icon: getFieldIcon(field.Category),
+ action: (): void => handleAddSystemField(field.FieldKey),
+ });
+ }
+ });
+
+ // Add optional sections that are not currently visible
+ optionalSections.forEach(section => {
+ if (!section.isVisible) {
+ options.push({
+ key: section.key,
+ label: t(`common.${section.key === '2fa' ? 'twoFactorAuthentication' : section.key}`),
+ icon: getSectionIcon(section.key),
+ action: (): void => handleAddSection(section.onAdd),
+ });
+ }
+ });
+
+ return options;
+ }, [optionalSystemFields, visibleFieldKeys, optionalSections, t, handleAddSystemField, handleAddSection]);
+
+ return (
+ <>
+ <RobustPressable
+ style={styles.addButton}
+ onPress={() => setIsOpen(true)}
+ >
+ <MaterialIcons name="add" size={24} color={colors.textMuted} />
+ <ThemedText style={styles.addButtonText}>
+ {t('itemTypes.addField')}
+ </ThemedText>
+ </RobustPressable>
+
+ {/* Main Menu Modal */}
+ <Modal
+ visible={isOpen}
+ transparent
+ animationType="slide"
+ onRequestClose={() => setIsOpen(false)}
+ >
+ <RobustPressable
+ style={styles.modalOverlay}
+ onPress={() => setIsOpen(false)}
+ >
+ <View style={styles.menuContainer}>
+ {menuOptions.map((option, index) => (
+ <RobustPressable
+ key={option.key}
+ style={[
+ styles.menuOption,
+ index === menuOptions.length - 1 && menuOptions.length > 0 && { borderBottomWidth: 1 },
+ ]}
+ onPress={option.action}
+ >
+ <MaterialIcons
+ name={option.icon}
+ size={24}
+ color={colors.textMuted}
+ style={styles.menuOptionIcon}
+ />
+ <ThemedText style={styles.menuOptionText}>{option.label}</ThemedText>
+ </RobustPressable>
+ ))}
+ {/* Custom field option - always available */}
+ <RobustPressable
+ style={[styles.menuOption, { borderBottomWidth: 0 }]}
+ onPress={handleOpenCustomFieldModal}
+ >
+ <MaterialIcons
+ name="add-circle-outline"
+ size={24}
+ color={colors.textMuted}
+ style={styles.menuOptionIcon}
+ />
+ <ThemedText style={styles.menuOptionText}>
+ {t('itemTypes.addCustomField')}
+ </ThemedText>
+ </RobustPressable>
+ </View>
+ </RobustPressable>
+ </Modal>
+
+ {/* Custom Field Modal */}
+ <Modal
+ visible={showCustomFieldModal}
+ transparent
+ animationType="fade"
+ onRequestClose={handleCloseCustomFieldModal}
+ >
+ <View style={styles.customFieldModalOverlay}>
+ <View style={styles.customFieldModalContent}>
+ <ThemedText style={styles.customFieldModalTitle}>
+ {t('itemTypes.addCustomField')}
+ </ThemedText>
+
+ <ThemedText style={styles.customFieldModalLabel}>
+ {t('itemTypes.fieldLabel')}
+ </ThemedText>
+ <TextInput
+ style={styles.customFieldModalInput}
+ value={customFieldLabel}
+ onChangeText={setCustomFieldLabel}
+ placeholder={t('itemTypes.enterFieldName')}
+ placeholderTextColor={colors.textMuted}
+ autoFocus
+ />
+
+ <ThemedText style={styles.customFieldModalLabel}>
+ {t('itemTypes.fieldType')}
+ </ThemedText>
+ <ScrollView
+ horizontal
+ showsHorizontalScrollIndicator={false}
+ style={styles.fieldTypeScrollView}
+ contentContainerStyle={styles.fieldTypeContainer}
+ >
+ {FIELD_TYPE_OPTIONS.map(option => (
+ <RobustPressable
+ key={option.value}
+ style={[
+ styles.fieldTypeChip,
+ customFieldType === option.value && styles.fieldTypeChipSelected,
+ ]}
+ onPress={() => setCustomFieldType(option.value as FieldType)}
+ >
+ <ThemedText
+ style={[
+ styles.fieldTypeChipText,
+ customFieldType === option.value && styles.fieldTypeChipTextSelected,
+ ]}
+ >
+ {t(option.labelKey)}
+ </ThemedText>
+ </RobustPressable>
+ ))}
+ </ScrollView>
+
+ <View style={styles.customFieldModalButtons}>
+ <RobustPressable
+ style={[styles.customFieldModalButton, styles.customFieldModalButtonSecondary]}
+ onPress={handleCloseCustomFieldModal}
+ >
+ <ThemedText style={[styles.customFieldModalButtonText, styles.customFieldModalButtonTextSecondary]}>
+ {t('common.cancel')}
+ </ThemedText>
+ </RobustPressable>
+ <RobustPressable
+ style={[
+ styles.customFieldModalButton,
+ styles.customFieldModalButtonPrimary,
+ !customFieldLabel.trim() && { opacity: 0.5 },
+ ]}
+ onPress={handleAddCustomField}
+ disabled={!customFieldLabel.trim()}
+ >
+ <ThemedText style={[styles.customFieldModalButtonText, styles.customFieldModalButtonTextPrimary]}>
+ {t('common.add')}
+ </ThemedText>
+ </RobustPressable>
+ </View>
+ </View>
+ </View>
+ </Modal>
+ </>
+ );
+};
diff --git a/apps/mobile-app/components/form/AdvancedPasswordField.tsx b/apps/mobile-app/components/form/AdvancedPasswordField.tsx
index 74b9b2f43..8feea8e07 100644
--- a/apps/mobile-app/components/form/AdvancedPasswordField.tsx
+++ b/apps/mobile-app/components/form/AdvancedPasswordField.tsx
@@ -25,6 +25,8 @@ type AdvancedPasswordFieldProps = Omit<TextInputProps, 'value' | 'onChangeText'>
showPassword?: boolean;
onShowPasswordChange?: (show: boolean) => void;
isNewCredential?: boolean;
+ /** Optional callback for remove button - when provided, shows X button in label row */
+ onRemove?: () => void;
}
const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, AdvancedPasswordFieldProps>(({
@@ -35,6 +37,7 @@ const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, Adva
showPassword: controlledShowPassword,
onShowPasswordChange,
isNewCredential = false,
+ onRemove,
...props
}, ref) => {
const colors = useColors();
@@ -227,8 +230,16 @@ const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, Adva
inputLabel: {
color: colors.textMuted,
fontSize: 12,
+ },
+ labelContainer: {
+ alignItems: 'center',
+ flexDirection: 'row',
+ justifyContent: 'space-between',
marginBottom: 4,
},
+ removeButton: {
+ padding: 4,
+ },
modalContent: {
backgroundColor: colors.accentBackground,
borderRadius: 12,
@@ -348,9 +359,20 @@ const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, Adva
return (
<View style={styles.inputGroup}>
- <ThemedText style={styles.inputLabel}>
- {label} {required && <ThemedText style={styles.requiredIndicator}>*</ThemedText>}
- </ThemedText>
+ <View style={styles.labelContainer}>
+ <ThemedText style={styles.inputLabel}>
+ {label} {required && <ThemedText style={styles.requiredIndicator}>*</ThemedText>}
+ </ThemedText>
+ {onRemove && (
+ <TouchableOpacity
+ style={styles.removeButton}
+ onPress={onRemove}
+ activeOpacity={0.7}
+ >
+ <MaterialIcons name="close" size={18} color={colors.textMuted} />
+ </TouchableOpacity>
+ )}
+ </View>
<View style={styles.inputContainer}>
<TextInput
diff --git a/apps/mobile-app/components/form/EmailDomainField.tsx b/apps/mobile-app/components/form/EmailDomainField.tsx
index 8d083d3c0..eac1a6f90 100644
--- a/apps/mobile-app/components/form/EmailDomainField.tsx
+++ b/apps/mobile-app/components/form/EmailDomainField.tsx
@@ -14,6 +14,8 @@ type EmailDomainFieldProps = {
error?: string;
required?: boolean;
label: string;
+ /** Optional callback for remove button - when provided, shows X button in label row */
+ onRemove?: () => void;
}
// Hardcoded public email domains (same as in browser extension)
@@ -39,7 +41,8 @@ export const EmailDomainField: React.FC<EmailDomainFieldProps> = ({
onChange,
error,
required = false,
- label
+ label,
+ onRemove
}) => {
const { t } = useTranslation();
const colors = useColors();
@@ -269,8 +272,16 @@ export const EmailDomainField: React.FC<EmailDomainFieldProps> = ({
label: {
color: colors.textMuted,
fontSize: 12,
+ },
+ labelContainer: {
+ alignItems: 'center',
+ flexDirection: 'row',
+ justifyContent: 'space-between',
marginBottom: 4,
},
+ removeButton: {
+ padding: 4,
+ },
modalCloseButton: {
padding: 8,
},
@@ -336,10 +347,17 @@ export const EmailDomainField: React.FC<EmailDomainFieldProps> = ({
return (
<View style={styles.container}>
- <Text style={styles.label}>
- {label}
- {required && <Text style={styles.requiredAsterisk}> *</Text>}
- </Text>
+ <View style={styles.labelContainer}>
+ <Text style={styles.label}>
+ {label}
+ {required && <Text style={styles.requiredAsterisk}> *</Text>}
+ </Text>
+ {onRemove && (
+ <TouchableOpacity style={styles.removeButton} onPress={onRemove}>
+ <MaterialIcons name="close" size={18} color={colors.textMuted} />
+ </TouchableOpacity>
+ )}
+ </View>
<View style={styles.inputContainer}>
<TextInput
diff --git a/apps/mobile-app/components/form/FormField.tsx b/apps/mobile-app/components/form/FormField.tsx
index 6eab32947..a113022d9 100644
--- a/apps/mobile-app/components/form/FormField.tsx
+++ b/apps/mobile-app/components/form/FormField.tsx
@@ -23,6 +23,8 @@ type FormFieldProps = Omit<TextInputProps, 'onChangeText'> & {
required?: boolean;
buttons?: FormFieldButton[];
error?: string;
+ /** Optional callback for remove button - when provided, shows X button in label row */
+ onRemove?: () => void;
}
/**
@@ -35,6 +37,7 @@ const FormFieldComponent = forwardRef<FormFieldRef, FormFieldProps>(({
required,
buttons,
error,
+ onRemove,
...props
}, ref) => {
const colors = useColors();
@@ -94,6 +97,15 @@ const FormFieldComponent = forwardRef<FormFieldRef, FormFieldProps>(({
fontSize: 12,
marginBottom: 4,
},
+ labelContainer: {
+ alignItems: 'center',
+ flexDirection: 'row',
+ justifyContent: 'space-between',
+ marginBottom: 4,
+ },
+ removeButton: {
+ padding: 4,
+ },
requiredIndicator: {
color: colorRed,
marginLeft: 4,
@@ -104,9 +116,20 @@ const FormFieldComponent = forwardRef<FormFieldRef, FormFieldProps>(({
return (
<View style={styles.inputGroup}>
- <ThemedText style={styles.inputLabel}>
- {label} {required && <ThemedText style={styles.requiredIndicator}>*</ThemedText>}
- </ThemedText>
+ <View style={styles.labelContainer}>
+ <ThemedText style={styles.inputLabel}>
+ {label} {required && <ThemedText style={styles.requiredIndicator}>*</ThemedText>}
+ </ThemedText>
+ {onRemove && (
+ <TouchableHighlight
+ style={styles.removeButton}
+ onPress={onRemove}
+ underlayColor={colors.accentBackground}
+ >
+ <MaterialIcons name="close" size={18} color={colors.textMuted} />
+ </TouchableHighlight>
+ )}
+ </View>
<View style={[styles.inputContainer, error ? styles.inputError : null]}>
<TextInput
ref={inputRef}
diff --git a/apps/mobile-app/components/form/FormSection.tsx b/apps/mobile-app/components/form/FormSection.tsx
new file mode 100644
index 000000000..27855f207
--- /dev/null
+++ b/apps/mobile-app/components/form/FormSection.tsx
@@ -0,0 +1,81 @@
+import React from 'react';
+import { View, StyleSheet } from 'react-native';
+
+import { useColors } from '@/hooks/useColorScheme';
+
+import { ThemedText } from '@/components/themed/ThemedText';
+
+type FormSectionProps = {
+ /** Section title - can be a string or custom React node */
+ title?: React.ReactNode;
+ /** Content to render inside the section */
+ children: React.ReactNode;
+ /** Optional action buttons to show in the header */
+ actions?: React.ReactNode;
+ /** Whether to add bottom margin (default: true) */
+ marginBottom?: boolean;
+};
+
+/**
+ * A reusable form section container with consistent styling.
+ * Used for grouping related form fields with an optional title and action buttons.
+ */
+export const FormSection: React.FC<FormSectionProps> = ({
+ title,
+ children,
+ actions,
+ marginBottom = true,
+}) => {
+ const colors = useColors();
+
+ const styles = StyleSheet.create({
+ actionsContainer: {
+ flexDirection: 'row',
+ alignItems: 'center',
+ gap: 8,
+ },
+ container: {
+ backgroundColor: colors.accentBackground,
+ borderRadius: 8,
+ marginBottom: marginBottom ? 24 : 0,
+ padding: 16,
+ },
+ contentContainer: {
+ gap: 12,
+ },
+ headerContainer: {
+ alignItems: 'center',
+ flexDirection: 'row',
+ justifyContent: 'space-between',
+ marginBottom: 12,
+ },
+ title: {
+ color: colors.text,
+ fontSize: 18,
+ fontWeight: '600',
+ },
+ titleContainer: {
+ flexDirection: 'row',
+ alignItems: 'center',
+ flex: 1,
+ },
+ });
+
+ return (
+ <View style={styles.container}>
+ {title && (
+ <View style={styles.headerContainer}>
+ <View style={styles.titleContainer}>
+ {typeof title === 'string' ? (
+ <ThemedText style={styles.title}>{title}</ThemedText>
+ ) : (
+ title
+ )}
+ </View>
+ {actions && <View style={styles.actionsContainer}>{actions}</View>}
+ </View>
+ )}
+ <View style={styles.contentContainer}>{children}</View>
+ </View>
+ );
+};
diff --git a/apps/mobile-app/components/form/HiddenField.tsx b/apps/mobile-app/components/form/HiddenField.tsx
new file mode 100644
index 000000000..014aa9f73
--- /dev/null
+++ b/apps/mobile-app/components/form/HiddenField.tsx
@@ -0,0 +1,114 @@
+import MaterialIcons from '@expo/vector-icons/MaterialIcons';
+import React, { useState } from 'react';
+import { View, TextInput, StyleSheet } from 'react-native';
+
+import { useColors } from '@/hooks/useColorScheme';
+
+import { ThemedText } from '@/components/themed/ThemedText';
+import { RobustPressable } from '@/components/ui/RobustPressable';
+
+type HiddenFieldProps = {
+ /** Field label */
+ label: string;
+ /** Current value */
+ value: string;
+ /** Change handler */
+ onChangeText: (value: string) => void;
+ /** Placeholder text */
+ placeholder?: string;
+ /** Keyboard type */
+ keyboardType?: 'default' | 'numeric';
+ /** Optional callback for remove button */
+ onRemove?: () => void;
+};
+
+/**
+ * A form field for hidden/masked values like CVV, PIN, etc.
+ * Includes a show/hide toggle button.
+ */
+export const HiddenField: React.FC<HiddenFieldProps> = ({
+ label,
+ value,
+ onChangeText,
+ placeholder,
+ keyboardType = 'default',
+ onRemove,
+}) => {
+ const colors = useColors();
+ const [isVisible, setIsVisible] = useState(false);
+
+ const styles = StyleSheet.create({
+ container: {
+ marginBottom: 0,
+ },
+ input: {
+ backgroundColor: colors.background,
+ borderColor: colors.accentBorder,
+ borderRadius: 8,
+ borderWidth: 1,
+ color: colors.text,
+ flex: 1,
+ fontSize: 16,
+ paddingHorizontal: 12,
+ paddingVertical: 10,
+ },
+ inputContainer: {
+ alignItems: 'center',
+ flexDirection: 'row',
+ },
+ label: {
+ color: colors.text,
+ fontSize: 14,
+ fontWeight: '600',
+ marginBottom: 6,
+ },
+ labelContainer: {
+ alignItems: 'center',
+ flexDirection: 'row',
+ justifyContent: 'space-between',
+ },
+ removeButton: {
+ padding: 4,
+ },
+ toggleButton: {
+ marginLeft: 8,
+ padding: 8,
+ },
+ });
+
+ return (
+ <View style={styles.container}>
+ <View style={styles.labelContainer}>
+ <ThemedText style={styles.label}>{label}</ThemedText>
+ {onRemove && (
+ <RobustPressable onPress={onRemove} style={styles.removeButton}>
+ <MaterialIcons name="close" size={18} color={colors.textMuted} />
+ </RobustPressable>
+ )}
+ </View>
+ <View style={styles.inputContainer}>
+ <TextInput
+ style={styles.input}
+ value={value}
+ onChangeText={onChangeText}
+ placeholder={placeholder}
+ placeholderTextColor={colors.textMuted}
+ secureTextEntry={!isVisible}
+ keyboardType={keyboardType}
+ autoCapitalize="none"
+ autoCorrect={false}
+ />
+ <RobustPressable
+ onPress={() => setIsVisible(!isVisible)}
+ style={styles.toggleButton}
+ >
+ <MaterialIcons
+ name={isVisible ? 'visibility' : 'visibility-off'}
+ size={24}
+ color={colors.textMuted}
+ />
+ </RobustPressable>
+ </View>
+ </View>
+ );
+};
diff --git a/apps/mobile-app/components/items/ItemTypeSelector.tsx b/apps/mobile-app/components/items/ItemTypeSelector.tsx
new file mode 100644
index 000000000..937cb7aad
--- /dev/null
+++ b/apps/mobile-app/components/items/ItemTypeSelector.tsx
@@ -0,0 +1,243 @@
+import MaterialIcons from '@expo/vector-icons/MaterialIcons';
+import React, { useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { View, StyleSheet, Modal } from 'react-native';
+
+import type { ItemType } from '@/utils/dist/core/models/vault';
+import { ItemTypes } from '@/utils/dist/core/models/vault';
+
+import { useColors } from '@/hooks/useColorScheme';
+
+import { ThemedText } from '@/components/themed/ThemedText';
+import { RobustPressable } from '@/components/ui/RobustPressable';
+
+/**
+ * Item type option configuration.
+ */
+type ItemTypeOption = {
+ type: ItemType;
+ titleKey: string;
+ icon: keyof typeof MaterialIcons.glyphMap;
+};
+
+/**
+ * Available item type options with icons.
+ */
+const ITEM_TYPE_OPTIONS: ItemTypeOption[] = [
+ {
+ type: ItemTypes.Login,
+ titleKey: 'itemTypes.login.title',
+ icon: 'vpn-key',
+ },
+ {
+ type: ItemTypes.Alias,
+ titleKey: 'itemTypes.alias.title',
+ icon: 'person',
+ },
+ {
+ type: ItemTypes.CreditCard,
+ titleKey: 'itemTypes.creditCard.title',
+ icon: 'credit-card',
+ },
+ {
+ type: ItemTypes.Note,
+ titleKey: 'itemTypes.note.title',
+ icon: 'description',
+ },
+];
+
+type ItemTypeSelectorProps = {
+ selectedType: ItemType;
+ isEditMode: boolean;
+ onTypeChange: (type: ItemType) => void;
+ onRegenerateAlias?: () => void;
+};
+
+/**
+ * Item type selector component with dropdown menu.
+ * Allows selecting between Login, Alias, CreditCard, and Note types.
+ */
+export const ItemTypeSelector: React.FC<ItemTypeSelectorProps> = ({
+ selectedType,
+ isEditMode,
+ onTypeChange,
+ onRegenerateAlias,
+}) => {
+ const { t } = useTranslation();
+ const colors = useColors();
+ const [showDropdown, setShowDropdown] = useState(false);
+
+ const selectedTypeOption = ITEM_TYPE_OPTIONS.find(opt => opt.type === selectedType);
+
+ const styles = StyleSheet.create({
+ checkIcon: {
+ marginLeft: 'auto',
+ },
+ container: {
+ backgroundColor: colors.primary + '15',
+ borderColor: colors.primary,
+ borderRadius: 8,
+ borderWidth: 1,
+ flexDirection: 'row',
+ alignItems: 'center',
+ paddingHorizontal: 16,
+ paddingVertical: 12,
+ marginBottom: 16,
+ },
+ dropdownContainer: {
+ flex: 1,
+ flexDirection: 'row',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ },
+ dropdownIcon: {
+ marginLeft: 8,
+ },
+ labelContainer: {
+ flexDirection: 'row',
+ alignItems: 'center',
+ },
+ labelIcon: {
+ marginRight: 8,
+ },
+ labelText: {
+ color: colors.primary,
+ fontWeight: '600',
+ fontSize: 14,
+ },
+ modalContainer: {
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
+ flex: 1,
+ justifyContent: 'center',
+ padding: 20,
+ },
+ modalContent: {
+ backgroundColor: colors.background,
+ borderColor: colors.accentBorder,
+ borderRadius: 12,
+ borderWidth: 1,
+ },
+ optionButton: {
+ alignItems: 'center',
+ borderBottomColor: colors.accentBorder,
+ borderBottomWidth: 1,
+ flexDirection: 'row',
+ paddingHorizontal: 16,
+ paddingVertical: 16,
+ },
+ optionIcon: {
+ marginRight: 12,
+ },
+ optionText: {
+ color: colors.text,
+ flex: 1,
+ fontSize: 16,
+ fontWeight: '500',
+ },
+ optionTextSelected: {
+ color: colors.primary,
+ fontWeight: '600',
+ },
+ regenerateButton: {
+ backgroundColor: colors.primary + '20',
+ borderRadius: 6,
+ marginLeft: 8,
+ padding: 8,
+ },
+ });
+
+ return (
+ <View style={styles.container}>
+ <RobustPressable
+ onPress={() => setShowDropdown(true)}
+ style={styles.dropdownContainer}
+ >
+ <View style={styles.labelContainer}>
+ {selectedTypeOption && (
+ <MaterialIcons
+ name={selectedTypeOption.icon}
+ size={20}
+ color={colors.primary}
+ style={styles.labelIcon}
+ />
+ )}
+ <ThemedText style={styles.labelText}>
+ {isEditMode ? t('itemTypes.editing') : t('itemTypes.creating')}{' '}
+ {selectedTypeOption ? t(selectedTypeOption.titleKey) : ''}
+ </ThemedText>
+ </View>
+ <MaterialIcons
+ name="keyboard-arrow-down"
+ size={24}
+ color={colors.primary}
+ style={styles.dropdownIcon}
+ />
+ </RobustPressable>
+
+ {/* Regenerate alias button - only for Alias type in create mode */}
+ {selectedType === ItemTypes.Alias && !isEditMode && onRegenerateAlias && (
+ <RobustPressable
+ onPress={onRegenerateAlias}
+ style={styles.regenerateButton}
+ >
+ <MaterialIcons name="refresh" size={20} color={colors.primary} />
+ </RobustPressable>
+ )}
+
+ {/* Type Dropdown Modal */}
+ <Modal
+ visible={showDropdown}
+ transparent
+ animationType="fade"
+ onRequestClose={() => setShowDropdown(false)}
+ >
+ <RobustPressable
+ style={styles.modalContainer}
+ onPress={() => setShowDropdown(false)}
+ >
+ <View style={styles.modalContent}>
+ {ITEM_TYPE_OPTIONS.map((option, index) => (
+ <RobustPressable
+ key={option.type}
+ style={[
+ styles.optionButton,
+ index === ITEM_TYPE_OPTIONS.length - 1 && { borderBottomWidth: 0 },
+ ]}
+ onPress={() => {
+ onTypeChange(option.type);
+ setShowDropdown(false);
+ }}
+ >
+ <MaterialIcons
+ name={option.icon}
+ size={24}
+ color={selectedType === option.type ? colors.primary : colors.textMuted}
+ style={styles.optionIcon}
+ />
+ <ThemedText
+ style={[
+ styles.optionText,
+ selectedType === option.type && styles.optionTextSelected,
+ ]}
+ >
+ {t(option.titleKey)}
+ </ThemedText>
+ {selectedType === option.type && (
+ <MaterialIcons
+ name="check"
+ size={24}
+ color={colors.primary}
+ style={styles.checkIcon}
+ />
+ )}
+ </RobustPressable>
+ ))}
+ </View>
+ </RobustPressable>
+ </Modal>
+ </View>
+ );
+};
+
+export { ITEM_TYPE_OPTIONS };
+export type { ItemTypeOption };
diff --git a/apps/mobile-app/i18n/locales/en.json b/apps/mobile-app/i18n/locales/en.json
index 7d68e8593..eb25489d9 100644
--- a/apps/mobile-app/i18n/locales/en.json
+++ b/apps/mobile-app/i18n/locales/en.json
@@ -21,6 +21,8 @@
"enabled": "Enabled",
"disabled": "Disabled",
"twoFactorAuthentication": "Two-Factor Authentication",
+ "add": "Add",
+ "attachments": "Attachments",
"deleteItemConfirmTitle": "Delete Item",
"deleteItemConfirmDescription": "Are you sure you want to delete this item?",
"errors": {
@@ -433,6 +435,56 @@
"emails": "Emails",
"settings": "Settings"
},
+ "itemTypes": {
+ "creating": "Creating",
+ "editing": "Editing",
+ "login": {
+ "title": "Login"
+ },
+ "alias": {
+ "title": "Alias"
+ },
+ "creditCard": {
+ "title": "Credit Card",
+ "cardInformation": "Card Information"
+ },
+ "note": {
+ "title": "Note"
+ },
+ "addField": "Add Field",
+ "addCustomField": "Add Custom Field",
+ "customFields": "Custom Fields",
+ "fieldLabel": "Field Label",
+ "fieldType": "Field Type",
+ "enterFieldName": "Enter field name",
+ "fieldTypes": {
+ "text": "Text",
+ "hidden": "Hidden",
+ "email": "Email",
+ "url": "URL",
+ "phone": "Phone",
+ "number": "Number",
+ "date": "Date",
+ "textArea": "Text Area"
+ }
+ },
+ "fieldLabels": {
+ "login.username": "Username",
+ "login.password": "Password",
+ "login.email": "Email",
+ "login.url": "URL",
+ "alias.first_name": "First Name",
+ "alias.last_name": "Last Name",
+ "alias.gender": "Gender",
+ "alias.birthdate": "Birth Date",
+ "card.cardholder_name": "Cardholder Name",
+ "card.number": "Card Number",
+ "card.expiry_month": "Expiry Month",
+ "card.expiry_year": "Expiry Year",
+ "card.cvv": "CVV",
+ "card.pin": "PIN",
+ "notes.content": "Notes"
+ },
"items": {
"title": "Items",
"addItem": "Add Item",
diff --git a/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj b/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj
index a33439843..35b0ea342 100644
--- a/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj
+++ b/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 70;
+ objectVersion = 60;
objects = {
/* Begin PBXBuildFile section */
@@ -212,7 +212,7 @@
/* End PBXFileReference section */
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
- CEE9098F2DA548C7008D568F /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
+ CEE9098F2DA548C7008D568F /* Exceptions for "Autofill" folder in "Autofill" target */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
Info.plist,
@@ -222,13 +222,84 @@
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
/* Begin PBXFileSystemSynchronizedRootGroup section */
- CE59C7602E4F47FD0024A246 /* VaultUITests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = VaultUITests; sourceTree = "<group>"; };
- CE77825E2EA1822400A75E6F /* VaultUtils */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = VaultUtils; sourceTree = "<group>"; };
- CEE480882DBE86DC00F4A367 /* VaultStoreKit */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = VaultStoreKit; sourceTree = "<group>"; };
- CEE480972DBE86DD00F4A367 /* VaultStoreKitTests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = VaultStoreKitTests; sourceTree = "<group>"; };
- CEE4816B2DBE8AC800F4A367 /* VaultUI */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = VaultUI; sourceTree = "<group>"; };
- CEE482AB2DBE8EFE00F4A367 /* VaultModels */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = VaultModels; sourceTree = "<group>"; };
- CEE909812DA548C7008D568F /* Autofill */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (CEE9098F2DA548C7008D568F /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = Autofill; sourceTree = "<group>"; };
+ CE59C7602E4F47FD0024A246 /* VaultUITests */ = {
+ isa = PBXFileSystemSynchronizedRootGroup;
+ exceptions = (
+ );
+ explicitFileTypes = {
+ };
+ explicitFolders = (
+ );
+ path = VaultUITests;
+ sourceTree = "<group>";
+ };
+ CE77825E2EA1822400A75E6F /* VaultUtils */ = {
+ isa = PBXFileSystemSynchronizedRootGroup;
+ exceptions = (
+ );
+ explicitFileTypes = {
+ };
+ explicitFolders = (
+ );
+ path = VaultUtils;
+ sourceTree = "<group>";
+ };
+ CEE480882DBE86DC00F4A367 /* VaultStoreKit */ = {
+ isa = PBXFileSystemSynchronizedRootGroup;
+ exceptions = (
+ );
+ explicitFileTypes = {
+ };
+ explicitFolders = (
+ );
+ path = VaultStoreKit;
+ sourceTree = "<group>";
+ };
+ CEE480972DBE86DD00F4A367 /* VaultStoreKitTests */ = {
+ isa = PBXFileSystemSynchronizedRootGroup;
+ exceptions = (
+ );
+ explicitFileTypes = {
+ };
+ explicitFolders = (
+ );
+ path = VaultStoreKitTests;
+ sourceTree = "<group>";
+ };
+ CEE4816B2DBE8AC800F4A367 /* VaultUI */ = {
+ isa = PBXFileSystemSynchronizedRootGroup;
+ exceptions = (
+ );
+ explicitFileTypes = {
+ };
+ explicitFolders = (
+ );
+ path = VaultUI;
+ sourceTree = "<group>";
+ };
+ CEE482AB2DBE8EFE00F4A367 /* VaultModels */ = {
+ isa = PBXFileSystemSynchronizedRootGroup;
+ exceptions = (
+ );
+ explicitFileTypes = {
+ };
+ explicitFolders = (
+ );
+ path = VaultModels;
+ sourceTree = "<group>";
+ };
+ CEE909812DA548C7008D568F /* Autofill */ = {
+ isa = PBXFileSystemSynchronizedRootGroup;
+ exceptions = (
+ CEE9098F2DA548C7008D568F /* Exceptions for "Autofill" folder in "Autofill" target */,
+ );
+ explicitFileTypes = {
+ };
+ explicitFolders = (
+ );
+ path = Autofill;
+ sourceTree = "<group>";
+ };
/* End PBXFileSystemSynchronizedRootGroup section */
/* Begin PBXFrameworksBuildPhase section */
@@ -1349,7 +1420,10 @@
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\"";
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
- OTHER_LDFLAGS = "$(inherited) ";
+ OTHER_LDFLAGS = (
+ "$(inherited)",
+ " ",
+ );
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
@@ -1403,7 +1477,10 @@
);
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\"";
MTL_ENABLE_DEBUG_INFO = NO;
- OTHER_LDFLAGS = "$(inherited) ";
+ OTHER_LDFLAGS = (
+ "$(inherited)",
+ " ",
+ );
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
diff --git a/apps/server/AliasVault.Client/wwwroot/css/tailwind.css b/apps/server/AliasVault.Client/wwwroot/css/tailwind.css
index f7da3338b..0a88d2316 100644
--- a/apps/server/AliasVault.Client/wwwroot/css/tailwind.css
+++ b/apps/server/AliasVault.Client/wwwroot/css/tailwind.css
@@ -624,10 +624,6 @@ video {
position: relative;
}
-.sticky {
- position: sticky;
-}
-
.inset-0 {
inset: 0px;
}
@@ -646,6 +642,10 @@ video {
bottom: 0px;
}
+.bottom-full {
+ bottom: 100%;
+}
+
.left-0 {
left: 0px;
}
@@ -666,6 +666,14 @@ video {
right: 2.5rem;
}
+.right-2 {
+ right: 0.5rem;
+}
+
+.right-3 {
+ right: 0.75rem;
+}
+
.right-4 {
right: 1rem;
}
@@ -674,6 +682,10 @@ video {
top: 0px;
}
+.top-1\/2 {
+ top: 50%;
+}
+
.top-2 {
top: 0.5rem;
}
@@ -682,6 +694,10 @@ video {
top: 5rem;
}
+.top-3 {
+ top: 0.75rem;
+}
+
.top-4 {
top: 1rem;
}
@@ -694,26 +710,6 @@ video {
top: 100%;
}
-.bottom-full {
- bottom: 100%;
-}
-
-.right-3 {
- right: 0.75rem;
-}
-
-.top-3 {
- top: 0.75rem;
-}
-
-.right-2 {
- right: 0.5rem;
-}
-
-.top-1\/2 {
- top: 50%;
-}
-
.-z-10 {
z-index: -10;
}
@@ -722,6 +718,10 @@ video {
z-index: 10;
}
+.z-20 {
+ z-index: 20;
+}
+
.z-30 {
z-index: 30;
}
@@ -734,18 +734,14 @@ video {
z-index: 1000;
}
-.z-20 {
- z-index: 20;
-}
-
-.z-40 {
- z-index: 40;
-}
-
.col-span-1 {
grid-column: span 1 / span 1;
}
+.col-span-3 {
+ grid-column: span 3 / span 3;
+}
+
.col-span-6 {
grid-column: span 6 / span 6;
}
@@ -754,10 +750,6 @@ video {
grid-column: 1 / -1;
}
-.col-span-3 {
- grid-column: span 3 / span 3;
-}
-
.float-left {
float: left;
}
@@ -770,6 +762,11 @@ video {
margin: 0.5rem;
}
+.-mx-2 {
+ margin-left: -0.5rem;
+ margin-right: -0.5rem;
+}
+
.mx-4 {
margin-left: 1rem;
margin-right: 1rem;
@@ -795,11 +792,6 @@ video {
margin-bottom: 1.5rem;
}
-.-mx-2 {
- margin-left: -0.5rem;
- margin-right: -0.5rem;
-}
-
.-ml-0 {
margin-left: -0px;
}
@@ -820,6 +812,10 @@ video {
margin-bottom: 0.25rem;
}
+.mb-10 {
+ margin-bottom: 2.5rem;
+}
+
.mb-2 {
margin-bottom: 0.5rem;
}
@@ -940,10 +936,6 @@ video {
margin-top: 2rem;
}
-.mb-10 {
- margin-bottom: 2.5rem;
-}
-
.block {
display: block;
}
@@ -1064,14 +1056,14 @@ video {
max-height: 8rem;
}
-.max-h-\[90vh\] {
- max-height: 90vh;
-}
-
.max-h-64 {
max-height: 16rem;
}
+.max-h-\[90vh\] {
+ max-height: 90vh;
+}
+
.min-h-\[250px\] {
min-height: 250px;
}
@@ -1080,6 +1072,10 @@ video {
min-height: 300px;
}
+.min-h-\[40px\] {
+ min-height: 40px;
+}
+
.min-h-\[600px\] {
min-height: 600px;
}
@@ -1092,10 +1088,6 @@ video {
min-height: 100vh;
}
-.min-h-\[40px\] {
- min-height: 40px;
-}
-
.w-1 {
width: 0.25rem;
}
@@ -1228,10 +1220,6 @@ video {
max-width: 100px;
}
-.max-w-\[120px\] {
- max-width: 120px;
-}
-
.max-w-\[150px\] {
max-width: 150px;
}
@@ -1738,15 +1726,15 @@ video {
border-color: rgb(239 68 68 / var(--tw-border-opacity));
}
+.border-transparent {
+ border-color: transparent;
+}
+
.border-yellow-200 {
--tw-border-opacity: 1;
border-color: rgb(254 240 138 / var(--tw-border-opacity));
}
-.border-transparent {
- border-color: transparent;
-}
-
.bg-amber-100 {
--tw-bg-opacity: 1;
background-color: rgb(254 243 199 / var(--tw-bg-opacity));
@@ -1999,6 +1987,14 @@ video {
padding: 0px !important;
}
+.p-1 {
+ padding: 0.25rem;
+}
+
+.p-1\.5 {
+ padding: 0.375rem;
+}
+
.p-2 {
padding: 0.5rem;
}
@@ -2027,24 +2023,11 @@ video {
padding: 2rem;
}
-.p-1 {
- padding: 0.25rem;
-}
-
-.p-1\.5 {
- padding: 0.375rem;
-}
-
.px-2 {
padding-left: 0.5rem;
padding-right: 0.5rem;
}
-.px-2\.5 {
- padding-left: 0.625rem;
- padding-right: 0.625rem;
-}
-
.px-3 {
padding-left: 0.75rem;
padding-right: 0.75rem;
@@ -2120,11 +2103,6 @@ video {
padding-bottom: 2rem;
}
-.px-3\.5 {
- padding-left: 0.875rem;
- padding-right: 0.875rem;
-}
-
.pb-28 {
padding-bottom: 7rem;
}
@@ -2173,10 +2151,6 @@ video {
padding-top: 4rem;
}
-.pt-2 {
- padding-top: 0.5rem;
-}
-
.pt-4 {
padding-top: 1rem;
}
@@ -2193,10 +2167,6 @@ video {
padding-top: 2rem;
}
-.pr-8 {
- padding-right: 2rem;
-}
-
.text-left {
text-align: left;
}
@@ -2394,6 +2364,11 @@ video {
color: rgb(22 163 74 / var(--tw-text-opacity));
}
+.text-green-700 {
+ --tw-text-opacity: 1;
+ color: rgb(21 128 61 / var(--tw-text-opacity));
+}
+
.text-green-800 {
--tw-text-opacity: 1;
color: rgb(22 101 52 / var(--tw-text-opacity));
@@ -2497,11 +2472,6 @@ video {
color: rgb(133 77 14 / var(--tw-text-opacity));
}
-.text-green-700 {
- --tw-text-opacity: 1;
- color: rgb(21 128 61 / var(--tw-text-opacity));
-}
-
.underline {
text-decoration-line: underline;
}
@@ -2704,11 +2674,6 @@ video {
border-color: rgb(251 146 60 / var(--tw-border-opacity));
}
-.hover\:border-red-300:hover {
- --tw-border-opacity: 1;
- border-color: rgb(252 165 165 / var(--tw-border-opacity));
-}
-
.hover\:border-primary-500:hover {
--tw-border-opacity: 1;
border-color: rgb(244 149 65 / var(--tw-border-opacity));
@@ -2764,6 +2729,11 @@ video {
background-color: rgb(31 41 55 / var(--tw-bg-opacity));
}
+.hover\:bg-green-200:hover {
+ --tw-bg-opacity: 1;
+ background-color: rgb(187 247 208 / var(--tw-bg-opacity));
+}
+
.hover\:bg-green-700:hover {
--tw-bg-opacity: 1;
background-color: rgb(21 128 61 / var(--tw-bg-opacity));
@@ -2794,6 +2764,11 @@ video {
background-color: rgb(251 203 116 / var(--tw-bg-opacity));
}
+.hover\:bg-primary-500:hover {
+ --tw-bg-opacity: 1;
+ background-color: rgb(244 149 65 / var(--tw-bg-opacity));
+}
+
.hover\:bg-primary-600:hover {
--tw-bg-opacity: 1;
background-color: rgb(214 131 56 / var(--tw-bg-opacity));
@@ -2814,9 +2789,9 @@ video {
background-color: rgb(254 226 226 / var(--tw-bg-opacity));
}
-.hover\:bg-red-50:hover {
+.hover\:bg-red-200:hover {
--tw-bg-opacity: 1;
- background-color: rgb(254 242 242 / var(--tw-bg-opacity));
+ background-color: rgb(254 202 202 / var(--tw-bg-opacity));
}
.hover\:bg-red-600:hover {
@@ -2834,26 +2809,6 @@ video {
background-color: rgb(153 27 27 / var(--tw-bg-opacity));
}
-.hover\:bg-primary-500:hover {
- --tw-bg-opacity: 1;
- background-color: rgb(244 149 65 / var(--tw-bg-opacity));
-}
-
-.hover\:bg-primary-50:hover {
- --tw-bg-opacity: 1;
- background-color: rgb(255 224 150 / var(--tw-bg-opacity));
-}
-
-.hover\:bg-green-200:hover {
- --tw-bg-opacity: 1;
- background-color: rgb(187 247 208 / var(--tw-bg-opacity));
-}
-
-.hover\:bg-red-200:hover {
- --tw-bg-opacity: 1;
- background-color: rgb(254 202 202 / var(--tw-bg-opacity));
-}
-
.hover\:from-primary-600:hover {
--tw-gradient-from: #d68338 var(--tw-gradient-from-position);
--tw-gradient-to: rgb(214 131 56 / 0) var(--tw-gradient-to-position);
@@ -2869,11 +2824,6 @@ video {
color: rgb(146 64 14 / var(--tw-text-opacity));
}
-.hover\:text-blue-700:hover {
- --tw-text-opacity: 1;
- color: rgb(29 78 216 / var(--tw-text-opacity));
-}
-
.hover\:text-blue-800:hover {
--tw-text-opacity: 1;
color: rgb(30 64 175 / var(--tw-text-opacity));
@@ -2884,6 +2834,11 @@ video {
color: rgb(107 114 128 / var(--tw-text-opacity));
}
+.hover\:text-gray-600:hover {
+ --tw-text-opacity: 1;
+ color: rgb(75 85 99 / var(--tw-text-opacity));
+}
+
.hover\:text-gray-700:hover {
--tw-text-opacity: 1;
color: rgb(55 65 81 / var(--tw-text-opacity));
@@ -2899,39 +2854,39 @@ video {
color: rgb(17 24 39 / var(--tw-text-opacity));
}
-.hover\:text-orange-600:hover {
+.hover\:text-green-700:hover {
--tw-text-opacity: 1;
- color: rgb(234 88 12 / var(--tw-text-opacity));
+ color: rgb(21 128 61 / var(--tw-text-opacity));
}
-.hover\:text-primary-600:hover {
+.hover\:text-orange-500:hover {
--tw-text-opacity: 1;
- color: rgb(214 131 56 / var(--tw-text-opacity));
+ color: rgb(249 115 22 / var(--tw-text-opacity));
}
-.hover\:text-primary-700:hover {
+.hover\:text-orange-600:hover {
--tw-text-opacity: 1;
- color: rgb(184 112 47 / var(--tw-text-opacity));
+ color: rgb(234 88 12 / var(--tw-text-opacity));
}
-.hover\:text-red-200:hover {
+.hover\:text-primary-500:hover {
--tw-text-opacity: 1;
- color: rgb(254 202 202 / var(--tw-text-opacity));
+ color: rgb(244 149 65 / var(--tw-text-opacity));
}
-.hover\:text-red-700:hover {
+.hover\:text-primary-600:hover {
--tw-text-opacity: 1;
- color: rgb(185 28 28 / var(--tw-text-opacity));
+ color: rgb(214 131 56 / var(--tw-text-opacity));
}
-.hover\:text-red-800:hover {
+.hover\:text-primary-700:hover {
--tw-text-opacity: 1;
- color: rgb(153 27 27 / var(--tw-text-opacity));
+ color: rgb(184 112 47 / var(--tw-text-opacity));
}
-.hover\:text-white:hover {
+.hover\:text-red-200:hover {
--tw-text-opacity: 1;
- color: rgb(255 255 255 / var(--tw-text-opacity));
+ color: rgb(254 202 202 / var(--tw-text-opacity));
}
.hover\:text-red-500:hover {
@@ -2939,24 +2894,19 @@ video {
color: rgb(239 68 68 / var(--tw-text-opacity));
}
-.hover\:text-gray-600:hover {
- --tw-text-opacity: 1;
- color: rgb(75 85 99 / var(--tw-text-opacity));
-}
-
-.hover\:text-green-700:hover {
+.hover\:text-red-700:hover {
--tw-text-opacity: 1;
- color: rgb(21 128 61 / var(--tw-text-opacity));
+ color: rgb(185 28 28 / var(--tw-text-opacity));
}
-.hover\:text-orange-500:hover {
+.hover\:text-red-800:hover {
--tw-text-opacity: 1;
- color: rgb(249 115 22 / var(--tw-text-opacity));
+ color: rgb(153 27 27 / var(--tw-text-opacity));
}
-.hover\:text-primary-500:hover {
+.hover\:text-white:hover {
--tw-text-opacity: 1;
- color: rgb(244 149 65 / var(--tw-text-opacity));
+ color: rgb(255 255 255 / var(--tw-text-opacity));
}
.hover\:underline:hover {
@@ -2992,21 +2942,21 @@ video {
outline-offset: 2px;
}
-.focus\:ring-2:focus {
+.focus\:ring-1:focus {
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
- --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
+ --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}
-.focus\:ring-4:focus {
+.focus\:ring-2:focus {
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
- --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);
+ --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}
-.focus\:ring-1:focus {
+.focus\:ring-4:focus {
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
- --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
+ --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}
@@ -3179,6 +3129,11 @@ video {
border-color: rgb(154 52 18 / var(--tw-border-opacity));
}
+.dark\:border-primary-400:is(.dark *) {
+ --tw-border-opacity: 1;
+ border-color: rgb(246 167 82 / var(--tw-border-opacity));
+}
+
.dark\:border-primary-500:is(.dark *) {
--tw-border-opacity: 1;
border-color: rgb(244 149 65 / var(--tw-border-opacity));
@@ -3219,11 +3174,6 @@ video {
border-color: rgb(133 77 14 / var(--tw-border-opacity));
}
-.dark\:border-primary-400:is(.dark *) {
- --tw-border-opacity: 1;
- border-color: rgb(246 167 82 / var(--tw-border-opacity));
-}
-
.dark\:bg-amber-800\/30:is(.dark *) {
background-color: rgb(146 64 14 / 0.3);
}
@@ -3295,6 +3245,10 @@ video {
background-color: rgb(22 101 52 / var(--tw-bg-opacity));
}
+.dark\:bg-green-900\/30:is(.dark *) {
+ background-color: rgb(20 83 45 / 0.3);
+}
+
.dark\:bg-indigo-900:is(.dark *) {
--tw-bg-opacity: 1;
background-color: rgb(49 46 129 / var(--tw-bg-opacity));
@@ -3391,10 +3345,6 @@ video {
background-color: rgb(113 63 18 / 0.2);
}
-.dark\:bg-green-900\/30:is(.dark *) {
- background-color: rgb(20 83 45 / 0.3);
-}
-
.dark\:bg-opacity-75:is(.dark *) {
--tw-bg-opacity: 0.75;
}
@@ -3507,6 +3457,11 @@ video {
color: rgb(251 203 116 / var(--tw-text-opacity));
}
+.dark\:text-primary-300:is(.dark *) {
+ --tw-text-opacity: 1;
+ color: rgb(248 185 99 / var(--tw-text-opacity));
+}
+
.dark\:text-primary-400:is(.dark *) {
--tw-text-opacity: 1;
color: rgb(246 167 82 / var(--tw-text-opacity));
@@ -3566,11 +3521,6 @@ video {
color: rgb(250 204 21 / var(--tw-text-opacity));
}
-.dark\:text-primary-300:is(.dark *) {
- --tw-text-opacity: 1;
- color: rgb(248 185 99 / var(--tw-text-opacity));
-}
-
.dark\:placeholder-gray-400:is(.dark *)::-moz-placeholder {
--tw-placeholder-opacity: 1;
color: rgb(156 163 175 / var(--tw-placeholder-opacity));
@@ -3614,11 +3564,6 @@ video {
border-color: rgb(249 115 22 / var(--tw-border-opacity));
}
-.dark\:hover\:border-red-700:hover:is(.dark *) {
- --tw-border-opacity: 1;
- border-color: rgb(185 28 28 / var(--tw-border-opacity));
-}
-
.dark\:hover\:bg-blue-500:hover:is(.dark *) {
--tw-bg-opacity: 1;
background-color: rgb(59 130 246 / var(--tw-bg-opacity));
@@ -3667,6 +3612,10 @@ video {
background-color: rgb(21 128 61 / var(--tw-bg-opacity));
}
+.dark\:hover\:bg-green-900\/50:hover:is(.dark *) {
+ background-color: rgb(20 83 45 / 0.5);
+}
+
.dark\:hover\:bg-orange-600:hover:is(.dark *) {
--tw-bg-opacity: 1;
background-color: rgb(234 88 12 / var(--tw-bg-opacity));
@@ -3690,31 +3639,19 @@ video {
background-color: rgb(123 74 30 / 0.3);
}
+.dark\:hover\:bg-primary-900\/40:hover:is(.dark *) {
+ background-color: rgb(123 74 30 / 0.4);
+}
+
.dark\:hover\:bg-red-700:hover:is(.dark *) {
--tw-bg-opacity: 1;
background-color: rgb(185 28 28 / var(--tw-bg-opacity));
}
-.dark\:hover\:bg-red-900\/20:hover:is(.dark *) {
- background-color: rgb(127 29 29 / 0.2);
-}
-
.dark\:hover\:bg-red-900\/30:hover:is(.dark *) {
background-color: rgb(127 29 29 / 0.3);
}
-.dark\:hover\:bg-primary-900\/40:hover:is(.dark *) {
- background-color: rgb(123 74 30 / 0.4);
-}
-
-.dark\:hover\:bg-primary-900\/20:hover:is(.dark *) {
- background-color: rgb(123 74 30 / 0.2);
-}
-
-.dark\:hover\:bg-green-900\/50:hover:is(.dark *) {
- background-color: rgb(20 83 45 / 0.5);
-}
-
.dark\:hover\:bg-red-900\/50:hover:is(.dark *) {
background-color: rgb(127 29 29 / 0.5);
}
@@ -3739,11 +3676,6 @@ video {
color: rgb(191 219 254 / var(--tw-text-opacity));
}
-.dark\:hover\:text-blue-400:hover:is(.dark *) {
- --tw-text-opacity: 1;
- color: rgb(96 165 250 / var(--tw-text-opacity));
-}
-
.dark\:hover\:text-gray-100:hover:is(.dark *) {
--tw-text-opacity: 1;
color: rgb(243 244 246 / var(--tw-text-opacity));
@@ -3759,6 +3691,11 @@ video {
color: rgb(209 213 219 / var(--tw-text-opacity));
}
+.dark\:hover\:text-green-300:hover:is(.dark *) {
+ --tw-text-opacity: 1;
+ color: rgb(134 239 172 / var(--tw-text-opacity));
+}
+
.dark\:hover\:text-orange-400:hover:is(.dark *) {
--tw-text-opacity: 1;
color: rgb(251 146 60 / var(--tw-text-opacity));
@@ -3794,11 +3731,6 @@ video {
color: rgb(255 255 255 / var(--tw-text-opacity));
}
-.dark\:hover\:text-green-300:hover:is(.dark *) {
- --tw-text-opacity: 1;
- color: rgb(134 239 172 / var(--tw-text-opacity));
-}
-
.dark\:hover\:file\:bg-primary-800\/60:is(.dark *)::file-selector-button:hover {
background-color: rgb(154 93 38 / 0.6);
}
@@ -3959,14 +3891,14 @@ video {
width: 100%;
}
- .sm\:max-w-lg {
- max-width: 32rem;
- }
-
.sm\:max-w-2xl {
max-width: 42rem;
}
+ .sm\:max-w-lg {
+ max-width: 32rem;
+ }
+
.sm\:max-w-md {
max-width: 28rem;
}