carbon-react 114.9.0 → 114.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/esm/__internal__/popover/popover.component.js +1 -1
  2. package/esm/components/draggable/draggable-container.component.js +4 -4
  3. package/esm/components/draggable/draggable-container.d.ts +4 -1
  4. package/esm/components/duelling-picklist/duelling-picklist.component.d.ts +21 -0
  5. package/esm/components/duelling-picklist/duelling-picklist.component.js +171 -36
  6. package/esm/components/duelling-picklist/duelling-picklist.context.d.ts +11 -0
  7. package/esm/components/duelling-picklist/duelling-picklist.context.js +6 -1
  8. package/esm/components/duelling-picklist/duelling-picklist.style.d.ts +10 -0
  9. package/esm/components/duelling-picklist/index.d.ts +12 -6
  10. package/esm/components/duelling-picklist/picklist/picklist.component.d.ts +16 -0
  11. package/esm/components/duelling-picklist/picklist/picklist.component.js +31 -39
  12. package/esm/components/duelling-picklist/picklist/picklist.style.d.ts +5 -0
  13. package/esm/components/duelling-picklist/picklist-divider/picklist-divider.component.d.ts +5 -0
  14. package/esm/components/duelling-picklist/picklist-divider/picklist-divider.component.js +4 -0
  15. package/esm/components/duelling-picklist/picklist-divider/picklist-divider.style.d.ts +2 -0
  16. package/esm/components/duelling-picklist/picklist-group/picklist-group.component.d.ts +19 -0
  17. package/esm/components/duelling-picklist/picklist-group/picklist-group.component.js +30 -32
  18. package/esm/components/duelling-picklist/picklist-group/picklist-group.style.d.ts +14 -0
  19. package/esm/components/duelling-picklist/picklist-item/picklist-item.component.d.ts +28 -0
  20. package/esm/components/duelling-picklist/picklist-item/picklist-item.component.js +16 -44
  21. package/esm/components/duelling-picklist/picklist-item/picklist-item.style.d.ts +7 -0
  22. package/esm/components/duelling-picklist/picklist-placeholder/picklist-placeholder.component.d.ts +7 -0
  23. package/esm/components/duelling-picklist/picklist-placeholder/picklist-placeholder.component.js +2 -2
  24. package/lib/__internal__/popover/popover.component.js +1 -1
  25. package/lib/components/draggable/draggable-container.component.js +4 -4
  26. package/lib/components/draggable/draggable-container.d.ts +4 -1
  27. package/lib/components/duelling-picklist/duelling-picklist.component.d.ts +21 -0
  28. package/lib/components/duelling-picklist/duelling-picklist.component.js +172 -39
  29. package/lib/components/duelling-picklist/duelling-picklist.context.d.ts +11 -0
  30. package/lib/components/duelling-picklist/duelling-picklist.context.js +6 -1
  31. package/lib/components/duelling-picklist/duelling-picklist.style.d.ts +10 -0
  32. package/lib/components/duelling-picklist/index.d.ts +12 -6
  33. package/lib/components/duelling-picklist/picklist/picklist.component.d.ts +16 -0
  34. package/lib/components/duelling-picklist/picklist/picklist.component.js +28 -44
  35. package/lib/components/duelling-picklist/picklist/picklist.style.d.ts +5 -0
  36. package/lib/components/duelling-picklist/picklist-divider/picklist-divider.component.d.ts +5 -0
  37. package/lib/components/duelling-picklist/picklist-divider/picklist-divider.component.js +5 -0
  38. package/lib/components/duelling-picklist/picklist-divider/picklist-divider.style.d.ts +2 -0
  39. package/lib/components/duelling-picklist/picklist-group/picklist-group.component.d.ts +19 -0
  40. package/lib/components/duelling-picklist/picklist-group/picklist-group.component.js +31 -33
  41. package/lib/components/duelling-picklist/picklist-group/picklist-group.style.d.ts +14 -0
  42. package/lib/components/duelling-picklist/picklist-item/picklist-item.component.d.ts +28 -0
  43. package/lib/components/duelling-picklist/picklist-item/picklist-item.component.js +17 -45
  44. package/lib/components/duelling-picklist/picklist-item/picklist-item.style.d.ts +7 -0
  45. package/lib/components/duelling-picklist/picklist-placeholder/picklist-placeholder.component.d.ts +7 -0
  46. package/lib/components/duelling-picklist/picklist-placeholder/picklist-placeholder.component.js +3 -3
  47. package/package.json +1 -1
  48. package/esm/components/duelling-picklist/duelling-picklist.d.ts +0 -24
  49. package/esm/components/duelling-picklist/picklist/picklist.d.ts +0 -19
  50. package/esm/components/duelling-picklist/picklist-divider/picklist-divider.d.ts +0 -12
  51. package/esm/components/duelling-picklist/picklist-group/picklist-group.d.ts +0 -18
  52. package/esm/components/duelling-picklist/picklist-item/picklist-item.d.ts +0 -24
  53. package/esm/components/duelling-picklist/picklist-placeholder/picklist-placeholder.d.ts +0 -10
  54. package/lib/components/duelling-picklist/duelling-picklist.d.ts +0 -24
  55. package/lib/components/duelling-picklist/picklist/picklist.d.ts +0 -19
  56. package/lib/components/duelling-picklist/picklist-divider/picklist-divider.d.ts +0 -12
  57. package/lib/components/duelling-picklist/picklist-group/picklist-group.d.ts +0 -18
  58. package/lib/components/duelling-picklist/picklist-item/picklist-item.d.ts +0 -24
  59. package/lib/components/duelling-picklist/picklist-placeholder/picklist-placeholder.d.ts +0 -10
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.areEqual = exports.Picklist = void 0;
6
+ exports.default = exports.Picklist = void 0;
7
7
 
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
 
@@ -43,8 +43,10 @@ const Picklist = ({
43
43
  length: filteredChildren.length
44
44
  }, () => /*#__PURE__*/_react.default.createRef()), [filteredChildren.length]);
45
45
  const focusItem = (0, _react.useCallback)((ev, itemIndex) => {
46
+ var _refs$itemIndex$curre;
47
+
46
48
  ev.preventDefault();
47
- refs[itemIndex].current.focus();
49
+ (_refs$itemIndex$curre = refs[itemIndex].current) === null || _refs$itemIndex$curre === void 0 ? void 0 : _refs$itemIndex$curre.focus();
48
50
  }, [refs]);
49
51
  const handleKeyDown = (0, _react.useCallback)(ev => {
50
52
  if (_events.default.isHomeKey(ev)) {
@@ -53,22 +55,31 @@ const Picklist = ({
53
55
  focusItem(ev, refs.length - 1);
54
56
  }
55
57
  }, [focusItem, refs]);
56
- const content = filteredChildren.map((child, childIndex) => child && /*#__PURE__*/_react.default.cloneElement(child, {
57
- ref: refs[childIndex],
58
- disabled,
59
- index: childIndex,
60
- listIndex: index,
61
- isLastGroup: child.type === _picklistGroup.default && childIndex === filteredChildren.length - 1
62
- }));
58
+ const content = filteredChildren.map((child, childIndex) => {
59
+ if (! /*#__PURE__*/_react.default.isValidElement(child)) {
60
+ return child;
61
+ }
62
+
63
+ const props = {
64
+ ref: refs[childIndex],
65
+ disabled,
66
+ index: childIndex,
67
+ listIndex: index,
68
+ isLastGroup: child.type === _picklistGroup.default && childIndex === filteredChildren.length - 1
69
+ };
70
+ return /*#__PURE__*/_react.default.cloneElement(child, props);
71
+ });
63
72
  (0, _react.useEffect)(() => {
64
- if ((elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.groupIndex) === undefined && index === (elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.listIndex)) {
73
+ if (elementToFocus.groupIndex === undefined && elementToFocus.listIndex === index && elementToFocus.itemIndex !== undefined) {
65
74
  var _refs$elementToFocus$;
66
75
 
67
- if ((_refs$elementToFocus$ = refs[elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.itemIndex]) !== null && _refs$elementToFocus$ !== void 0 && _refs$elementToFocus$.current) {
68
- refs[elementToFocus.itemIndex].current.focus();
76
+ const itemToBeFocused = (_refs$elementToFocus$ = refs[elementToFocus.itemIndex]) === null || _refs$elementToFocus$ === void 0 ? void 0 : _refs$elementToFocus$.current;
77
+
78
+ if (itemToBeFocused) {
79
+ itemToBeFocused.focus();
69
80
  setElementToFocus();
70
81
  } else {
71
- setElementToFocus(0, index === 0 ? 1 : 0, elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.groupIndex);
82
+ setElementToFocus(0, index === 0 ? 1 : 0, elementToFocus.groupIndex);
72
83
  }
73
84
  }
74
85
  }, [elementToFocus, index, refs, setElementToFocus]);
@@ -83,38 +94,11 @@ const Picklist = ({
83
94
 
84
95
  exports.Picklist = Picklist;
85
96
  Picklist.propTypes = {
86
- /** List of PicklistItem elements */
87
- children: _propTypes.default.node,
88
-
89
- /** Placeholder to be rendered when list is empty */
90
- placeholder: _propTypes.default.node,
91
-
92
- /** Indicate if component is disabled */
93
- disabled: _propTypes.default.bool,
94
-
95
- /** @private @ignore */
96
- index: _propTypes.default.number
97
+ "children": _propTypes.default.node,
98
+ "disabled": _propTypes.default.bool,
99
+ "index": _propTypes.default.number,
100
+ "placeholder": _propTypes.default.node
97
101
  };
98
-
99
- const areEqual = (prevProps, nextProps) => {
100
- let changesCounter = 0;
101
-
102
- const prevChildCount = _react.default.Children.count(prevProps.children);
103
-
104
- const nextChildCount = _react.default.Children.count(nextProps.children);
105
-
106
- if (prevChildCount !== nextChildCount) {
107
- changesCounter += 1;
108
- }
109
-
110
- if (prevProps.disabled !== nextProps.disabled) {
111
- changesCounter += 1;
112
- }
113
-
114
- return !changesCounter;
115
- };
116
-
117
- exports.areEqual = areEqual;
118
102
  Picklist.displayName = "Picklist";
119
103
  var _default = Picklist;
120
104
  exports.default = _default;
@@ -0,0 +1,5 @@
1
+ declare const StyledPicklist: import("styled-components").StyledComponent<"div", any, import("../../box").BoxProps & {
2
+ as: string;
3
+ }, "as">;
4
+ declare const StyledEmptyContainer: import("styled-components").StyledComponent<"li", any, {}, never>;
5
+ export { StyledPicklist, StyledEmptyContainer };
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { StyledComponentProps } from "styled-components";
3
+ export declare type PicklistDividerProps = StyledComponentProps<"div", Record<string, unknown>, Record<string, unknown>, "">;
4
+ declare const PicklistDivider: (props: PicklistDividerProps) => JSX.Element;
5
+ export default PicklistDivider;
@@ -7,6 +7,8 @@ exports.default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
10
12
  var _picklistDivider = _interopRequireDefault(require("./picklist-divider.style"));
11
13
 
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -17,5 +19,8 @@ const PicklistDivider = props => /*#__PURE__*/_react.default.createElement(_pick
17
19
  "data-element": "picklist-divider"
18
20
  }));
19
21
 
22
+ PicklistDivider.propTypes = {
23
+ "theme": _propTypes.default.object
24
+ };
20
25
  var _default = PicklistDivider;
21
26
  exports.default = _default;
@@ -0,0 +1,2 @@
1
+ declare const StyledPicklistDivider: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export default StyledPicklistDivider;
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ export interface PicklistGroupProps {
3
+ /** Group title */
4
+ title: React.ReactNode;
5
+ /** Item content */
6
+ children: React.ReactNode;
7
+ /** Define if item is of type add or remove */
8
+ type: "add" | "remove";
9
+ /** Handler invoked when add/remove button is clicked or when space/enter is pressed on the whole item */
10
+ onChange: () => void;
11
+ /** @private @ignore */
12
+ index?: number;
13
+ /** @private @ignore */
14
+ listIndex?: number;
15
+ /** @private @ignore */
16
+ isLastGroup?: boolean;
17
+ }
18
+ export declare const PicklistGroup: React.ForwardRefExoticComponent<PicklistGroupProps & React.RefAttributes<HTMLButtonElement>>;
19
+ export default PicklistGroup;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = exports.PicklistGroup = void 0;
7
7
 
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
 
@@ -33,7 +33,7 @@ const PicklistGroup = /*#__PURE__*/_react.default.forwardRef(({
33
33
  index,
34
34
  listIndex,
35
35
  isLastGroup,
36
- ...rest
36
+ ...transitionGroupProps
37
37
  }, ref) => {
38
38
  const {
39
39
  setElementToFocus,
@@ -58,18 +58,27 @@ const PicklistGroup = /*#__PURE__*/_react.default.forwardRef(({
58
58
  length: filteredChildren.length
59
59
  }, () => /*#__PURE__*/_react.default.createRef()), [filteredChildren.length]);
60
60
 
61
- const content = _react.default.Children.map(children, (child, childIndex) => child && /*#__PURE__*/_react.default.cloneElement(child, {
62
- ref: refs[childIndex],
63
- index: childIndex,
64
- listIndex,
65
- groupIndex: index,
66
- isLastGroup,
67
- isLastItem: childIndex === filteredChildren.length - 1
68
- }));
61
+ const content = _react.default.Children.map(children, (child, childIndex) => {
62
+ if (! /*#__PURE__*/_react.default.isValidElement(child)) {
63
+ return child;
64
+ }
65
+
66
+ const props = {
67
+ ref: refs[childIndex],
68
+ index: childIndex,
69
+ listIndex,
70
+ groupIndex: index,
71
+ isLastGroup,
72
+ isLastItem: childIndex === filteredChildren.length - 1
73
+ };
74
+ return /*#__PURE__*/_react.default.cloneElement(child, props);
75
+ });
69
76
 
70
77
  (0, _react.useEffect)(() => {
71
- if (index === (elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.groupIndex) && listIndex === (elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.listIndex)) {
72
- refs[elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.itemIndex].current.focus();
78
+ if (elementToFocus.groupIndex === index && elementToFocus.listIndex === listIndex && elementToFocus.itemIndex !== undefined) {
79
+ var _refs$elementToFocus$;
80
+
81
+ (_refs$elementToFocus$ = refs[elementToFocus.itemIndex].current) === null || _refs$elementToFocus$ === void 0 ? void 0 : _refs$elementToFocus$.focus();
73
82
  setElementToFocus();
74
83
  }
75
84
  }, [elementToFocus, index, isLastGroup, listIndex, refs, setElementToFocus]);
@@ -80,7 +89,7 @@ const PicklistGroup = /*#__PURE__*/_react.default.forwardRef(({
80
89
  exit: 0
81
90
  },
82
91
  classNames: "picklist-group"
83
- }, rest, type === "add" ? {
92
+ }, transitionGroupProps, type === "add" ? {
84
93
  enter: false
85
94
  } : {}), /*#__PURE__*/_react.default.createElement(_picklistGroup.StyledGroupWrapper, {
86
95
  highlighted: highlighted,
@@ -103,27 +112,16 @@ const PicklistGroup = /*#__PURE__*/_react.default.forwardRef(({
103
112
  }, content))));
104
113
  });
105
114
 
115
+ exports.PicklistGroup = PicklistGroup;
106
116
  PicklistGroup.propTypes = {
107
- /** Group title */
108
- title: _propTypes.default.node.isRequired,
109
-
110
- /** Item content */
111
- children: _propTypes.default.node.isRequired,
112
-
113
- /** Define if item is of type add or remove */
114
- type: _propTypes.default.oneOf(["add", "remove"]).isRequired,
115
-
116
- /** Handler invoked when add/remove button is clicked or when space/enter is pressed on the whole item */
117
- onChange: _propTypes.default.func.isRequired,
118
-
119
- /** @private @ignore */
120
- index: _propTypes.default.number,
121
-
122
- /** @private @ignore */
123
- listIndex: _propTypes.default.number,
124
-
125
- /** @private @ignore */
126
- isLastGroup: _propTypes.default.bool
117
+ "children": _propTypes.default.node,
118
+ "index": _propTypes.default.number,
119
+ "isLastGroup": _propTypes.default.bool,
120
+ "listIndex": _propTypes.default.number,
121
+ "onChange": _propTypes.default.func.isRequired,
122
+ "title": _propTypes.default.node,
123
+ "type": _propTypes.default.oneOf(["add", "remove"]).isRequired
127
124
  };
125
+ PicklistGroup.displayName = "PicklistGroup";
128
126
  var _default = PicklistGroup;
129
127
  exports.default = _default;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { PicklistGroupProps } from "./picklist-group.component";
3
+ declare const StyledGroupWrapper: import("styled-components").StyledComponent<"li", any, {
4
+ highlighted: boolean;
5
+ type: PicklistGroupProps["type"];
6
+ }, never>;
7
+ declare const StyledPicklistGroupUl: import("styled-components").StyledComponent<"ul", any, {}, never>;
8
+ declare const StyledPicklistGroup: import("styled-components").StyledComponent<"li", any, {}, never>;
9
+ declare const StyledGroupButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>, any, {
10
+ onMouseEnter: (e: React.MouseEvent<HTMLButtonElement>) => void;
11
+ onMouseLeave: (e: React.MouseEvent<HTMLButtonElement>) => void;
12
+ iconType: PicklistGroupProps["type"];
13
+ }, never>;
14
+ export { StyledGroupWrapper, StyledPicklistGroupUl, StyledPicklistGroup, StyledGroupButton, };
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ declare type Item = Record<string, unknown> | string | number;
3
+ export interface PicklistItemProps {
4
+ /** Item content */
5
+ children: React.ReactNode;
6
+ /** Define if item is of type add or remove */
7
+ type: "add" | "remove";
8
+ /** Handler invoked when add/remove button is clicked or when space/enter is pressed on the whole item */
9
+ onChange: (item: Item) => void;
10
+ /** Value passed to the onChange handler - can be a string, a number or an object */
11
+ item: Item;
12
+ /** Disable the item */
13
+ locked?: boolean;
14
+ /** Tooltip message for the locked icon (only present when locked prop is true) */
15
+ tooltipMessage?: string;
16
+ /** @private @ignore */
17
+ index?: number;
18
+ /** @private @ignore */
19
+ groupIndex?: number;
20
+ /** @private @ignore */
21
+ listIndex?: number;
22
+ /** @private @ignore */
23
+ isLastItem?: boolean;
24
+ /** @private @ignore */
25
+ isLastGroup?: boolean;
26
+ }
27
+ export declare const PicklistItem: React.ForwardRefExoticComponent<PicklistItemProps & React.RefAttributes<HTMLButtonElement>>;
28
+ export default PicklistItem;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = exports.PicklistItem = void 0;
7
7
 
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
 
@@ -28,10 +28,8 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
28
28
  const PicklistItem = /*#__PURE__*/_react.default.forwardRef(({
29
29
  children,
30
30
  type,
31
- disabled,
32
31
  onChange,
33
32
  item,
34
- highlighted,
35
33
  locked,
36
34
  tooltipMessage = "This item is locked and can not be moved",
37
35
  index,
@@ -39,12 +37,12 @@ const PicklistItem = /*#__PURE__*/_react.default.forwardRef(({
39
37
  groupIndex,
40
38
  isLastGroup,
41
39
  isLastItem,
42
- ...rest
40
+ ...transitionGroupProps
43
41
  }, ref) => {
44
42
  const {
45
43
  setElementToFocus
46
44
  } = (0, _react.useContext)(_duellingPicklist.default);
47
- const picklistItemNodeRef = (0, _react.useRef)();
45
+ const picklistItemNodeRef = (0, _react.useRef)(null);
48
46
  const calculateFocusIndex = (0, _react.useCallback)(() => {
49
47
  if (isLastItem) {
50
48
  const toggledListIndex = listIndex === 0 ? 1 : 0;
@@ -88,7 +86,7 @@ const PicklistItem = /*#__PURE__*/_react.default.forwardRef(({
88
86
  exit: 0
89
87
  },
90
88
  classNames: "picklist-item"
91
- }, rest, type === "add" ? {
89
+ }, transitionGroupProps, type === "add" ? {
92
90
  enter: false
93
91
  } : {}, {
94
92
  nodeRef: picklistItemNodeRef
@@ -102,7 +100,6 @@ const PicklistItem = /*#__PURE__*/_react.default.forwardRef(({
102
100
  destructive: type === "remove",
103
101
  iconType: type,
104
102
  onClick: handleClick,
105
- highlighted: highlighted,
106
103
  ref: ref
107
104
  }), locked && /*#__PURE__*/_react.default.createElement(_picklistItem.StyledLockIcon, {
108
105
  type: "locked",
@@ -110,45 +107,20 @@ const PicklistItem = /*#__PURE__*/_react.default.forwardRef(({
110
107
  })));
111
108
  });
112
109
 
110
+ exports.PicklistItem = PicklistItem;
113
111
  PicklistItem.propTypes = {
114
- /** Item content */
115
- children: _propTypes.default.node.isRequired,
116
-
117
- /** Define if item is of type add or remove */
118
- type: _propTypes.default.oneOf(["add", "remove"]).isRequired,
119
-
120
- /** Indicate if component is disabled */
121
- disabled: _propTypes.default.bool,
122
-
123
- /** Handler invoked when add/remove button is clicked or when space/enter is pressed on the whole item */
124
- onChange: _propTypes.default.func.isRequired,
125
-
126
- /** Value passed to the onChange handler */
127
- item: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string, _propTypes.default.number]).isRequired,
128
-
129
- /** Disable the item */
130
- locked: _propTypes.default.bool,
131
-
132
- /** Tooltip message for the locked icon (only present when locked prop is true) */
133
- tooltipMessage: _propTypes.default.string,
134
-
135
- /** @private @ignore */
136
- highlighted: _propTypes.default.bool,
137
-
138
- /** @private @ignore */
139
- index: _propTypes.default.number,
140
-
141
- /** @private @ignore */
142
- groupIndex: _propTypes.default.number,
143
-
144
- /** @private @ignore */
145
- listIndex: _propTypes.default.number,
146
-
147
- /** @private @ignore */
148
- isLastItem: _propTypes.default.bool,
149
-
150
- /** @private @ignore */
151
- isLastGroup: _propTypes.default.bool
112
+ "children": _propTypes.default.node,
113
+ "groupIndex": _propTypes.default.number,
114
+ "index": _propTypes.default.number,
115
+ "isLastGroup": _propTypes.default.bool,
116
+ "isLastItem": _propTypes.default.bool,
117
+ "item": _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.object, _propTypes.default.string]).isRequired,
118
+ "listIndex": _propTypes.default.number,
119
+ "locked": _propTypes.default.bool,
120
+ "onChange": _propTypes.default.func.isRequired,
121
+ "tooltipMessage": _propTypes.default.string,
122
+ "type": _propTypes.default.oneOf(["add", "remove"]).isRequired
152
123
  };
124
+ PicklistItem.displayName = "PicklistItem";
153
125
  var _default = PicklistItem;
154
126
  exports.default = _default;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ declare const StyledPicklistItem: import("styled-components").StyledComponent<"li", any, {
3
+ locked?: boolean | undefined;
4
+ }, never>;
5
+ declare const StyledButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>, any, {}, never>;
6
+ declare const StyledLockIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
7
+ export { StyledPicklistItem, StyledButton, StyledLockIcon };
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export interface PicklistPlaceholderProps {
3
+ /** Text to be displayed when list is empty */
4
+ text: string;
5
+ }
6
+ export declare const PicklistPlaceholder: ({ text }: PicklistPlaceholderProps) => JSX.Element;
7
+ export default PicklistPlaceholder;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = exports.PicklistPlaceholder = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -19,9 +19,9 @@ const PicklistPlaceholder = ({
19
19
  "data-element": "picklist-placeholder"
20
20
  }, text);
21
21
 
22
+ exports.PicklistPlaceholder = PicklistPlaceholder;
22
23
  PicklistPlaceholder.propTypes = {
23
- /** Text to be displayed when list is empty */
24
- text: _propTypes.default.string.isRequired
24
+ "text": _propTypes.default.string.isRequired
25
25
  };
26
26
  var _default = PicklistPlaceholder;
27
27
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "114.9.0",
3
+ "version": "114.10.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",
@@ -1,24 +0,0 @@
1
- import * as React from "react";
2
- import { MarginProps } from "styled-system";
3
-
4
- export interface DuellingPicklistProps extends MarginProps {
5
- /**
6
- * Content of the component, should contain two Picklist children
7
- * and a PicklistDivider
8
- */
9
- children?: React.ReactNode;
10
- /** Indicate if component is disabled */
11
- disabled?: boolean;
12
- /** Place for components like Search or Filter placed above the left list */
13
- leftControls?: React.ReactNode;
14
- /** Left list label */
15
- leftLabel?: string;
16
- /** Place for components like Search or Filter placed above the right list */
17
- rightControls?: React.ReactNode;
18
- /** Right list label */
19
- rightLabel?: string;
20
- }
21
-
22
- declare function DuellingPicklist(props: DuellingPicklistProps): JSX.Element;
23
-
24
- export default DuellingPicklist;
@@ -1,19 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface PicklistProps {
4
- /** List of PicklistItem elements */
5
- children?: React.ReactNode;
6
- /** Placeholder to be rendered when list is empty */
7
- placeholder?: React.ReactNode;
8
- /** Indicate if component is disabled */
9
- disabled?: boolean;
10
- }
11
-
12
- declare function areEqual(
13
- prevProps: PicklistProps,
14
- nextProps: PicklistProps
15
- ): boolean;
16
- declare function Picklist(props: PicklistProps): JSX.Element;
17
-
18
- export { areEqual, Picklist };
19
- export default Picklist;
@@ -1,12 +0,0 @@
1
- import { StyledComponentProps } from "styled-components";
2
-
3
- declare function PicklistDivider(
4
- attrs: StyledComponentProps<
5
- "div",
6
- Record<string, unknown>,
7
- Record<string, unknown>,
8
- ""
9
- >
10
- ): JSX.Element;
11
-
12
- export default PicklistDivider;
@@ -1,18 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface PicklistGroupProps {
4
- /** Group title */
5
- title: React.ReactNode;
6
- /** Item content */
7
- children: React.ReactNode;
8
- /** Define if item is of type add or remove */
9
- type: "add" | "remove";
10
- /** Handler invoked when add/remove button is clicked or when space/enter is pressed on the whole item */
11
- onChange: () => void;
12
- }
13
-
14
- declare function PicklistGroup(
15
- props: PicklistGroupProps & React.RefAttributes<HTMLInputElement>
16
- ): JSX.Element;
17
-
18
- export default PicklistGroup;
@@ -1,24 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface PicklistItemProps {
4
- /** Item content */
5
- children: React.ReactNode;
6
- /** Define if item is of type add or remove */
7
- type: "add" | "remove";
8
- /** Indicate if component is disabled */
9
- disabled?: boolean;
10
- /** Handler invoked when add/remove button is clicked or when space/enter is pressed on the whole item */
11
- onChange: () => void;
12
- /** Value passed to the onChange handler */
13
- item: Record<string, unknown> | string | number;
14
- /** Disable the item */
15
- locked?: boolean;
16
- /** Tooltip message for the locked icon (only present when locked prop is true) */
17
- tooltipMessage?: string;
18
- }
19
-
20
- declare function PicklistItem(
21
- props: PicklistItemProps & React.RefAttributes<HTMLInputElement>
22
- ): JSX.Element;
23
-
24
- export default PicklistItem;
@@ -1,10 +0,0 @@
1
- export interface PicklistPlaceholderProps {
2
- /** Text to be displayed when list is empty */
3
- text: string;
4
- }
5
-
6
- declare function PicklistPlaceholder(
7
- props: PicklistPlaceholderProps
8
- ): JSX.Element;
9
-
10
- export default PicklistPlaceholder;
@@ -1,24 +0,0 @@
1
- import * as React from "react";
2
- import { MarginProps } from "styled-system";
3
-
4
- export interface DuellingPicklistProps extends MarginProps {
5
- /**
6
- * Content of the component, should contain two Picklist children
7
- * and a PicklistDivider
8
- */
9
- children?: React.ReactNode;
10
- /** Indicate if component is disabled */
11
- disabled?: boolean;
12
- /** Place for components like Search or Filter placed above the left list */
13
- leftControls?: React.ReactNode;
14
- /** Left list label */
15
- leftLabel?: string;
16
- /** Place for components like Search or Filter placed above the right list */
17
- rightControls?: React.ReactNode;
18
- /** Right list label */
19
- rightLabel?: string;
20
- }
21
-
22
- declare function DuellingPicklist(props: DuellingPicklistProps): JSX.Element;
23
-
24
- export default DuellingPicklist;
@@ -1,19 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface PicklistProps {
4
- /** List of PicklistItem elements */
5
- children?: React.ReactNode;
6
- /** Placeholder to be rendered when list is empty */
7
- placeholder?: React.ReactNode;
8
- /** Indicate if component is disabled */
9
- disabled?: boolean;
10
- }
11
-
12
- declare function areEqual(
13
- prevProps: PicklistProps,
14
- nextProps: PicklistProps
15
- ): boolean;
16
- declare function Picklist(props: PicklistProps): JSX.Element;
17
-
18
- export { areEqual, Picklist };
19
- export default Picklist;
@@ -1,12 +0,0 @@
1
- import { StyledComponentProps } from "styled-components";
2
-
3
- declare function PicklistDivider(
4
- attrs: StyledComponentProps<
5
- "div",
6
- Record<string, unknown>,
7
- Record<string, unknown>,
8
- ""
9
- >
10
- ): JSX.Element;
11
-
12
- export default PicklistDivider;