@pega/cosmos-react-dnd 8.0.0-build.9.1 → 8.0.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.
Files changed (33) hide show
  1. package/lib/components/DragDropList/DragDropList.d.ts +1 -1
  2. package/lib/components/DragDropList/DragDropList.d.ts.map +1 -1
  3. package/lib/components/DragDropList/DragDropList.types.d.ts +3 -1
  4. package/lib/components/DragDropList/DragDropList.types.d.ts.map +1 -1
  5. package/lib/components/DragDropList/DragDropList.types.js.map +1 -1
  6. package/lib/components/DragDropList/DragDropListContext.d.ts +5 -0
  7. package/lib/components/DragDropList/DragDropListContext.d.ts.map +1 -1
  8. package/lib/components/DragDropList/DragDropListContext.js +1 -0
  9. package/lib/components/DragDropList/DragDropListContext.js.map +1 -1
  10. package/lib/components/DragDropList/index.d.ts +2 -0
  11. package/lib/components/DragDropList/index.d.ts.map +1 -1
  12. package/lib/components/DragDropList/index.js +1 -0
  13. package/lib/components/DragDropList/index.js.map +1 -1
  14. package/lib/components/DragHandle/DragHandle.d.ts +3 -1
  15. package/lib/components/DragHandle/DragHandle.d.ts.map +1 -1
  16. package/lib/components/DragHandle/DragHandle.js +53 -18
  17. package/lib/components/DragHandle/DragHandle.js.map +1 -1
  18. package/lib/components/StandardDragDropList/StandardDragDropList.d.ts +2 -3
  19. package/lib/components/StandardDragDropList/StandardDragDropList.d.ts.map +1 -1
  20. package/lib/components/StandardDragDropList/StandardDragDropList.js +22 -19
  21. package/lib/components/StandardDragDropList/StandardDragDropList.js.map +1 -1
  22. package/lib/components/StandardDragDropList/StandardDragDropList.styles.d.ts +7 -3
  23. package/lib/components/StandardDragDropList/StandardDragDropList.styles.d.ts.map +1 -1
  24. package/lib/components/StandardDragDropList/StandardDragDropList.styles.js +23 -6
  25. package/lib/components/StandardDragDropList/StandardDragDropList.styles.js.map +1 -1
  26. package/lib/components/StandardDragDropList/StandardDragDropList.test-ids.d.ts +1 -1
  27. package/lib/components/StandardDragDropList/StandardDragDropList.test-ids.d.ts.map +1 -1
  28. package/lib/components/StandardDragDropList/StandardDragDropList.test-ids.js +2 -1
  29. package/lib/components/StandardDragDropList/StandardDragDropList.test-ids.js.map +1 -1
  30. package/lib/components/StandardDragDropList/StandardDragDropList.types.d.ts +7 -1
  31. package/lib/components/StandardDragDropList/StandardDragDropList.types.d.ts.map +1 -1
  32. package/lib/components/StandardDragDropList/StandardDragDropList.types.js.map +1 -1
  33. package/package.json +10 -10
@@ -1,5 +1,5 @@
1
1
  import type { ForwardProps } from '@pega/cosmos-react-core';
2
2
  import type { DragDropListProps } from './DragDropList.types';
3
- declare const DragDropList: <T extends object = object>({ testId, id: idProp, accept, items, itemRenderer: ItemRenderer, emptyRenderer: EmptyRenderer, onChange, onEnter, pullMode, pushMode, dragToRemove, as: Component, ...restProps }: DragDropListProps<T> & ForwardProps) => JSX.Element;
3
+ declare const DragDropList: <T extends object = object>({ testId, id: idProp, accept, items, itemRenderer: ItemRenderer, emptyRenderer: EmptyRenderer, onChange, onEnter, pullMode, pushMode, dragToRemove, as: Component, ...restProps }: DragDropListProps<T> & ForwardProps) => import("react/jsx-runtime").JSX.Element;
4
4
  export default DragDropList;
5
5
  //# sourceMappingURL=DragDropList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DragDropList.d.ts","sourceRoot":"","sources":["../../../src/components/DragDropList/DragDropList.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,yBAAyB,CAAC;AAQxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAgB9D,QAAA,MAAM,YAAY,GAAI,CAAC,SAAS,MAAM,8LAcnC,iBAAiB,CAAC,CAAC,CAAC,GAAG,YAAY,gBA4SrC,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"DragDropList.d.ts","sourceRoot":"","sources":["../../../src/components/DragDropList/DragDropList.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,yBAAyB,CAAC;AAQxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAgB9D,QAAA,MAAM,YAAY,GAAI,CAAC,SAAS,MAAM,8LAcnC,iBAAiB,CAAC,CAAC,CAAC,GAAG,YAAY,4CA4SrC,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -30,7 +30,9 @@ export interface DragDropListProps<T extends object = object> extends AsProp, Ba
30
30
  */
31
31
  dragToRemove?: boolean;
32
32
  /** User defined function(Component) that should return content for when the list is empty. */
33
- emptyRenderer?: ComponentType;
33
+ emptyRenderer?: ComponentType<{
34
+ children?: undefined;
35
+ }>;
34
36
  /** Called when list data is updated. "insertIndex" is only defined when a new item has been added to the list. */
35
37
  onChange: (items: DragDropListProps<T>['items'], insertIndex?: number) => void;
36
38
  /** Called when an item enters a list. Allows for transformation of the item to fit the new list. */
@@ -1 +1 @@
1
- {"version":3,"file":"DragDropList.types.d.ts","sourceRoot":"","sources":["../../../src/components/DragDropList/DragDropList.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE7F,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAC1D,SAAQ,aAAa,CAAC,CAAC,CAAC,EACtB,uBAAuB,EACvB,UAAU;IACZ,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAClC,UAAU,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,SA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;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,8FAA8F;IAC9F,aAAa,CAAC,EAAE,aAAa,CAAC;QAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IACxD,kHAAkH;IAClH,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/E,oGAAoG;IACpG,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,aAAa,CAAC,CAAC,CAAC,CAAC;CACxD"}
@@ -1 +1 @@
1
- {"version":3,"file":"DragDropList.types.js","sourceRoot":"","sources":["../../../src/components/DragDropList/DragDropList.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { RefCallback, ComponentType } from 'react';\n\nimport type { AsProp, BaseProps, NoChildrenProp, TestIdProp } from '@pega/cosmos-react-core';\n\nimport type { DraggableItem, DraggableCollectedProps } from '../Draggable';\nimport type { DroppableProps } from '../Droppable';\n\nexport interface ItemRendererProps<T extends object = object>\n extends DraggableItem<T>,\n DraggableCollectedProps,\n TestIdProp {\n dragRef: RefCallback<HTMLElement>;\n previewRef: RefCallback<HTMLElement>;\n}\n\nexport interface DragDropListProps<T extends object = object>\n extends AsProp,\n BaseProps,\n NoChildrenProp,\n TestIdProp {\n /** Unique identifier for the list */\n id?: string;\n /** Type of item allowed to be dropped on this list (useful when there is multiple lists that share data). */\n accept: DroppableProps['accept'];\n /** Array of data objects used for the list. */\n items: DraggableItem<T>[];\n /** @default 'remove' */\n pullMode?: 'clone' | 'remove' | ((destinationId: string) => 'clone' | 'remove');\n /** @default 'insert' */\n pushMode?:\n | 'insert'\n | 'prepend'\n | 'append'\n | ((a: DraggableItem<T>, b: DraggableItem<T>) => number);\n /** User defined function that should return content for the draggable element. */\n itemRenderer: ComponentType<ItemRendererProps<T>>;\n /**\n * Enable drag handle elements for each of the list items. By default the entire element is draggable.\n * @default false\n */\n dragHandles?: boolean;\n /**\n * Enables \"Drag to remove from list\" behavior\n * @default false\n */\n dragToRemove?: boolean;\n /** User defined function(Component) that should return content for when the list is empty. */\n emptyRenderer?: ComponentType;\n /** Called when list data is updated. \"insertIndex\" is only defined when a new item has been added to the list. */\n onChange: (items: DragDropListProps<T>['items'], insertIndex?: number) => void;\n /** Called when an item enters a list. Allows for transformation of the item to fit the new list. */\n onEnter?: (item: DraggableItem<T>) => DraggableItem<T>;\n}\n"]}
1
+ {"version":3,"file":"DragDropList.types.js","sourceRoot":"","sources":["../../../src/components/DragDropList/DragDropList.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { RefCallback, ComponentType } from 'react';\n\nimport type { AsProp, BaseProps, NoChildrenProp, TestIdProp } from '@pega/cosmos-react-core';\n\nimport type { DraggableItem, DraggableCollectedProps } from '../Draggable';\nimport type { DroppableProps } from '../Droppable';\n\nexport interface ItemRendererProps<T extends object = object>\n extends DraggableItem<T>,\n DraggableCollectedProps,\n TestIdProp {\n dragRef: RefCallback<HTMLElement>;\n previewRef: RefCallback<HTMLElement>;\n}\n\nexport interface DragDropListProps<T extends object = object>\n extends AsProp,\n BaseProps,\n NoChildrenProp,\n TestIdProp {\n /** Unique identifier for the list */\n id?: string;\n /** Type of item allowed to be dropped on this list (useful when there is multiple lists that share data). */\n accept: DroppableProps['accept'];\n /** Array of data objects used for the list. */\n items: DraggableItem<T>[];\n /** @default 'remove' */\n pullMode?: 'clone' | 'remove' | ((destinationId: string) => 'clone' | 'remove');\n /** @default 'insert' */\n pushMode?:\n | 'insert'\n | 'prepend'\n | 'append'\n | ((a: DraggableItem<T>, b: DraggableItem<T>) => number);\n /** User defined function that should return content for the draggable element. */\n itemRenderer: ComponentType<ItemRendererProps<T>>;\n /**\n * Enable drag handle elements for each of the list items. By default the entire element is draggable.\n * @default false\n */\n dragHandles?: boolean;\n /**\n * Enables \"Drag to remove from list\" behavior\n * @default false\n */\n dragToRemove?: boolean;\n /** User defined function(Component) that should return content for when the list is empty. */\n emptyRenderer?: ComponentType<{ children?: undefined }>;\n /** Called when list data is updated. \"insertIndex\" is only defined when a new item has been added to the list. */\n onChange: (items: DragDropListProps<T>['items'], insertIndex?: number) => void;\n /** Called when an item enters a list. Allows for transformation of the item to fit the new list. */\n onEnter?: (item: DraggableItem<T>) => DraggableItem<T>;\n}\n"]}
@@ -1,6 +1,11 @@
1
1
  import type { DraggableItem } from '../Draggable';
2
2
  export interface DragDropListContextValue {
3
+ orientation?: 'vertical' | 'horizontal';
4
+ keyboardDragStart?: (itemId: DraggableItem['id']) => void;
5
+ keyboardDragEnd?: (itemId: DraggableItem['id']) => void;
6
+ keyboardDragCancel?: (itemId: DraggableItem['id']) => void;
3
7
  keyboardReorderItem: (itemId: DraggableItem['id'], direction: 'prev' | 'next') => void;
8
+ keyboardMoveLists?: (itemId: DraggableItem['id'], direction: 'prev' | 'next') => void;
4
9
  }
5
10
  declare const DragDropListContext: import("react").Context<DragDropListContextValue>;
6
11
  export default DragDropListContext;
@@ -1 +1 @@
1
- {"version":3,"file":"DragDropListContext.d.ts","sourceRoot":"","sources":["../../../src/components/DragDropList/DragDropListContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,WAAW,wBAAwB;IACvC,mBAAmB,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;CACxF;AAED,QAAA,MAAM,mBAAmB,mDAEvB,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"DragDropListContext.d.ts","sourceRoot":"","sources":["../../../src/components/DragDropList/DragDropListContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,WAAW,wBAAwB;IACvC,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACxC,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IAC1D,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IACxD,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IAC3D,mBAAmB,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IACvF,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;CACvF;AAED,QAAA,MAAM,mBAAmB,mDAGvB,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { createContext } from 'react';
2
2
  const DragDropListContext = createContext({
3
+ orientation: 'vertical',
3
4
  keyboardReorderItem: () => { }
4
5
  });
5
6
  export default DragDropListContext;
@@ -1 +1 @@
1
- {"version":3,"file":"DragDropListContext.js","sourceRoot":"","sources":["../../../src/components/DragDropList/DragDropListContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAQtC,MAAM,mBAAmB,GAAG,aAAa,CAA2B;IAClE,mBAAmB,EAAE,GAAG,EAAE,GAAE,CAAC;CAC9B,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC","sourcesContent":["import { createContext } from 'react';\n\nimport type { DraggableItem } from '../Draggable';\n\nexport interface DragDropListContextValue {\n keyboardReorderItem: (itemId: DraggableItem['id'], direction: 'prev' | 'next') => void;\n}\n\nconst DragDropListContext = createContext<DragDropListContextValue>({\n keyboardReorderItem: () => {}\n});\n\nexport default DragDropListContext;\n"]}
1
+ {"version":3,"file":"DragDropListContext.js","sourceRoot":"","sources":["../../../src/components/DragDropList/DragDropListContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAatC,MAAM,mBAAmB,GAAG,aAAa,CAA2B;IAClE,WAAW,EAAE,UAAU;IACvB,mBAAmB,EAAE,GAAG,EAAE,GAAE,CAAC;CAC9B,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC","sourcesContent":["import { createContext } from 'react';\n\nimport type { DraggableItem } from '../Draggable';\n\nexport interface DragDropListContextValue {\n orientation?: 'vertical' | 'horizontal';\n keyboardDragStart?: (itemId: DraggableItem['id']) => void;\n keyboardDragEnd?: (itemId: DraggableItem['id']) => void;\n keyboardDragCancel?: (itemId: DraggableItem['id']) => void;\n keyboardReorderItem: (itemId: DraggableItem['id'], direction: 'prev' | 'next') => void;\n keyboardMoveLists?: (itemId: DraggableItem['id'], direction: 'prev' | 'next') => void;\n}\n\nconst DragDropListContext = createContext<DragDropListContextValue>({\n orientation: 'vertical',\n keyboardReorderItem: () => {}\n});\n\nexport default DragDropListContext;\n"]}
@@ -1,3 +1,5 @@
1
1
  export { default } from './DragDropList';
2
+ export { default as DragDropListContext } from './DragDropListContext';
3
+ export type { DragDropListContextValue } from './DragDropListContext';
2
4
  export type { DragDropListProps, ItemRendererProps } from './DragDropList.types';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DragDropList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DragDropList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export { default } from './DragDropList';
2
+ export { default as DragDropListContext } from './DragDropListContext';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DragDropList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { default } from './DragDropList';\nexport type { DragDropListProps, ItemRendererProps } from './DragDropList.types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DragDropList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export { default } from './DragDropList';\nexport { default as DragDropListContext } from './DragDropListContext';\nexport type { DragDropListContextValue } from './DragDropListContext';\nexport type { DragDropListProps, ItemRendererProps } from './DragDropList.types';\n"]}
@@ -7,7 +7,9 @@ export interface DragHandleProps extends WithAttributes<'div', {
7
7
  contextualLabel?: string;
8
8
  }> {
9
9
  }
10
- export declare const StyledDragHandle: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
10
+ export declare const StyledDragHandle: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").ButtonProps>, import("styled-components").DefaultTheme, {
11
+ rotateIcon?: boolean;
12
+ }, never>;
11
13
  declare const DragHandle: import("react").ForwardRefExoticComponent<Omit<DragHandleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
12
14
  export default DragHandle;
13
15
  //# sourceMappingURL=DragHandle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DragHandle.d.ts","sourceRoot":"","sources":["../../../src/components/DragHandle/DragHandle.tsx"],"names":[],"mappings":"AAUA,OAAO,EAQL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,WAAW,eACf,SAAQ,cAAc,CACpB,KAAK,EACL;IACE,wEAAwE;IACxE,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC5B,iFAAiF;IACjF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CACF;CAAG;AAEN,eAAO,MAAM,gBAAgB,qOAM5B,CAAC;AAEF,QAAA,MAAM,UAAU,yHA0Ef,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"DragHandle.d.ts","sourceRoot":"","sources":["../../../src/components/DragHandle/DragHandle.tsx"],"names":[],"mappings":"AAUA,OAAO,EAQL,KAAK,cAAc,EAGpB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,WAAW,eACf,SAAQ,cAAc,CACpB,KAAK,EACL;IACE,wEAAwE;IACxE,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC5B,iFAAiF;IACjF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CACF;CAAG;AAEN,eAAO,MAAM,gBAAgB;iBACd,OAAO;SAgBpB,CAAC;AAEH,QAAA,MAAM,UAAU,yHAsHf,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,43 +1,76 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useContext, useEffect, useState } from 'react';
3
- import styled from 'styled-components';
4
- import { Icon, Button, useI18n, useUID, useConsolidatedRef, HiddenText } from '@pega/cosmos-react-core';
3
+ import styled, { css } from 'styled-components';
4
+ import { Icon, Button, useI18n, useUID, useConsolidatedRef, HiddenText, StyledIcon, useEscape } from '@pega/cosmos-react-core';
5
5
  import DragDropListContext from '../DragDropList/DragDropListContext';
6
- export const StyledDragHandle = styled(Button) `
7
- cursor: grab;
6
+ export const StyledDragHandle = styled(Button)(({ rotateIcon }) => {
7
+ return css `
8
+ cursor: grab;
8
9
 
9
- &[aria-grabbed='true'] {
10
- cursor: grabbing;
11
- }
12
- `;
10
+ &[aria-grabbed='true'] {
11
+ cursor: grabbing;
12
+ }
13
+
14
+ ${rotateIcon &&
15
+ css `
16
+ ${StyledIcon} {
17
+ transform: rotate(90deg);
18
+ }
19
+ `}
20
+ `;
21
+ });
13
22
  const DragHandle = forwardRef(function DragHandle({ itemId, contextualLabel, ...restProps }, ref) {
14
23
  const [grabbed, setGrabbed] = useState(false);
15
24
  const [keyboardGrabbed, setKeyboardGrabbed] = useState(false);
16
- const context = useContext(DragDropListContext);
25
+ const { keyboardReorderItem, keyboardMoveLists, keyboardDragStart, keyboardDragEnd, keyboardDragCancel, orientation = 'vertical' } = useContext(DragDropListContext);
17
26
  const descriptionId = useUID();
18
27
  const t = useI18n();
19
28
  const dragHandleRef = useConsolidatedRef(ref);
29
+ useEscape(() => {
30
+ if (grabbed) {
31
+ keyboardDragCancel?.(itemId);
32
+ setGrabbed(false);
33
+ setKeyboardGrabbed(false);
34
+ }
35
+ });
20
36
  const handleKeyDown = (e) => {
21
37
  // Limit preventDefault and stopPropagation to these codes to not interfere with tab key behavior
22
- if (['Enter', 'Space', 'ArrowUp', 'ArrowDown'].includes(e.code)) {
38
+ const arrows = orientation === 'horizontal' ? ['ArrowLeft', 'ArrowRight'] : ['ArrowUp', 'ArrowDown'];
39
+ if (['Space', ...arrows].includes(e.code) || (grabbed && e.code === 'Tab')) {
23
40
  e.preventDefault();
24
41
  e.stopPropagation();
25
42
  }
26
- if (e.code === 'Enter' || e.code === 'Space') {
43
+ if (e.code === 'Space') {
44
+ if (keyboardGrabbed) {
45
+ keyboardDragEnd?.(itemId);
46
+ }
47
+ else {
48
+ keyboardDragStart?.(itemId);
49
+ }
27
50
  setGrabbed(prev => !prev);
28
51
  setKeyboardGrabbed(prev => !prev);
29
52
  }
30
53
  else if (grabbed)
31
- if (e.code === 'ArrowUp') {
32
- context.keyboardReorderItem(itemId, 'prev');
54
+ if ((orientation === 'horizontal' && e.code === 'ArrowLeft') ||
55
+ (orientation === 'vertical' && e.code === 'ArrowUp')) {
56
+ keyboardReorderItem(itemId, 'prev');
57
+ }
58
+ else if ((orientation === 'horizontal' && e.code === 'ArrowRight') ||
59
+ (orientation === 'vertical' && e.code === 'ArrowDown')) {
60
+ keyboardReorderItem(itemId, 'next');
61
+ }
62
+ else if (e.code === 'Tab' && e.shiftKey) {
63
+ keyboardMoveLists?.(itemId, 'prev');
33
64
  }
34
- else if (e.code === 'ArrowDown') {
35
- context.keyboardReorderItem(itemId, 'next');
65
+ else if (e.code === 'Tab' && !e.shiftKey) {
66
+ keyboardMoveLists?.(itemId, 'next');
36
67
  }
37
68
  };
38
69
  useEffect(() => {
39
- if (!grabbed)
70
+ if (!grabbed) {
71
+ setKeyboardGrabbed(false);
40
72
  return;
73
+ }
41
74
  const removeGrabbed = () => {
42
75
  setGrabbed(false);
43
76
  setKeyboardGrabbed(false);
@@ -48,13 +81,15 @@ const DragHandle = forwardRef(function DragHandle({ itemId, contextualLabel, ...
48
81
  };
49
82
  }, [grabbed]);
50
83
  const dragText = t('drag');
51
- return (_jsxs(StyledDragHandle, { ...restProps, forwardedAs: 'div', role: 'button', tabIndex: 0, label: grabbed ? undefined : dragText, "aria-label": contextualLabel ? `${dragText} - ${contextualLabel}` : dragText, "aria-describedby": descriptionId, ref: dragHandleRef, icon: true, variant: 'simple', compact: true, "aria-grabbed": grabbed, onKeyDown: handleKeyDown, onMouseDown: () => {
84
+ return (_jsxs(StyledDragHandle, { ...restProps, "data-drag-handle-for": itemId, forwardedAs: 'div', role: 'button', tabIndex: 0, label: grabbed ? undefined : dragText, "aria-label": contextualLabel ? `${dragText} - ${contextualLabel}` : dragText, "aria-describedby": descriptionId, ref: dragHandleRef, icon: true, variant: 'simple', compact: true, "aria-grabbed": grabbed, rotateIcon: orientation === 'horizontal' && keyboardGrabbed, onKeyDown: handleKeyDown, onMouseDown: () => {
52
85
  setGrabbed(true);
53
86
  }, onMouseUp: () => {
54
87
  setGrabbed(false);
55
88
  }, onBlur: () => {
56
89
  setGrabbed(false);
57
- }, children: [_jsx(Icon, { name: keyboardGrabbed ? 'arrow-micro-up-down' : 'drag' }), _jsx(HiddenText, { id: descriptionId, children: t('drag_handle_description') })] }));
90
+ }, children: [_jsx(Icon, { name: keyboardGrabbed ? 'arrow-micro-up-down' : 'drag' }), _jsx(HiddenText, { id: descriptionId, children: `${t('drag_handle_activate_description')} ${t(orientation === 'horizontal'
91
+ ? 'drag_handle_horizontal_description'
92
+ : 'drag_handle_vertical_description')}${keyboardMoveLists ? ` ${t('drag_handle_tab_description')}` : ''} ${t('drag_handle_drop_description')} ${t('drag_handle_cancel_description')}` })] }));
58
93
  });
59
94
  export default DragHandle;
60
95
  //# sourceMappingURL=DragHandle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DragHandle.js","sourceRoot":"","sources":["../../../src/components/DragHandle/DragHandle.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EAGT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,IAAI,EACJ,MAAM,EACN,OAAO,EACP,MAAM,EACN,kBAAkB,EAClB,UAAU,EAGX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,mBAAmB,MAAM,qCAAqC,CAAC;AActE,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;;;;;;CAM7C,CAAC;AAEF,MAAM,UAAU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EAChE,KAAC,UAAU,IAAC,EAAE,EAAE,aAAa,YAAG,CAAC,CAAC,yBAAyB,CAAC,GAAc,IACzD,CACpB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {\n forwardRef,\n useContext,\n useEffect,\n useState,\n type KeyboardEvent,\n type PropsWithoutRef\n} from 'react';\nimport styled from 'styled-components';\n\nimport {\n Icon,\n Button,\n useI18n,\n useUID,\n useConsolidatedRef,\n HiddenText,\n type RefElement,\n type WithAttributes\n} from '@pega/cosmos-react-core';\n\nimport DragDropListContext from '../DragDropList/DragDropListContext';\nimport type { DraggableItem } from '../Draggable';\n\nexport interface DragHandleProps\n extends WithAttributes<\n 'div',\n {\n /** The id of the item, used to keep track of the row when reordering */\n itemId: DraggableItem['id'];\n /** The label or name of the actual item being dragged, used for accessibility */\n contextualLabel?: string;\n }\n > {}\n\nexport const StyledDragHandle = styled(Button)`\n cursor: grab;\n\n &[aria-grabbed='true'] {\n cursor: grabbing;\n }\n`;\n\nconst DragHandle = forwardRef<RefElement<DragHandleProps>, PropsWithoutRef<DragHandleProps>>(\n function DragHandle({ itemId, contextualLabel, ...restProps }, ref) {\n const [grabbed, setGrabbed] = useState(false);\n const [keyboardGrabbed, setKeyboardGrabbed] = useState(false);\n const context = useContext(DragDropListContext);\n const descriptionId = useUID();\n const t = useI18n();\n const dragHandleRef = useConsolidatedRef(ref);\n\n const handleKeyDown = (e: KeyboardEvent<HTMLButtonElement>) => {\n // Limit preventDefault and stopPropagation to these codes to not interfere with tab key behavior\n if (['Enter', 'Space', 'ArrowUp', 'ArrowDown'].includes(e.code)) {\n e.preventDefault();\n e.stopPropagation();\n }\n\n if (e.code === 'Enter' || e.code === 'Space') {\n setGrabbed(prev => !prev);\n setKeyboardGrabbed(prev => !prev);\n } else if (grabbed)\n if (e.code === 'ArrowUp') {\n context.keyboardReorderItem(itemId, 'prev');\n } else if (e.code === 'ArrowDown') {\n context.keyboardReorderItem(itemId, 'next');\n }\n };\n\n useEffect(() => {\n if (!grabbed) return;\n\n const removeGrabbed = () => {\n setGrabbed(false);\n setKeyboardGrabbed(false);\n };\n\n document.addEventListener('dragend', removeGrabbed);\n\n return () => {\n document.removeEventListener('dragend', removeGrabbed);\n };\n }, [grabbed]);\n\n const dragText = t('drag');\n\n return (\n <StyledDragHandle\n {...restProps}\n forwardedAs='div'\n role='button'\n tabIndex={0}\n label={grabbed ? undefined : dragText}\n aria-label={contextualLabel ? `${dragText} - ${contextualLabel}` : dragText}\n aria-describedby={descriptionId}\n ref={dragHandleRef}\n icon\n variant='simple'\n compact\n aria-grabbed={grabbed}\n onKeyDown={handleKeyDown}\n onMouseDown={() => {\n setGrabbed(true);\n }}\n onMouseUp={() => {\n setGrabbed(false);\n }}\n onBlur={() => {\n setGrabbed(false);\n }}\n >\n <Icon name={keyboardGrabbed ? 'arrow-micro-up-down' : 'drag'} />\n <HiddenText id={descriptionId}>{t('drag_handle_description')}</HiddenText>\n </StyledDragHandle>\n );\n }\n);\n\nexport default DragHandle;\n"]}
1
+ {"version":3,"file":"DragHandle.js","sourceRoot":"","sources":["../../../src/components/DragHandle/DragHandle.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EAGT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,MAAM,EACN,OAAO,EACP,MAAM,EACN,kBAAkB,EAClB,UAAU,EAGV,UAAU,EACV,SAAS,EACV,MAAM,yBAAyB,CAAC;AAEjC,OAAO,mBAAmB,MAAM,qCAAqC,CAAC;AActE,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,CAE3C,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE;IACpB,OAAO,GAAG,CAAA;;;;;;;MAON,UAAU;QACZ,GAAG,CAAA;QACC,UAAU;;;KAG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CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,MAAM,GAAI,EAChE,KAAC,UAAU,IAAC,EAAE,EAAE,aAAa,YAC1B,GAAG,CAAC,CAAC,kCAAkC,CAAC,IAAI,CAAC,CAC5C,WAAW,KAAK,YAAY;oBAC1B,CAAC,CAAC,oCAAoC;oBACtC,CAAC,CAAC,kCAAkC,CACvC,GAAG,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,8BAA8B,CAAC,IAAI,CAAC,CAAC,gCAAgC,CAAC,EAAE,GACtI,IACI,CACpB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {\n forwardRef,\n useContext,\n useEffect,\n useState,\n type KeyboardEvent,\n type PropsWithoutRef\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Icon,\n Button,\n useI18n,\n useUID,\n useConsolidatedRef,\n HiddenText,\n type RefElement,\n type WithAttributes,\n StyledIcon,\n useEscape\n} from '@pega/cosmos-react-core';\n\nimport DragDropListContext from '../DragDropList/DragDropListContext';\nimport type { DraggableItem } from '../Draggable';\n\nexport interface DragHandleProps\n extends WithAttributes<\n 'div',\n {\n /** The id of the item, used to keep track of the row when reordering */\n itemId: DraggableItem['id'];\n /** The label or name of the actual item being dragged, used for accessibility */\n contextualLabel?: string;\n }\n > {}\n\nexport const StyledDragHandle = styled(Button)<{\n rotateIcon?: boolean;\n}>(({ rotateIcon }) => {\n return css`\n cursor: grab;\n\n &[aria-grabbed='true'] {\n cursor: grabbing;\n }\n\n ${rotateIcon &&\n css`\n ${StyledIcon} {\n transform: rotate(90deg);\n }\n `}\n `;\n});\n\nconst DragHandle = forwardRef<RefElement<DragHandleProps>, PropsWithoutRef<DragHandleProps>>(\n function DragHandle({ itemId, contextualLabel, ...restProps }, ref) {\n const [grabbed, setGrabbed] = useState(false);\n const [keyboardGrabbed, setKeyboardGrabbed] = useState(false);\n const {\n keyboardReorderItem,\n keyboardMoveLists,\n keyboardDragStart,\n keyboardDragEnd,\n keyboardDragCancel,\n orientation = 'vertical'\n } = useContext(DragDropListContext);\n const descriptionId = useUID();\n const t = useI18n();\n const dragHandleRef = useConsolidatedRef(ref);\n\n useEscape(() => {\n if (grabbed) {\n keyboardDragCancel?.(itemId);\n setGrabbed(false);\n setKeyboardGrabbed(false);\n }\n });\n\n const handleKeyDown = (e: KeyboardEvent<HTMLButtonElement>) => {\n // Limit preventDefault and stopPropagation to these codes to not interfere with tab key behavior\n const arrows =\n orientation === 'horizontal' ? ['ArrowLeft', 'ArrowRight'] : ['ArrowUp', 'ArrowDown'];\n if (['Space', ...arrows].includes(e.code) || (grabbed && e.code === 'Tab')) {\n e.preventDefault();\n e.stopPropagation();\n }\n\n if (e.code === 'Space') {\n if (keyboardGrabbed) {\n keyboardDragEnd?.(itemId);\n } else {\n keyboardDragStart?.(itemId);\n }\n\n setGrabbed(prev => !prev);\n setKeyboardGrabbed(prev => !prev);\n } else if (grabbed)\n if (\n (orientation === 'horizontal' && e.code === 'ArrowLeft') ||\n (orientation === 'vertical' && e.code === 'ArrowUp')\n ) {\n keyboardReorderItem(itemId, 'prev');\n } else if (\n (orientation === 'horizontal' && e.code === 'ArrowRight') ||\n (orientation === 'vertical' && e.code === 'ArrowDown')\n ) {\n keyboardReorderItem(itemId, 'next');\n } else if (e.code === 'Tab' && e.shiftKey) {\n keyboardMoveLists?.(itemId, 'prev');\n } else if (e.code === 'Tab' && !e.shiftKey) {\n keyboardMoveLists?.(itemId, 'next');\n }\n };\n\n useEffect(() => {\n if (!grabbed) {\n setKeyboardGrabbed(false);\n return;\n }\n\n const removeGrabbed = () => {\n setGrabbed(false);\n setKeyboardGrabbed(false);\n };\n\n document.addEventListener('dragend', removeGrabbed);\n\n return () => {\n document.removeEventListener('dragend', removeGrabbed);\n };\n }, [grabbed]);\n\n const dragText = t('drag');\n\n return (\n <StyledDragHandle\n {...restProps}\n data-drag-handle-for={itemId}\n forwardedAs='div'\n role='button'\n tabIndex={0}\n label={grabbed ? undefined : dragText}\n aria-label={contextualLabel ? `${dragText} - ${contextualLabel}` : dragText}\n aria-describedby={descriptionId}\n ref={dragHandleRef}\n icon\n variant='simple'\n compact\n aria-grabbed={grabbed}\n rotateIcon={orientation === 'horizontal' && keyboardGrabbed}\n onKeyDown={handleKeyDown}\n onMouseDown={() => {\n setGrabbed(true);\n }}\n onMouseUp={() => {\n setGrabbed(false);\n }}\n onBlur={() => {\n setGrabbed(false);\n }}\n >\n <Icon name={keyboardGrabbed ? 'arrow-micro-up-down' : 'drag'} />\n <HiddenText id={descriptionId}>\n {`${t('drag_handle_activate_description')} ${t(\n orientation === 'horizontal'\n ? 'drag_handle_horizontal_description'\n : 'drag_handle_vertical_description'\n )}${keyboardMoveLists ? ` ${t('drag_handle_tab_description')}` : ''} ${t('drag_handle_drop_description')} ${t('drag_handle_cancel_description')}`}\n </HiddenText>\n </StyledDragHandle>\n );\n }\n);\n\nexport default DragHandle;\n"]}
@@ -1,7 +1,6 @@
1
- import type { FunctionComponent } from 'react';
2
- import type { ForwardProps } from '@pega/cosmos-react-core';
1
+ import type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
3
2
  import type { StandardDragDropListProps } from './StandardDragDropList.types';
4
- declare const _default: FunctionComponent<StandardDragDropListProps & ForwardProps> & {
3
+ declare const _default: ForwardRefForwardPropsComponent<StandardDragDropListProps> & {
5
4
  getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["header"]>;
6
5
  };
7
6
  export default _default;
@@ -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;AAkB5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAuB5D,OAAO,KAAK,EACV,yBAAyB,EAE1B,MAAM,8BAA8B,CAAC;;;;AA2ctC,wBAAiF"}
1
+ {"version":3,"file":"StandardDragDropList.d.ts","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAwB/E,OAAO,KAAK,EACV,yBAAyB,EAE1B,MAAM,8BAA8B,CAAC;;;;AAwetC,wBAAiF"}
@@ -1,20 +1,20 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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, AdditionalInfo } from '@pega/cosmos-react-core';
3
+ import { Flex, registerIcon, Icon, Text, Button, useI18n, EmptyState, ExpandCollapse, useUID, Tooltip, useElement, useTestIds, withTestIds, AdditionalInfo, Checkbox } 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';
7
+ import * as DiamondMinusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/diamond-minus.icon';
8
8
  import * as WarnSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/warn-solid.icon';
9
9
  import DragDropList from '../DragDropList';
10
10
  import DragHandle from '../DragHandle';
11
- import { StyledStandardDragDropList, StyledStandardDragDropListItem, StyledExpandCollapseToggle, StyledItemActions, StyledItemContent, StyledItemStatus, StyledPrimary, StyledSecondary, StyledListItemInner } from './StandardDragDropList.styles';
11
+ import { StyledStandardDragDropList, StyledStandardDragDropListItem, StyledExpandCollapseToggle, StyledItemActions, StyledItemContent, StyledItemStatus, StyledPrimary, StyledSecondary, StyledListItemInner, StyledItemSecondaryContainer } from './StandardDragDropList.styles';
12
12
  import { getItemRendererTestIds, getStandardDragDropListTestIds } from './StandardDragDropList.test-ids';
13
- registerIcon(DragIcon, PlusIcon, CaretDownIcon, FlagWaveSolidIcon, WarnSolidIcon);
13
+ registerIcon(DragIcon, PlusIcon, CaretDownIcon, DiamondMinusIcon, WarnSolidIcon);
14
14
  let StandardDragDropList;
15
15
  const ItemStatus = ({ message, type }) => {
16
16
  const [ttt, setTTT] = useElement(null);
17
- const iconName = type === 'warning' ? 'flag-wave-solid' : 'warn-solid';
17
+ const iconName = type === 'warning' ? 'diamond-minus' : 'warn-solid';
18
18
  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 })] }) })) }));
19
19
  };
20
20
  const getFlattenedIds = (items) => {
@@ -24,35 +24,37 @@ const getFlattenedIds = (items) => {
24
24
  };
25
25
  const ItemRenderer = ({ testId, dragRef, previewRef, isDragging, data: { id,
26
26
  // Remove type for DOM restProps
27
- type, accept, primary, secondary, draggable = true, status, items, icon, onConfigure, onRemove, onAddTo, onChange, ...restProps }, data }) => {
27
+ type, accept, primary, secondary, draggable = true, status, items, icon, onConfigure, onRemove, onAddTo, onChange, onItemSelection, selected, ...restProps }, data }) => {
28
28
  const t = useI18n();
29
29
  const [collapsed, setCollapsed] = useState(false);
30
30
  const expandCollpaseId = useUID();
31
31
  const testIds = useTestIds(testId, getItemRendererTestIds);
32
32
  const hasActions = !!(onConfigure ?? onRemove ?? onAddTo);
33
+ const numberOfActions = [onConfigure, onRemove, onAddTo].filter(Boolean).length;
33
34
  const [primaryTextEl, setPrimaryTextEl] = useElement(null);
34
35
  const [secondaryTextEl, setSecondaryTextEl] = useElement(null);
35
36
  const primaryEl = useMemo(() => {
36
- const tooltip = (_jsx(Tooltip, { smart: true, target: primaryTextEl, showDelay: 'none', hideDelay: 'none', children: typeof primary === 'string' ? primary : primary.text }));
37
+ const primaryText = typeof primary === 'string' ? primary : primary.text;
38
+ const tooltip = (_jsx(Tooltip, { smart: true, target: primaryTextEl, showDelay: 'none', hideDelay: 'none', children: primaryText }));
37
39
  const labelText = collapsed ? t('expand') : t('collapse');
38
40
  if (items) {
39
- return (_jsxs(_Fragment, { children: [_jsx(StyledExpandCollapseToggle, { "data-testid": testIds.expandCollapseButton, variant: 'simple', icon: true, label: labelText, "aria-label": `${labelText} - ${primary}`, onClick: () => setCollapsed(cur => !cur), "aria-owns": expandCollpaseId, "aria-expanded": !collapsed, children: _jsx(Icon, { name: 'caret-down' }) }), _jsxs("span", { ref: setPrimaryTextEl, children: [primary, tooltip] })] }));
41
+ return (_jsxs(_Fragment, { children: [_jsx(StyledExpandCollapseToggle, { "data-testid": testIds.expandCollapseButton, variant: 'simple', icon: true, label: labelText, "aria-label": `${labelText} - ${primaryText}`, onClick: () => setCollapsed(cur => !cur), "aria-owns": expandCollpaseId, "aria-expanded": !collapsed, children: _jsx(Icon, { name: 'caret-down' }) }), _jsxs("span", { ref: setPrimaryTextEl, children: [primaryText, tooltip] })] }));
40
42
  }
41
43
  if (typeof primary === 'string') {
42
- return (_jsxs("span", { ref: setPrimaryTextEl, children: [primary, tooltip] }));
44
+ return (_jsxs("span", { ref: setPrimaryTextEl, children: [primaryText, tooltip] }));
43
45
  }
44
- return (_jsx(Button, { variant: 'link', onClick: primary.onClick, href: primary.href, ref: setPrimaryTextEl, children: _jsxs(StyledPrimary, { children: [primary.text, tooltip] }) }));
46
+ return (_jsx(Button, { variant: 'link', onClick: primary.onClick, href: primary.href, ref: setPrimaryTextEl, children: _jsxs(StyledPrimary, { children: [primaryText, tooltip] }) }));
45
47
  }, [t, items, primary, collapsed, expandCollpaseId, primaryTextEl]);
46
- return (_jsxs(Flex, { "data-testid": testIds.root, ...restProps, container: { direction: 'column' }, as: StyledStandardDragDropListItem, ref: previewRef, isDragging: isDragging, hasActions: hasActions, children: [_jsxs(Flex, { container: { alignItems: 'center' }, as: StyledListItemInner, isDraggable: draggable, hasActions: hasActions, hasVisual: !!status || !!icon, children: [draggable && _jsx(DragHandle, { itemId: id, ref: dragRef, "data-testid": testIds.dragHandle }), _jsx(Flex, { container: { alignItems: 'center', gap: 0.5 }, item: { grow: 1 }, children: _jsxs(Flex, { container: { alignItems: 'center', gap: status || icon ? 1 : undefined, pad: 0.5 }, item: { grow: 1 }, as: StyledItemContent, children: [status && _jsx(ItemStatus, { type: status?.type, message: status?.message }), icon && !items && _jsx(Icon, { "data-testid": testIds.icon, ...icon, size: 's' }), primaryEl] }) }), (secondary || hasActions) && (_jsxs(Flex, { container: { alignItems: 'center', justify: 'end', gap: 0.5 }, children: [secondary && (_jsxs(StyledSecondary, { variant: 'secondary', ref: setSecondaryTextEl, children: [secondary, _jsx(Tooltip, { smart: true, target: secondaryTextEl, showDelay: 'none', hideDelay: 'none', children: secondary })] })), hasActions && (_jsxs(Flex, { container: { alignItems: 'center', gap: 0.5 }, as: StyledItemActions, children: [onAddTo && (_jsx("span", { children: _jsx(Button, { "data-testid": testIds.addButton, icon: true, variant: 'simple', label: t('add'), onClick: (e) => {
48
+ return (_jsxs(Flex, { "data-testid": testIds.root, ...restProps, container: { direction: 'column' }, as: StyledStandardDragDropListItem, ref: previewRef, isDragging: isDragging, hasActions: hasActions, children: [_jsxs(Flex, { container: { alignItems: 'center' }, as: StyledListItemInner, isDraggable: draggable, isSelectable: !!onItemSelection, hasActions: hasActions, hasVisual: !!status || !!icon, children: [draggable && _jsx(DragHandle, { itemId: id, ref: dragRef, "data-testid": testIds.dragHandle }), _jsx(Flex, { container: { alignItems: 'center', gap: 0.5 }, item: { shrink: 1 }, children: _jsxs(Flex, { container: { alignItems: 'center', gap: status || icon ? 1 : undefined, pad: 0.5 }, as: StyledItemContent, children: [onItemSelection && !data.items && (_jsx(Checkbox, { "data-testid": testIds.checkbox, "aria-label": typeof primary === 'string' ? primary : primary.text, checked: selected, onChange: e => onItemSelection({ ...data, selected: e.target.checked }) })), status && _jsx(ItemStatus, { type: status?.type, message: status?.message }), icon && !items && _jsx(Icon, { "data-testid": testIds.icon, ...icon, size: 's' }), primaryEl] }) }), (secondary || hasActions) && (_jsxs(Flex, { container: { alignItems: 'center', justify: 'end', gap: 0.5 }, item: { grow: 1 }, numberOfActions: numberOfActions, as: StyledItemSecondaryContainer, children: [secondary && (_jsxs(StyledSecondary, { variant: 'secondary', ref: setSecondaryTextEl, children: [secondary, _jsx(Tooltip, { smart: true, target: secondaryTextEl, showDelay: 'none', hideDelay: 'none', children: secondary })] })), hasActions && (_jsxs(Flex, { container: { alignItems: 'center', gap: 0.5 }, as: StyledItemActions, children: [onAddTo && (_jsx("span", { children: _jsx(Button, { "data-testid": testIds.addButton, icon: true, variant: 'simple', label: t('add'), onClick: (e) => {
47
49
  onAddTo?.(id, e);
48
50
  }, children: _jsx(Icon, { name: 'plus' }) }) })), onConfigure && (_jsx("span", { children: _jsx(Button, { "data-testid": testIds.configureButton, icon: true, variant: 'simple', label: t('configure'), onClick: (e) => {
49
51
  onConfigure?.(id, e);
50
52
  }, children: _jsx(Icon, { name: 'gear' }) }) })), onRemove && (_jsx("span", { children: _jsx(Button, { "data-testid": testIds.removeButton, icon: true, variant: 'simple', label: t('remove'), onClick: (e) => {
51
53
  onRemove?.(id, e);
52
- }, 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 }) }))] }));
54
+ }, 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, onItemSelection: data.onItemSelection }) }))] }));
53
55
  };
54
56
  const ItemRendererWithTestIds = withTestIds(ItemRenderer, getItemRendererTestIds);
55
- StandardDragDropList = forwardRef(function StandardDragDropListFunction({ testId, accept, items: itemsProp, heading: title, footer, onChange: onChangeProp, pushMode, pullMode, headingTag = 'h2', additionalInfo, ...restProps }, ref) {
57
+ StandardDragDropList = forwardRef(function StandardDragDropListFunction({ testId, accept, items: itemsProp, heading: title, info, footer, onChange: onChangeProp, onItemSelection, pushMode, pullMode, headingTag = 'h2', additionalInfo, ...restProps }, ref) {
56
58
  const flatIds = useMemo(() => getFlattenedIds(itemsProp), [itemsProp]);
57
59
  const timerRef = useRef();
58
60
  const newItemsRef = useRef();
@@ -113,6 +115,7 @@ StandardDragDropList = forwardRef(function StandardDragDropListFunction({ testId
113
115
  type: item.type,
114
116
  data: {
115
117
  ...item,
118
+ onItemSelection,
116
119
  draggable: item.draggable && !!onChangeProp
117
120
  }
118
121
  };
@@ -122,6 +125,7 @@ StandardDragDropList = forwardRef(function StandardDragDropListFunction({ testId
122
125
  ...newItem,
123
126
  data: {
124
127
  ...item,
128
+ onItemSelection,
125
129
  accept: item.accept ?? accept,
126
130
  draggable: item.draggable && !!onChangeProp,
127
131
  onChange: onChangeProp
@@ -157,12 +161,11 @@ StandardDragDropList = forwardRef(function StandardDragDropListFunction({ testId
157
161
  }
158
162
  }, [onChangeProp, flatIds, mergeChangeHandler]);
159
163
  const heading = title ? _jsx(Text, { variant: headingTag, children: title }) : null;
160
- return (_jsxs(StyledStandardDragDropList, { ref: ref, "data-testid": testIds.root, ...restProps, children: [heading && (_jsx(Flex, { "data-testid": testIds.header, container: {
161
- justify: 'between',
162
- alignItems: 'center',
163
- gap: 1,
164
- pad: [1, undefined]
165
- }, 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: {
164
+ return (_jsxs(StyledStandardDragDropList, { ref: ref, "data-testid": testIds.root, ...restProps, children: [heading && (_jsxs(Flex, { container: { direction: 'column', gap: 1, pad: [1, undefined] }, children: [_jsx(Flex, { "data-testid": testIds.header, container: {
165
+ justify: 'between',
166
+ alignItems: 'center',
167
+ gap: 1
168
+ }, as: 'header', children: additionalInfo ? (_jsxs(Flex, { container: true, children: [heading, _jsx(AdditionalInfo, { heading: additionalInfo.heading ?? title, children: additionalInfo.content })] })) : (heading) }), info && _jsx(Text, { variant: 'primary', children: info })] })), _jsx(DragDropList, { testId: testId, accept: accept, items: itemsToRender, pushMode: pushMode, pullMode: pullMode, itemRenderer: ItemRendererWithTestIds, emptyRenderer: EmptyState, onChange: onChange }), footer && (_jsx(Flex, { container: {
166
169
  alignItems: 'center',
167
170
  itemGap: 1,
168
171
  pad: [1, undefined]
@@ -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,UAAU,EACV,WAAW,EACX,cAAc,EACf,MAAM,yBAAyB,CAAC;AAEjC,OA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SAAS,CAAC;iBACpB,EACD,EAAE,EAAC,QAAQ,YAEV,cAAc,CAAC,CAAC,CAAC,CAChB,MAAC,IAAI,IAAC,SAAS,mBACZ,OAAO,EAER,KAAC,cAAc,IAAC,OAAO,EAAE,cAAc,CAAC,OAAO,IAAI,KAAM,YACtD,cAAc,CAAC,OAAO,GACR,IACZ,CACR,CAAC,CAAC,CAAC,CACF,OAAO,CACR,GACI,CACR,EAED,KAAC,YAAY,IACX,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,uBAAuB,EACrC,aAAa,EAAE,UAAU,EACzB,QAAQ,EAAE,QAAQ,GAClB,EAED,MAAM,IAAI,CACT,KAAC,IAAI,IACH,SAAS,EAAE;oBACT,UAAU,EAAE,QAAQ;oBACpB,OAAO,EAAE,CAAC;oBACV,GAAG,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC;iBACpB,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';\nimport DragHandle from '../DragHandle';\n\nimport {\n StyledStandardDragDropList,\n StyledStandardDragDropListItem,\n StyledExpandCollapseToggle,\n StyledItemActions,\n StyledItemContent,\n StyledItemStatus,\n StyledPrimary,\n StyledSecondary,\n StyledListItemInner\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 icon,\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 [primaryTextEl, setPrimaryTextEl] = useElement<\n HTMLSpanElement | HTMLAnchorElement | HTMLButtonElement\n >(null);\n const [secondaryTextEl, setSecondaryTextEl] = useElement<HTMLSpanElement>(null);\n\n const primaryEl = useMemo(() => {\n const tooltip = (\n <Tooltip smart target={primaryTextEl} showDelay='none' hideDelay='none'>\n {typeof primary === 'string' ? primary : primary.text}\n </Tooltip>\n );\n\n const labelText = collapsed ? t('expand') : t('collapse');\n\n if (items) {\n return (\n <>\n <StyledExpandCollapseToggle\n data-testid={testIds.expandCollapseButton}\n variant='simple'\n icon\n label={labelText}\n aria-label={`${labelText} - ${primary}`}\n onClick={() => setCollapsed(cur => !cur)}\n aria-owns={expandCollpaseId}\n aria-expanded={!collapsed}\n >\n <Icon name='caret-down' />\n </StyledExpandCollapseToggle>\n <span ref={setPrimaryTextEl}>\n {primary}\n {tooltip}\n </span>\n </>\n );\n }\n\n if (typeof primary === 'string') {\n return (\n <span ref={setPrimaryTextEl}>\n {primary}\n {tooltip}\n </span>\n );\n }\n\n return (\n <Button variant='link' onClick={primary.onClick} href={primary.href} ref={setPrimaryTextEl}>\n <StyledPrimary>\n {primary.text}\n {tooltip}\n </StyledPrimary>\n </Button>\n );\n }, [t, items, primary, collapsed, expandCollpaseId, primaryTextEl]);\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 hasActions={hasActions}\n >\n <Flex\n container={{ alignItems: 'center' }}\n as={StyledListItemInner}\n isDraggable={draggable}\n hasActions={hasActions}\n hasVisual={!!status || !!icon}\n >\n {draggable && <DragHandle itemId={id} ref={dragRef} data-testid={testIds.dragHandle} />}\n\n <Flex container={{ alignItems: 'center', gap: 0.5 }} item={{ grow: 1 }}>\n <Flex\n container={{ alignItems: 'center', gap: status || icon ? 1 : undefined, pad: 0.5 }}\n item={{ grow: 1 }}\n as={StyledItemContent}\n >\n {status && <ItemStatus type={status?.type} message={status?.message} />}\n {icon && !items && <Icon data-testid={testIds.icon} {...icon} size='s' />}\n\n {primaryEl}\n </Flex>\n </Flex>\n\n {(secondary || hasActions) && (\n <Flex container={{ alignItems: 'center', justify: 'end', gap: 0.5 }}>\n {secondary && (\n <StyledSecondary variant='secondary' ref={setSecondaryTextEl}>\n {secondary}\n <Tooltip smart target={secondaryTextEl} showDelay='none' hideDelay='none'>\n {secondary}\n </Tooltip>\n </StyledSecondary>\n )}\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: {\n ...item,\n draggable: item.draggable && !!onChangeProp\n } as InternalStandardDragDropListItemProps\n };\n if (!item.items) return newItem;\n\n return {\n ...newItem,\n data: {\n ...item,\n accept: item.accept ?? accept,\n draggable: item.draggable && !!onChangeProp,\n onChange: onChangeProp\n ? (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 : undefined\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} data-testid={testIds.root} {...restProps}>\n {heading && (\n <Flex\n data-testid={testIds.header}\n container={{\n justify: 'between',\n alignItems: 'center',\n gap: 1,\n pad: [1, undefined]\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\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\n {footer && (\n <Flex\n container={{\n alignItems: 'center',\n itemGap: 1,\n pad: [1, undefined]\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,EACd,QAAQ,EACT,MAAM,yBAAyB,CAAC;AA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Q,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,uBAAuB,EACrC,aAAa,EAAE,UAAU,EACzB,QAAQ,EAAE,QAAQ,GAClB,EACD,MAAM,IAAI,CACT,KAAC,IAAI,IACH,SAAS,EAAE;oBACT,UAAU,EAAE,QAAQ;oBACpB,OAAO,EAAE,CAAC;oBACV,GAAG,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC;iBACpB,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 { 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 Checkbox\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent } 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 DiamondMinusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/diamond-minus.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';\nimport DragHandle from '../DragHandle';\n\nimport {\n StyledStandardDragDropList,\n StyledStandardDragDropListItem,\n StyledExpandCollapseToggle,\n StyledItemActions,\n StyledItemContent,\n StyledItemStatus,\n StyledPrimary,\n StyledSecondary,\n StyledListItemInner,\n StyledItemSecondaryContainer\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, DiamondMinusIcon, WarnSolidIcon);\n\ntype InternalStandardDragDropListItemProps = StandardDragDropListItemProps &\n (\n | {\n items: StandardDragDropListItemProps[];\n onItemSelection?: StandardDragDropListProps['onItemSelection'];\n accept: StandardDragDropListProps['accept'];\n onChange: StandardDragDropListProps['onChange'];\n }\n | {\n items?: undefined;\n onItemSelection?: StandardDragDropListProps['onItemSelection'];\n accept?: never;\n onChange?: never;\n }\n );\n\nlet StandardDragDropList: ForwardRefForwardPropsComponent<StandardDragDropListProps>;\n\nconst ItemStatus = ({\n message,\n type\n}: Partial<NonNullable<StandardDragDropListItemProps['status']>>) => {\n const [ttt, setTTT] = useElement(null);\n const iconName = type === 'warning' ? 'diamond-minus' : '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 icon,\n onConfigure,\n onRemove,\n onAddTo,\n onChange,\n onItemSelection,\n selected,\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 const numberOfActions = [onConfigure, onRemove, onAddTo].filter(Boolean).length;\n\n const [primaryTextEl, setPrimaryTextEl] = useElement<\n HTMLSpanElement | HTMLAnchorElement | HTMLButtonElement\n >(null);\n const [secondaryTextEl, setSecondaryTextEl] = useElement<HTMLSpanElement>(null);\n\n const primaryEl = useMemo(() => {\n const primaryText = typeof primary === 'string' ? primary : primary.text;\n\n const tooltip = (\n <Tooltip smart target={primaryTextEl} showDelay='none' hideDelay='none'>\n {primaryText}\n </Tooltip>\n );\n\n const labelText = collapsed ? t('expand') : t('collapse');\n\n if (items) {\n return (\n <>\n <StyledExpandCollapseToggle\n data-testid={testIds.expandCollapseButton}\n variant='simple'\n icon\n label={labelText}\n aria-label={`${labelText} - ${primaryText}`}\n onClick={() => setCollapsed(cur => !cur)}\n aria-owns={expandCollpaseId}\n aria-expanded={!collapsed}\n >\n <Icon name='caret-down' />\n </StyledExpandCollapseToggle>\n <span ref={setPrimaryTextEl}>\n {primaryText}\n {tooltip}\n </span>\n </>\n );\n }\n\n if (typeof primary === 'string') {\n return (\n <span ref={setPrimaryTextEl}>\n {primaryText}\n {tooltip}\n </span>\n );\n }\n\n return (\n <Button variant='link' onClick={primary.onClick} href={primary.href} ref={setPrimaryTextEl}>\n <StyledPrimary>\n {primaryText}\n {tooltip}\n </StyledPrimary>\n </Button>\n );\n }, [t, items, primary, collapsed, expandCollpaseId, primaryTextEl]);\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 hasActions={hasActions}\n >\n <Flex\n container={{ alignItems: 'center' }}\n as={StyledListItemInner}\n isDraggable={draggable}\n isSelectable={!!onItemSelection}\n hasActions={hasActions}\n hasVisual={!!status || !!icon}\n >\n {draggable && <DragHandle itemId={id} ref={dragRef} data-testid={testIds.dragHandle} />}\n <Flex container={{ alignItems: 'center', gap: 0.5 }} item={{ shrink: 1 }}>\n <Flex\n container={{ alignItems: 'center', gap: status || icon ? 1 : undefined, pad: 0.5 }}\n as={StyledItemContent}\n >\n {onItemSelection && !data.items && (\n <Checkbox\n data-testid={testIds.checkbox}\n aria-label={typeof primary === 'string' ? primary : primary.text}\n checked={selected}\n onChange={e => onItemSelection({ ...data, selected: e.target.checked })}\n />\n )}\n {status && <ItemStatus type={status?.type} message={status?.message} />}\n {icon && !items && <Icon data-testid={testIds.icon} {...icon} size='s' />}\n\n {primaryEl}\n </Flex>\n </Flex>\n\n {(secondary || hasActions) && (\n <Flex\n container={{ alignItems: 'center', justify: 'end', gap: 0.5 }}\n item={{ grow: 1 }}\n numberOfActions={numberOfActions}\n as={StyledItemSecondaryContainer}\n >\n {secondary && (\n <StyledSecondary variant='secondary' ref={setSecondaryTextEl}>\n {secondary}\n <Tooltip smart target={secondaryTextEl} showDelay='none' hideDelay='none'>\n {secondary}\n </Tooltip>\n </StyledSecondary>\n )}\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\n accept={data.accept}\n items={data.items}\n onChange={data.onChange}\n onItemSelection={data.onItemSelection}\n />\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 info,\n footer,\n onChange: onChangeProp,\n onItemSelection,\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: {\n ...item,\n onItemSelection,\n draggable: item.draggable && !!onChangeProp\n } as InternalStandardDragDropListItemProps\n };\n if (!item.items) return newItem;\n\n return {\n ...newItem,\n data: {\n ...item,\n onItemSelection,\n accept: item.accept ?? accept,\n draggable: item.draggable && !!onChangeProp,\n onChange: onChangeProp\n ? (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 : undefined\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} data-testid={testIds.root} {...restProps}>\n {heading && (\n <Flex container={{ direction: 'column', gap: 1, pad: [1, undefined] }}>\n <Flex\n data-testid={testIds.header}\n container={{\n justify: 'between',\n alignItems: 'center',\n gap: 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 {info && <Text variant='primary'>{info}</Text>}\n </Flex>\n )}\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, undefined]\n }}\n as='footer'\n >\n {footer}\n </Flex>\n )}\n </StyledStandardDragDropList>\n );\n});\n\nexport default withTestIds(StandardDragDropList, getStandardDragDropListTestIds);\n"]}
@@ -1,14 +1,18 @@
1
1
  import { type DefaultTheme, type StyledComponent } from 'styled-components';
2
- export declare const StyledExpandCollapseToggle: StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & import("@pega/cosmos-react-core").ForwardProps>, DefaultTheme, {}, never>;
2
+ export declare const StyledExpandCollapseToggle: StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").ButtonProps>, DefaultTheme, {}, never>;
3
3
  export declare const StyledItemStatus: StyledComponent<"div", DefaultTheme, {}, never>;
4
4
  export declare const StyledItemContent: StyledComponent<"div", DefaultTheme, {}, never>;
5
5
  export declare const StyledItemActions: StyledComponent<"div", DefaultTheme, {}, never>;
6
- export declare const StyledPrimary: StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").TextProps & import("@pega/cosmos-react-core").ForwardProps>, DefaultTheme, {}, never>;
7
- export declare const StyledSecondary: StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").TextProps & import("@pega/cosmos-react-core").ForwardProps>, DefaultTheme, {}, never>;
6
+ export declare const StyledItemSecondaryContainer: StyledComponent<"div", DefaultTheme, {
7
+ numberOfActions: number;
8
+ }, never>;
9
+ export declare const StyledPrimary: StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").TextProps>, DefaultTheme, {}, never>;
10
+ export declare const StyledSecondary: StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").TextProps>, DefaultTheme, {}, never>;
8
11
  export declare const StyledListItemInner: StyledComponent<"div", DefaultTheme, {
9
12
  isDraggable?: boolean;
10
13
  hasActions?: boolean;
11
14
  hasVisual?: boolean;
15
+ isSelectable?: boolean;
12
16
  }, never>;
13
17
  export declare const StyledStandardDragDropListItem: StyledComponent<"li", DefaultTheme, {
14
18
  isDragging?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"StandardDragDropList.styles.d.ts","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.styles.ts"],"names":[],"mappings":"AAAA,OAAe,EAAO,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAOzF,eAAO,MAAM,0BAA0B,6KAerC,CAAC;AAIH,eAAO,MAAM,gBAAgB,iDAU3B,CAAC;AAIH,eAAO,MAAM,iBAAiB,iDAW5B,CAAC;AAIH,eAAO,MAAM,iBAAiB,iDAAe,CAAC;AAE9C,eAAO,MAAM,aAAa,2KAGzB,CAAC;AAEF,eAAO,MAAM,eAAe,2KAG3B,CAAC;AAEF,eAAO,MAAM,mBAAmB;kBAChB,OAAO;iBACR,OAAO;gBACR,OAAO;SAgCnB,CAAC;AAIH,eAAO,MAAM,8BAA8B;iBAC5B,OAAO;YACZ,OAAO;SAiEf,CAAC;AAIH,eAAO,MAAM,0BAA0B,EAAE,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAyFvF,CAAC"}
1
+ {"version":3,"file":"StandardDragDropList.styles.d.ts","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.styles.ts"],"names":[],"mappings":"AAAA,OAAe,EAAO,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAQzF,eAAO,MAAM,0BAA0B,4JAerC,CAAC;AAIH,eAAO,MAAM,gBAAgB,iDAU3B,CAAC;AAIH,eAAO,MAAM,iBAAiB,iDAe5B,CAAC;AAIH,eAAO,MAAM,iBAAiB,iDAAe,CAAC;AAE9C,eAAO,MAAM,4BAA4B;qBAAiC,MAAM;SAa/E,CAAC;AAEF,eAAO,MAAM,aAAa,0JAGzB,CAAC;AAEF,eAAO,MAAM,eAAe,0JAG3B,CAAC;AAEF,eAAO,MAAM,mBAAmB;kBAChB,OAAO;iBACR,OAAO;gBACR,OAAO;mBACJ,OAAO;SAiCtB,CAAC;AAIH,eAAO,MAAM,8BAA8B;iBAC5B,OAAO;YACZ,OAAO;SAiEf,CAAC;AAIH,eAAO,MAAM,0BAA0B,EAAE,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAyFvF,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import { Button, defaultThemeProp, StyledIcon, Text, useDirection } from '@pega/cosmos-react-core';
3
- import { elipsisOverflow } from '@pega/cosmos-react-core/lib/styles/mixins';
3
+ import { ellipsisOverflow } from '@pega/cosmos-react-core/lib/styles/mixins';
4
+ import { StyledPseudoRadioCheck } from '@pega/cosmos-react-core/lib/components/RadioCheck/RadioCheck';
4
5
  import { StyledDragHandle } from '../DragHandle';
5
6
  export const StyledExpandCollapseToggle = styled(Button)(({ theme }) => {
6
7
  const { ltr } = useDirection();
@@ -35,25 +36,40 @@ export const StyledItemContent = styled.div(({ theme }) => {
35
36
  return css `
36
37
  &,
37
38
  & > :nth-child(2) {
38
- ${elipsisOverflow}
39
+ ${ellipsisOverflow}
39
40
  }
40
41
 
41
42
  & > ${StyledIcon} {
42
43
  margin-inline: ${theme.base.spacing};
43
44
  }
45
+
46
+ & ${StyledPseudoRadioCheck} {
47
+ margin-inline-end: 0;
48
+ }
44
49
  `;
45
50
  });
46
51
  StyledItemContent.defaultProps = defaultThemeProp;
47
52
  export const StyledItemActions = styled.div ``;
53
+ export const StyledItemSecondaryContainer = styled.div(({ theme, numberOfActions }) => {
54
+ const minContainerWidth = `calc(${numberOfActions} * ${theme.base['hit-area']['mouse-min']} + ${numberOfActions - 1} * ${theme.base.spacing} / 2)`;
55
+ const minCoarseContainerWidth = `calc(${numberOfActions} * ${theme.base['hit-area']['finger-min']} + ${numberOfActions - 1} * ${theme.base.spacing} / 2)`;
56
+ return css `
57
+ min-width: ${minContainerWidth};
58
+
59
+ @media (pointer: coarse) {
60
+ min-width: ${minCoarseContainerWidth};
61
+ }
62
+ `;
63
+ });
48
64
  export const StyledPrimary = styled(Text) `
49
65
  display: inline;
50
- ${elipsisOverflow};
66
+ ${ellipsisOverflow};
51
67
  `;
52
68
  export const StyledSecondary = styled(Text) `
53
69
  max-width: 14ch;
54
- ${elipsisOverflow}
70
+ ${ellipsisOverflow}
55
71
  `;
56
- export const StyledListItemInner = styled.div(({ theme, isDraggable, hasActions, hasVisual }) => {
72
+ export const StyledListItemInner = styled.div(({ theme, isDraggable, hasActions, hasVisual, isSelectable }) => {
57
73
  return css `
58
74
  white-space: nowrap;
59
75
  padding-inline-start: calc(${theme.base.spacing} / 2);
@@ -62,12 +78,13 @@ export const StyledListItemInner = styled.div(({ theme, isDraggable, hasActions,
62
78
  : `calc(${theme.base.spacing} * 1.5)`};
63
79
 
64
80
  ${!isDraggable &&
65
- !hasVisual &&
81
+ (!hasVisual || isSelectable) &&
66
82
  css `
67
83
  padding-inline-start: ${theme.base.spacing};
68
84
  `}
69
85
  ${hasVisual &&
70
86
  !isDraggable &&
87
+ !isSelectable &&
71
88
  css `
72
89
  padding-inline-start: 0;
73
90
  `}
@@ -1 +1 @@
1
- {"version":3,"file":"StandardDragDropList.styles.js","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAA2C,MAAM,mBAAmB,CAAC;AAEzF,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACnG,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACrE,MAAM,EAAE,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;IAC/B,OAAO,GAAG,CAAA;;;;;QAKJ,UAAU;8BACY,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI;;;+BAG7D,UAAU;2BACd,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;;GAEtC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,0BAA0B,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3D,M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yledComponent } from 'styled-components';\n\nimport { Button, defaultThemeProp, StyledIcon, Text, useDirection } from '@pega/cosmos-react-core';\nimport { elipsisOverflow } from '@pega/cosmos-react-core/lib/styles/mixins';\n\nimport { StyledDragHandle } from '../DragHandle';\n\nexport const StyledExpandCollapseToggle = styled(Button)(({ theme }) => {\n const { ltr } = useDirection();\n return css`\n & > div {\n vertical-align: middle;\n }\n\n & ${StyledIcon} {\n transition: transform ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n }\n\n &[aria-expanded='false'] ${StyledIcon}:first-of-type {\n transform: rotateZ(${ltr ? '-' : ''}90deg);\n }\n `;\n});\n\nStyledExpandCollapseToggle.defaultProps = defaultThemeProp;\n\nexport const StyledItemStatus = styled.div(({ theme }) => {\n return css`\n ${StyledIcon} {\n outline: none;\n\n &:focus {\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n }\n `;\n});\n\nStyledItemStatus.defaultProps = defaultThemeProp;\n\nexport const StyledItemContent = styled.div(({ theme }) => {\n return css`\n &,\n & > :nth-child(2) {\n ${elipsisOverflow}\n }\n\n & > ${StyledIcon} {\n margin-inline: ${theme.base.spacing};\n }\n `;\n});\n\nStyledItemContent.defaultProps = defaultThemeProp;\n\nexport const StyledItemActions = styled.div``;\n\nexport const StyledPrimary = styled(Text)`\n display: inline;\n ${elipsisOverflow};\n`;\n\nexport const StyledSecondary = styled(Text)`\n max-width: 14ch;\n ${elipsisOverflow}\n`;\n\nexport const StyledListItemInner = styled.div<{\n isDraggable?: boolean;\n hasActions?: boolean;\n hasVisual?: boolean;\n}>(({ theme, isDraggable, hasActions, hasVisual }) => {\n return css`\n white-space: nowrap;\n padding-inline-start: calc(${theme.base.spacing} / 2);\n padding-inline-end: ${hasActions\n ? `calc(${theme.base.spacing} / 2)`\n : `calc(${theme.base.spacing} * 1.5)`};\n\n ${!isDraggable &&\n !hasVisual &&\n css`\n padding-inline-start: ${theme.base.spacing};\n `}\n ${hasVisual &&\n !isDraggable &&\n css`\n padding-inline-start: 0;\n `}\n\n &:has(${StyledExpandCollapseToggle}) {\n padding-inline-start: calc(${theme.base.spacing} * 0.5);\n\n &:not(:has(${StyledDragHandle})) {\n padding-inline-start: 0;\n }\n\n & > ${StyledDragHandle} {\n padding-inline-end: 0;\n }\n }\n `;\n});\n\nStyledListItemInner.defaultProps = defaultThemeProp;\n\nexport const StyledStandardDragDropListItem = styled.li<{\n isDragging?: boolean;\n empty?: boolean;\n}>(({ theme, isDragging, empty }) => {\n const bdrColor = theme.base.palette['border-line'];\n const bdr = `0.0625rem dashed ${isDragging || empty ? bdrColor : 'transparent'}`;\n\n if (empty) {\n return css`\n text-align: center;\n padding: ${theme.base.spacing};\n border: ${bdr};\n font-style: italic;\n `;\n }\n\n return css`\n position: relative;\n background: ${theme.base.palette['primary-background']};\n\n ${isDragging &&\n css`\n z-index: 1;\n\n & > div,\n span {\n opacity: 0.5;\n }\n `}\n\n &::before,\n &::after {\n content: '';\n display: block;\n position: absolute;\n height: 0.0625rem;\n left: 0;\n right: 0;\n background: ${isDragging ? theme.base.palette['primary-background'] : bdrColor};\n }\n\n &::before {\n top: 0;\n border-top: ${bdr};\n ${isDragging &&\n css`\n box-shadow: 0 0.0625rem 0 ${theme.base.palette.interactive};\n `}\n }\n\n &::after {\n bottom: -0.0625rem;\n border-bottom: ${bdr};\n ${isDragging &&\n css`\n box-shadow: 0 -0.0625rem 0 ${theme.base.palette.interactive};\n `}\n }\n\n & > ${StyledListItemInner} {\n min-height: calc(${theme.base['hit-area'].mouse} + ${theme.base.spacing});\n\n @media (pointer: coarse) {\n min-height: calc(${theme.base['hit-area']['finger-min']} + ${theme.base.spacing});\n }\n }\n `;\n});\n\nStyledStandardDragDropListItem.defaultProps = defaultThemeProp;\n\nexport const StyledStandardDragDropList: StyledComponent<'div', DefaultTheme, object, never> =\n styled.div(({ theme }) => {\n const {\n base: {\n palette: { 'border-line': borderColor },\n 'border-radius': baseBorderRadius\n },\n components: {\n 'form-control': { 'border-radius': borderRadiusMultiplier, 'border-width': borderWidth }\n }\n } = theme;\n\n const matchBottomBorderRadius = css`\n border-end-start-radius: calc(${baseBorderRadius} * ${borderRadiusMultiplier});\n border-end-end-radius: calc(${baseBorderRadius} * ${borderRadiusMultiplier});\n `;\n\n return css`\n flex-grow: 1;\n background-color: ${theme.base.palette['primary-background']};\n\n ul {\n list-style: none;\n border: ${borderWidth} solid ${borderColor};\n border-radius: calc(${baseBorderRadius} * ${borderRadiusMultiplier});\n\n > ${StyledStandardDragDropListItem} {\n &:first-child {\n border-start-start-radius: calc(${baseBorderRadius} * ${borderRadiusMultiplier});\n border-start-end-radius: calc(${baseBorderRadius} * ${borderRadiusMultiplier});\n\n &::before {\n display: none;\n }\n }\n\n &:last-child,\n &:last-child ${StyledStandardDragDropListItem}:last-child {\n ${matchBottomBorderRadius}\n\n &::after {\n display: none;\n }\n }\n\n &:last-child ${StyledStandardDragDropList} {\n ${matchBottomBorderRadius}\n }\n }\n\n ul {\n border: none;\n\n > ${StyledStandardDragDropListItem} {\n &:first-child {\n border-radius: 0;\n }\n\n &:first-child::before {\n display: block;\n }\n\n &:last-child {\n border-radius: 0;\n }\n\n &:last-child::after {\n display: block;\n }\n }\n }\n }\n\n & & {\n padding-inline: calc(3.5 * ${theme.base.spacing}) 0;\n\n ${StyledStandardDragDropListItem} {\n ${StyledListItemInner} {\n padding-inline-start: calc(${theme.base.spacing} * 1);\n }\n\n &:last-child {\n &::after {\n display: none;\n }\n }\n }\n }\n `;\n });\n\nStyledStandardDragDropList.defaultProps = defaultThemeProp;\n"]}
1
+ {"version":3,"file":"StandardDragDropList.styles.js","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAA2C,MAAM,mBAAmB,CAAC;AAEzF,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACnG,O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AAC","sourcesContent":["import styled, { css, type DefaultTheme, type StyledComponent } from 'styled-components';\n\nimport { Button, defaultThemeProp, StyledIcon, Text, useDirection } from '@pega/cosmos-react-core';\nimport { ellipsisOverflow } from '@pega/cosmos-react-core/lib/styles/mixins';\nimport { StyledPseudoRadioCheck } from '@pega/cosmos-react-core/lib/components/RadioCheck/RadioCheck';\n\nimport { StyledDragHandle } from '../DragHandle';\n\nexport const StyledExpandCollapseToggle = styled(Button)(({ theme }) => {\n const { ltr } = useDirection();\n return css`\n & > div {\n vertical-align: middle;\n }\n\n & ${StyledIcon} {\n transition: transform ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n }\n\n &[aria-expanded='false'] ${StyledIcon}:first-of-type {\n transform: rotateZ(${ltr ? '-' : ''}90deg);\n }\n `;\n});\n\nStyledExpandCollapseToggle.defaultProps = defaultThemeProp;\n\nexport const StyledItemStatus = styled.div(({ theme }) => {\n return css`\n ${StyledIcon} {\n outline: none;\n\n &:focus {\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n }\n `;\n});\n\nStyledItemStatus.defaultProps = defaultThemeProp;\n\nexport const StyledItemContent = styled.div(({ theme }) => {\n return css`\n &,\n & > :nth-child(2) {\n ${ellipsisOverflow}\n }\n\n & > ${StyledIcon} {\n margin-inline: ${theme.base.spacing};\n }\n\n & ${StyledPseudoRadioCheck} {\n margin-inline-end: 0;\n }\n `;\n});\n\nStyledItemContent.defaultProps = defaultThemeProp;\n\nexport const StyledItemActions = styled.div``;\n\nexport const StyledItemSecondaryContainer = styled.div<{ numberOfActions: number }>(\n ({ theme, numberOfActions }) => {\n const minContainerWidth = `calc(${numberOfActions} * ${theme.base['hit-area']['mouse-min']} + ${numberOfActions - 1} * ${theme.base.spacing} / 2)`;\n const minCoarseContainerWidth = `calc(${numberOfActions} * ${theme.base['hit-area']['finger-min']} + ${numberOfActions - 1} * ${theme.base.spacing} / 2)`;\n\n return css`\n min-width: ${minContainerWidth};\n\n @media (pointer: coarse) {\n min-width: ${minCoarseContainerWidth};\n }\n `;\n }\n);\n\nexport const StyledPrimary = styled(Text)`\n display: inline;\n ${ellipsisOverflow};\n`;\n\nexport const StyledSecondary = styled(Text)`\n max-width: 14ch;\n ${ellipsisOverflow}\n`;\n\nexport const StyledListItemInner = styled.div<{\n isDraggable?: boolean;\n hasActions?: boolean;\n hasVisual?: boolean;\n isSelectable?: boolean;\n}>(({ theme, isDraggable, hasActions, hasVisual, isSelectable }) => {\n return css`\n white-space: nowrap;\n padding-inline-start: calc(${theme.base.spacing} / 2);\n padding-inline-end: ${hasActions\n ? `calc(${theme.base.spacing} / 2)`\n : `calc(${theme.base.spacing} * 1.5)`};\n\n ${!isDraggable &&\n (!hasVisual || isSelectable) &&\n css`\n padding-inline-start: ${theme.base.spacing};\n `}\n ${hasVisual &&\n !isDraggable &&\n !isSelectable &&\n css`\n padding-inline-start: 0;\n `}\n\n &:has(${StyledExpandCollapseToggle}) {\n padding-inline-start: calc(${theme.base.spacing} * 0.5);\n\n &:not(:has(${StyledDragHandle})) {\n padding-inline-start: 0;\n }\n\n & > ${StyledDragHandle} {\n padding-inline-end: 0;\n }\n }\n `;\n});\n\nStyledListItemInner.defaultProps = defaultThemeProp;\n\nexport const StyledStandardDragDropListItem = styled.li<{\n isDragging?: boolean;\n empty?: boolean;\n}>(({ theme, isDragging, empty }) => {\n const bdrColor = theme.base.palette['border-line'];\n const bdr = `0.0625rem dashed ${isDragging || empty ? bdrColor : 'transparent'}`;\n\n if (empty) {\n return css`\n text-align: center;\n padding: ${theme.base.spacing};\n border: ${bdr};\n font-style: italic;\n `;\n }\n\n return css`\n position: relative;\n background: ${theme.base.palette['primary-background']};\n\n ${isDragging &&\n css`\n z-index: 1;\n\n & > div,\n span {\n opacity: 0.5;\n }\n `}\n\n &::before,\n &::after {\n content: '';\n display: block;\n position: absolute;\n height: 0.0625rem;\n left: 0;\n right: 0;\n background: ${isDragging ? theme.base.palette['primary-background'] : bdrColor};\n }\n\n &::before {\n top: 0;\n border-top: ${bdr};\n ${isDragging &&\n css`\n box-shadow: 0 0.0625rem 0 ${theme.base.palette.interactive};\n `}\n }\n\n &::after {\n bottom: -0.0625rem;\n border-bottom: ${bdr};\n ${isDragging &&\n css`\n box-shadow: 0 -0.0625rem 0 ${theme.base.palette.interactive};\n `}\n }\n\n & > ${StyledListItemInner} {\n min-height: calc(${theme.base['hit-area'].mouse} + ${theme.base.spacing});\n\n @media (pointer: coarse) {\n min-height: calc(${theme.base['hit-area']['finger-min']} + ${theme.base.spacing});\n }\n }\n `;\n});\n\nStyledStandardDragDropListItem.defaultProps = defaultThemeProp;\n\nexport const StyledStandardDragDropList: StyledComponent<'div', DefaultTheme, object, never> =\n styled.div(({ theme }) => {\n const {\n base: {\n palette: { 'border-line': borderColor },\n 'border-radius': baseBorderRadius\n },\n components: {\n 'form-control': { 'border-radius': borderRadiusMultiplier, 'border-width': borderWidth }\n }\n } = theme;\n\n const matchBottomBorderRadius = css`\n border-end-start-radius: calc(${baseBorderRadius} * ${borderRadiusMultiplier});\n border-end-end-radius: calc(${baseBorderRadius} * ${borderRadiusMultiplier});\n `;\n\n return css`\n flex-grow: 1;\n background-color: ${theme.base.palette['primary-background']};\n\n ul {\n list-style: none;\n border: ${borderWidth} solid ${borderColor};\n border-radius: calc(${baseBorderRadius} * ${borderRadiusMultiplier});\n\n > ${StyledStandardDragDropListItem} {\n &:first-child {\n border-start-start-radius: calc(${baseBorderRadius} * ${borderRadiusMultiplier});\n border-start-end-radius: calc(${baseBorderRadius} * ${borderRadiusMultiplier});\n\n &::before {\n display: none;\n }\n }\n\n &:last-child,\n &:last-child ${StyledStandardDragDropListItem}:last-child {\n ${matchBottomBorderRadius}\n\n &::after {\n display: none;\n }\n }\n\n &:last-child ${StyledStandardDragDropList} {\n ${matchBottomBorderRadius}\n }\n }\n\n ul {\n border: none;\n\n > ${StyledStandardDragDropListItem} {\n &:first-child {\n border-radius: 0;\n }\n\n &:first-child::before {\n display: block;\n }\n\n &:last-child {\n border-radius: 0;\n }\n\n &:last-child::after {\n display: block;\n }\n }\n }\n }\n\n & & {\n padding-inline: calc(3.5 * ${theme.base.spacing}) 0;\n\n ${StyledStandardDragDropListItem} {\n ${StyledListItemInner} {\n padding-inline-start: calc(${theme.base.spacing} * 1);\n }\n\n &:last-child {\n &::after {\n display: none;\n }\n }\n }\n }\n `;\n });\n\nStyledStandardDragDropList.defaultProps = defaultThemeProp;\n"]}
@@ -1,3 +1,3 @@
1
- export declare const getItemRendererTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["expand-collapse-button", "add-button", "configure-button", "remove-button", "drag-handle", "icon"]>;
1
+ export declare const getItemRendererTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["expand-collapse-button", "add-button", "configure-button", "remove-button", "drag-handle", "icon", "checkbox"]>;
2
2
  export declare const getStandardDragDropListTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => 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,yOAOxB,CAAC;AAEZ,eAAO,MAAM,8BAA8B,+IAEhC,CAAC"}
1
+ {"version":3,"file":"StandardDragDropList.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,qPAQxB,CAAC;AAEZ,eAAO,MAAM,8BAA8B,+IAEhC,CAAC"}
@@ -5,7 +5,8 @@ export const getItemRendererTestIds = createTestIds('standard-drag-drop-item', [
5
5
  'configure-button',
6
6
  'remove-button',
7
7
  'drag-handle',
8
- 'icon'
8
+ 'icon',
9
+ 'checkbox'
9
10
  ]);
10
11
  export const getStandardDragDropListTestIds = createTestIds('standard-drag-drop-list', [
11
12
  'header'
@@ -1 +1 @@
1
- {"version":3,"file":"StandardDragDropList.test-ids.js","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAAC,yBAAyB,EAAE;IAC7E,wBAAwB;IACxB,YAAY;IACZ,kBAAkB;IAClB,eAAe;IACf,aAAa;IACb,MAAM;CACE,CAAC,CAAC;AAEZ,MAAM,CAAC,MAAM,8BAA8B,GAAG,aAAa,CAAC,yBAAyB,EAAE;IACrF,QAAQ;CACA,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\n\nexport const getItemRendererTestIds = createTestIds('standard-drag-drop-item', [\n 'expand-collapse-button',\n 'add-button',\n 'configure-button',\n 'remove-button',\n 'drag-handle',\n 'icon'\n] as const);\n\nexport const getStandardDragDropListTestIds = createTestIds('standard-drag-drop-list', [\n 'header'\n] as const);\n"]}
1
+ {"version":3,"file":"StandardDragDropList.test-ids.js","sourceRoot":"","sources":["../../../src/components/StandardDragDropList/StandardDragDropList.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAAC,yBAAyB,EAAE;IAC7E,wBAAwB;IACxB,YAAY;IACZ,kBAAkB;IAClB,eAAe;IACf,aAAa;IACb,MAAM;IACN,UAAU;CACF,CAAC,CAAC;AAEZ,MAAM,CAAC,MAAM,8BAA8B,GAAG,aAAa,CAAC,yBAAyB,EAAE;IACrF,QAAQ;CACA,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\n\nexport const getItemRendererTestIds = createTestIds('standard-drag-drop-item', [\n 'expand-collapse-button',\n 'add-button',\n 'configure-button',\n 'remove-button',\n 'drag-handle',\n 'icon',\n 'checkbox'\n] as const);\n\nexport const getStandardDragDropListTestIds = createTestIds('standard-drag-drop-list', [\n 'header'\n] as const);\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { MouseEvent, MouseEventHandler, ReactNode, Ref } from 'react';
2
- import type { TestIdProp, OmitStrict, BaseProps, NoChildrenProp, ForwardProps, HeadingTag, AdditionalInfoProps, IconProps } from '@pega/cosmos-react-core';
2
+ import type { TestIdProp, OmitStrict, BaseProps, NoChildrenProp, ForwardProps, HeadingTag, AdditionalInfoProps, IconProps, FormControlProps } 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. */
@@ -11,11 +11,15 @@ export interface StandardDragDropListProps extends OmitStrict<DragDropListProps<
11
11
  heading?: AdditionalInfoProps['heading'];
12
12
  content: AdditionalInfoProps['children'];
13
13
  };
14
+ /** For use in providing instructional information about the list. */
15
+ info?: FormControlProps['info'];
14
16
  /**
15
17
  * Select the heading tag for header
16
18
  * @default h2
17
19
  */
18
20
  headingTag?: HeadingTag;
21
+ /** Enables list item selection rendering checkboxes for each. */
22
+ onItemSelection?: (item: StandardDragDropListItemProps) => void;
19
23
  /** A region for various list level actions */
20
24
  footer?: ReactNode;
21
25
  /**
@@ -47,6 +51,8 @@ export type StandardDragDropListItemProps = ForwardProps & {
47
51
  };
48
52
  /** Whether or not the item can be reordered with drag. */
49
53
  draggable?: boolean;
54
+ /** Selected state of the item. */
55
+ selected?: boolean;
50
56
  /** Defines the props of the icon passed to the list item */
51
57
  icon?: OmitStrict<IconProps, 'size'>;
52
58
  /**
@@ -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,EACV,mBAAmB,EACnB,SAAS,EACV,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,MAAM,CAAC;IACjB,uFAAuF;IACvF,cAAc,CAAC,EAAE;QACf,OAAO,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACzC,OAAO,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;KAC1C,CAAC;IACF;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC/D,uDAAuD;IACvD,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,KAAK,UAAU,GAAG,CAChB,EAAE,EAAE,6BAA6B,CAAC,IAAI,CAAC,EACvC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAC7B,IAAI,CAAC;AAEV,MAAM,MAAM,6BAA6B,GAAG,YAAY,GAAG;IACzD,6DAA6D;IAC7D,EAAE,EAAE,MAAM,CAAC;IACX,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,wFAAwF;IACxF,OAAO,EAAE,MAAM,GAAG,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,iBAAiB,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,YAAY,CAAC,CAAC;IAC/F,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;QAC1B,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACrC;;;OAGG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAC;CACvB,GAAG,CACE;IACE,sDAAsD;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
+ {"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,E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EV,MAAM,MAAM,6BAA6B,GAAG,YAAY,GAAG;IACzD,6DAA6D;IAC7D,EAAE,EAAE,MAAM,CAAC;IACX,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,wFAAwF;IACxF,OAAO,EAAE,MAAM,GAAG,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,iBAAiB,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,YAAY,CAAC,CAAC;IAC/F,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;QAC1B,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACrC;;;OAGG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAC;CACvB,GAAG,CACE;IACE,sDAAsD;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 AdditionalInfoProps,\n IconProps\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 /** Defines the props of the icon passed to the list item */\n icon?: OmitStrict<IconProps, 'size'>;\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 IconProps,\n FormControlProps\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 /** For use in providing instructional information about the list. */\n info?: FormControlProps['info'];\n /**\n * Select the heading tag for header\n * @default h2\n */\n headingTag?: HeadingTag;\n /** Enables list item selection rendering checkboxes for each. */\n onItemSelection?: (item: StandardDragDropListItemProps) => void;\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 /** Selected state of the item. */\n selected?: boolean;\n /** Defines the props of the icon passed to the list item */\n icon?: OmitStrict<IconProps, 'size'>;\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": "8.0.0-build.9.1",
3
+ "version": "8.0.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/pegasystems/cosmos-react.git",
@@ -19,26 +19,26 @@
19
19
  "build": "tsc -b tsconfig.build.json"
20
20
  },
21
21
  "dependencies": {
22
- "@pega/cosmos-react-core": "8.0.0-build.9.1",
23
- "@types/react": "^17.0.62",
24
- "@types/react-dom": "^17.0.20",
22
+ "@pega/cosmos-react-core": "8.0.1",
23
+ "@types/react": "^17.0.62 || ^18.3.3",
24
+ "@types/react-dom": "^17.0.20 || ^18.3.0",
25
25
  "@types/styled-components": "^5.1.26",
26
26
  "dnd-core": "14.0.1",
27
27
  "polished": "^4.1.0",
28
28
  "rdndmb-html5-to-touch": "^7.1.3",
29
- "react": "^17.0.0",
30
- "react-dnd": "^14.0.4",
29
+ "react": "^17.0.0 || ^18.0.0",
30
+ "react-dnd": "^14.0.5",
31
31
  "react-dnd-multi-backend": "^7.1.3",
32
- "react-dom": "^17.0.0",
32
+ "react-dom": "^17.0.0 || ^18.0.0",
33
33
  "styled-components": "^5.2.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@storybook/addon-actions": "~8.2.9",
37
37
  "@storybook/react": "~8.2.9",
38
38
  "@storybook/theming": "~8.2.9",
39
- "@testing-library/dom": "^8.13.0",
40
- "@testing-library/react": "^12.1.3",
41
- "@testing-library/user-event": "^14.5.1",
39
+ "@testing-library/dom": "^10.3.0",
40
+ "@testing-library/react": "^16.0.0",
41
+ "@testing-library/user-event": "^14.6.1",
42
42
  "typescript": "~5.5.4"
43
43
  }
44
44
  }