diff --git a/src/CONST.ts b/src/CONST.ts index a13704ce86bc..897aabd944d7 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -417,6 +417,9 @@ const CONST = { horizontal: 12 + variables.navigationTabBarSize, vertical: 72, }, + POPOVER_DROPDOWN_WIDTH: 336, + POPOVER_DROPDOWN_MIN_HEIGHT: 0, + POPOVER_DROPDOWN_MAX_HEIGHT: 416, POPOVER_DATE_WIDTH: 338, POPOVER_DATE_MAX_HEIGHT: 366, POPOVER_DATE_MIN_HEIGHT: 322, @@ -6531,6 +6534,7 @@ const CONST = { }, SEARCH: { + NEVER: 'never', RESULTS_PAGE_SIZE: 50, DATA_TYPES: { EXPENSE: 'expense', @@ -6627,7 +6631,6 @@ const CONST = { TAX_AMOUNT: 'taxAmount', TITLE: 'title', ASSIGNEE: 'assignee', - CREATED_BY: 'createdBy', IN: 'in', }, SYNTAX_OPERATORS: { @@ -6656,6 +6659,8 @@ const CONST = { DESCRIPTION: 'description', FROM: 'from', TO: 'to', + PAYER: 'payer', + EXPORTER: 'exporter', CATEGORY: 'category', TAG: 'tag', TAX_RATE: 'taxRate', @@ -6671,7 +6676,6 @@ const CONST = { POSTED: 'posted', TITLE: 'title', ASSIGNEE: 'assignee', - CREATED_BY: 'createdBy', REIMBURSABLE: 'reimbursable', BILLABLE: 'billable', POLICY_ID: 'policyID', @@ -6697,6 +6701,8 @@ const CONST = { DESCRIPTION: 'description', FROM: 'from', TO: 'to', + PAYER: 'payer', + EXPORTER: 'exporter', CATEGORY: 'category', TAG: 'tag', TAX_RATE: 'tax-rate', @@ -6712,13 +6718,13 @@ const CONST = { POSTED: 'posted', TITLE: 'title', ASSIGNEE: 'assignee', - CREATED_BY: 'created-by', REIMBURSABLE: 'reimbursable', BILLABLE: 'billable', }, DATE_MODIFIERS: { BEFORE: 'Before', AFTER: 'After', + ON: 'On', }, SNAPSHOT_ONYX_KEYS: [ ONYXKEYS.COLLECTION.REPORT, diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 1d6937c1ff7c..3bb9bd728706 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -73,7 +73,6 @@ const ROUTES = { SEARCH_ADVANCED_FILTERS_POSTED: 'search/filters/posted', SEARCH_ADVANCED_FILTERS_TITLE: 'search/filters/title', SEARCH_ADVANCED_FILTERS_ASSIGNEE: 'search/filters/assignee', - SEARCH_ADVANCED_FILTERS_CREATED_BY: 'search/filters/createdBy', SEARCH_ADVANCED_FILTERS_REIMBURSABLE: 'search/filters/reimbursable', SEARCH_ADVANCED_FILTERS_BILLABLE: 'search/filters/billable', SEARCH_ADVANCED_FILTERS_WORKSPACE: 'search/filters/workspace', diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 96344091d4a8..78573885d444 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -63,7 +63,6 @@ const SCREENS = { ADVANCED_FILTERS_TO_RHP: 'Search_Advanced_Filters_To_RHP', ADVANCED_FILTERS_TITLE_RHP: 'Search_Advanced_Filters_Title_RHP', ADVANCED_FILTERS_ASSIGNEE_RHP: 'Search_Advanced_Filters_Assignee_RHP', - ADVANCED_FILTERS_CREATED_BY_RHP: 'Search_Advanced_Filters_Created_By_RHP', ADVANCED_FILTERS_REIMBURSABLE_RHP: 'Search_Advanced_Filters_Reimbursable_RHP', ADVANCED_FILTERS_BILLABLE_RHP: 'Search_Advanced_Filters_Billable_RHP', ADVANCED_FILTERS_WORKSPACE_RHP: 'Search_Advanced_Filters_Workspace_RHP', diff --git a/src/components/Button/index.tsx b/src/components/Button/index.tsx index 34ab3e22f3ec..dd955e8dee94 100644 --- a/src/components/Button/index.tsx +++ b/src/components/Button/index.tsx @@ -294,12 +294,12 @@ function Button( danger && styles.buttonDangerText, !!icon && styles.textAlignLeft, !!secondLineText && styles.noPaddingBottom, - textStyles, isHovered && textHoverStyles, - link && styles.link, - link && isHovered && StyleUtils.getColorStyle(theme.linkHover), link && styles.fontWeightNormal, link && styles.fontSizeLabel, + textStyles, + link && styles.link, + link && isHovered && StyleUtils.getColorStyle(theme.linkHover), ]} dataSet={{[CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT]: true}} > diff --git a/src/components/CaretWrapper.tsx b/src/components/CaretWrapper.tsx index a5c6525e908f..dc29fa9c3b3a 100644 --- a/src/components/CaretWrapper.tsx +++ b/src/components/CaretWrapper.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import type {ViewStyle} from 'react-native'; +import type {StyleProp, ViewStyle} from 'react-native'; import {View} from 'react-native'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -9,7 +9,7 @@ import Icon from './Icon'; import * as Expensicons from './Icon/Expensicons'; type CaretWrapperProps = ChildrenProps & { - style?: ViewStyle; + style?: StyleProp; }; function CaretWrapper({children, style}: CaretWrapperProps) { diff --git a/src/components/DatePicker/CalendarPicker/YearPickerModal.tsx b/src/components/DatePicker/CalendarPicker/YearPickerModal.tsx index d912edcf80cf..de3a1e3b725b 100644 --- a/src/components/DatePicker/CalendarPicker/YearPickerModal.tsx +++ b/src/components/DatePicker/CalendarPicker/YearPickerModal.tsx @@ -55,6 +55,8 @@ function YearPickerModal({isVisible, years, currentYear = new Date().getFullYear hideModalContentWhileAnimating useNativeDriver shouldHandleNavigationBack + shouldUseCustomBackdrop + onBackdropPress={onClose} enableEdgeToEdgeBottomSafeAreaPadding > {buttons?.map(({buttonText, buttonAction, success, icon, isDisabled, style}) => ( + + {/* Dropdown overlay */} + + + + + ); +} + +DropdownButton.displayName = 'DropdownButton'; +export type {PopoverComponentProps}; +export default withViewportOffsetTop(DropdownButton); diff --git a/src/components/Search/FilterDropdowns/MultiSelectPopup.tsx b/src/components/Search/FilterDropdowns/MultiSelectPopup.tsx new file mode 100644 index 000000000000..9b6fad81e9b4 --- /dev/null +++ b/src/components/Search/FilterDropdowns/MultiSelectPopup.tsx @@ -0,0 +1,110 @@ +import React, {useCallback, useMemo, useState} from 'react'; +import {View} from 'react-native'; +import Button from '@components/Button'; +import SelectionList from '@components/SelectionList'; +import MultiSelectListItem from '@components/SelectionList/MultiSelectListItem'; +import type {ListItem} from '@components/SelectionList/types'; +import Text from '@components/Text'; +import useLocalize from '@hooks/useLocalize'; +import useResponsiveLayout from '@hooks/useResponsiveLayout'; +import useThemeStyles from '@hooks/useThemeStyles'; +import type {TranslationPaths} from '@src/languages/types'; + +type MultiSelectItem = { + translation: TranslationPaths; + value: T; +}; + +type MultiSelectPopupProps = { + /** The label to show when in an overlay on mobile */ + label: string; + + /** The list of all items to show up in the list */ + items: Array>; + + /** The currently selected items */ + value: Array>; + + /** Function to call to close the overlay when changes are applied */ + closeOverlay: () => void; + + /** Function to call when changes are applied */ + onChange: (item: Array>) => void; +}; + +function MultiSelectPopup({label, value, items, closeOverlay, onChange}: MultiSelectPopupProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth + const {isSmallScreenWidth} = useResponsiveLayout(); + const [selectedItems, setSelectedItems] = useState(value); + + const listData: ListItem[] = useMemo(() => { + return items.map((item) => ({ + text: translate(item.translation), + keyForList: item.value, + isSelected: !!selectedItems.find((i) => i.value === item.value), + })); + }, [items, selectedItems, translate]); + + const updateSelectedItems = useCallback( + (item: ListItem) => { + if (item.isSelected) { + setSelectedItems(selectedItems.filter((i) => i.value !== item.keyForList)); + return; + } + + const newItem = items.find((i) => i.value === item.keyForList); + + if (newItem) { + setSelectedItems([...selectedItems, newItem]); + } + }, + [items, selectedItems], + ); + + const applyChanges = useCallback(() => { + onChange(selectedItems); + closeOverlay(); + }, [closeOverlay, onChange, selectedItems]); + + const resetChanges = useCallback(() => { + onChange([]); + closeOverlay(); + }, [closeOverlay, onChange]); + + return ( + + {isSmallScreenWidth && {label}} + + + + + + +