@elliemae/ds-shuttle-v2 3.53.0-next.9 → 3.54.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/config/useAutoCalculated/index.js.map +2 -2
- package/dist/cjs/config/useFocusTracker/useFocusItemTracker.js +34 -7
- package/dist/cjs/config/useFocusTracker/useFocusItemTracker.js.map +2 -2
- package/dist/cjs/config/useStore/focusAndTabIndexManager.js.map +2 -2
- package/dist/cjs/parts/Item/Item.js +26 -21
- package/dist/cjs/parts/Item/Item.js.map +2 -2
- package/dist/cjs/parts/Item/useThisItemIsFocused.js +1 -1
- package/dist/cjs/parts/Item/useThisItemIsFocused.js.map +2 -2
- package/dist/cjs/parts/MainContent.js +8 -7
- package/dist/cjs/parts/MainContent.js.map +2 -2
- package/dist/cjs/parts/Panel/bottom/LoadMoreBtn.js +29 -5
- package/dist/cjs/parts/Panel/bottom/LoadMoreBtn.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +2 -2
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/esm/config/useAutoCalculated/index.js.map +2 -2
- package/dist/esm/config/useFocusTracker/useFocusItemTracker.js +34 -7
- package/dist/esm/config/useFocusTracker/useFocusItemTracker.js.map +2 -2
- package/dist/esm/config/useStore/focusAndTabIndexManager.js.map +2 -2
- package/dist/esm/parts/Item/Item.js +27 -22
- package/dist/esm/parts/Item/Item.js.map +2 -2
- package/dist/esm/parts/Item/useThisItemIsFocused.js +1 -1
- package/dist/esm/parts/Item/useThisItemIsFocused.js.map +2 -2
- package/dist/esm/parts/MainContent.js +8 -7
- package/dist/esm/parts/MainContent.js.map +2 -2
- package/dist/esm/parts/Panel/bottom/LoadMoreBtn.js +29 -5
- package/dist/esm/parts/Panel/bottom/LoadMoreBtn.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +5 -5
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/types/config/itemMovementHelpers.d.ts +1 -1
- package/dist/types/config/useAutoCalculated/index.d.ts +0 -1
- package/dist/types/config/useAutoCalculated/useShuttleVirtualized.d.ts +0 -1
- package/dist/types/config/useFocusTracker/useFocusItemTracker.d.ts +2 -0
- package/dist/types/config/useFocusTracker/useFocusTracker.d.ts +2 -0
- package/dist/types/config/useStore/focusAndTabIndexManager.d.ts +1 -1
- package/dist/types/config/useStore/useStore.d.ts +2 -3
- package/dist/types/parts/Dnd/DndHandle.d.ts +2 -2
- package/dist/types/parts/Item/ItemActions/useActionsHandlers.d.ts +2 -2
- package/dist/types/parts/Item/ItemMiddleSection.d.ts +1 -1
- package/dist/types/parts/Item/ItemOverlay.d.ts +1 -1
- package/dist/types/react-desc-prop-types.d.ts +9 -10
- package/dist/types/tests/loadMore/ShuttleV2WithLoadMoreTestable.d.ts +2 -0
- package/dist/types/tests/loadMore/shuttle-v2.load-more.focus.test.d.ts +1 -0
- package/package.json +24 -23
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react-desc-prop-types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport type { WeakValidationMap } from 'react';\nimport type React from 'react';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n getPropsPerDatatestIdPropTypes,\n getPropsPerSlotPropTypes,\n} from '@elliemae/ds-props-helpers';\n\nimport { type useHeadlessTooltip } from '@elliemae/ds-hooks-headless-tooltip';\n\nimport { type DSControlledCheckboxT } from '@elliemae/ds-form-checkbox';\nimport { type DSInputTextT } from '@elliemae/ds-form-input-text';\nimport { type DSButtonT, type DSButtonV3T } from '@elliemae/ds-button-v2';\nimport { type useSortable, type DnDKitTree } from '@elliemae/ds-drag-and-drop';\nimport type { ZustandT } from '@elliemae/ds-zustand-helpers';\n\nimport type { REGIONS_FOCUSES, ACTIONS_FOCUSES, ITEMS_FOCUSES, DropIndicatorPosition } from './constants/index.js';\nimport type { useAutoCalculated } from './config/useAutoCalculated/index.js';\nimport { DSShuttleV2DataTestIds, DSShuttleV2Name, DSShuttleV2Slots } from './config/DSShuttleV2Definitions.js';\nexport declare namespace DSShuttleV2T {\n export type Datum = Record<string, unknown>;\n export type PanelMetaInfo = { isDestinationPanel: boolean; hasMultipleSelection?: boolean; height?: number };\n type HydratedId = string;\n\n export type DatumInternalMeta = {\n isFirst: boolean;\n isLast: boolean;\n isSelected: boolean;\n softDeleted: boolean;\n localIndex: number;\n hydratedId: HydratedId;\n hydratedPreventMove: boolean;\n };\n export type DatumRenderFlags = {\n selectionPrevented: boolean;\n withActions: boolean;\n withMoveBtn: boolean;\n withDrilldownBtn: boolean;\n internallyDisabledMove: boolean;\n internallyDisabledDrilldown: boolean;\n };\n\n export type DropIndicatorPositionValues = TypescriptHelpersT.ObjectValues<typeof DropIndicatorPosition>;\n\n // =============================================================================\n // Hydratables section - panel level hydratables\n // =============================================================================\n type RequiredPanelHydratables = Record<string, never>;\n type OptionalPanelHydratables = {\n batchActionableButtonProps: Record<string, unknown>;\n };\n export type PanelHydratables = RequiredPanelHydratables & OptionalPanelHydratables;\n\n // =============================================================================\n // Hydratables section - datum level hydratables\n // shared usage between internal and custom component\n // =============================================================================\n export type PrimaryKeyHydratables = {\n id: HydratedId;\n };\n type FunctionalHydratables = {\n preventMove?: boolean;\n };\n type RequiredDatumHydratablesWithoutComponents = {\n label: string;\n };\n type OptionalDatumHydratablesWithoutComponents = {\n subtitle?: string;\n preventDrilldown?: boolean;\n };\n type DatumHydratablesWithoutComponents = PrimaryKeyHydratables &\n FunctionalHydratables &\n RequiredDatumHydratablesWithoutComponents &\n OptionalDatumHydratablesWithoutComponents;\n // =============================================================================\n // Hydratables section - datum level hydratables\n // Custom component-only\n // =============================================================================\n export type ComponentProps = {\n datum: Datum;\n thisItemIsFocused: boolean;\n panelMetaInfo: PanelMetaInfo;\n datumInternalMeta: DatumInternalMeta;\n datumHydratables: DatumHydratablesWithoutComponents;\n tooltipHelpers?: ReturnType<typeof useHeadlessTooltip>;\n };\n // eslint-disable-next-line @typescript-eslint/ban-types\n type RequiredDatumHydratablesComponents = {};\n type OptionalDatumHydratablesComponents = {\n Icon?: React.ComponentType<ComponentProps>;\n CustomRenderer?: React.ComponentType<ComponentProps>;\n };\n // =============================================================================\n // Hydratables section - datum level hydratables\n // Finals\n // =============================================================================\n type RequiredDatumHydratables = RequiredDatumHydratablesWithoutComponents & RequiredDatumHydratablesComponents;\n type OptionalDatumHydratables = OptionalDatumHydratablesWithoutComponents & OptionalDatumHydratablesComponents;\n export type DatumHydratables = PrimaryKeyHydratables & RequiredDatumHydratables & OptionalDatumHydratables;\n\n // =============================================================================\n // Hydraters\n // =============================================================================\n export type PrimaryKeyHydraters = TypescriptHelpersT.Hydraters<PrimaryKeyHydratables, [Datum]>;\n export type FunctionalHydraters = TypescriptHelpersT.Hydraters<\n FunctionalHydratables,\n [Datum, Partial<PanelMetaInfo>]\n >;\n type HydratersMeta = { datumMeta: DatumInternalMeta; panelMetaInfo: PanelMetaInfo };\n type RequiredDatumHydraters = TypescriptHelpersT.Hydraters<RequiredDatumHydratables, [Datum, HydratersMeta]>;\n type OptionalDatumHydraters = TypescriptHelpersT.Hydraters<OptionalDatumHydratables, [Datum, HydratersMeta]>;\n\n type DatumHydraters = PrimaryKeyHydraters & FunctionalHydraters & RequiredDatumHydraters & OptionalDatumHydraters;\n\n type RequiredPanelHydraters = TypescriptHelpersT.Hydraters<RequiredPanelHydratables, [PanelMetaInfo]>;\n type OptionalPanelHydraters = Partial<TypescriptHelpersT.Hydraters<OptionalPanelHydratables, [PanelMetaInfo]>>;\n type PanelHydraters = RequiredPanelHydraters & OptionalPanelHydraters;\n\n // =============================================================================\n // Datum & Internals structures\n // =============================================================================\n export type ConfiguredDatum = DatumInternalMeta & { original: Datum };\n export interface ItemMeta extends PanelMetaInfo {\n datum: Datum;\n datumHydratables: DatumHydratables;\n datumInternalMeta: DatumInternalMeta;\n datumRenderFlags: DatumRenderFlags;\n withDragNDrop: boolean;\n useSortableHelpers?: ReturnType<typeof useSortable>;\n }\n\n // =============================================================================\n // Callbacks\n // =============================================================================\n type OnDataChange = (\n newData: Datum[],\n metainfo: {\n event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>;\n item?: Datum;\n selectedItems?: Datum[];\n },\n ) => void;\n\n type OnChangeEvent = (\n items: Datum[],\n metainfo: {\n event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>;\n },\n ) => void;\n\n type OnReorderEventMetadata = Omit<DnDKitTree.OnReorder<DSShuttleV2T.Datum>, 'considerExpanding'>;\n type OnReorderEvent = (movedItem: Datum, metadata: OnReorderEventMetadata) => void;\n\n export type SelectionMap = Record<string, boolean>;\n type OnSelectionChange = (\n newSelection: SelectionMap,\n metainfo: {\n event:\n | Parameters<Required<DSButtonT.Props>['onClick']>[0]\n | Parameters<DSControlledCheckboxT.InternalProps['onChange']>[1]\n | React.MouseEvent<HTMLButtonElement | HTMLDivElement>\n | React.KeyboardEvent<HTMLDivElement>\n | React.ChangeEvent<HTMLInputElement>;\n item?: Datum;\n },\n ) => void;\n type OnSelectionDrilldown = (\n item: Datum,\n metainfo: { event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement> },\n ) => void;\n\n type OnLoadMore = (e: Parameters<Required<DSButtonT.Props>['onClick']>[0]) => void;\n type OnFilterChange = (\n newfilter: string | null,\n metainfo: { event: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement> },\n ) => void;\n type OnSearchbarOpen = (\n newfilter: boolean,\n metainfo: { event: Parameters<Required<DSButtonT.Props>['onClick']>[0] },\n ) => void;\n\n export type SoftDeletedMap = Record<string, boolean>;\n type OnSoftDeletedChange = (\n newSoftDeleted: SoftDeletedMap,\n metainfo: {\n event:\n | Parameters<Required<DSButtonT.Props>['onClick']>[0]\n | Parameters<DSControlledCheckboxT.InternalProps['onChange']>[1]\n | React.MouseEvent<HTMLButtonElement | HTMLDivElement>\n | React.KeyboardEvent<HTMLDivElement>\n | React.ChangeEvent<HTMLInputElement>;\n item?: Datum;\n },\n ) => void;\n // =============================================================================\n // Zustand Store\n // =============================================================================\n export type FocusRegion = (typeof REGIONS_FOCUSES)[keyof typeof REGIONS_FOCUSES];\n export type FocusItem = Omit<(typeof ITEMS_FOCUSES)[keyof typeof ITEMS_FOCUSES], 'GET_SPECIFIC_ITEM'> & string;\n export type FocusItemAction = (typeof ACTIONS_FOCUSES)[keyof typeof ACTIONS_FOCUSES];\n export type InternalAtoms = {\n focusRegion: FocusRegion;\n focusItem: FocusItem;\n focusItemAction: FocusItemAction;\n deferFocusUntilFirstRender: boolean;\n dropIndicatorPosition: DropIndicatorPositionValues;\n overId: string;\n dndDraggingItem: ConfiguredDatum | null;\n dndDraggingItemMeta: ItemMeta | null;\n lastActiveId: string;\n isDropValid: boolean;\n sourcePanelLastSelectedItem: string | null | undefined;\n destinationPanelLastSelectedItem: string | null | undefined;\n };\n export type UseAutoCalculatedT = ReturnType<typeof useAutoCalculated>;\n export type Selectors = {\n getIsDragAndDropHappening: () => boolean;\n getPanelLastSelectedItem: (isDestinationPanel: boolean) => string | null | undefined;\n };\n export type Reducers = Record<string, never>;\n export type ShuttleInternalStore = ZustandT.InternalStore<InternalAtoms, Selectors, Reducers>;\n // =============================================================================\n // Final Props\n // =============================================================================\n export interface RequiredProps extends RequiredDatumHydraters, PrimaryKeyHydraters {\n sourceData: Datum[];\n sourceSelectedItems: SelectionMap;\n onSourceSelectionChange: OnSelectionChange;\n SourceHeader: React.ComponentType<Record<string, unknown>>;\n onSourceDrilldown: OnSelectionDrilldown;\n\n destinationData: Datum[];\n destinationSelectedItems: SelectionMap;\n onDestinationSelectionChange: OnSelectionChange;\n DestinationHeader: React.ComponentType<Record<string, unknown>>;\n onDestinationDrilldown: OnSelectionDrilldown;\n }\n\n export interface DefaultProps extends Required<FunctionalHydraters> {\n // load-more and loaders\n sourceIsLoading: boolean;\n sourceWithLoadMore: boolean;\n sourceIsLoadingMore: boolean;\n onSourceLoadMore: OnLoadMore;\n destinationIsLoading: boolean;\n destinationWithLoadMore: boolean;\n destinationIsLoadingMore: boolean;\n onDestinationLoadMore: OnLoadMore;\n destinationNoOptionsMessage: string;\n sourceNoOptionsMessage: string;\n // switch side\n onSourceAdd: OnChangeEvent;\n onSourceRemove: OnChangeEvent;\n onDestinationAdd: OnChangeEvent;\n onDestinationRemove: OnChangeEvent;\n\n // dnd\n addDragAndDropFromSource: boolean;\n removeDragAndDropFromDestination: boolean;\n onSourceReorder: OnReorderEvent;\n onDestinationReorder: OnReorderEvent;\n\n // soft delete\n sourceSoftDeletedItems: SoftDeletedMap;\n onSourceSoftDelete: OnSoftDeletedChange;\n destinationSoftDeletedItems: SoftDeletedMap;\n onDestinationSoftDelete: OnSoftDeletedChange;\n }\n export interface OptionalProps\n extends OptionalDatumHydraters,\n OptionalPanelHydraters,\n TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSShuttleV2Name, typeof DSShuttleV2Slots> {\n sourceItemProps?: Record<string, unknown>;\n destinationItemProps?: Record<string, unknown>;\n sourceHeaderProps?: Record<string, unknown>;\n destinationHeaderProps?: Record<string, unknown>;\n // filtering\n sourceShowSearchbar?: boolean;\n destinationShowSearchbar?: boolean;\n onSourceOpenSearchbar?: OnSearchbarOpen;\n onDesinationOpenSearchbar?: OnSearchbarOpen;\n\n sourceFilterValue?: string;\n destinationFilterValue?: string;\n onSourceFilterChange?: OnFilterChange;\n onDestinationFilterChange?: OnFilterChange;\n\n moveButtonProps?: ({\n itemMeta,\n isDestinationPanel,\n }: {\n itemMeta: ItemMeta;\n isDestinationPanel: boolean;\n }) => Omit<DSButtonV3T.Props, 'children'>;\n drillDownButtonProps?: ({\n itemMeta,\n isDestinationPanel,\n }: {\n itemMeta: ItemMeta;\n isDestinationPanel: boolean;\n }) => Omit<DSButtonV3T.Props, 'children'>;\n\n checkboxSelectAllProps?: (metainfo: PanelMetaInfo) => DSControlledCheckboxT.Props;\n dsShuttleV2ListWrapperMid?: (metaInfo: PanelMetaInfo) => Record<string, unknown>;\n areaSearchBarProps?: (metaInfo: PanelMetaInfo) => DSInputTextT.Props;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSShuttleV2T.DefaultProps = {\n addDragAndDropFromSource: false,\n removeDragAndDropFromDestination: false,\n destinationNoOptionsMessage: 'There are no items to display',\n sourceNoOptionsMessage: 'There are no items to display',\n sourceIsLoading: false,\n destinationIsLoading: false,\n sourceWithLoadMore: false,\n destinationWithLoadMore: false,\n sourceIsLoadingMore: false,\n destinationIsLoadingMore: false,\n onSourceLoadMore: () => {},\n onDestinationLoadMore: () => {},\n\n onSourceAdd: () => {},\n onDestinationAdd: () => {},\n onSourceRemove: () => {},\n onDestinationRemove: () => {},\n onSourceReorder: () => {},\n onDestinationReorder: () => {},\n\n sourceSoftDeletedItems: {},\n onSourceSoftDelete: () => {},\n destinationSoftDeletedItems: {},\n onDestinationSoftDelete: () => {},\n\n getPreventMove: () => false,\n};\n\nconst DSShuttleV2PropTypes: DSPropTypesSchema<DSShuttleV2T.Props> = {\n ...getPropsPerSlotPropTypes(DSShuttleV2Name, DSShuttleV2Slots),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n\n sourceData: PropTypes.arrayOf(PropTypes.object).description(\n 'An array of objects representing the items in the source list',\n ).isRequired,\n sourceSelectedItems: PropTypes.object.description('An object representing the selected items in the source list')\n .isRequired,\n onSourceSelectionChange: PropTypes.func.description('A function called when the selection in the source list changes')\n .isRequired,\n SourceHeader: PropTypes.node.description('The header component for the source list').isRequired,\n sourceHeaderProps: PropTypes.object.description('Props to be passed to the source header').defaultValue({}),\n onSourceDrilldown: PropTypes.func.description('A function called when an item in the source list is clicked')\n .isRequired,\n destinationData: PropTypes.arrayOf(PropTypes.object).description(\n 'An array of objects representing the items in the destination list',\n ).isRequired,\n destinationSelectedItems: PropTypes.object.description(\n 'An object representing the selected items in the destination list',\n ).isRequired,\n onDestinationSelectionChange: PropTypes.func.description(\n 'A function called when the selection in the destination list changes',\n ).isRequired,\n DestinationHeader: PropTypes.node.description('The header component for the destination list').isRequired,\n destinationHeaderProps: PropTypes.object.description('Props to be passed to the destination header').defaultValue({}),\n onDestinationDrilldown: PropTypes.func.description(\n 'A function called when an item in the destination list is clicked',\n ).isRequired,\n getId: PropTypes.func.description(\n 'A function that takes an item from the source/destination list and returns its unique identifier',\n ).isRequired,\n getLabel: PropTypes.func.description(\n 'A function that takes an item from the source/destination list and returns its display label',\n ).isRequired,\n sourceIsLoading: PropTypes.bool\n .description('A boolean indicating whether the source list is currently loading data')\n .defaultValue(false),\n destinationIsLoading: PropTypes.bool\n .description('A boolean indicating whether the destination list is currently loading data')\n .defaultValue(false),\n sourceWithLoadMore: PropTypes.bool\n .description('A boolean indicating whether the source list supports \"load more\" functionality')\n .defaultValue(false),\n destinationWithLoadMore: PropTypes.bool\n .description('A boolean indicating whether the destination list supports \"load more\" functionality')\n .defaultValue(false),\n sourceIsLoadingMore: PropTypes.bool\n .description('A boolean indicating whether the source list is currently loading more data')\n .defaultValue(false),\n destinationIsLoadingMore: PropTypes.bool\n .description('A boolean indicating whether the destination list is currently loading more data')\n .defaultValue(false),\n onSourceLoadMore: PropTypes.func\n .description('A function called when the \"load more\" button in the source list is clicked')\n .defaultValue(() => {}),\n onDestinationLoadMore: PropTypes.func\n .description('A function called when the \"load more\" button in the destination list is clicked')\n .defaultValue(() => {}),\n onSourceAdd: PropTypes.func\n .description('A function called when an item is added from the source list to the destination list')\n .defaultValue(() => {}),\n onDestinationAdd: PropTypes.func\n .description('A function called when an item is added from the destination list to the source list')\n .defaultValue(() => {}),\n onSourceRemove: PropTypes.func\n .description('A function called when an item is removed from the destination list')\n .defaultValue(() => {}),\n onDestinationRemove: PropTypes.func\n .description('Callback function to handle when an item is removed from the destination shuttle list. ')\n .defaultValue(() => {}),\n onSourceReorder: PropTypes.func\n .description('Callback function to handle when items are reordered in the source shuttle list.')\n .defaultValue(() => {}),\n onDestinationReorder: PropTypes.func\n .description('Callback function to handle when items are reordered in the destination shuttle list. ')\n .defaultValue(() => {}),\n sourceSoftDeletedItems: PropTypes.object\n .description(\n 'Object containing the soft deleted items in the source shuttle list, where the key is the item ID and the value is the deleted item.',\n )\n .defaultValue({}),\n onSourceSoftDelete: PropTypes.func\n .description('Callback function to handle when an item is soft deleted in the source shuttle list. ')\n .defaultValue(() => {}),\n destinationSoftDeletedItems: PropTypes.object\n .description(\n 'Object containing the soft deleted items in the destination shuttle list, where the key is the item ID and the value is the deleted item.',\n )\n .defaultValue({}),\n onDestinationSoftDelete: PropTypes.func\n .description('Callback function to handle when an item is soft deleted in the destination shuttle list.')\n .defaultValue(() => {}),\n getPreventMove: PropTypes.func\n .description('Function that determines whether a specific item can be moved to the destination shuttle list. ')\n .defaultValue(() => false),\n addDragAndDropFromSource: PropTypes.bool\n .description('Specifies whether items can be dragged from the source list and dropped into the destination list.')\n .defaultValue(false),\n removeDragAndDropFromDestination: PropTypes.bool\n .description('Specifies whether items can be removed from the destination list by dragging them out of the list.')\n .defaultValue(false),\n sourceItemProps: PropTypes.object\n .description('Specifies additional props to be applied to each item in the source list.')\n .defaultValue({}),\n destinationItemProps: PropTypes.object\n .description('Specifies additional props to be applied to each item in the destination list.')\n .defaultValue({}),\n sourceShowSearchbar: PropTypes.bool\n .description('Specifies whether the search bar should be shown in the source list.')\n .defaultValue(false),\n destinationShowSearchbar: PropTypes.bool\n .description('Specifies whether the search bar should be shown in the destination list.')\n .defaultValue(false),\n onSourceOpenSearchbar: PropTypes.func\n .description('Callback function that is called when the search bar in the source list is opened.')\n .defaultValue(() => {}),\n onDesinationOpenSearchbar: PropTypes.func\n .description('Callback function that is called when the search bar in the destination list is opened.')\n .defaultValue(() => {}),\n sourceFilterValue: PropTypes.string\n .description('Specifies the current value of the search filter in the source list.')\n .defaultValue(''),\n destinationFilterValue: PropTypes.string\n .description('Specifies the current value of the search filter in the destination list.')\n .defaultValue(''),\n onSourceFilterChange: PropTypes.func\n .description('Callback function that is called when the search filter in the source list is changed.')\n .defaultValue(() => {}),\n onDestinationFilterChange: PropTypes.func\n .description('Callback function that is called when the search filter in the destination list is changed.')\n .defaultValue(() => {}),\n getSubtitle: PropTypes.func\n .description('Callback function that returns the subtitle to be displayed for each item in the list.')\n .defaultValue(() => ''),\n getIcon: PropTypes.func\n .description('Callback function that returns the icon to be displayed for each item in the list.')\n .defaultValue(() => ''),\n getPreventDrilldown: PropTypes.func\n .description('Callback function that determines whether drilldown should be prevented for a particular item.')\n .defaultValue(() => false),\n getCustomRenderer: PropTypes.func\n .description('Callback function that returns a custom renderer for each item in the list.')\n .defaultValue(() => undefined),\n getBatchActionableButtonProps: PropTypes.func\n .description('Callback function that returns the props for the batch actionable button in the destination list.')\n .defaultValue(() => ({}))\n .signature(`(({ isDestionationPanel: boolean }) => ({ \"aria-label\": string }))`),\n ...getPropsPerDatatestIdPropTypes(DSShuttleV2DataTestIds),\n destinationNoOptionsMessage: PropTypes.string\n .description('Custome message to be display when no matches found after filtering in destination panel')\n .defaultValue('There are no items to display'),\n sourceNoOptionsMessage: PropTypes.string\n .description('Custome message to be display when no matches found after filtering in source panel')\n .defaultValue('There are no items to display'),\n checkboxSelectAllProps: PropTypes.func\n .description('Function that returns props for the select all checkbox in the source panel.')\n .defaultValue({}),\n moveButtonProps: PropTypes.func\n .description('Function that returns props for the move button.')\n .defaultValue(() => ({}))\n .signature(`(({ isDestionationPanel: boolean }) => ({ \"aria-label\": string }))`),\n drillDownButtonProps: PropTypes.func\n .description('Function that returns props for the drilldown button.')\n .defaultValue(() => ({}))\n .signature(`(({ isDestionationPanel: boolean }) => ({ \"aria-label\": string }))`),\n areaSearchBarProps: PropTypes.func\n .description('Function that returns props for the area search bar.')\n .defaultValue(() => ({})),\n dsShuttleV2ListWrapperMid: PropTypes.func\n .description('Function that returns props for the list wrapper.')\n .defaultValue(() => ({})),\n};\n\nexport const DSShuttleV2PropTypesSchema = DSShuttleV2PropTypes as unknown as WeakValidationMap<DSShuttleV2T.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport { type DSButtonT, type DSButtonV3T } from '@elliemae/ds-button-v2';\nimport { type DnDKitTree, type useSortable } from '@elliemae/ds-drag-and-drop';\nimport { type DSControlledCheckboxT } from '@elliemae/ds-form-checkbox';\nimport { type DSInputTextT } from '@elliemae/ds-form-input-text';\nimport { type useHeadlessTooltip } from '@elliemae/ds-hooks-headless-tooltip';\nimport type { DSPropTypesSchema, GlobalAttributesT, ValidationMap, XstyledProps } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerDatatestIdPropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type { ZustandT } from '@elliemae/ds-zustand-helpers';\nimport type React from 'react';\nimport { DSShuttleV2DataTestIds, DSShuttleV2Name, DSShuttleV2Slots } from './config/DSShuttleV2Definitions.js';\nimport type { useAutoCalculated } from './config/useAutoCalculated/index.js';\nimport type { ACTIONS_FOCUSES, DropIndicatorPosition, ITEMS_FOCUSES, REGIONS_FOCUSES } from './constants/index.js';\n\nexport declare namespace DSShuttleV2T {\n export type Datum = Record<string, unknown>;\n export type PanelMetaInfo = { isDestinationPanel: boolean; hasMultipleSelection?: boolean; height?: number };\n type HydratedId = string;\n\n export type DatumInternalMeta = {\n isFirst: boolean;\n isLast: boolean;\n isSelected: boolean;\n softDeleted: boolean;\n localIndex: number;\n hydratedId: HydratedId;\n hydratedPreventMove: boolean;\n };\n export type DatumRenderFlags = {\n selectionPrevented: boolean;\n withActions: boolean;\n withMoveBtn: boolean;\n withDrilldownBtn: boolean;\n internallyDisabledMove: boolean;\n internallyDisabledDrilldown: boolean;\n };\n\n export type DropIndicatorPositionValues = TypescriptHelpersT.ObjectValues<typeof DropIndicatorPosition>;\n\n // =============================================================================\n // Hydratables section - panel level hydratables\n // =============================================================================\n type RequiredPanelHydratables = Record<string, never>;\n type OptionalPanelHydratables = {\n batchActionableButtonProps: Record<string, unknown>;\n };\n export type PanelHydratables = RequiredPanelHydratables & OptionalPanelHydratables;\n\n // =============================================================================\n // Hydratables section - datum level hydratables\n // shared usage between internal and custom component\n // =============================================================================\n export type PrimaryKeyHydratables = {\n id: HydratedId;\n };\n type FunctionalHydratables = {\n preventMove?: boolean;\n };\n type RequiredDatumHydratablesWithoutComponents = {\n label: string;\n };\n type OptionalDatumHydratablesWithoutComponents = {\n subtitle?: string;\n preventDrilldown?: boolean;\n };\n type DatumHydratablesWithoutComponents = PrimaryKeyHydratables &\n FunctionalHydratables &\n RequiredDatumHydratablesWithoutComponents &\n OptionalDatumHydratablesWithoutComponents;\n // =============================================================================\n // Hydratables section - datum level hydratables\n // Custom component-only\n // =============================================================================\n export type ComponentProps = {\n datum: Datum;\n thisItemIsFocused: boolean;\n panelMetaInfo: PanelMetaInfo;\n datumInternalMeta: DatumInternalMeta;\n datumHydratables: DatumHydratablesWithoutComponents;\n tooltipHelpers?: ReturnType<typeof useHeadlessTooltip>;\n };\n // eslint-disable-next-line @typescript-eslint/ban-types\n type RequiredDatumHydratablesComponents = {};\n type OptionalDatumHydratablesComponents = {\n Icon?: React.ComponentType<ComponentProps>;\n CustomRenderer?: React.ComponentType<ComponentProps>;\n };\n // =============================================================================\n // Hydratables section - datum level hydratables\n // Finals\n // =============================================================================\n type RequiredDatumHydratables = RequiredDatumHydratablesWithoutComponents & RequiredDatumHydratablesComponents;\n type OptionalDatumHydratables = OptionalDatumHydratablesWithoutComponents & OptionalDatumHydratablesComponents;\n export type DatumHydratables = PrimaryKeyHydratables & RequiredDatumHydratables & OptionalDatumHydratables;\n\n // =============================================================================\n // Hydraters\n // =============================================================================\n export type PrimaryKeyHydraters = TypescriptHelpersT.Hydraters<PrimaryKeyHydratables, [Datum]>;\n export type FunctionalHydraters = TypescriptHelpersT.Hydraters<\n FunctionalHydratables,\n [Datum, Partial<PanelMetaInfo>]\n >;\n type HydratersMeta = { datumMeta: DatumInternalMeta; panelMetaInfo: PanelMetaInfo };\n type RequiredDatumHydraters = TypescriptHelpersT.Hydraters<RequiredDatumHydratables, [Datum, HydratersMeta]>;\n type OptionalDatumHydraters = TypescriptHelpersT.Hydraters<OptionalDatumHydratables, [Datum, HydratersMeta]>;\n\n type DatumHydraters = PrimaryKeyHydraters & FunctionalHydraters & RequiredDatumHydraters & OptionalDatumHydraters;\n\n type RequiredPanelHydraters = TypescriptHelpersT.Hydraters<RequiredPanelHydratables, [PanelMetaInfo]>;\n type OptionalPanelHydraters = Partial<TypescriptHelpersT.Hydraters<OptionalPanelHydratables, [PanelMetaInfo]>>;\n type PanelHydraters = RequiredPanelHydraters & OptionalPanelHydraters;\n\n // =============================================================================\n // Datum & Internals structures\n // =============================================================================\n export type ConfiguredDatum = DatumInternalMeta & { original: Datum };\n export interface ItemMeta extends PanelMetaInfo {\n datum: Datum;\n datumHydratables: DatumHydratables;\n datumInternalMeta: DatumInternalMeta;\n datumRenderFlags: DatumRenderFlags;\n withDragNDrop: boolean;\n useSortableHelpers?: ReturnType<typeof useSortable>;\n }\n\n // =============================================================================\n // Callbacks\n // =============================================================================\n type OnDataChange = (\n newData: Datum[],\n metainfo: {\n event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>;\n item?: Datum;\n selectedItems?: Datum[];\n },\n ) => void;\n\n type OnChangeEvent = (\n items: Datum[],\n metainfo: {\n event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>;\n },\n ) => void;\n\n type OnReorderEventMetadata = Omit<DnDKitTree.OnReorder<DSShuttleV2T.Datum>, 'considerExpanding'>;\n type OnReorderEvent = (movedItem: Datum, metadata: OnReorderEventMetadata) => void;\n\n export type SelectionMap = Record<string, boolean>;\n type OnSelectionChange = (\n newSelection: SelectionMap,\n metainfo: {\n event:\n | Parameters<Required<DSButtonT.Props>['onClick']>[0]\n | Parameters<DSControlledCheckboxT.InternalProps['onChange']>[1]\n | React.MouseEvent<HTMLButtonElement | HTMLDivElement>\n | React.KeyboardEvent<HTMLDivElement>\n | React.ChangeEvent<HTMLInputElement>;\n item?: Datum;\n },\n ) => void;\n type OnSelectionDrilldown = (\n item: Datum,\n metainfo: { event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement> },\n ) => void;\n\n type OnLoadMore = (e: Parameters<Required<DSButtonT.Props>['onClick']>[0]) => void;\n type OnFilterChange = (\n newfilter: string | null,\n metainfo: { event: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement> },\n ) => void;\n type OnSearchbarOpen = (\n newfilter: boolean,\n metainfo: { event: Parameters<Required<DSButtonT.Props>['onClick']>[0] },\n ) => void;\n\n export type SoftDeletedMap = Record<string, boolean>;\n type OnSoftDeletedChange = (\n newSoftDeleted: SoftDeletedMap,\n metainfo: {\n event:\n | Parameters<Required<DSButtonT.Props>['onClick']>[0]\n | Parameters<DSControlledCheckboxT.InternalProps['onChange']>[1]\n | React.MouseEvent<HTMLButtonElement | HTMLDivElement>\n | React.KeyboardEvent<HTMLDivElement>\n | React.ChangeEvent<HTMLInputElement>;\n item?: Datum;\n },\n ) => void;\n // =============================================================================\n // Zustand Store\n // =============================================================================\n export type FocusRegion = (typeof REGIONS_FOCUSES)[keyof typeof REGIONS_FOCUSES];\n export type FocusItem = Omit<(typeof ITEMS_FOCUSES)[keyof typeof ITEMS_FOCUSES], 'GET_SPECIFIC_ITEM'> & string;\n export type FocusItemAction = (typeof ACTIONS_FOCUSES)[keyof typeof ACTIONS_FOCUSES];\n export type InternalAtoms = {\n focusRegion: FocusRegion;\n focusItem: FocusItem;\n focusItemAction: FocusItemAction;\n deferFocusUntilFirstRender: boolean;\n dropIndicatorPosition: DropIndicatorPositionValues;\n overId: string;\n dndDraggingItem: ConfiguredDatum | null;\n dndDraggingItemMeta: ItemMeta | null;\n lastActiveId: string;\n isDropValid: boolean;\n sourcePanelLastSelectedItem: string | null | undefined;\n destinationPanelLastSelectedItem: string | null | undefined;\n };\n export type UseAutoCalculatedT = ReturnType<typeof useAutoCalculated>;\n export type Selectors = {\n getIsDragAndDropHappening: () => boolean;\n getPanelLastSelectedItem: (isDestinationPanel: boolean) => string | null | undefined;\n };\n export type Reducers = Record<string, never>;\n export type ShuttleInternalStore = ZustandT.InternalStore<InternalAtoms, Selectors, Reducers>;\n // =============================================================================\n // Final Props\n // =============================================================================\n export interface RequiredProps extends RequiredDatumHydraters, PrimaryKeyHydraters {\n sourceData: Datum[];\n sourceSelectedItems: SelectionMap;\n onSourceSelectionChange: OnSelectionChange;\n SourceHeader: React.ComponentType<Record<string, unknown>>;\n onSourceDrilldown: OnSelectionDrilldown;\n\n destinationData: Datum[];\n destinationSelectedItems: SelectionMap;\n onDestinationSelectionChange: OnSelectionChange;\n DestinationHeader: React.ComponentType<Record<string, unknown>>;\n onDestinationDrilldown: OnSelectionDrilldown;\n }\n\n export interface DefaultProps extends Required<FunctionalHydraters> {\n // load-more and loaders\n sourceIsLoading: boolean;\n sourceWithLoadMore: boolean;\n sourceIsLoadingMore: boolean;\n onSourceLoadMore: OnLoadMore;\n destinationIsLoading: boolean;\n destinationWithLoadMore: boolean;\n destinationIsLoadingMore: boolean;\n onDestinationLoadMore: OnLoadMore;\n destinationNoOptionsMessage: string;\n sourceNoOptionsMessage: string;\n // switch side\n onSourceAdd: OnChangeEvent;\n onSourceRemove: OnChangeEvent;\n onDestinationAdd: OnChangeEvent;\n onDestinationRemove: OnChangeEvent;\n\n // dnd\n addDragAndDropFromSource: boolean;\n removeDragAndDropFromDestination: boolean;\n onSourceReorder: OnReorderEvent;\n onDestinationReorder: OnReorderEvent;\n\n // soft delete\n sourceSoftDeletedItems: SoftDeletedMap;\n onSourceSoftDelete: OnSoftDeletedChange;\n destinationSoftDeletedItems: SoftDeletedMap;\n onDestinationSoftDelete: OnSoftDeletedChange;\n }\n export interface OptionalProps\n extends OptionalDatumHydraters,\n OptionalPanelHydraters,\n TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSShuttleV2Name, typeof DSShuttleV2Slots> {\n sourceItemProps?: Record<string, unknown>;\n destinationItemProps?: Record<string, unknown>;\n sourceHeaderProps?: Record<string, unknown>;\n destinationHeaderProps?: Record<string, unknown>;\n // filtering\n sourceShowSearchbar?: boolean;\n destinationShowSearchbar?: boolean;\n onSourceOpenSearchbar?: OnSearchbarOpen;\n onDesinationOpenSearchbar?: OnSearchbarOpen;\n\n sourceFilterValue?: string;\n destinationFilterValue?: string;\n onSourceFilterChange?: OnFilterChange;\n onDestinationFilterChange?: OnFilterChange;\n\n moveButtonProps?: ({\n itemMeta,\n isDestinationPanel,\n }: {\n itemMeta: ItemMeta;\n isDestinationPanel: boolean;\n }) => Omit<DSButtonV3T.Props, 'children'>;\n drillDownButtonProps?: ({\n itemMeta,\n isDestinationPanel,\n }: {\n itemMeta: ItemMeta;\n isDestinationPanel: boolean;\n }) => Omit<DSButtonV3T.Props, 'children'>;\n\n checkboxSelectAllProps?: (metainfo: PanelMetaInfo) => DSControlledCheckboxT.Props;\n dsShuttleV2ListWrapperMid?: (metaInfo: PanelMetaInfo) => Record<string, unknown>;\n areaSearchBarProps?: (metaInfo: PanelMetaInfo) => DSInputTextT.Props;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSShuttleV2T.DefaultProps = {\n addDragAndDropFromSource: false,\n removeDragAndDropFromDestination: false,\n destinationNoOptionsMessage: 'There are no items to display',\n sourceNoOptionsMessage: 'There are no items to display',\n sourceIsLoading: false,\n destinationIsLoading: false,\n sourceWithLoadMore: false,\n destinationWithLoadMore: false,\n sourceIsLoadingMore: false,\n destinationIsLoadingMore: false,\n onSourceLoadMore: () => {},\n onDestinationLoadMore: () => {},\n\n onSourceAdd: () => {},\n onDestinationAdd: () => {},\n onSourceRemove: () => {},\n onDestinationRemove: () => {},\n onSourceReorder: () => {},\n onDestinationReorder: () => {},\n\n sourceSoftDeletedItems: {},\n onSourceSoftDelete: () => {},\n destinationSoftDeletedItems: {},\n onDestinationSoftDelete: () => {},\n\n getPreventMove: () => false,\n};\n\nconst DSShuttleV2PropTypes: DSPropTypesSchema<DSShuttleV2T.Props> = {\n ...getPropsPerSlotPropTypes(DSShuttleV2Name, DSShuttleV2Slots),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n\n sourceData: PropTypes.arrayOf(PropTypes.object).description(\n 'An array of objects representing the items in the source list',\n ).isRequired,\n sourceSelectedItems: PropTypes.object.description('An object representing the selected items in the source list')\n .isRequired,\n onSourceSelectionChange: PropTypes.func.description('A function called when the selection in the source list changes')\n .isRequired,\n SourceHeader: PropTypes.func.description('The header component for the source list').isRequired,\n sourceHeaderProps: PropTypes.object.description('Props to be passed to the source header').defaultValue({}),\n onSourceDrilldown: PropTypes.func.description('A function called when an item in the source list is clicked')\n .isRequired,\n destinationData: PropTypes.arrayOf(PropTypes.object).description(\n 'An array of objects representing the items in the destination list',\n ).isRequired,\n destinationSelectedItems: PropTypes.object.description(\n 'An object representing the selected items in the destination list',\n ).isRequired,\n onDestinationSelectionChange: PropTypes.func.description(\n 'A function called when the selection in the destination list changes',\n ).isRequired,\n DestinationHeader: PropTypes.func.description('The header component for the destination list').isRequired,\n destinationHeaderProps: PropTypes.object.description('Props to be passed to the destination header').defaultValue({}),\n onDestinationDrilldown: PropTypes.func.description(\n 'A function called when an item in the destination list is clicked',\n ).isRequired,\n getId: PropTypes.func.description(\n 'A function that takes an item from the source/destination list and returns its unique identifier',\n ).isRequired,\n getLabel: PropTypes.func.description(\n 'A function that takes an item from the source/destination list and returns its display label',\n ).isRequired,\n sourceIsLoading: PropTypes.bool\n .description('A boolean indicating whether the source list is currently loading data')\n .defaultValue(false),\n destinationIsLoading: PropTypes.bool\n .description('A boolean indicating whether the destination list is currently loading data')\n .defaultValue(false),\n sourceWithLoadMore: PropTypes.bool\n .description('A boolean indicating whether the source list supports \"load more\" functionality')\n .defaultValue(false),\n destinationWithLoadMore: PropTypes.bool\n .description('A boolean indicating whether the destination list supports \"load more\" functionality')\n .defaultValue(false),\n sourceIsLoadingMore: PropTypes.bool\n .description('A boolean indicating whether the source list is currently loading more data')\n .defaultValue(false),\n destinationIsLoadingMore: PropTypes.bool\n .description('A boolean indicating whether the destination list is currently loading more data')\n .defaultValue(false),\n onSourceLoadMore: PropTypes.func\n .description('A function called when the \"load more\" button in the source list is clicked')\n .defaultValue(() => {}),\n onDestinationLoadMore: PropTypes.func\n .description('A function called when the \"load more\" button in the destination list is clicked')\n .defaultValue(() => {}),\n onSourceAdd: PropTypes.func\n .description('A function called when an item is added from the source list to the destination list')\n .defaultValue(() => {}),\n onDestinationAdd: PropTypes.func\n .description('A function called when an item is added from the destination list to the source list')\n .defaultValue(() => {}),\n onSourceRemove: PropTypes.func\n .description('A function called when an item is removed from the destination list')\n .defaultValue(() => {}),\n onDestinationRemove: PropTypes.func\n .description('Callback function to handle when an item is removed from the destination shuttle list. ')\n .defaultValue(() => {}),\n onSourceReorder: PropTypes.func\n .description('Callback function to handle when items are reordered in the source shuttle list.')\n .defaultValue(() => {}),\n onDestinationReorder: PropTypes.func\n .description('Callback function to handle when items are reordered in the destination shuttle list. ')\n .defaultValue(() => {}),\n sourceSoftDeletedItems: PropTypes.object\n .description(\n 'Object containing the soft deleted items in the source shuttle list, where the key is the item ID and the value is the deleted item.',\n )\n .defaultValue({}),\n onSourceSoftDelete: PropTypes.func\n .description('Callback function to handle when an item is soft deleted in the source shuttle list. ')\n .defaultValue(() => {}),\n destinationSoftDeletedItems: PropTypes.object\n .description(\n 'Object containing the soft deleted items in the destination shuttle list, where the key is the item ID and the value is the deleted item.',\n )\n .defaultValue({}),\n onDestinationSoftDelete: PropTypes.func\n .description('Callback function to handle when an item is soft deleted in the destination shuttle list.')\n .defaultValue(() => {}),\n getPreventMove: PropTypes.func\n .description('Function that determines whether a specific item can be moved to the destination shuttle list. ')\n .defaultValue(() => false),\n addDragAndDropFromSource: PropTypes.bool\n .description('Specifies whether items can be dragged from the source list and dropped into the destination list.')\n .defaultValue(false),\n removeDragAndDropFromDestination: PropTypes.bool\n .description('Specifies whether items can be removed from the destination list by dragging them out of the list.')\n .defaultValue(false),\n sourceItemProps: PropTypes.object\n .description('Specifies additional props to be applied to each item in the source list.')\n .defaultValue({}),\n destinationItemProps: PropTypes.object\n .description('Specifies additional props to be applied to each item in the destination list.')\n .defaultValue({}),\n sourceShowSearchbar: PropTypes.bool\n .description('Specifies whether the search bar should be shown in the source list.')\n .defaultValue(false),\n destinationShowSearchbar: PropTypes.bool\n .description('Specifies whether the search bar should be shown in the destination list.')\n .defaultValue(false),\n onSourceOpenSearchbar: PropTypes.func\n .description('Callback function that is called when the search bar in the source list is opened.')\n .defaultValue(() => {}),\n onDesinationOpenSearchbar: PropTypes.func\n .description('Callback function that is called when the search bar in the destination list is opened.')\n .defaultValue(() => {}),\n sourceFilterValue: PropTypes.string\n .description('Specifies the current value of the search filter in the source list.')\n .defaultValue(''),\n destinationFilterValue: PropTypes.string\n .description('Specifies the current value of the search filter in the destination list.')\n .defaultValue(''),\n onSourceFilterChange: PropTypes.func\n .description('Callback function that is called when the search filter in the source list is changed.')\n .defaultValue(() => {}),\n onDestinationFilterChange: PropTypes.func\n .description('Callback function that is called when the search filter in the destination list is changed.')\n .defaultValue(() => {}),\n getSubtitle: PropTypes.func\n .description('Callback function that returns the subtitle to be displayed for each item in the list.')\n .defaultValue(() => ''),\n getIcon: PropTypes.func\n .description('Callback function that returns the icon to be displayed for each item in the list.')\n .defaultValue(() => ''),\n getPreventDrilldown: PropTypes.func\n .description('Callback function that determines whether drilldown should be prevented for a particular item.')\n .defaultValue(() => false),\n getCustomRenderer: PropTypes.func\n .description('Callback function that returns a custom renderer for each item in the list.')\n .defaultValue(() => undefined),\n getBatchActionableButtonProps: PropTypes.func\n .description('Callback function that returns the props for the batch actionable button in the destination list.')\n .defaultValue(() => ({}))\n .signature(`(({ isDestionationPanel: boolean }) => ({ \"aria-label\": string }))`),\n ...getPropsPerDatatestIdPropTypes(DSShuttleV2DataTestIds),\n destinationNoOptionsMessage: PropTypes.string\n .description('Custome message to be display when no matches found after filtering in destination panel')\n .defaultValue('There are no items to display'),\n sourceNoOptionsMessage: PropTypes.string\n .description('Custome message to be display when no matches found after filtering in source panel')\n .defaultValue('There are no items to display'),\n checkboxSelectAllProps: PropTypes.func\n .description('Function that returns props for the select all checkbox in the source panel.')\n .defaultValue({}),\n moveButtonProps: PropTypes.func\n .description('Function that returns props for the move button.')\n .defaultValue(() => ({}))\n .signature(`(({ isDestionationPanel: boolean }) => ({ \"aria-label\": string }))`),\n drillDownButtonProps: PropTypes.func\n .description('Function that returns props for the drilldown button.')\n .defaultValue(() => ({}))\n .signature(`(({ isDestionationPanel: boolean }) => ({ \"aria-label\": string }))`),\n areaSearchBarProps: PropTypes.func\n .description('Function that returns props for the area search bar.')\n .defaultValue(() => ({})),\n dsShuttleV2ListWrapperMid: PropTypes.func\n .description('Function that returns props for the list wrapper.')\n .defaultValue(() => ({})),\n};\n\nexport const DSShuttleV2PropTypesSchema = DSShuttleV2PropTypes as unknown as ValidationMap<DSShuttleV2T.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADOvB,8BAMO;AAIP,oCAA0E;AAmTnE,MAAM,eAA0C;AAAA,EACrD,0BAA0B;AAAA,EAC1B,kCAAkC;AAAA,EAClC,6BAA6B;AAAA,EAC7B,wBAAwB;AAAA,EACxB,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,qBAAqB;AAAA,EACrB,0BAA0B;AAAA,EAC1B,kBAAkB,MAAM;AAAA,EAAC;AAAA,EACzB,uBAAuB,MAAM;AAAA,EAAC;AAAA,EAE9B,aAAa,MAAM;AAAA,EAAC;AAAA,EACpB,kBAAkB,MAAM;AAAA,EAAC;AAAA,EACzB,gBAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,qBAAqB,MAAM;AAAA,EAAC;AAAA,EAC5B,iBAAiB,MAAM;AAAA,EAAC;AAAA,EACxB,sBAAsB,MAAM;AAAA,EAAC;AAAA,EAE7B,wBAAwB,CAAC;AAAA,EACzB,oBAAoB,MAAM;AAAA,EAAC;AAAA,EAC3B,6BAA6B,CAAC;AAAA,EAC9B,yBAAyB,MAAM;AAAA,EAAC;AAAA,EAEhC,gBAAgB,MAAM;AACxB;AAEA,MAAM,uBAA8D;AAAA,EAClE,OAAG,kDAAyB,+CAAiB,8CAAgB;AAAA,EAC7D,GAAG;AAAA,EACH,GAAG;AAAA,EAEH,YAAY,kCAAU,QAAQ,kCAAU,MA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B;AAAA,EAC/C,wBAAwB,kCAAU,OAC/B,YAAY,qFAAqF,EACjG,aAAa,+BAA+B;AAAA,EAC/C,wBAAwB,kCAAU,KAC/B,YAAY,8EAA8E,EAC1F,aAAa,CAAC,CAAC;AAAA,EAClB,iBAAiB,kCAAU,KACxB,YAAY,kDAAkD,EAC9D,aAAa,OAAO,CAAC,EAAE,EACvB,UAAU,oEAAoE;AAAA,EACjF,sBAAsB,kCAAU,KAC7B,YAAY,uDAAuD,EACnE,aAAa,OAAO,CAAC,EAAE,EACvB,UAAU,oEAAoE;AAAA,EACjF,oBAAoB,kCAAU,KAC3B,YAAY,sDAAsD,EAClE,aAAa,OAAO,CAAC,EAAE;AAAA,EAC1B,2BAA2B,kCAAU,KAClC,YAAY,mDAAmD,EAC/D,aAAa,OAAO,CAAC,EAAE;AAC5B;AAEO,MAAM,6BAA6B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/config/useAutoCalculated/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo } from 'react';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types.js';\nimport { useDataStructure } from './useDataStructure.js';\nimport { useShuttleVirtualized } from './useShuttleVirtualized.js';\nexport const useAutoCalculated = (propsWithDefaults: DSShuttleV2T.InternalProps) => {\n const dataScructured = useDataStructure(propsWithDefaults);\n const virtualData = useShuttleVirtualized();\n\n return useMemo(() => ({ ...dataScructured, ...virtualData }), [dataScructured, virtualData]);\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,eAAe;AAExB,SAAS,wBAAwB;AACjC,SAAS,6BAA6B;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo } from 'react';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types.js';\nimport { useDataStructure } from './useDataStructure.js';\nimport { useShuttleVirtualized } from './useShuttleVirtualized.js';\n\nexport const useAutoCalculated = (propsWithDefaults: DSShuttleV2T.InternalProps) => {\n const dataScructured = useDataStructure(propsWithDefaults);\n const virtualData = useShuttleVirtualized();\n\n return useMemo(() => ({ ...dataScructured, ...virtualData }), [dataScructured, virtualData]);\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,eAAe;AAExB,SAAS,wBAAwB;AACjC,SAAS,6BAA6B;AAE/B,MAAM,oBAAoB,CAAC,sBAAkD;AAClF,QAAM,iBAAiB,iBAAiB,iBAAiB;AACzD,QAAM,cAAc,sBAAsB;AAE1C,SAAO,QAAQ,OAAO,EAAE,GAAG,gBAAgB,GAAG,YAAY,IAAI,CAAC,gBAAgB,WAAW,CAAC;AAC7F;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -49,22 +49,49 @@ const useFocusItemTracker = () => {
|
|
|
49
49
|
},
|
|
50
50
|
[destinationData, destinationWithLoadMore, getFocusItem, setFocusItem, sourceData, sourceWithLoadMore]
|
|
51
51
|
);
|
|
52
|
+
const destHasData = destinationData.length > 0;
|
|
53
|
+
const sourceHasData = sourceData.length > 0;
|
|
54
|
+
const getCanFocusFirstItem = useCallback(
|
|
55
|
+
({ isDestinationPanel }) => isDestinationPanel ? destHasData : sourceHasData,
|
|
56
|
+
[destHasData, sourceHasData]
|
|
57
|
+
);
|
|
58
|
+
const getCanFocusLastItem = getCanFocusFirstItem;
|
|
59
|
+
const trackFocusItemFirst = useCallback(
|
|
60
|
+
({ isDestinationPanel }) => {
|
|
61
|
+
const firstItem = isDestinationPanel ? destinationData[0] : sourceData[0];
|
|
62
|
+
if (firstItem) setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(firstItem));
|
|
63
|
+
},
|
|
64
|
+
[destinationData, setFocusItem, sourceData]
|
|
65
|
+
);
|
|
66
|
+
const trackFocusItemLast = useCallback(
|
|
67
|
+
({ isDestinationPanel }) => {
|
|
68
|
+
const lastItem = isDestinationPanel ? destinationData[destinationData.length - 1] : sourceData[sourceData.length - 1];
|
|
69
|
+
if (lastItem) setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(lastItem));
|
|
70
|
+
},
|
|
71
|
+
[destinationData, setFocusItem, sourceData]
|
|
72
|
+
);
|
|
52
73
|
return useMemo(
|
|
53
74
|
() => ({
|
|
54
75
|
trackFocusItem: (item) => setFocusItem(item.hydratedId),
|
|
55
76
|
trackFocusItemReset: () => setFocusItem(ITEMS_FOCUSES.RESET),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
)
|
|
61
|
-
),
|
|
77
|
+
getCanFocusFirstItem,
|
|
78
|
+
trackFocusItemFirst,
|
|
79
|
+
getCanFocusLastItem,
|
|
80
|
+
trackFocusItemLast,
|
|
62
81
|
trackFocusLoadMoreBtnDestination: () => setFocusItem(ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION),
|
|
63
82
|
trackFocusLoadMoreBtn: () => setFocusItem(ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE),
|
|
64
83
|
trackFocusPrevItem,
|
|
65
84
|
trackFocusNextItem
|
|
66
85
|
}),
|
|
67
|
-
[
|
|
86
|
+
[
|
|
87
|
+
getCanFocusFirstItem,
|
|
88
|
+
getCanFocusLastItem,
|
|
89
|
+
setFocusItem,
|
|
90
|
+
trackFocusItemFirst,
|
|
91
|
+
trackFocusItemLast,
|
|
92
|
+
trackFocusNextItem,
|
|
93
|
+
trackFocusPrevItem
|
|
94
|
+
]
|
|
68
95
|
);
|
|
69
96
|
};
|
|
70
97
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/config/useFocusTracker/useFocusItemTracker.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useMemo, useCallback } from 'react';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types.js';\nimport { useInternalStore, usePropsStore } from '../useStore/index.js';\nimport { ITEMS_FOCUSES } from '../../constants/index.js';\n\nexport const useFocusItemTracker = () => {\n const getFocusItem = useInternalStore((state) => state.getFocusItem);\n const setFocusItem = useInternalStore((state) => state.setFocusItem);\n const sourceData = usePropsStore((state) => state.sourceConfiguredData);\n const destinationData = usePropsStore((state) => state.destinationConfiguredData);\n const sourceWithLoadMore = usePropsStore((state) => state.sourceWithLoadMore);\n const destinationWithLoadMore = usePropsStore((state) => state.destinationWithLoadMore);\n const trackFocusPrevItem = useCallback(\n ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const focusItem = getFocusItem();\n const referenceData = isDestinationPanel ? destinationData : sourceData;\n const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;\n // loop logic\n const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === focusItem);\n if (currentItemIndex === 0 && withLoadMore)\n setFocusItem(isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);\n else if (currentItemIndex !== -1) {\n const prevItemIndex = currentItemIndex === 0 ? referenceData.length - 1 : currentItemIndex - 1;\n const prevItem = referenceData[prevItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));\n } else {\n const prevItemIndex = 0;\n const prevItem = referenceData[prevItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));\n }\n },\n [destinationData, destinationWithLoadMore, getFocusItem, setFocusItem, sourceData, sourceWithLoadMore],\n );\n const trackFocusNextItem = useCallback(\n ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const focusItem = getFocusItem();\n const referenceData = isDestinationPanel ? destinationData : sourceData;\n const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;\n // focus loop logic\n const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === focusItem);\n if (currentItemIndex === referenceData.length - 1 && withLoadMore)\n setFocusItem(isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);\n else if (currentItemIndex !== -1) {\n const nextItemIndex = currentItemIndex === referenceData.length - 1 ? 0 : currentItemIndex + 1;\n const nextItem = referenceData[nextItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));\n } else {\n const nextItemIndex = referenceData.length - 1;\n const nextItem = referenceData[nextItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));\n }\n },\n [destinationData, destinationWithLoadMore, getFocusItem, setFocusItem, sourceData, sourceWithLoadMore],\n );\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,SAAS,mBAAmB;AAErC,SAAS,kBAAkB,qBAAqB;AAChD,SAAS,qBAAqB;AAEvB,MAAM,sBAAsB,MAAM;AACvC,QAAM,eAAe,iBAAiB,CAAC,UAAU,MAAM,YAAY;AACnE,QAAM,eAAe,iBAAiB,CAAC,UAAU,MAAM,YAAY;AACnE,QAAM,aAAa,cAAc,CAAC,UAAU,MAAM,oBAAoB;AACtE,QAAM,kBAAkB,cAAc,CAAC,UAAU,MAAM,yBAAyB;AAChF,QAAM,qBAAqB,cAAc,CAAC,UAAU,MAAM,kBAAkB;AAC5E,QAAM,0BAA0B,cAAc,CAAC,UAAU,MAAM,uBAAuB;AACtF,QAAM,qBAAqB;AAAA,IACzB,CAAC,EAAE,mBAAmB,MAAkC;AACtD,YAAM,YAAY,aAAa;AAC/B,YAAM,gBAAgB,qBAAqB,kBAAkB;AAC7D,YAAM,eAAe,qBAAqB,0BAA0B;AAEpE,YAAM,mBA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eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useMemo, useCallback } from 'react';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types.js';\nimport { useInternalStore, usePropsStore } from '../useStore/index.js';\nimport { ITEMS_FOCUSES } from '../../constants/index.js';\n\nexport const useFocusItemTracker = () => {\n const getFocusItem = useInternalStore((state) => state.getFocusItem);\n const setFocusItem = useInternalStore((state) => state.setFocusItem);\n const sourceData = usePropsStore((state) => state.sourceConfiguredData);\n const destinationData = usePropsStore((state) => state.destinationConfiguredData);\n const sourceWithLoadMore = usePropsStore((state) => state.sourceWithLoadMore);\n const destinationWithLoadMore = usePropsStore((state) => state.destinationWithLoadMore);\n const trackFocusPrevItem = useCallback(\n ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const focusItem = getFocusItem();\n const referenceData = isDestinationPanel ? destinationData : sourceData;\n const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;\n // loop logic\n const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === focusItem);\n if (currentItemIndex === 0 && withLoadMore)\n setFocusItem(isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);\n else if (currentItemIndex !== -1) {\n const prevItemIndex = currentItemIndex === 0 ? referenceData.length - 1 : currentItemIndex - 1;\n const prevItem = referenceData[prevItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));\n } else {\n const prevItemIndex = 0;\n const prevItem = referenceData[prevItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));\n }\n },\n [destinationData, destinationWithLoadMore, getFocusItem, setFocusItem, sourceData, sourceWithLoadMore],\n );\n const trackFocusNextItem = useCallback(\n ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const focusItem = getFocusItem();\n const referenceData = isDestinationPanel ? destinationData : sourceData;\n const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;\n // focus loop logic\n const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === focusItem);\n if (currentItemIndex === referenceData.length - 1 && withLoadMore)\n setFocusItem(isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);\n else if (currentItemIndex !== -1) {\n const nextItemIndex = currentItemIndex === referenceData.length - 1 ? 0 : currentItemIndex + 1;\n const nextItem = referenceData[nextItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));\n } else {\n const nextItemIndex = referenceData.length - 1;\n const nextItem = referenceData[nextItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));\n }\n },\n [destinationData, destinationWithLoadMore, getFocusItem, setFocusItem, sourceData, sourceWithLoadMore],\n );\n\n const destHasData = destinationData.length > 0;\n const sourceHasData = sourceData.length > 0;\n const getCanFocusFirstItem = useCallback(\n ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => (isDestinationPanel ? destHasData : sourceHasData),\n [destHasData, sourceHasData],\n );\n const getCanFocusLastItem = getCanFocusFirstItem;\n\n const trackFocusItemFirst = useCallback(\n ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const firstItem = isDestinationPanel ? destinationData[0] : sourceData[0];\n if (firstItem) setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(firstItem));\n },\n [destinationData, setFocusItem, sourceData],\n );\n const trackFocusItemLast = useCallback(\n ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const lastItem = isDestinationPanel\n ? destinationData[destinationData.length - 1]\n : sourceData[sourceData.length - 1];\n if (lastItem) setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(lastItem));\n },\n [destinationData, setFocusItem, sourceData],\n );\n\n return useMemo(\n () => ({\n trackFocusItem: (item: DSShuttleV2T.ConfiguredDatum) => setFocusItem(item.hydratedId),\n trackFocusItemReset: () => setFocusItem(ITEMS_FOCUSES.RESET),\n getCanFocusFirstItem,\n trackFocusItemFirst,\n getCanFocusLastItem,\n trackFocusItemLast,\n trackFocusLoadMoreBtnDestination: () => setFocusItem(ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION),\n trackFocusLoadMoreBtn: () => setFocusItem(ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE),\n trackFocusPrevItem,\n trackFocusNextItem,\n }),\n [\n getCanFocusFirstItem,\n getCanFocusLastItem,\n setFocusItem,\n trackFocusItemFirst,\n trackFocusItemLast,\n trackFocusNextItem,\n trackFocusPrevItem,\n ],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,SAAS,mBAAmB;AAErC,SAAS,kBAAkB,qBAAqB;AAChD,SAAS,qBAAqB;AAEvB,MAAM,sBAAsB,MAAM;AACvC,QAAM,eAAe,iBAAiB,CAAC,UAAU,MAAM,YAAY;AACnE,QAAM,eAAe,iBAAiB,CAAC,UAAU,MAAM,YAAY;AACnE,QAAM,aAAa,cAAc,CAAC,UAAU,MAAM,oBAAoB;AACtE,QAAM,kBAAkB,cAAc,CAAC,UAAU,MAAM,yBAAyB;AAChF,QAAM,qBAAqB,cAAc,CAAC,UAAU,MAAM,kBAAkB;AAC5E,QAAM,0BAA0B,cAAc,CAAC,UAAU,MAAM,uBAAuB;AACtF,QAAM,qBAAqB;AAAA,IACzB,CAAC,EAAE,mBAAmB,MAAkC;AACtD,YAAM,YAAY,aAAa;AAC/B,YAAM,gBAAgB,qBAAqB,kBAAkB;AAC7D,YAAM,eAAe,qBAAqB,0BAA0B;AAEpE,YAAM,mBAAmB,cAAc,UAAU,CAAC,aAAa,SAAS,eAAe,SAAS;AAChG,UAAI,qBAAqB,KAAK;AAC5B,qBAAa,qBAAqB,cAAc,4BAA4B,cAAc,oBAAoB;AAAA,eACvG,qBAAqB,IAAI;AAChC,cAA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,QAAM,sBAAsB;AAAA,IAC1B,CAAC,EAAE,mBAAmB,MAAkC;AACtD,YAAM,YAAY,qBAAqB,gBAAgB,CAAC,IAAI,WAAW,CAAC;AACxE,UAAI,UAAW,cAAa,cAAc,kBAAkB,SAAS,CAAC;AAAA,IACxE;AAAA,IACA,CAAC,iBAAiB,cAAc,UAAU;AAAA,EAC5C;AACA,QAAM,qBAAqB;AAAA,IACzB,CAAC,EAAE,mBAAmB,MAAkC;AACtD,YAAM,WAAW,qBACb,gBAAgB,gBAAgB,SAAS,CAAC,IAC1C,WAAW,WAAW,SAAS,CAAC;AACpC,UAAI,SAAU,cAAa,cAAc,kBAAkB,QAAQ,CAAC;AAAA,IACtE;AAAA,IACA,CAAC,iBAAiB,cAAc,UAAU;AAAA,EAC5C;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,MACL,gBAAgB,CAAC,SAAuC,aAAa,KAAK,UAAU;AAAA,MACpF,qBAAqB,MAAM,aAAa,cAAc,KAAK;AAAA,MAC3D;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,kCAAkC,MAAM,aAAa,cAAc,yBAAyB;AAAA,MAC5F,uBAAuB,MAAM,aAAa,cAAc,oBAAoB;AAAA,MAC5E;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/config/useStore/focusAndTabIndexManager.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { ITEMS_FOCUSES, REGIONS_FOCUSES } from '../../constants/index.js';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types.js';\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { ZustandT } from '@elliemae/ds-zustand-helpers';\nimport { ITEMS_FOCUSES, REGIONS_FOCUSES } from '../../constants/index.js';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types.js';\n\ntype State = readonly [\n DSShuttleV2T.FocusRegion,\n DSShuttleV2T.FocusItem,\n DSShuttleV2T.FocusItemAction,\n () => ZustandT.InternalStore<DSShuttleV2T.InternalAtoms, DSShuttleV2T.Selectors, DSShuttleV2T.Reducers>,\n];\n\nconst getElementFromState = (state: State) => {\n const [focusRegion, focusItem, focusItemAction, get] = state;\n\n const { getZustandRef } = get();\n\n if (\n focusItem === ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE &&\n (focusRegion === REGIONS_FOCUSES.SOURCE_BOTTOM || focusRegion === REGIONS_FOCUSES.SOURCE_PANEL_ITEM)\n ) {\n return getZustandRef([focusItem]);\n }\n if (\n focusItem === ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION &&\n (focusRegion === REGIONS_FOCUSES.DESTINATION_BOTTOM || focusRegion === REGIONS_FOCUSES.DESTINATION_PANEL_ITEM)\n ) {\n return getZustandRef([focusItem]);\n }\n\n return getZustandRef([focusRegion, focusItem, focusItemAction]);\n};\n\nconst isItem = (state: State) =>\n state[2] === 'parent' &&\n state[1] !== ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE &&\n state[1] !== ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION;\n\nconst isMove = (state: State) => state[2] === 'move-btn';\n\nconst isDrilldown = (state: State) => state[2] === 'drilldown-btn';\n\nconst shouldApplyRovingTabIndex = (state: State) => isItem(state) || isMove(state) || isDrilldown(state);\n\nconst tabIndexManager = ({\n selectedState,\n previousSelectedState,\n currentFocusedItem,\n nextFocusedItem,\n}: {\n selectedState: State;\n previousSelectedState: State;\n currentFocusedItem: HTMLElement | null;\n nextFocusedItem: HTMLElement | null;\n}) => {\n if (currentFocusedItem && shouldApplyRovingTabIndex(previousSelectedState)) {\n currentFocusedItem.tabIndex = -1;\n }\n\n if (nextFocusedItem && shouldApplyRovingTabIndex(selectedState)) {\n nextFocusedItem.tabIndex = 0;\n }\n};\n\nexport const focusAndTabIndexManager = (selectedState: State, previousSelectedState: State) => {\n const currentFocusedItem = getElementFromState(previousSelectedState);\n const nextFocusedItem = getElementFromState(selectedState);\n\n const get = selectedState[3];\n const { setDeferFocusUntilFirstRender } = get();\n\n tabIndexManager({ selectedState, previousSelectedState, currentFocusedItem, nextFocusedItem });\n\n if (isItem(selectedState)) {\n // The item on `nextFocusItem` could be an old virtualized item.\n // If this is the case, we should focus it on render too just in case\n setDeferFocusUntilFirstRender(true); // we will reset this flag inside the ref callback of the item\n } else {\n setDeferFocusUntilFirstRender(false);\n }\n\n nextFocusedItem?.focus();\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,eAAe,uBAAuB;AAU/C,MAAM,sBAAsB,CAAC,UAAiB;AAC5C,QAAM,CAAC,aAAa,WAAW,iBAAiB,GAAG,IAAI;AAEvD,QAAM,EAAE,cAAc,IAAI,IAAI;AAE9B,MACE,cAAc,cAAc,yBAC3B,gBAAgB,gBAAgB,iBAAiB,gBAAgB,gBAAgB,oBAClF;AACA,WAAO,cAAc,CAAC,SAAS,CAAC;AAAA,EAClC;AACA,MACE,cAAc,cAAc,8BAC3B,gBAAgB,gBAAgB,sBAAsB,gBAAgB,gBAAgB,yBACvF;AACA,WAAO,cAAc,CAAC,SAAS,CAAC;AAAA,EAClC;AAEA,SAAO,cAAc,CAAC,aAAa,WAAW,eAAe,CAAC;AAChE;AAEA,MAAM,SAAS,CAAC,UACd,MAAM,CAAC,MAAM,YACb,MAAM,CAAC,MAAM,cAAc,wBAC3B,MAAM,CAAC,MAAM,cAAc;AAE7B,MAAM,SAAS,CAAC,UAAiB,MAAM,CAAC,MAAM;AAE9C,MAAM,cAAc,CAAC,UAAiB,MAAM,CAAC,MAAM;AAEnD,MAAM,4BAA4B,CAAC,UAAiB,OAAO,KAAK,KAAK,OAAO,KAAK,KAAK,YAAY,KAAK;AAEvG,MAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAKM;AACJ,MAAI,sBAAsB,0BAA0B,qBAAqB,GAAG;AAC1E,uBAAmB,WAAW;AAAA,EAChC;AAEA,MAAI,mBAAmB,0BAA0B,aAAa,GAAG;AAC/D,oBAAgB,WAAW;AAAA,EAC7B;AACF;AAEO,MAAM,0BAA0B,CAAC,eAAsB,0BAAiC;AAC7F,QAAM,qBAAqB,oBAAoB,qBAAqB;AACpE,QAAM,kBAAkB,oBAAoB,aAAa;AAEzD,QAAM,MAAM,cAAc,CAAC;AAC3B,QAAM,EAAE,8BAA8B,IAAI,IAAI;AAE9C,kBAAgB,EAAE,eAAe,uBAAuB,oBAAoB,gBAAgB,CAAC;AAE7F,MAAI,OAAO,aAAa,GAAG;AAGzB,kCAA8B,IAAI;AAAA,EACpC,OAAO;AACL,kCAA8B,KAAK;AAAA,EACrC;AAEA,mBAAiB,MAAM;AACzB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import React2, { useMemo } from "react";
|
|
4
|
-
import { useHeadlessTooltip } from "@elliemae/ds-hooks-headless-tooltip";
|
|
5
|
-
import { styled, css } from "@elliemae/ds-system";
|
|
6
3
|
import { Grid } from "@elliemae/ds-grid";
|
|
4
|
+
import { useHeadlessTooltip } from "@elliemae/ds-hooks-headless-tooltip";
|
|
5
|
+
import { css, styled } from "@elliemae/ds-system";
|
|
6
|
+
import React2, { useEffect, useMemo } from "react";
|
|
7
7
|
import { DSShuttleV2Name, DSShuttleV2Slots } from "../../config/DSShuttleV2Definitions.js";
|
|
8
8
|
import { useInternalStore, usePropsStore } from "../../config/useStore/index.js";
|
|
9
|
-
import { ItemSelection } from "./ItemSelection.js";
|
|
10
|
-
import { ItemActions } from "./ItemActions/index.js";
|
|
11
|
-
import { ItemMiddleSection } from "./ItemMiddleSection.js";
|
|
12
|
-
import { useSelectionLogic } from "./useSelectionLogic.js";
|
|
13
|
-
import { useItemArrowNavigation } from "./useItemArrowNavigation.js";
|
|
14
9
|
import { REGIONS_FOCUSES } from "../../constants/index.js";
|
|
15
10
|
import { DragHandle } from "../Dnd/DndHandle.js";
|
|
16
11
|
import { DropIndicator } from "../Dnd/DropIndicator.js";
|
|
17
12
|
import { withConditionalUseSortable } from "../HoC/withConditionalUseSortable.js";
|
|
13
|
+
import { ItemActions } from "./ItemActions/index.js";
|
|
18
14
|
import { useInnerRefHandlers as useInnerRefActionHandlers } from "./ItemActions/useInnerRefHandlers.js";
|
|
15
|
+
import { ItemMiddleSection } from "./ItemMiddleSection.js";
|
|
16
|
+
import { ItemSelection } from "./ItemSelection.js";
|
|
17
|
+
import { useItemArrowNavigation } from "./useItemArrowNavigation.js";
|
|
19
18
|
import { useItemKeyboardSelection } from "./useItemKeyboardSelection.js";
|
|
19
|
+
import { useSelectionLogic } from "./useSelectionLogic.js";
|
|
20
20
|
import { useThisItemIsFocused } from "./useThisItemIsFocused.js";
|
|
21
21
|
const cssDisabled = css`
|
|
22
22
|
background-color: ${({ theme }) => theme.colors.neutral["100"]};
|
|
@@ -62,28 +62,34 @@ const useInnerRefHandlers = (itemMeta) => {
|
|
|
62
62
|
const { hydratedId } = datumInternalMeta;
|
|
63
63
|
const setZustandRef = useInternalStore((state) => state.setZustandRef);
|
|
64
64
|
const setDeferFocusUntilFirstRender = useInternalStore((state) => state.setDeferFocusUntilFirstRender);
|
|
65
|
-
const
|
|
65
|
+
const deferedAfterFirstRender = useInternalStore((state) => state.getDeferFocusUntilFirstRender());
|
|
66
|
+
const isLoadingMore = usePropsStore(
|
|
67
|
+
(state) => isDestinationPanel ? state.destinationIsLoadingMore : state.sourceIsLoadingMore
|
|
68
|
+
);
|
|
66
69
|
const thisItemIsFocused = useThisItemIsFocused(itemMeta);
|
|
67
70
|
const currRegion = isDestinationPanel ? REGIONS_FOCUSES.DESTINATION_PANEL_ITEM : REGIONS_FOCUSES.SOURCE_PANEL_ITEM;
|
|
68
71
|
const currItemId = hydratedId;
|
|
69
72
|
const innerRefHandlerParentItem = React2.useCallback(
|
|
70
73
|
(node) => {
|
|
71
74
|
setZustandRef([currRegion, currItemId, "parent"], node);
|
|
72
|
-
if (
|
|
73
|
-
node?.focus();
|
|
75
|
+
if (deferedAfterFirstRender && thisItemIsFocused && node) {
|
|
74
76
|
setDeferFocusUntilFirstRender(false);
|
|
77
|
+
if (node.tabIndex === -1) node.tabIndex = 0;
|
|
78
|
+
node.focus();
|
|
75
79
|
}
|
|
76
80
|
},
|
|
77
|
-
[
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
[setZustandRef, currRegion, currItemId, thisItemIsFocused, deferedAfterFirstRender, setDeferFocusUntilFirstRender]
|
|
82
|
+
);
|
|
83
|
+
useEffect(
|
|
84
|
+
() => () => {
|
|
85
|
+
if (isLoadingMore) setDeferFocusUntilFirstRender(true);
|
|
86
|
+
},
|
|
87
|
+
[isLoadingMore, setDeferFocusUntilFirstRender]
|
|
88
|
+
);
|
|
89
|
+
return React2.useMemo(
|
|
90
|
+
() => ({ innerRefHandlerParentItem, thisItemIsFocused }),
|
|
91
|
+
[innerRefHandlerParentItem, thisItemIsFocused]
|
|
85
92
|
);
|
|
86
|
-
return React2.useMemo(() => ({ innerRefHandlerParentItem }), [innerRefHandlerParentItem]);
|
|
87
93
|
};
|
|
88
94
|
const Item = React2.memo((itemMeta) => {
|
|
89
95
|
const { datumInternalMeta, withDragNDrop, useSortableHelpers, hasMultipleSelection } = itemMeta;
|
|
@@ -113,7 +119,7 @@ const Item = React2.memo((itemMeta) => {
|
|
|
113
119
|
},
|
|
114
120
|
[onItemKeyDownSelection, onItemContainerKeyDown]
|
|
115
121
|
);
|
|
116
|
-
const { innerRefHandlerParentItem } = useInnerRefHandlers(itemMeta);
|
|
122
|
+
const { innerRefHandlerParentItem, thisItemIsFocused } = useInnerRefHandlers(itemMeta);
|
|
117
123
|
const { innerRefHandlerDnd } = useInnerRefActionHandlers(itemMeta);
|
|
118
124
|
const overId = useInternalStore((state) => state.overId);
|
|
119
125
|
const isDropValid = useInternalStore((state) => state.isDropValid);
|
|
@@ -121,7 +127,6 @@ const Item = React2.memo((itemMeta) => {
|
|
|
121
127
|
const showDropIndicatorPosition = hydratedId === overId && dropIndicatorPosition;
|
|
122
128
|
const sortableRef = useSortableHelpers?.setNodeRef ?? (() => {
|
|
123
129
|
});
|
|
124
|
-
const thisItemIsFocused = useThisItemIsFocused(itemMeta);
|
|
125
130
|
const config = React2.useMemo(() => ({ hasFocus: thisItemIsFocused }), [thisItemIsFocused]);
|
|
126
131
|
const tooltipHelpers = useHeadlessTooltip(config);
|
|
127
132
|
const idItem = useMemo(() => `${hydratedId}-wrapper${softDeleted ? "-soft-deleted" : ""}`, [hydratedId, softDeleted]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/Item/Item.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable max-statements */\nimport
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable max-statements */\nimport { Grid } from '@elliemae/ds-grid';\nimport { useHeadlessTooltip } from '@elliemae/ds-hooks-headless-tooltip';\nimport { css, styled } from '@elliemae/ds-system';\nimport React, { useEffect, useMemo } from 'react';\nimport { DSShuttleV2Name, DSShuttleV2Slots } from '../../config/DSShuttleV2Definitions.js';\nimport { useInternalStore, usePropsStore } from '../../config/useStore/index.js';\nimport { REGIONS_FOCUSES } from '../../constants/index.js';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types.js';\nimport { DragHandle } from '../Dnd/DndHandle.js';\nimport { DropIndicator } from '../Dnd/DropIndicator.js';\nimport { withConditionalUseSortable } from '../HoC/withConditionalUseSortable.js';\nimport { ItemActions } from './ItemActions/index.js';\nimport { useInnerRefHandlers as useInnerRefActionHandlers } from './ItemActions/useInnerRefHandlers.js';\nimport { ItemMiddleSection } from './ItemMiddleSection.js';\nimport { ItemSelection } from './ItemSelection.js';\nimport { useItemArrowNavigation } from './useItemArrowNavigation.js';\nimport { useItemKeyboardSelection } from './useItemKeyboardSelection.js';\nimport { useSelectionLogic } from './useSelectionLogic.js';\nimport { useThisItemIsFocused } from './useThisItemIsFocused.js';\n\n// we are using the class-name added via slot for the children `:hover` styling of icon colors\nconst cssDisabled = css`\n background-color: ${({ theme }) => theme.colors.neutral['100']};\n color: ${({ theme }) => theme.colors.neutral['300']};\n .DSShuttleV2-item-action-btn-to-source-icon > svg,\n .DSShuttleV2-item-action-btn-to-destination-icon > svg,\n .DSShuttleV2-item-action-btn-drilldown-icon > svg {\n fill: ${({ theme }) => theme.colors.neutral['300']};\n }\n`;\n\nconst focusRing = css`\n outline: 2px solid ${({ theme }) => theme.colors.brand['700']};\n outline-offset: -2px;\n`;\ninterface ItemWrapperT {\n isDragging: boolean;\n isDndActive: boolean;\n hasFocusRing: boolean;\n}\n\nconst ItemWrapper = styled(Grid, { name: DSShuttleV2Name, slot: DSShuttleV2Slots.ITEM_WRAPPER })<ItemWrapperT>`\n min-height: 2.769rem;\n position: relative;\n background-color: white;\n &:hover {\n background-color: ${({ isDndActive, theme }) => (!isDndActive ? theme.colors.brand['200'] : 'white')};\n .DSShuttleV2-item-action-btn-to-source-icon > svg,\n .DSShuttleV2-item-action-btn-to-destination-icon > svg,\n .DSShuttleV2-item-action-btn-drilldown-icon > svg {\n fill: brand-700;\n }\n ${({ isDragging }) => isDragging && cssDisabled}\n }\n\n ${({ hasFocusRing }) => hasFocusRing && focusRing}\n\n border-bottom: 1px solid neutral-100;\n\n ${({ isDragging }) => isDragging && cssDisabled}\n`;\n\nconst ItemSelectionWrapper = styled(Grid, { name: DSShuttleV2Name, slot: DSShuttleV2Slots.ITEM_CHECKBOX })`\n height: 100%;\n &:focus {\n outline: none;\n }\n`;\n\nconst useInnerRefHandlers = (itemMeta: DSShuttleV2T.ItemMeta) => {\n const { datumInternalMeta, isDestinationPanel } = itemMeta;\n const { hydratedId } = datumInternalMeta;\n const setZustandRef = useInternalStore((state) => state.setZustandRef);\n\n const setDeferFocusUntilFirstRender = useInternalStore((state) => state.setDeferFocusUntilFirstRender);\n const deferedAfterFirstRender = useInternalStore((state) => state.getDeferFocusUntilFirstRender());\n const isLoadingMore = usePropsStore((state) =>\n isDestinationPanel ? state.destinationIsLoadingMore : state.sourceIsLoadingMore,\n );\n\n const thisItemIsFocused = useThisItemIsFocused(itemMeta);\n\n const currRegion = isDestinationPanel ? REGIONS_FOCUSES.DESTINATION_PANEL_ITEM : REGIONS_FOCUSES.SOURCE_PANEL_ITEM;\n const currItemId = hydratedId;\n\n const innerRefHandlerParentItem = React.useCallback(\n (node: HTMLDivElement | null) => {\n setZustandRef([currRegion, currItemId, 'parent'], node);\n if (deferedAfterFirstRender && thisItemIsFocused && node) {\n setDeferFocusUntilFirstRender(false);\n if (node.tabIndex === -1) node.tabIndex = 0;\n node.focus();\n }\n },\n [setZustandRef, currRegion, currItemId, thisItemIsFocused, deferedAfterFirstRender, setDeferFocusUntilFirstRender],\n );\n\n useEffect(\n () => () => {\n if (isLoadingMore) setDeferFocusUntilFirstRender(true);\n },\n [isLoadingMore, setDeferFocusUntilFirstRender],\n );\n\n return React.useMemo(\n () => ({ innerRefHandlerParentItem, thisItemIsFocused }),\n [innerRefHandlerParentItem, thisItemIsFocused],\n );\n};\n\nexport const Item = React.memo((itemMeta: DSShuttleV2T.ItemMeta) => {\n const { datumInternalMeta, withDragNDrop, useSortableHelpers, hasMultipleSelection } = itemMeta;\n const { isSelected, hydratedId, softDeleted } = datumInternalMeta;\n\n const cols = useMemo(() => {\n if (withDragNDrop) return ['5px', 'auto', '1fr', 'auto'];\n return ['5px', '1fr', 'auto'];\n }, [withDragNDrop]);\n\n const setDndDraggingItemMeta = useInternalStore((state) => state.setDndDraggingItemMeta);\n const getIsDragAndDropHappening = useInternalStore((state) => state.getIsDragAndDropHappening);\n const isDraggingThisItem = useInternalStore((state) => state.dndDraggingItem?.hydratedId === hydratedId);\n\n React.useEffect(() => {\n if (isDraggingThisItem) {\n setDndDraggingItemMeta((prevItemMeta) => {\n if (prevItemMeta?.datumInternalMeta.hydratedId === hydratedId) return prevItemMeta;\n return itemMeta;\n });\n }\n }, [hydratedId, isDraggingThisItem, itemMeta, setDndDraggingItemMeta]);\n\n const { selectItem, onShiftMouseDownPreventTextSelection } = useSelectionLogic(itemMeta);\n const { onItemContainerKeyDown } = useItemArrowNavigation(itemMeta);\n const { onItemKeyDownSelection } = useItemKeyboardSelection(itemMeta);\n\n const handleItemKeyDown: React.KeyboardEventHandler<HTMLDivElement> = React.useCallback(\n (event) => {\n onItemKeyDownSelection(event);\n onItemContainerKeyDown(event);\n },\n [onItemKeyDownSelection, onItemContainerKeyDown],\n );\n const { innerRefHandlerParentItem, thisItemIsFocused } = useInnerRefHandlers(itemMeta);\n const { innerRefHandlerDnd } = useInnerRefActionHandlers(itemMeta);\n const overId = useInternalStore((state) => state.overId);\n const isDropValid = useInternalStore((state) => state.isDropValid);\n const dropIndicatorPosition = useInternalStore((state) => state.dropIndicatorPosition);\n\n const showDropIndicatorPosition = hydratedId === overId && dropIndicatorPosition;\n const sortableRef = useSortableHelpers?.setNodeRef ?? (() => {});\n\n // const thisItemIsFocused = useThisItemIsFocused(itemMeta);\n const config = React.useMemo(() => ({ hasFocus: thisItemIsFocused }), [thisItemIsFocused]);\n\n const tooltipHelpers = useHeadlessTooltip(config);\n\n const idItem = useMemo(() => `${hydratedId}-wrapper${softDeleted ? '-soft-deleted' : ''}`, [hydratedId, softDeleted]);\n\n const getOwnerProps = usePropsStore((store) => store.get);\n const getOwnerPropsArguments = React.useCallback(() => itemMeta, [itemMeta]);\n\n return (\n <ItemWrapper\n isDragging={isDraggingThisItem}\n isDndActive={getIsDragAndDropHappening()}\n cols={cols}\n alignItems=\"center\"\n onClick={selectItem}\n innerRef={sortableRef}\n onKeyDown={handleItemKeyDown}\n onMouseDown={onShiftMouseDownPreventTextSelection}\n onMouseEnter={tooltipHelpers.onMouseEnter}\n onMouseLeave={tooltipHelpers.onMouseLeave}\n onPointerEnter={tooltipHelpers.onMouseEnter}\n onPointerLeave={tooltipHelpers.onMouseLeave}\n hasFocusRing={thisItemIsFocused}\n tabIndex={-1}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <ItemSelectionWrapper\n role=\"checkbox\"\n aria-checked={isSelected}\n onFocus={tooltipHelpers.onFocus}\n onBlur={tooltipHelpers.onBlur}\n aria-labelledby={`${hydratedId}-text-section${softDeleted ? '-soft-deleted' : ''}`}\n id={idItem}\n innerRef={innerRefHandlerParentItem}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <ItemSelection {...itemMeta} />\n </ItemSelectionWrapper>\n {withDragNDrop && useSortableHelpers ? (\n <DragHandle\n id={hydratedId}\n useSortableHelpers={useSortableHelpers}\n isDndActive={getIsDragAndDropHappening()}\n isDragging={isDraggingThisItem}\n innerRef={innerRefHandlerDnd}\n disabled={hasMultipleSelection}\n />\n ) : null}\n <ItemMiddleSection {...itemMeta} tooltipHelpers={tooltipHelpers} />\n {!hasMultipleSelection ? <ItemActions {...itemMeta} /> : null}\n <DropIndicator vertical={false} dropIndicatorPosition={showDropIndicatorPosition} isDropValid={isDropValid} />\n </ItemWrapper>\n );\n});\n\nconst ItemSortable = withConditionalUseSortable(Item);\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,UAAU,gBAAgC;AAAA,QAChE,CAAC,uBAAuB,oBAAC,eAAa,GAAG,UAAU,IAAK;AAAA,QACzD,oBAAC,iBAAc,UAAU,OAAO,uBAAuB,2BAA2B,aAA0B;AAAA;AAAA;AAAA,EAC9G;AAEJ,CAAC;AAED,MAAM,eAAe,2BAA2B,IAAI;AAEpD,IAAO,eAAQ;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -7,7 +7,7 @@ const useThisItemIsFocused = (itemMeta) => {
|
|
|
7
7
|
const currRegion = isDestinationPanel ? REGIONS_FOCUSES.DESTINATION_PANEL_ITEM : REGIONS_FOCUSES.SOURCE_PANEL_ITEM;
|
|
8
8
|
const currItemId = hydratedId;
|
|
9
9
|
const thisItemIsFocused = useInternalStore(
|
|
10
|
-
(state) => currRegion === state.focusRegion && currItemId === state.focusItem && "parent"
|
|
10
|
+
(state) => currRegion === state.focusRegion && currItemId === state.focusItem && state.focusItemAction === "parent"
|
|
11
11
|
);
|
|
12
12
|
return thisItemIsFocused;
|
|
13
13
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/Item/useThisItemIsFocused.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { type DSShuttleV2T } from '../../react-desc-prop-types.js';\nimport { useInternalStore } from '../../config/useStore/index.js';\nimport { REGIONS_FOCUSES } from '../../constants/index.js';\n\n// Define a generic type for the useThisItemIsFocused hook to ensure type safety\ntype UseThisItemIsFocused = (itemMeta: DSShuttleV2T.ItemMeta) => boolean;\n\nexport const useThisItemIsFocused: UseThisItemIsFocused = (itemMeta) => {\n const { datumInternalMeta, isDestinationPanel } = itemMeta;\n const { hydratedId } = datumInternalMeta;\n\n const currRegion = isDestinationPanel ? REGIONS_FOCUSES.DESTINATION_PANEL_ITEM : REGIONS_FOCUSES.SOURCE_PANEL_ITEM;\n const currItemId = hydratedId;\n const thisItemIsFocused = useInternalStore(\n (state) => currRegion === state.focusRegion && currItemId === state.focusItem && 'parent'
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAKzB,MAAM,uBAA6C,CAAC,aAAa;AACtE,QAAM,EAAE,mBAAmB,mBAAmB,IAAI;AAClD,QAAM,EAAE,WAAW,IAAI;AAEvB,QAAM,aAAa,qBAAqB,gBAAgB,yBAAyB,gBAAgB;AACjG,QAAM,aAAa;AACnB,QAAM,oBAAoB;AAAA,IACxB,CAAC,UAAU,eAAe,MAAM,eAAe,eAAe,MAAM,aAAa,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { type DSShuttleV2T } from '../../react-desc-prop-types.js';\nimport { useInternalStore } from '../../config/useStore/index.js';\nimport { REGIONS_FOCUSES } from '../../constants/index.js';\n\n// Define a generic type for the useThisItemIsFocused hook to ensure type safety\ntype UseThisItemIsFocused = (itemMeta: DSShuttleV2T.ItemMeta) => boolean;\n\nexport const useThisItemIsFocused: UseThisItemIsFocused = (itemMeta) => {\n const { datumInternalMeta, isDestinationPanel } = itemMeta;\n const { hydratedId } = datumInternalMeta;\n\n const currRegion = isDestinationPanel ? REGIONS_FOCUSES.DESTINATION_PANEL_ITEM : REGIONS_FOCUSES.SOURCE_PANEL_ITEM;\n const currItemId = hydratedId;\n const thisItemIsFocused = useInternalStore(\n (state) => currRegion === state.focusRegion && currItemId === state.focusItem && state.focusItemAction === 'parent',\n );\n\n return thisItemIsFocused;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAKzB,MAAM,uBAA6C,CAAC,aAAa;AACtE,QAAM,EAAE,mBAAmB,mBAAmB,IAAI;AAClD,QAAM,EAAE,WAAW,IAAI;AAEvB,QAAM,aAAa,qBAAqB,gBAAgB,yBAAyB,gBAAgB;AACjG,QAAM,aAAa;AACnB,QAAM,oBAAoB;AAAA,IACxB,CAAC,UAAU,eAAe,MAAM,eAAe,eAAe,MAAM,aAAa,MAAM,oBAAoB;AAAA,EAC7G;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import React2, { useMemo } from "react";
|
|
4
|
-
import { useFontSizeDetector } from "@elliemae/ds-hooks-fontsize-detector";
|
|
5
|
-
import { styled } from "@elliemae/ds-system";
|
|
6
3
|
import { Grid } from "@elliemae/ds-grid";
|
|
4
|
+
import { useFontSizeDetector } from "@elliemae/ds-hooks-fontsize-detector";
|
|
7
5
|
import { useOnBlurOut } from "@elliemae/ds-hooks-on-blur-out";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { styled } from "@elliemae/ds-system";
|
|
7
|
+
import React2, { useMemo } from "react";
|
|
10
8
|
import { DSShuttleV2Name, DSShuttleV2Slots } from "../config/DSShuttleV2Definitions.js";
|
|
11
9
|
import { useFocusTracker } from "../config/useFocusTracker/index.js";
|
|
10
|
+
import { usePropsStore } from "../config/useStore/index.js";
|
|
11
|
+
import { PanelWrapper } from "./PanelWrapper.js";
|
|
12
12
|
const StyledWrapper = styled(Grid, { name: DSShuttleV2Name, slot: DSShuttleV2Slots.WRAPPER })``;
|
|
13
13
|
const layoutWithSmallFont = {
|
|
14
14
|
cols: { small: ["auto"], medium: ["1fr", "1fr"] },
|
|
@@ -33,6 +33,8 @@ const useResizeObserver = (ref) => {
|
|
|
33
33
|
resizeObserver.unobserve(observeTarget);
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
+
return () => {
|
|
37
|
+
};
|
|
36
38
|
}, [ref]);
|
|
37
39
|
return dimensions;
|
|
38
40
|
};
|
|
@@ -56,9 +58,8 @@ const MainContent = React2.memo(() => {
|
|
|
56
58
|
const colsAndRowsLayout = useMemo(() => {
|
|
57
59
|
if (metaInfo.isLarge) {
|
|
58
60
|
return layoutWithBigFont;
|
|
59
|
-
} else {
|
|
60
|
-
return layoutWithSmallFont;
|
|
61
61
|
}
|
|
62
|
+
return layoutWithSmallFont;
|
|
62
63
|
}, [metaInfo]);
|
|
63
64
|
const [ref, setRef] = React2.useState();
|
|
64
65
|
const parentNode = ref?.parentNode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/MainContent.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { Grid } from '@elliemae/ds-grid';\nimport { useFontSizeDetector } from '@elliemae/ds-hooks-fontsize-detector';\nimport { useOnBlurOut } from '@elliemae/ds-hooks-on-blur-out';\nimport { styled } from '@elliemae/ds-system';\nimport React, { useMemo } from 'react';\nimport { DSShuttleV2Name, DSShuttleV2Slots } from '../config/DSShuttleV2Definitions.js';\nimport { useFocusTracker } from '../config/useFocusTracker/index.js';\nimport { usePropsStore } from '../config/useStore/index.js';\nimport { PanelWrapper } from './PanelWrapper.js';\n\nconst StyledWrapper = styled(Grid, { name: DSShuttleV2Name, slot: DSShuttleV2Slots.WRAPPER })``;\n\nconst layoutWithSmallFont = {\n cols: { small: ['auto'], medium: ['1fr', '1fr'] },\n rows: { small: ['1fr', '1fr'], medium: ['auto'] },\n};\nconst layoutWithBigFont = {\n cols: ['auto'],\n rows: ['1fr', '1fr'],\n};\n\ntype ResizeObserverConstructorEntries = Parameters<ConstructorParameters<typeof ResizeObserver>[0]>[0];\n\nconst useResizeObserver = (ref: HTMLElement | null | undefined) => {\n const [dimensions, setDimensions] = React.useState<number>(0);\n\n React.useEffect(() => {\n if (ref) {\n const observeTarget = ref;\n const resizeObserver = new ResizeObserver((entries: ResizeObserverConstructorEntries) => {\n entries.forEach((entry) => {\n setDimensions(Math.ceil(entry.contentRect.height));\n });\n });\n resizeObserver.observe(observeTarget);\n\n return () => {\n resizeObserver.unobserve(observeTarget);\n };\n }\n // No cleanup needed if ref is null or undefined\n return () => {};\n }, [ref]);\n\n return dimensions;\n};\n\n// this custom hook will return the font size of the font detector element\n\nexport const MainContent = React.memo(() => {\n const { trackFocusRegionReset, trackFocusItemReset, trackFocusActionReset } = useFocusTracker();\n const config = React.useMemo(\n () => ({\n onBlur: () => {\n trackFocusRegionReset();\n trackFocusItemReset();\n trackFocusActionReset();\n },\n }),\n [trackFocusActionReset, trackFocusItemReset, trackFocusRegionReset],\n );\n const handleOnBlurOut = useOnBlurOut(config);\n const destinationHasMultipleSelectedItems = usePropsStore((store) => store.destinationHasMultipleSelectedItems);\n const sourceHasMultipleSelectedItems = usePropsStore((store) => store.sourceHasMultipleSelectedItems);\n const getOwnerProps = usePropsStore((store) => store.get);\n\n const metaInfo = useFontSizeDetector();\n\n const colsAndRowsLayout = useMemo(() => {\n if (metaInfo.isLarge) {\n return layoutWithBigFont;\n }\n return layoutWithSmallFont;\n }, [metaInfo]);\n\n const [ref, setRef] = React.useState<HTMLDivElement | null>();\n const parentNode = ref?.parentNode as HTMLElement | null | undefined;\n const height = useResizeObserver(parentNode);\n const finalHeight = height !== 0 ? height : 208;\n return (\n <StyledWrapper\n gutter=\"xs\"\n onBlur={handleOnBlurOut}\n {...colsAndRowsLayout}\n getOwnerProps={getOwnerProps}\n style={{ height: `${finalHeight}px` }}\n innerRef={setRef}\n >\n <PanelWrapper isDestinationPanel={false} hasMultipleSelection={sourceHasMultipleSelectedItems} />\n <PanelWrapper isDestinationPanel hasMultipleSelection={destinationHasMultipleSelectedItems} />\n </StyledWrapper>\n );\n});\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACgFnB,SAQE,KARF;AAhFJ,SAAS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