Refactor MultipleObjectsPicker component (#10552)
Refactor to only have MultipleRecordPicker and SingleRecordPicker What's done: - SingleRecordPicker, MultipleRecordPicker - RelationToOneInput - RelationFromManyInput - usage in TableCell, InlineCell, RelationDetailSection, Workflow What's left: - Make a pass on the app, to make sure the hotkeyScopes, clickOutside are properly set - Fix flashing on ActivityTarget - add more tests on the code
This commit is contained in:
@ -3,10 +3,8 @@ import { DropdownOnToggleEffect } from '@/ui/layout/dropdown/components/Dropdown
|
||||
import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponeInstanceContext';
|
||||
import { DropdownScope } from '@/ui/layout/dropdown/scopes/DropdownScope';
|
||||
import { dropdownHotkeyComponentState } from '@/ui/layout/dropdown/states/dropdownHotkeyComponentState';
|
||||
import { dropdownMaxHeightComponentStateV2 } from '@/ui/layout/dropdown/states/dropdownMaxHeightComponentStateV2';
|
||||
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
|
||||
import { getScopeIdFromComponentId } from '@/ui/utilities/recoil-scope/utils/getScopeIdFromComponentId';
|
||||
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
|
||||
import styled from '@emotion/styled';
|
||||
import {
|
||||
Placement,
|
||||
@ -68,11 +66,6 @@ export const Dropdown = ({
|
||||
}: DropdownProps) => {
|
||||
const { isDropdownOpen, toggleDropdown } = useDropdown(dropdownId);
|
||||
|
||||
const setDropdownMaxHeight = useSetRecoilComponentStateV2(
|
||||
dropdownMaxHeightComponentStateV2,
|
||||
dropdownId,
|
||||
);
|
||||
|
||||
const isUsingOffset =
|
||||
isDefined(dropdownOffset?.x) || isDefined(dropdownOffset?.y);
|
||||
|
||||
@ -92,9 +85,10 @@ export const Dropdown = ({
|
||||
flip(),
|
||||
size({
|
||||
padding: 32,
|
||||
apply: ({ availableHeight }) => {
|
||||
apply: () => {
|
||||
flushSync(() => {
|
||||
setDropdownMaxHeight(availableHeight);
|
||||
// TODO: I think this is not needed anymore let's remove it if not used for a few weeks
|
||||
// setDropdownMaxHeight(availableHeight);
|
||||
});
|
||||
},
|
||||
boundary: document.querySelector('#root') ?? undefined,
|
||||
|
||||
@ -11,7 +11,7 @@ const StyledDropdownMenuItemsExternalContainer = styled.div<{
|
||||
display: flex;
|
||||
|
||||
flex-direction: column;
|
||||
max-height: ${({ hasMaxHeight }) => (hasMaxHeight ? '188px' : 'none')};
|
||||
max-height: ${({ hasMaxHeight }) => (hasMaxHeight ? '168px' : 'none')};
|
||||
|
||||
padding: var(--padding);
|
||||
|
||||
@ -72,7 +72,6 @@ export const DropdownMenuItemsContainer = ({
|
||||
<ScrollWrapper
|
||||
contextProviderName="dropdownMenuItemsContainer"
|
||||
componentInstanceId={`scroll-wrapper-dropdown-menu-${id}`}
|
||||
heightMode="fit-content"
|
||||
>
|
||||
<StyledDropdownMenuItemsExternalContainer
|
||||
hasMaxHeight={hasMaxHeight}
|
||||
|
||||
Reference in New Issue
Block a user