@pega/cosmos-react-dnd 7.0.0-build.3.3 → 7.0.0-build.30.0
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/lib/components/DragDropManager/DragDropManager.d.ts.map +1 -1
- package/lib/components/DragDropManager/DragDropManager.js +7 -2
- package/lib/components/DragDropManager/DragDropManager.js.map +1 -1
- package/lib/components/StandardDragDropList/StandardDragDropList.d.ts +1 -1
- package/lib/components/StandardDragDropList/StandardDragDropList.d.ts.map +1 -1
- package/lib/components/StandardDragDropList/StandardDragDropList.js +10 -6
- package/lib/components/StandardDragDropList/StandardDragDropList.js.map +1 -1
- package/lib/components/StandardDragDropList/StandardDragDropList.test-ids.d.ts +2 -2
- package/lib/components/StandardDragDropList/StandardDragDropList.test-ids.d.ts.map +1 -1
- package/lib/components/StandardDragDropList/StandardDragDropList.types.d.ts +7 -2
- package/lib/components/StandardDragDropList/StandardDragDropList.types.d.ts.map +1 -1
- package/lib/components/StandardDragDropList/StandardDragDropList.types.js.map +1 -1
- package/package.json +7 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragDropManager.d.ts","sourceRoot":"","sources":["../../../src/components/DragDropManager/DragDropManager.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DragDropManager.d.ts","sourceRoot":"","sources":["../../../src/components/DragDropManager/DragDropManager.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAK1D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,IAAI,CAAC;CACpB;AAED,QAAA,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,CAkB5D,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
2
3
|
import { DndProvider } from 'react-dnd';
|
|
3
|
-
import {
|
|
4
|
+
import { MultiBackend } from 'react-dnd-multi-backend';
|
|
5
|
+
import { HTML5toTouch } from 'rdndmb-html5-to-touch';
|
|
4
6
|
const DragDropManager = ({ children, rootElement }) => {
|
|
5
|
-
|
|
7
|
+
const options = useMemo(() => ({
|
|
8
|
+
backends: [...HTML5toTouch.backends].map(backend => backend.id === 'html5' ? { ...backend, options: { rootElement } } : backend)
|
|
9
|
+
}), [rootElement]);
|
|
10
|
+
return (_jsx(DndProvider, { backend: MultiBackend, options: options, children: children }));
|
|
6
11
|
};
|
|
7
12
|
export default DragDropManager;
|
|
8
13
|
//# sourceMappingURL=DragDropManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragDropManager.js","sourceRoot":"","sources":["../../../src/components/DragDropManager/DragDropManager.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"DragDropManager.js","sourceRoot":"","sources":["../../../src/components/DragDropManager/DragDropManager.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAOrD,MAAM,eAAe,GAA4C,CAAC,EAChE,QAAQ,EACR,WAAW,EACU,EAAE,EAAE;IACzB,MAAM,OAAO,GAAG,OAAO,CACrB,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CACjD,OAAO,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAC5E;KACF,CAAC,EACF,CAAC,WAAW,CAAC,CACd,CAAC;IAEF,OAAO,CACL,KAAC,WAAW,IAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,YACjD,QAAQ,GACG,CACf,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { useMemo } from 'react';\nimport type { FunctionComponent, ReactNode } from 'react';\nimport { DndProvider } from 'react-dnd';\nimport { MultiBackend } from 'react-dnd-multi-backend';\nimport { HTML5toTouch } from 'rdndmb-html5-to-touch';\n\nexport interface DragDropManagerProps {\n children: ReactNode;\n rootElement?: Node;\n}\n\nconst DragDropManager: FunctionComponent<DragDropManagerProps> = ({\n children,\n rootElement\n}: DragDropManagerProps) => {\n const options = useMemo(\n () => ({\n backends: [...HTML5toTouch.backends].map(backend =>\n backend.id === 'html5' ? { ...backend, options: { rootElement } } : backend\n )\n }),\n [rootElement]\n );\n\n return (\n <DndProvider backend={MultiBackend} options={options}>\n {children}\n </DndProvider>\n );\n};\n\nexport default DragDropManager;\n"]}
|
|
@@ -2,7 +2,7 @@ import type { FunctionComponent } from 'react';
|
|
|
2
2
|
import type { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
3
|
import type { StandardDragDropListProps } from './StandardDragDropList.types';
|
|
4
4
|
declare const _default: FunctionComponent<StandardDragDropListProps & ForwardProps> & {
|
|
5
|
-
getTestIds: (testIdProp?: string | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["header"]>;
|
|
5
|
+
getTestIds: (testIdProp?: string | null | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["header"]>;
|
|
6
6
|
};
|
|
7
7
|
export default _default;
|
|
8
8
|
//# sourceMappingURL=StandardDragDropList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardDragDropList.d.ts","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAA+B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"StandardDragDropList.d.ts","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAA+B,MAAM,OAAO,CAAC;AAkB5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAsB5D,OAAO,KAAK,EACV,yBAAyB,EAE1B,MAAM,8BAA8B,CAAC;;;;AA6ZtC,wBAAiF"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useCallback, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { Flex, registerIcon, Icon, Text, Button, useI18n, EmptyState, ExpandCollapse, useUID, Tooltip, useElement, useTestIds, withTestIds } from '@pega/cosmos-react-core';
|
|
3
|
+
import { Flex, registerIcon, Icon, Text, Button, useI18n, EmptyState, ExpandCollapse, useUID, Tooltip, useElement, useTestIds, withTestIds, AdditionalInfo } from '@pega/cosmos-react-core';
|
|
4
4
|
import * as DragIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/drag.icon';
|
|
5
5
|
import * as PlusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/plus.icon';
|
|
6
6
|
import * as CaretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';
|
|
7
|
+
import * as FlagWaveSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/flag-wave-solid.icon';
|
|
8
|
+
import * as WarnSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/warn-solid.icon';
|
|
7
9
|
import DragDropList from '../DragDropList';
|
|
8
10
|
import { StyledStandardDragDropList, StyledStandardDragDropListItem, StyledDragHandle, StyledExpandCollapseToggle, StyledItemActions, StyledItemContent, StyledItemStatus, StyledListItemInner, StyledSecondary } from './StandardDragDropList.styles';
|
|
9
11
|
import { getItemRendererTestIds, getStandardDragDropListTestIds } from './StandardDragDropList.test-ids';
|
|
10
|
-
registerIcon(DragIcon, PlusIcon, CaretDownIcon);
|
|
12
|
+
registerIcon(DragIcon, PlusIcon, CaretDownIcon, FlagWaveSolidIcon, WarnSolidIcon);
|
|
11
13
|
let StandardDragDropList;
|
|
12
14
|
const ItemStatus = ({ message, type }) => {
|
|
13
15
|
const [ttt, setTTT] = useElement(null);
|
|
14
|
-
|
|
16
|
+
const iconName = type === 'warning' ? 'flag-wave-solid' : 'warn-solid';
|
|
17
|
+
return (_jsx(StyledItemStatus, { "aria-live": 'polite', role: 'status', children: message && (_jsx(Text, { variant: 'secondary', status: type, children: _jsxs(Flex, { container: { gap: 0.5 }, children: [_jsx(Icon, { ref: setTTT, name: iconName, role: 'status', tabIndex: 0, "aria-label": type }), _jsx(Tooltip, { target: ttt, "aria-hidden": true, showDelay: 'none', hideDelay: 'none', children: message })] }) })) }));
|
|
15
18
|
};
|
|
16
19
|
const getFlattenedIds = (items) => {
|
|
17
20
|
return items.flatMap(item => {
|
|
@@ -44,7 +47,7 @@ type, accept, primary, secondary, draggable = true, status, items, onConfigure,
|
|
|
44
47
|
}, children: _jsx(Icon, { name: 'trash' }) }) }))] }))] }))] }), data.items && data.items.length > 0 && (_jsx(ExpandCollapse, { collapsed: collapsed, id: expandCollpaseId, children: _jsx(StandardDragDropList, { accept: data.accept, items: data.items, onChange: data.onChange }) }))] }));
|
|
45
48
|
};
|
|
46
49
|
const ItemRendererWithTestIds = withTestIds(ItemRenderer, getItemRendererTestIds);
|
|
47
|
-
StandardDragDropList = forwardRef(function StandardDragDropListFunction({ testId, accept, items: itemsProp, heading: title, footer, onChange: onChangeProp, pushMode, pullMode, headingTag = 'h2', ...restProps }, ref) {
|
|
50
|
+
StandardDragDropList = forwardRef(function StandardDragDropListFunction({ testId, accept, items: itemsProp, heading: title, footer, onChange: onChangeProp, pushMode, pullMode, headingTag = 'h2', additionalInfo, ...restProps }, ref) {
|
|
48
51
|
const flatIds = useMemo(() => getFlattenedIds(itemsProp), [itemsProp]);
|
|
49
52
|
const timerRef = useRef();
|
|
50
53
|
const newItemsRef = useRef();
|
|
@@ -142,12 +145,13 @@ StandardDragDropList = forwardRef(function StandardDragDropListFunction({ testId
|
|
|
142
145
|
onChangeProp(newContentItems);
|
|
143
146
|
}
|
|
144
147
|
}, [onChangeProp, flatIds, mergeChangeHandler]);
|
|
145
|
-
|
|
148
|
+
const heading = title ? _jsx(Text, { variant: headingTag, children: title }) : null;
|
|
149
|
+
return (_jsxs(StyledStandardDragDropList, { ref: ref, ...restProps, children: [heading && (_jsx(Flex, { "data-testid": testIds.header, container: {
|
|
146
150
|
justify: 'between',
|
|
147
151
|
alignItems: 'center',
|
|
148
152
|
gap: 1,
|
|
149
153
|
pad: 1
|
|
150
|
-
}, as: 'header', children:
|
|
154
|
+
}, as: 'header', children: additionalInfo ? (_jsxs(Flex, { container: true, children: [heading, _jsx(AdditionalInfo, { heading: additionalInfo.heading ?? title, children: additionalInfo.content })] })) : (heading) })), _jsx(DragDropList, { testId: testId, accept: accept, items: itemsToRender, pushMode: pushMode, pullMode: pullMode, itemRenderer: ItemRendererWithTestIds, emptyRenderer: EmptyState, onChange: onChange }), footer && (_jsx(Flex, { container: {
|
|
151
155
|
alignItems: 'center',
|
|
152
156
|
itemGap: 1,
|
|
153
157
|
pad: 1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardDragDropList.js","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG3E,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,OAAO,EACP,UAAU,EACV,cAAc,EACd,MAAM,EACN,OAAO,EACP,UAAU,EACV,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EAAE,CAAC;oBACV,GAAG,EAAE,CAAC;iBACP,EACD,EAAE,EAAC,QAAQ,YAEV,MAAM,GACF,CACR,IAC0B,CAC9B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,oBAAoB,EAAE,8BAA8B,CAAC,CAAC","sourcesContent":["import { forwardRef, useCallback, useMemo, useRef, useState } from 'react';\nimport type { FunctionComponent, MouseEvent, PropsWithoutRef } from 'react';\n\nimport {\n Flex,\n registerIcon,\n Icon,\n Text,\n Button,\n useI18n,\n EmptyState,\n ExpandCollapse,\n useUID,\n Tooltip,\n useElement,\n useTestIds,\n withTestIds\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps } from '@pega/cosmos-react-core';\nimport * as DragIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/drag.icon';\nimport * as PlusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/plus.icon';\nimport * as CaretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';\n\nimport DragDropList from '../DragDropList';\nimport type { ItemRendererProps } from '../DragDropList';\nimport type { DraggableItem } from '../Draggable';\n\nimport {\n StyledStandardDragDropList,\n StyledStandardDragDropListItem,\n StyledDragHandle,\n StyledExpandCollapseToggle,\n StyledItemActions,\n StyledItemContent,\n StyledItemStatus,\n StyledListItemInner,\n StyledSecondary\n} from './StandardDragDropList.styles';\nimport type {\n StandardDragDropListProps,\n StandardDragDropListItemProps\n} from './StandardDragDropList.types';\nimport {\n getItemRendererTestIds,\n getStandardDragDropListTestIds\n} from './StandardDragDropList.test-ids';\n\nregisterIcon(DragIcon, PlusIcon, CaretDownIcon);\n\ntype InternalStandardDragDropListItemProps = StandardDragDropListItemProps &\n (\n | {\n items: StandardDragDropListItemProps[];\n accept: StandardDragDropListProps['accept'];\n onChange: StandardDragDropListProps['onChange'];\n }\n | {\n items?: undefined;\n accept?: never;\n onChange?: never;\n }\n );\n\nlet StandardDragDropList: FunctionComponent<StandardDragDropListProps & ForwardProps>;\n\nconst ItemStatus = ({\n message,\n type\n}: Partial<NonNullable<StandardDragDropListItemProps['status']>>) => {\n const [ttt, setTTT] = useElement(null);\n\n return (\n <StyledItemStatus aria-live='polite' role='status'>\n {message && (\n <Text variant='secondary' status='error'>\n <Flex container={{ gap: 0.5 }}>\n <Icon ref={setTTT} name='warn-solid' role='status' tabIndex={0} aria-label={type} />\n <Tooltip target={ttt} aria-hidden showDelay='none' hideDelay='none'>\n {message}\n </Tooltip>\n </Flex>\n </Text>\n )}\n </StyledItemStatus>\n );\n};\n\nconst getFlattenedIds = (\n items: StandardDragDropListItemProps[]\n): StandardDragDropListItemProps['id'][] => {\n return items.flatMap(item => {\n return item.items ? [item.id, ...item.items.map(({ id }) => id)] : [item.id];\n });\n};\n\nconst ItemRenderer = ({\n testId,\n dragRef,\n previewRef,\n isDragging,\n data: {\n id,\n // Remove type for DOM restProps\n type,\n accept,\n primary,\n secondary,\n draggable = true,\n status,\n items,\n onConfigure,\n onRemove,\n onAddTo,\n onChange,\n ...restProps\n },\n data\n}: ItemRendererProps<InternalStandardDragDropListItemProps>) => {\n const t = useI18n();\n const [collapsed, setCollapsed] = useState(false);\n const expandCollpaseId = useUID();\n const testIds = useTestIds(testId, getItemRendererTestIds);\n\n const hasActions = !!(onConfigure ?? onRemove ?? onAddTo);\n\n const primaryEl = useMemo(() => {\n if (items) {\n return (\n <StyledExpandCollapseToggle\n data-testid={testIds.expandCollapseButton}\n variant='text'\n aria-label={`${primary}. ${collapsed ? t('expand') : t('collapse')}.`}\n onClick={() => setCollapsed(cur => !cur)}\n aria-owns={expandCollpaseId}\n aria-expanded={collapsed ? 'false' : 'true'}\n >\n <Flex container={{ inline: true, alignItems: 'center', gap: 0.5 }}>\n <Icon name='caret-down' />\n <span>{primary}</span>\n </Flex>\n </StyledExpandCollapseToggle>\n );\n }\n\n if (typeof primary === 'string') {\n return <span>{primary}</span>;\n }\n\n return (\n <Button variant='link' onClick={primary.onClick} href={primary.href}>\n <span>{primary.text}</span>\n </Button>\n );\n }, [t, items, primary, collapsed, expandCollpaseId]);\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n container={{ direction: 'column' }}\n as={StyledStandardDragDropListItem}\n ref={previewRef}\n isDragging={isDragging}\n >\n <Flex container={{ alignItems: 'center' }} as={StyledListItemInner}>\n {draggable && (\n <StyledDragHandle ref={dragRef} data-testid={testIds.dragHandle}>\n <Icon name='drag' />\n </StyledDragHandle>\n )}\n\n <Flex container={{ alignItems: 'center', gap: 0.5 }} item={{ grow: 1 }}>\n <Flex\n container={{ alignItems: 'center', gap: status ? 0.5 : undefined, pad: 0.25 }}\n item={{ grow: 1 }}\n as={StyledItemContent}\n >\n <ItemStatus type={status?.type} message={status?.message} />\n\n {primaryEl}\n </Flex>\n </Flex>\n\n {(secondary || hasActions) && (\n <Flex container={{ alignItems: 'center', gap: 0.5 }}>\n {secondary && <StyledSecondary variant='secondary'>{secondary}</StyledSecondary>}\n\n {hasActions && (\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as={StyledItemActions}>\n {onAddTo && (\n <span>\n <Button\n data-testid={testIds.addButton}\n icon\n variant='simple'\n label={t('add')}\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n onAddTo?.(id, e);\n }}\n >\n <Icon name='plus' />\n </Button>\n </span>\n )}\n\n {onConfigure && (\n <span>\n <Button\n data-testid={testIds.configureButton}\n icon\n variant='simple'\n label={t('configure')}\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n onConfigure?.(id, e);\n }}\n >\n <Icon name='gear' />\n </Button>\n </span>\n )}\n\n {onRemove && (\n <span>\n <Button\n data-testid={testIds.removeButton}\n icon\n variant='simple'\n label={t('remove')}\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n onRemove?.(id, e);\n }}\n >\n <Icon name='trash' />\n </Button>\n </span>\n )}\n </Flex>\n )}\n </Flex>\n )}\n </Flex>\n\n {/* Using data here so TS can track conditional type. */}\n {data.items && data.items.length > 0 && (\n <ExpandCollapse collapsed={collapsed} id={expandCollpaseId}>\n <StandardDragDropList accept={data.accept} items={data.items} onChange={data.onChange} />\n </ExpandCollapse>\n )}\n </Flex>\n );\n};\n\nconst ItemRendererWithTestIds = withTestIds(ItemRenderer, getItemRendererTestIds);\n\nStandardDragDropList = forwardRef(function StandardDragDropListFunction(\n {\n testId,\n accept,\n items: itemsProp,\n heading: title,\n footer,\n onChange: onChangeProp,\n pushMode,\n pullMode,\n headingTag = 'h2',\n ...restProps\n }: PropsWithoutRef<StandardDragDropListProps>,\n ref: StandardDragDropListProps['ref']\n) {\n const flatIds = useMemo(() => getFlattenedIds(itemsProp), [itemsProp]);\n\n const timerRef = useRef<number>();\n const newItemsRef = useRef<StandardDragDropListItemProps[]>();\n\n const testIds = useTestIds(testId, getStandardDragDropListTestIds);\n\n const mergeChangeHandler = useCallback(\n (newItems: StandardDragDropListItemProps[]) => {\n if (typeof timerRef.current === 'number' && newItemsRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = undefined;\n const refedItems = newItemsRef.current;\n newItemsRef.current = undefined;\n\n const reffedItemsCount = getFlattenedIds(refedItems).length;\n const newItemsCount = getFlattenedIds(newItems).length;\n\n // Item moved between the top level list and nested list.\n if (Math.abs(reffedItemsCount - newItemsCount) === 2) {\n const itemsWithDuplicate = reffedItemsCount > newItemsCount ? refedItems : newItems;\n\n const flatItemsWithDuplicate = getFlattenedIds(itemsWithDuplicate);\n\n const duplicateItemId = flatItemsWithDuplicate.find(\n (id, idx) => flatItemsWithDuplicate.indexOf(id) !== idx\n );\n\n // Should never happen.\n if (!duplicateItemId) return;\n\n // The duplicate was top level before.\n if (itemsProp.some(({ id }) => id === duplicateItemId)) {\n onChangeProp(itemsWithDuplicate.filter(({ id }) => id !== duplicateItemId));\n }\n\n // The duplicate was nested before.\n else {\n onChangeProp(\n itemsWithDuplicate.map(innerItem => {\n if (!innerItem.items) return innerItem;\n\n if (\n itemsProp\n .find(({ id }) => id === innerItem.id)\n ?.items?.some(({ id: subItemId }) => subItemId === duplicateItemId)\n ) {\n return {\n ...innerItem,\n items: innerItem.items.filter(({ id }) => id !== duplicateItemId)\n };\n }\n\n return innerItem;\n })\n );\n }\n } else {\n // Failsafe for two unrelated change events within 100ms.\n onChangeProp(refedItems);\n onChangeProp(newItems);\n }\n } else {\n newItemsRef.current = newItems;\n timerRef.current = window.setTimeout(() => {\n onChangeProp(newItems);\n }, 100);\n }\n },\n [onChangeProp, itemsProp]\n );\n\n const itemsToRender: DraggableItem<InternalStandardDragDropListItemProps>[] = useMemo(\n () =>\n itemsProp.map(item => {\n const newItem = {\n id: item.id,\n type: item.type,\n data: item as InternalStandardDragDropListItemProps\n };\n if (!item.items) return newItem;\n\n return {\n ...newItem,\n data: {\n ...item,\n accept: item.accept ?? accept,\n onChange: (newItems: InternalStandardDragDropListItemProps[]) => {\n const newContentItems = itemsProp.map(topLevelItem =>\n topLevelItem.id === item.id && topLevelItem.items\n ? { ...topLevelItem, items: newItems }\n : topLevelItem\n );\n\n const flatNewItems = getFlattenedIds(newContentItems);\n\n if (\n itemsProp.some(propItem => !!propItem.items) &&\n flatIds.length !== flatNewItems.length\n ) {\n // An item may be \"removed\" or \"duplicated\".\n mergeChangeHandler(newContentItems);\n } else {\n onChangeProp(newContentItems);\n }\n }\n } as InternalStandardDragDropListItemProps\n };\n }),\n [accept, itemsProp, onChangeProp, flatIds, mergeChangeHandler]\n );\n\n const onChange = useCallback(\n (newItems: DraggableItem<InternalStandardDragDropListItemProps>[]) => {\n const newContentItems = newItems.map(({ data: { onChange: _, ...data } }) => {\n return data;\n });\n const flatNewItems = getFlattenedIds(newContentItems);\n\n if (itemsProp.some(propItem => !!propItem.items) && flatIds.length !== flatNewItems.length) {\n // An item may be \"removed\" or \"duplicated\".\n mergeChangeHandler(newContentItems);\n } else {\n onChangeProp(newContentItems);\n }\n },\n [onChangeProp, flatIds, mergeChangeHandler]\n );\n\n return (\n <StyledStandardDragDropList ref={ref} {...restProps}>\n {title && (\n <Flex\n data-testid={testIds.header}\n container={{\n justify: 'between',\n alignItems: 'center',\n gap: 1,\n pad: 1\n }}\n as='header'\n >\n <Text variant={headingTag}>{title}</Text>\n </Flex>\n )}\n <DragDropList\n testId={testId}\n accept={accept}\n items={itemsToRender}\n pushMode={pushMode}\n pullMode={pullMode}\n itemRenderer={ItemRendererWithTestIds}\n emptyRenderer={EmptyState}\n onChange={onChange}\n />\n {footer && (\n <Flex\n container={{\n alignItems: 'center',\n itemGap: 1,\n pad: 1\n }}\n as='footer'\n >\n {footer}\n </Flex>\n )}\n </StyledStandardDragDropList>\n );\n});\n\nexport default withTestIds(StandardDragDropList, getStandardDragDropListTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"StandardDragDropList.js","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG3E,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,OAAO,EACP,UAAU,EACV,cAAc,EACd,MAAM,EACN,OAAO,EACP,UAAU,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AACxF,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AACxF,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,iBAAiB,MAAM,wEAAwE,CAAC;AAC5G,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AAEnG,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAI3C,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,EAC9B,gBAAgB,EAChB,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EAChB,MAAM,+B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EAAE;oBACT,UAAU,EAAE,QAAQ;oBACpB,OAAO,EAAE,CAAC;oBACV,GAAG,EAAE,CAAC;iBACP,EACD,EAAE,EAAC,QAAQ,YAEV,MAAM,GACF,CACR,IAC0B,CAC9B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,oBAAoB,EAAE,8BAA8B,CAAC,CAAC","sourcesContent":["import { forwardRef, useCallback, useMemo, useRef, useState } from 'react';\nimport type { FunctionComponent, MouseEvent, PropsWithoutRef } from 'react';\n\nimport {\n Flex,\n registerIcon,\n Icon,\n Text,\n Button,\n useI18n,\n EmptyState,\n ExpandCollapse,\n useUID,\n Tooltip,\n useElement,\n useTestIds,\n withTestIds,\n AdditionalInfo\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps } from '@pega/cosmos-react-core';\nimport * as DragIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/drag.icon';\nimport * as PlusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/plus.icon';\nimport * as CaretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';\nimport * as FlagWaveSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/flag-wave-solid.icon';\nimport * as WarnSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/warn-solid.icon';\n\nimport DragDropList from '../DragDropList';\nimport type { ItemRendererProps } from '../DragDropList';\nimport type { DraggableItem } from '../Draggable';\n\nimport {\n StyledStandardDragDropList,\n StyledStandardDragDropListItem,\n StyledDragHandle,\n StyledExpandCollapseToggle,\n StyledItemActions,\n StyledItemContent,\n StyledItemStatus,\n StyledListItemInner,\n StyledSecondary\n} from './StandardDragDropList.styles';\nimport type {\n StandardDragDropListProps,\n StandardDragDropListItemProps\n} from './StandardDragDropList.types';\nimport {\n getItemRendererTestIds,\n getStandardDragDropListTestIds\n} from './StandardDragDropList.test-ids';\n\nregisterIcon(DragIcon, PlusIcon, CaretDownIcon, FlagWaveSolidIcon, WarnSolidIcon);\n\ntype InternalStandardDragDropListItemProps = StandardDragDropListItemProps &\n (\n | {\n items: StandardDragDropListItemProps[];\n accept: StandardDragDropListProps['accept'];\n onChange: StandardDragDropListProps['onChange'];\n }\n | {\n items?: undefined;\n accept?: never;\n onChange?: never;\n }\n );\n\nlet StandardDragDropList: FunctionComponent<StandardDragDropListProps & ForwardProps>;\n\nconst ItemStatus = ({\n message,\n type\n}: Partial<NonNullable<StandardDragDropListItemProps['status']>>) => {\n const [ttt, setTTT] = useElement(null);\n const iconName = type === 'warning' ? 'flag-wave-solid' : 'warn-solid';\n\n return (\n <StyledItemStatus aria-live='polite' role='status'>\n {message && (\n <Text variant='secondary' status={type}>\n <Flex container={{ gap: 0.5 }}>\n <Icon ref={setTTT} name={iconName} role='status' tabIndex={0} aria-label={type} />\n <Tooltip target={ttt} aria-hidden showDelay='none' hideDelay='none'>\n {message}\n </Tooltip>\n </Flex>\n </Text>\n )}\n </StyledItemStatus>\n );\n};\n\nconst getFlattenedIds = (\n items: StandardDragDropListItemProps[]\n): StandardDragDropListItemProps['id'][] => {\n return items.flatMap(item => {\n return item.items ? [item.id, ...item.items.map(({ id }) => id)] : [item.id];\n });\n};\n\nconst ItemRenderer = ({\n testId,\n dragRef,\n previewRef,\n isDragging,\n data: {\n id,\n // Remove type for DOM restProps\n type,\n accept,\n primary,\n secondary,\n draggable = true,\n status,\n items,\n onConfigure,\n onRemove,\n onAddTo,\n onChange,\n ...restProps\n },\n data\n}: ItemRendererProps<InternalStandardDragDropListItemProps>) => {\n const t = useI18n();\n const [collapsed, setCollapsed] = useState(false);\n const expandCollpaseId = useUID();\n const testIds = useTestIds(testId, getItemRendererTestIds);\n\n const hasActions = !!(onConfigure ?? onRemove ?? onAddTo);\n\n const primaryEl = useMemo(() => {\n if (items) {\n return (\n <StyledExpandCollapseToggle\n data-testid={testIds.expandCollapseButton}\n variant='text'\n aria-label={`${primary}. ${collapsed ? t('expand') : t('collapse')}.`}\n onClick={() => setCollapsed(cur => !cur)}\n aria-owns={expandCollpaseId}\n aria-expanded={collapsed ? 'false' : 'true'}\n >\n <Flex container={{ inline: true, alignItems: 'center', gap: 0.5 }}>\n <Icon name='caret-down' />\n <span>{primary}</span>\n </Flex>\n </StyledExpandCollapseToggle>\n );\n }\n\n if (typeof primary === 'string') {\n return <span>{primary}</span>;\n }\n\n return (\n <Button variant='link' onClick={primary.onClick} href={primary.href}>\n <span>{primary.text}</span>\n </Button>\n );\n }, [t, items, primary, collapsed, expandCollpaseId]);\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n container={{ direction: 'column' }}\n as={StyledStandardDragDropListItem}\n ref={previewRef}\n isDragging={isDragging}\n >\n <Flex container={{ alignItems: 'center' }} as={StyledListItemInner}>\n {draggable && (\n <StyledDragHandle ref={dragRef} data-testid={testIds.dragHandle}>\n <Icon name='drag' />\n </StyledDragHandle>\n )}\n\n <Flex container={{ alignItems: 'center', gap: 0.5 }} item={{ grow: 1 }}>\n <Flex\n container={{ alignItems: 'center', gap: status ? 0.5 : undefined, pad: 0.25 }}\n item={{ grow: 1 }}\n as={StyledItemContent}\n >\n <ItemStatus type={status?.type} message={status?.message} />\n\n {primaryEl}\n </Flex>\n </Flex>\n\n {(secondary || hasActions) && (\n <Flex container={{ alignItems: 'center', gap: 0.5 }}>\n {secondary && <StyledSecondary variant='secondary'>{secondary}</StyledSecondary>}\n\n {hasActions && (\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as={StyledItemActions}>\n {onAddTo && (\n <span>\n <Button\n data-testid={testIds.addButton}\n icon\n variant='simple'\n label={t('add')}\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n onAddTo?.(id, e);\n }}\n >\n <Icon name='plus' />\n </Button>\n </span>\n )}\n\n {onConfigure && (\n <span>\n <Button\n data-testid={testIds.configureButton}\n icon\n variant='simple'\n label={t('configure')}\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n onConfigure?.(id, e);\n }}\n >\n <Icon name='gear' />\n </Button>\n </span>\n )}\n\n {onRemove && (\n <span>\n <Button\n data-testid={testIds.removeButton}\n icon\n variant='simple'\n label={t('remove')}\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n onRemove?.(id, e);\n }}\n >\n <Icon name='trash' />\n </Button>\n </span>\n )}\n </Flex>\n )}\n </Flex>\n )}\n </Flex>\n\n {/* Using data here so TS can track conditional type. */}\n {data.items && data.items.length > 0 && (\n <ExpandCollapse collapsed={collapsed} id={expandCollpaseId}>\n <StandardDragDropList accept={data.accept} items={data.items} onChange={data.onChange} />\n </ExpandCollapse>\n )}\n </Flex>\n );\n};\n\nconst ItemRendererWithTestIds = withTestIds(ItemRenderer, getItemRendererTestIds);\n\nStandardDragDropList = forwardRef(function StandardDragDropListFunction(\n {\n testId,\n accept,\n items: itemsProp,\n heading: title,\n footer,\n onChange: onChangeProp,\n pushMode,\n pullMode,\n headingTag = 'h2',\n additionalInfo,\n ...restProps\n }: PropsWithoutRef<StandardDragDropListProps>,\n ref: StandardDragDropListProps['ref']\n) {\n const flatIds = useMemo(() => getFlattenedIds(itemsProp), [itemsProp]);\n\n const timerRef = useRef<number>();\n const newItemsRef = useRef<StandardDragDropListItemProps[]>();\n\n const testIds = useTestIds(testId, getStandardDragDropListTestIds);\n\n const mergeChangeHandler = useCallback(\n (newItems: StandardDragDropListItemProps[]) => {\n if (typeof timerRef.current === 'number' && newItemsRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = undefined;\n const refedItems = newItemsRef.current;\n newItemsRef.current = undefined;\n\n const reffedItemsCount = getFlattenedIds(refedItems).length;\n const newItemsCount = getFlattenedIds(newItems).length;\n\n // Item moved between the top level list and nested list.\n if (Math.abs(reffedItemsCount - newItemsCount) === 2) {\n const itemsWithDuplicate = reffedItemsCount > newItemsCount ? refedItems : newItems;\n\n const flatItemsWithDuplicate = getFlattenedIds(itemsWithDuplicate);\n\n const duplicateItemId = flatItemsWithDuplicate.find(\n (id, idx) => flatItemsWithDuplicate.indexOf(id) !== idx\n );\n\n // Should never happen.\n if (!duplicateItemId) return;\n\n // The duplicate was top level before.\n if (itemsProp.some(({ id }) => id === duplicateItemId)) {\n onChangeProp(itemsWithDuplicate.filter(({ id }) => id !== duplicateItemId));\n }\n\n // The duplicate was nested before.\n else {\n onChangeProp(\n itemsWithDuplicate.map(innerItem => {\n if (!innerItem.items) return innerItem;\n\n if (\n itemsProp\n .find(({ id }) => id === innerItem.id)\n ?.items?.some(({ id: subItemId }) => subItemId === duplicateItemId)\n ) {\n return {\n ...innerItem,\n items: innerItem.items.filter(({ id }) => id !== duplicateItemId)\n };\n }\n\n return innerItem;\n })\n );\n }\n } else {\n // Failsafe for two unrelated change events within 100ms.\n onChangeProp(refedItems);\n onChangeProp(newItems);\n }\n } else {\n newItemsRef.current = newItems;\n timerRef.current = window.setTimeout(() => {\n onChangeProp(newItems);\n }, 100);\n }\n },\n [onChangeProp, itemsProp]\n );\n\n const itemsToRender: DraggableItem<InternalStandardDragDropListItemProps>[] = useMemo(\n () =>\n itemsProp.map(item => {\n const newItem = {\n id: item.id,\n type: item.type,\n data: item as InternalStandardDragDropListItemProps\n };\n if (!item.items) return newItem;\n\n return {\n ...newItem,\n data: {\n ...item,\n accept: item.accept ?? accept,\n onChange: (newItems: InternalStandardDragDropListItemProps[]) => {\n const newContentItems = itemsProp.map(topLevelItem =>\n topLevelItem.id === item.id && topLevelItem.items\n ? { ...topLevelItem, items: newItems }\n : topLevelItem\n );\n\n const flatNewItems = getFlattenedIds(newContentItems);\n\n if (\n itemsProp.some(propItem => !!propItem.items) &&\n flatIds.length !== flatNewItems.length\n ) {\n // An item may be \"removed\" or \"duplicated\".\n mergeChangeHandler(newContentItems);\n } else {\n onChangeProp(newContentItems);\n }\n }\n } as InternalStandardDragDropListItemProps\n };\n }),\n [accept, itemsProp, onChangeProp, flatIds, mergeChangeHandler]\n );\n\n const onChange = useCallback(\n (newItems: DraggableItem<InternalStandardDragDropListItemProps>[]) => {\n const newContentItems = newItems.map(({ data: { onChange: _, ...data } }) => {\n return data;\n });\n const flatNewItems = getFlattenedIds(newContentItems);\n\n if (itemsProp.some(propItem => !!propItem.items) && flatIds.length !== flatNewItems.length) {\n // An item may be \"removed\" or \"duplicated\".\n mergeChangeHandler(newContentItems);\n } else {\n onChangeProp(newContentItems);\n }\n },\n [onChangeProp, flatIds, mergeChangeHandler]\n );\n\n const heading = title ? <Text variant={headingTag}>{title}</Text> : null;\n\n return (\n <StyledStandardDragDropList ref={ref} {...restProps}>\n {heading && (\n <Flex\n data-testid={testIds.header}\n container={{\n justify: 'between',\n alignItems: 'center',\n gap: 1,\n pad: 1\n }}\n as='header'\n >\n {additionalInfo ? (\n <Flex container>\n {heading}\n {/* Can assert title when heading is defined */}\n <AdditionalInfo heading={additionalInfo.heading ?? title!}>\n {additionalInfo.content}\n </AdditionalInfo>\n </Flex>\n ) : (\n heading\n )}\n </Flex>\n )}\n <DragDropList\n testId={testId}\n accept={accept}\n items={itemsToRender}\n pushMode={pushMode}\n pullMode={pullMode}\n itemRenderer={ItemRendererWithTestIds}\n emptyRenderer={EmptyState}\n onChange={onChange}\n />\n {footer && (\n <Flex\n container={{\n alignItems: 'center',\n itemGap: 1,\n pad: 1\n }}\n as='footer'\n >\n {footer}\n </Flex>\n )}\n </StyledStandardDragDropList>\n );\n});\n\nexport default withTestIds(StandardDragDropList, getStandardDragDropListTestIds);\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const getItemRendererTestIds: (testIdProp?: string | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["expand-collapse-button", "add-button", "configure-button", "remove-button", "drag-handle"]>;
|
|
2
|
-
export declare const getStandardDragDropListTestIds: (testIdProp?: string | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["header"]>;
|
|
1
|
+
export declare const getItemRendererTestIds: (testIdProp?: string | null | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["expand-collapse-button", "add-button", "configure-button", "remove-button", "drag-handle"]>;
|
|
2
|
+
export declare const getStandardDragDropListTestIds: (testIdProp?: string | null | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["header"]>;
|
|
3
3
|
//# sourceMappingURL=StandardDragDropList.test-ids.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardDragDropList.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"StandardDragDropList.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,oMAMxB,CAAC;AAEZ,eAAO,MAAM,8BAA8B,kHAEhC,CAAC"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { MouseEvent, MouseEventHandler, ReactNode, Ref } from 'react';
|
|
2
|
-
import type { TestIdProp, OmitStrict, BaseProps, NoChildrenProp, ForwardProps, HeadingTag } from '@pega/cosmos-react-core';
|
|
2
|
+
import type { TestIdProp, OmitStrict, BaseProps, NoChildrenProp, ForwardProps, HeadingTag, AdditionalInfoProps } from '@pega/cosmos-react-core';
|
|
3
3
|
import type { DragDropListProps } from '../DragDropList';
|
|
4
4
|
export interface StandardDragDropListProps extends OmitStrict<DragDropListProps<StandardDragDropListItemProps>, 'dragHandles' | 'itemRenderer' | 'emptyRenderer' | 'items' | 'onChange'>, BaseProps, NoChildrenProp, TestIdProp {
|
|
5
5
|
/** The contents of the list. */
|
|
6
6
|
items: StandardDragDropListItemProps[];
|
|
7
7
|
/** A title for the list. */
|
|
8
8
|
heading?: string;
|
|
9
|
+
/** Renders a button that when clicked presents additional information for the list. */
|
|
10
|
+
additionalInfo?: {
|
|
11
|
+
heading?: AdditionalInfoProps['heading'];
|
|
12
|
+
content: AdditionalInfoProps['children'];
|
|
13
|
+
};
|
|
9
14
|
/**
|
|
10
15
|
* Select the heading tag for header
|
|
11
16
|
* @default h2
|
|
@@ -37,7 +42,7 @@ export type StandardDragDropListItemProps = ForwardProps & {
|
|
|
37
42
|
secondary?: string;
|
|
38
43
|
/** Presents the item as being in an invalidate state. */
|
|
39
44
|
status?: {
|
|
40
|
-
type: 'error';
|
|
45
|
+
type: 'error' | 'warning';
|
|
41
46
|
message: string;
|
|
42
47
|
};
|
|
43
48
|
/** Whether or not the item can be reordered with drag. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardDragDropList.types.d.ts","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE3E,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,cAAc,EACd,YAAY,EACZ,UAAU,
|
|
1
|
+
{"version":3,"file":"StandardDragDropList.types.d.ts","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE3E,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,cAAc,EACd,YAAY,EACZ,UAAU,EACV,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,WAAW,yBACf,SAAQ,UAAU,CACd,iBAAiB,CAAC,6BAA6B,CAAC,EAChD,aAAa,GAAG,cAAc,GAAG,eAAe,GAAG,OAAO,GAAG,UAAU,CACxE,EACD,SAAS,EACT,cAAc,EACd,UAAU;IACZ,gCAAgC;IAChC,KAAK,EAAE,6BAA6B,EAAE,CAAC;IACvC,4BAA4B;IAC5B,OAAO,CAAC,EAAE,M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AAsD;IACtD,KAAK,EAAE,6BAA6B,EAAE,CAAC;IACvC,kHAAkH;IAClH,MAAM,CAAC,EAAE,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IAC7C,6DAA6D;IAC7D,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB,GACD;IACE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB,CACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardDragDropList.types.js","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MouseEvent, MouseEventHandler, ReactNode, Ref } from 'react';\n\nimport type {\n TestIdProp,\n OmitStrict,\n BaseProps,\n NoChildrenProp,\n ForwardProps,\n HeadingTag\n} from '@pega/cosmos-react-core';\n\nimport type { DragDropListProps } from '../DragDropList';\n\nexport interface StandardDragDropListProps\n extends OmitStrict<\n DragDropListProps<StandardDragDropListItemProps>,\n 'dragHandles' | 'itemRenderer' | 'emptyRenderer' | 'items' | 'onChange'\n >,\n BaseProps,\n NoChildrenProp,\n TestIdProp {\n /** The contents of the list. */\n items: StandardDragDropListItemProps[];\n /** A title for the list. */\n heading?: string;\n /**\n * Select the heading tag for header\n * @default h2\n */\n headingTag?: HeadingTag;\n /** A region for various list level actions */\n footer?: ReactNode;\n /**\n * Called when the list's content changes by way of drag for reorder, add or remove.\n * The handler is provided an array of items representing the new state.\n */\n onChange: (items: StandardDragDropListProps['items']) => void;\n /** A ref to the root HTMLElement for the component. */\n ref?: Ref<HTMLDivElement>;\n}\n\ntype ItemAction = (\n id: StandardDragDropListItemProps['id'],\n e: MouseEvent<HTMLButtonElement>\n) => void;\n\nexport type StandardDragDropListItemProps = ForwardProps & {\n /** An identifier unique within the entire list hierarchy. */\n id: string;\n /** Indicates the type of item for determining drop acceptance by a target list. */\n type: string;\n /** The primary textual representation for the item or props for a linkable resource. */\n primary: string | ({ text: string; onClick: MouseEventHandler; href?: string } & ForwardProps);\n /** An additional textual representation for the item e.g. metadata. */\n secondary?: string;\n /** Presents the item as being in an invalidate state. */\n status?: {\n type: 'error';\n message: string;\n };\n /** Whether or not the item can be reordered with drag. */\n draggable?: boolean;\n /**\n * If the item is configurable pass a callback to render a button.\n * The item's id and an event argument provides access to the underlying HTMLButtonElement.\n */\n onConfigure?: ItemAction;\n /**\n * If the item can be removed form the list pass a callback to render a button.\n * The handler's event argument provides access to the underlying HTMLButtonElement.\n */\n onRemove?: ItemAction;\n} & (\n | {\n /** If the item can possess a nested list of items. */\n items: StandardDragDropListItemProps[];\n /** Type of items allowed to be dropped on the list. If not passed it will inherit accept from the parent list. */\n accept?: StandardDragDropListProps['accept'];\n /** Optionally render an add button for parent item types. */\n onAddTo?: ItemAction;\n }\n | {\n items?: undefined;\n accept?: never;\n onAddTo?: never;\n }\n );\n"]}
|
|
1
|
+
{"version":3,"file":"StandardDragDropList.types.js","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MouseEvent, MouseEventHandler, ReactNode, Ref } from 'react';\n\nimport type {\n TestIdProp,\n OmitStrict,\n BaseProps,\n NoChildrenProp,\n ForwardProps,\n HeadingTag,\n AdditionalInfoProps\n} from '@pega/cosmos-react-core';\n\nimport type { DragDropListProps } from '../DragDropList';\n\nexport interface StandardDragDropListProps\n extends OmitStrict<\n DragDropListProps<StandardDragDropListItemProps>,\n 'dragHandles' | 'itemRenderer' | 'emptyRenderer' | 'items' | 'onChange'\n >,\n BaseProps,\n NoChildrenProp,\n TestIdProp {\n /** The contents of the list. */\n items: StandardDragDropListItemProps[];\n /** A title for the list. */\n heading?: string;\n /** Renders a button that when clicked presents additional information for the list. */\n additionalInfo?: {\n heading?: AdditionalInfoProps['heading'];\n content: AdditionalInfoProps['children'];\n };\n /**\n * Select the heading tag for header\n * @default h2\n */\n headingTag?: HeadingTag;\n /** A region for various list level actions */\n footer?: ReactNode;\n /**\n * Called when the list's content changes by way of drag for reorder, add or remove.\n * The handler is provided an array of items representing the new state.\n */\n onChange: (items: StandardDragDropListProps['items']) => void;\n /** A ref to the root HTMLElement for the component. */\n ref?: Ref<HTMLDivElement>;\n}\n\ntype ItemAction = (\n id: StandardDragDropListItemProps['id'],\n e: MouseEvent<HTMLButtonElement>\n) => void;\n\nexport type StandardDragDropListItemProps = ForwardProps & {\n /** An identifier unique within the entire list hierarchy. */\n id: string;\n /** Indicates the type of item for determining drop acceptance by a target list. */\n type: string;\n /** The primary textual representation for the item or props for a linkable resource. */\n primary: string | ({ text: string; onClick: MouseEventHandler; href?: string } & ForwardProps);\n /** An additional textual representation for the item e.g. metadata. */\n secondary?: string;\n /** Presents the item as being in an invalidate state. */\n status?: {\n type: 'error' | 'warning';\n message: string;\n };\n /** Whether or not the item can be reordered with drag. */\n draggable?: boolean;\n /**\n * If the item is configurable pass a callback to render a button.\n * The item's id and an event argument provides access to the underlying HTMLButtonElement.\n */\n onConfigure?: ItemAction;\n /**\n * If the item can be removed form the list pass a callback to render a button.\n * The handler's event argument provides access to the underlying HTMLButtonElement.\n */\n onRemove?: ItemAction;\n} & (\n | {\n /** If the item can possess a nested list of items. */\n items: StandardDragDropListItemProps[];\n /** Type of items allowed to be dropped on the list. If not passed it will inherit accept from the parent list. */\n accept?: StandardDragDropListProps['accept'];\n /** Optionally render an add button for parent item types. */\n onAddTo?: ItemAction;\n }\n | {\n items?: undefined;\n accept?: never;\n onAddTo?: never;\n }\n );\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-dnd",
|
|
3
|
-
"version": "7.0.0-build.
|
|
3
|
+
"version": "7.0.0-build.30.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/pegasystems/cosmos-react.git",
|
|
@@ -19,22 +19,23 @@
|
|
|
19
19
|
"build": "tsc -b tsconfig.build.json"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@pega/cosmos-react-core": "7.0.0-build.
|
|
22
|
+
"@pega/cosmos-react-core": "7.0.0-build.30.0",
|
|
23
23
|
"@types/react": "^17.0.62",
|
|
24
24
|
"@types/react-dom": "^17.0.20",
|
|
25
25
|
"@types/styled-components": "^5.1.26",
|
|
26
26
|
"dnd-core": "14.0.1",
|
|
27
27
|
"polished": "^4.1.0",
|
|
28
|
+
"rdndmb-html5-to-touch": "^7.1.3",
|
|
28
29
|
"react": "^17.0.0",
|
|
29
30
|
"react-dnd": "^14.0.4",
|
|
30
|
-
"react-dnd-
|
|
31
|
+
"react-dnd-multi-backend": "^7.1.3",
|
|
31
32
|
"react-dom": "^17.0.0",
|
|
32
33
|
"styled-components": "^5.2.0"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
|
-
"@storybook/addon-actions": "~
|
|
36
|
-
"@storybook/react": "~
|
|
37
|
-
"@storybook/theming": "~
|
|
36
|
+
"@storybook/addon-actions": "~8.2.9",
|
|
37
|
+
"@storybook/react": "~8.2.9",
|
|
38
|
+
"@storybook/theming": "~8.2.9",
|
|
38
39
|
"@testing-library/dom": "^8.13.0",
|
|
39
40
|
"@testing-library/react": "^12.1.3",
|
|
40
41
|
"@testing-library/user-event": "^14.5.1",
|