carbon-react 93.0.4 → 94.0.3

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 (81) hide show
  1. package/lib/__internal__/checkable-input/checkable-input.component.js +7 -1
  2. package/lib/__internal__/checkable-input/hidden-checkable-input.component.js +11 -1
  3. package/lib/__internal__/checkable-input/hidden-checkable-input.d.ts +5 -1
  4. package/lib/__internal__/form-field/form-field.component.js +9 -8
  5. package/lib/__internal__/form-field/form-field.d.ts +2 -0
  6. package/lib/components/action-popover/action-popover.component.js +28 -20
  7. package/lib/components/action-popover/action-popover.style.js +22 -12
  8. package/lib/components/i18n-provider/i18n-provider.component.js +0 -3
  9. package/lib/locales/en-gb.js +1 -8
  10. package/lib/locales/locale.d.ts +0 -7
  11. package/lib/locales/pl-pl.js +1 -8
  12. package/package.json +1 -6
  13. package/lib/components/action-toolbar/action-toolbar.component.js +0 -213
  14. package/lib/components/action-toolbar/action-toolbar.d.ts +0 -20
  15. package/lib/components/action-toolbar/action-toolbar.style.js +0 -40
  16. package/lib/components/action-toolbar/index.d.ts +0 -1
  17. package/lib/components/action-toolbar/index.js +0 -15
  18. package/lib/components/configurable-items/configurable-item-row/configurable-item-row.component.js +0 -174
  19. package/lib/components/configurable-items/configurable-item-row/configurable-item-row.d.ts +0 -25
  20. package/lib/components/configurable-items/configurable-item-row/configurable-item-row.style.js +0 -73
  21. package/lib/components/configurable-items/configurable-item-row/index.d.ts +0 -1
  22. package/lib/components/configurable-items/configurable-item-row/index.js +0 -15
  23. package/lib/components/configurable-items/configurable-items.component.js +0 -155
  24. package/lib/components/configurable-items/configurable-items.d.ts +0 -20
  25. package/lib/components/configurable-items/configurable-items.style.js +0 -70
  26. package/lib/components/configurable-items/index.d.ts +0 -2
  27. package/lib/components/configurable-items/index.js +0 -23
  28. package/lib/components/drag-and-drop/__internal__/item-target/index.js +0 -15
  29. package/lib/components/drag-and-drop/__internal__/item-target/item-target.js +0 -44
  30. package/lib/components/drag-and-drop/__internal__/item-types/index.js +0 -15
  31. package/lib/components/drag-and-drop/__internal__/item-types/item-types.js +0 -20
  32. package/lib/components/drag-and-drop/custom-drag-layer/custom-drag-layer.js +0 -171
  33. package/lib/components/drag-and-drop/custom-drag-layer/custom-drag-layer.style.js +0 -28
  34. package/lib/components/drag-and-drop/custom-drag-layer/index.js +0 -15
  35. package/lib/components/drag-and-drop/drag-and-drop-test.stories.js +0 -95
  36. package/lib/components/drag-and-drop/draggable-context/__internal__/scrollable-parent/index.js +0 -15
  37. package/lib/components/drag-and-drop/draggable-context/__internal__/scrollable-parent/scrollable-parent.js +0 -36
  38. package/lib/components/drag-and-drop/draggable-context/draggable-context.js +0 -264
  39. package/lib/components/drag-and-drop/draggable-context/index.js +0 -15
  40. package/lib/components/drag-and-drop/index.js +0 -39
  41. package/lib/components/drag-and-drop/with-drag/index.js +0 -15
  42. package/lib/components/drag-and-drop/with-drag/with-drag.js +0 -176
  43. package/lib/components/drag-and-drop/with-drop/index.js +0 -15
  44. package/lib/components/drag-and-drop/with-drop/with-drop.js +0 -201
  45. package/lib/components/table/draggable-table-cell/draggable-table-cell.component.js +0 -59
  46. package/lib/components/table/draggable-table-cell/draggable-table-cell.style.js +0 -36
  47. package/lib/components/table/draggable-table-cell/index.js +0 -15
  48. package/lib/components/table/index.js +0 -43
  49. package/lib/components/table/table-cell/index.js +0 -15
  50. package/lib/components/table/table-cell/table-cell.component.js +0 -164
  51. package/lib/components/table/table-cell/table-cell.style.js +0 -164
  52. package/lib/components/table/table-header/index.js +0 -15
  53. package/lib/components/table/table-header/table-header.component.js +0 -282
  54. package/lib/components/table/table-header/table-header.style.js +0 -116
  55. package/lib/components/table/table-modern.style.js +0 -110
  56. package/lib/components/table/table-row/index.js +0 -15
  57. package/lib/components/table/table-row/table-row-modern.style.js +0 -70
  58. package/lib/components/table/table-row/table-row.component.js +0 -486
  59. package/lib/components/table/table-row/table-row.style.js +0 -165
  60. package/lib/components/table/table-sizes.style.js +0 -33
  61. package/lib/components/table/table-story-helpers/table-story-wrapper.component.js +0 -189
  62. package/lib/components/table/table-subheader/index.js +0 -15
  63. package/lib/components/table/table-subheader/table-subheader.component.js +0 -35
  64. package/lib/components/table/table-subheader/table-subheader.style.js +0 -33
  65. package/lib/components/table/table.component.js +0 -792
  66. package/lib/components/table/table.config.js +0 -14
  67. package/lib/components/table/table.style.js +0 -139
  68. package/lib/components/table-ajax/__internal__/serialize/package.json +0 -3
  69. package/lib/components/table-ajax/__internal__/serialize/serialize.js +0 -26
  70. package/lib/components/table-ajax/index.js +0 -37
  71. package/lib/components/table-ajax/table-ajax.component.js +0 -602
  72. package/lib/patterns/configurable-items/actions/actions.js +0 -41
  73. package/lib/patterns/configurable-items/actions/package.json +0 -3
  74. package/lib/patterns/configurable-items/configurable-items-content/configurable-items-content.js +0 -140
  75. package/lib/patterns/configurable-items/configurable-items-content/package.json +0 -3
  76. package/lib/patterns/configurable-items/configurable-items.js +0 -216
  77. package/lib/patterns/configurable-items/constants/constants.js +0 -13
  78. package/lib/patterns/configurable-items/constants/package.json +0 -3
  79. package/lib/patterns/configurable-items/package.json +0 -3
  80. package/lib/patterns/configurable-items/store/package.json +0 -3
  81. package/lib/patterns/configurable-items/store/store.js +0 -92
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- const ItemTargetHelper = {
8
- /**
9
- * Helper method for when drag and drop is enabled for
10
- * items grouped together vertically e.g. a list, or
11
- * a table.
12
- */
13
- onHoverUpDown(props, monitor, component) {
14
- const item = monitor.getItem();
15
- const dragIndex = item.index;
16
- const hoverIndex = props.index; // Don't replace items with themselves
17
-
18
- if (dragIndex === hoverIndex) {
19
- return;
20
- }
21
-
22
- const newOffsetDiff = monitor.getDifferenceFromInitialOffset(); // prevents flickering
23
-
24
- if (item.offsetDiffY && Math.abs(item.offsetDiffY - newOffsetDiff.y) <= 1) {
25
- component.setState({
26
- inDeadZone: true
27
- });
28
- return;
29
- } // Time to actually perform the action
30
-
31
-
32
- const onDrag = props.onDrag || component.context.dragAndDropOnDrag;
33
- onDrag(dragIndex, hoverIndex); // Note: we're mutating the monitor item here!
34
- // Generally it's better to avoid mutations,
35
- // but it's good here for the sake of performance
36
- // to avoid expensive index searches.
37
-
38
- item.index = hoverIndex;
39
- item.offsetDiffY = newOffsetDiff.y;
40
- }
41
-
42
- };
43
- var _default = ItemTargetHelper;
44
- exports.default = _default;
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "default", {
7
- enumerable: true,
8
- get: function () {
9
- return _itemTypes.default;
10
- }
11
- });
12
-
13
- var _itemTypes = _interopRequireDefault(require("./item-types"));
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- /**
9
- * Defines the string types of items that can be dragged and dropped.
10
- *
11
- * NB drag sources and drop targets only interact if they have the
12
- * same string type.
13
- */
14
- const ItemTypes = {
15
- getItemType: props => {
16
- return props.identifier || "defaultDragAndDropIdentifier";
17
- }
18
- };
19
- var _default = ItemTypes;
20
- exports.default = _default;
@@ -1,171 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.collect = exports.UndecoratedCustomDragLayer = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
- var _reactDndLegacy = require("react-dnd-legacy");
15
-
16
- var _customDragLayer = _interopRequireDefault(require("./custom-drag-layer.style"));
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
-
22
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23
-
24
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
25
-
26
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
27
-
28
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
29
-
30
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
31
-
32
- function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
33
-
34
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
35
-
36
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
37
-
38
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
39
-
40
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
41
-
42
- const collect = monitor => {
43
- const item = monitor.getItem();
44
- return {
45
- currentOffset: monitor.getSourceClientOffset(),
46
- item,
47
- draggableNode: item && item.draggableNode ? item.draggableNode() : null,
48
- isDragging: monitor.isDragging()
49
- };
50
- };
51
-
52
- exports.collect = collect;
53
-
54
- let CustomDragLayer = /*#__PURE__*/function (_React$Component) {
55
- _inherits(CustomDragLayer, _React$Component);
56
-
57
- var _super = _createSuper(CustomDragLayer);
58
-
59
- function CustomDragLayer(...args) {
60
- var _this;
61
-
62
- _classCallCheck(this, CustomDragLayer);
63
-
64
- _this = _super.call(this, ...args);
65
-
66
- _defineProperty(_assertThisInitialized(_this), "getClassName", props => {
67
- return (0, _classnames.default)("custom-drag-layer", props.className);
68
- });
69
-
70
- _defineProperty(_assertThisInitialized(_this), "createClonedChild", props => {
71
- if (_this._container) {
72
- _this.width = props.draggableNode.getBoundingClientRect().width;
73
- _this.clonedChild = props.draggableNode.cloneNode(true);
74
- _this.clonedChild.style.pointerEvents = "auto"; // allow the css to define the pointer style
75
-
76
- _this._container.appendChild(_this.clonedChild);
77
- }
78
- });
79
-
80
- return _this;
81
- }
82
-
83
- _createClass(CustomDragLayer, [{
84
- key: "UNSAFE_componentWillUpdate",
85
- value: function UNSAFE_componentWillUpdate(nextProps) {
86
- if (nextProps.isDragging && nextProps.draggableNode && nextProps.draggableNode !== this.props.draggableNode) {
87
- this.setClonedChildWidth(nextProps);
88
- }
89
-
90
- if (nextProps.draggableNode && nextProps.isDragging && !this.clonedChild) {
91
- this.createClonedChild(nextProps);
92
- } else if (!nextProps.draggableNode && this.clonedChild) {
93
- this.removeClonedChild();
94
- }
95
- }
96
- }, {
97
- key: "getItemStyles",
98
- value: function getItemStyles(props) {
99
- const {
100
- currentOffset
101
- } = props;
102
-
103
- if (!currentOffset) {
104
- return {
105
- display: "none"
106
- };
107
- }
108
-
109
- const {
110
- x,
111
- y
112
- } = currentOffset;
113
- const transform = `translate(${x}px, ${y}px)`;
114
- return {
115
- transform,
116
- WebkitTransform: transform,
117
- width: this.width
118
- };
119
- }
120
- }, {
121
- key: "setClonedChildWidth",
122
- value: function setClonedChildWidth(props) {
123
- this.width = props.draggableNode.getBoundingClientRect().width;
124
- }
125
- }, {
126
- key: "removeClonedChild",
127
- value: function removeClonedChild() {
128
- this._container.removeChild(this.clonedChild);
129
-
130
- this.clonedChild = null;
131
- }
132
- }, {
133
- key: "render",
134
- value: function render() {
135
- return /*#__PURE__*/_react.default.createElement("div", {
136
- className: this.getClassName(this.props)
137
- }, /*#__PURE__*/_react.default.createElement(_customDragLayer.default, {
138
- ref: node => {
139
- this._container = node;
140
- },
141
- style: this.getItemStyles(this.props)
142
- }));
143
- }
144
- }]);
145
-
146
- return CustomDragLayer;
147
- }(_react.default.Component);
148
-
149
- CustomDragLayer.propTypes = {
150
- /**
151
- * The dom node being dragged.
152
- */
153
- draggableNode: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.node]),
154
-
155
- /**
156
- * Determine if the component is being dragged or not.
157
- */
158
-
159
- /* ESLint is not detecting that the prop is called via nextProps */
160
-
161
- /* eslint-disable react/no-unused-prop-types */
162
- isDragging: _propTypes.default.bool.isRequired
163
- /* eslint-enable react/no-unused-prop-types */
164
-
165
- };
166
- const UndecoratedCustomDragLayer = CustomDragLayer;
167
- exports.UndecoratedCustomDragLayer = UndecoratedCustomDragLayer;
168
-
169
- var _default = (0, _reactDndLegacy.DragLayer)(collect)(CustomDragLayer);
170
-
171
- exports.default = _default;
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _styledComponents = _interopRequireDefault(require("styled-components"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- const StyledDragContainer = _styledComponents.default.div`
13
- left: 0;
14
- list-style: none;
15
- margin: 0;
16
- padding: 0;
17
- pointer-events: none;
18
- position: fixed;
19
- top: 0;
20
- width: 100%;
21
- z-index: 100;
22
- box-shadow: 0 10px 20px 0 rgba(0, 20, 29, 0.2),
23
- 0 20px 40px 0 rgba(0, 20, 29, 0.1);
24
- cursor: move;
25
- cursor: grabbing;
26
- `;
27
- var _default = StyledDragContainer;
28
- exports.default = _default;
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "default", {
7
- enumerable: true,
8
- get: function () {
9
- return _customDragLayer.default;
10
- }
11
- });
12
-
13
- var _customDragLayer = _interopRequireDefault(require("./custom-drag-layer"));
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,95 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Custom = exports.default = void 0;
7
-
8
- var _react = _interopRequireWildcard(require("react"));
9
-
10
- var _addonActions = require("@storybook/addon-actions");
11
-
12
- var _ = require(".");
13
-
14
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
15
-
16
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
-
18
- // it's not mdx file because of https://github.com/storybookjs/storybook/issues/11542
19
- var _default = {
20
- component: _.DraggableContext,
21
- title: "DraggableContext/Test"
22
- };
23
- exports.default = _default;
24
-
25
- const Custom = () => {
26
- const [state, setState] = (0, _react.useState)([{
27
- id: "0",
28
- name: "UK"
29
- }, {
30
- id: "1",
31
- name: "Germany"
32
- }, {
33
- id: "2",
34
- name: "China"
35
- }, {
36
- id: "3",
37
- name: "US"
38
- }]);
39
-
40
- const handleDrag = (originalIndex, newIndex) => {
41
- const sortedItem = state[originalIndex];
42
- const newArr = [...state];
43
- newArr.splice(originalIndex, 1);
44
- newArr.splice(newIndex, 0, sortedItem);
45
- setState(newArr);
46
- (0, _addonActions.action)("drag")();
47
- };
48
-
49
- return /*#__PURE__*/_react.default.createElement(_.DraggableContext, {
50
- onDrag: handleDrag
51
- }, /*#__PURE__*/_react.default.createElement("ol", null, state.map((item, index) => {
52
- return /*#__PURE__*/_react.default.createElement(_.WithDrop, {
53
- key: item.id,
54
- index: index
55
- }, /*#__PURE__*/_react.default.createElement("li", {
56
- style: {
57
- listStyle: "none"
58
- }
59
- }, /*#__PURE__*/_react.default.createElement(_.WithDrag, null, /*#__PURE__*/_react.default.createElement("div", {
60
- style: {
61
- userSelect: "none",
62
- padding: 4
63
- }
64
- }, item.name))));
65
- })));
66
- };
67
-
68
- exports.Custom = Custom;
69
- Custom.storyName = "custom";
70
- Custom.argTypes = {
71
- customDragLayer: {
72
- table: {
73
- disable: true
74
- },
75
- control: false
76
- },
77
- onDrag: {
78
- table: {
79
- disable: true
80
- },
81
- control: false
82
- },
83
- children: {
84
- table: {
85
- disable: true
86
- },
87
- control: false
88
- },
89
- autoScroll: {
90
- table: {
91
- disable: true
92
- },
93
- control: false
94
- }
95
- };
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "default", {
7
- enumerable: true,
8
- get: function () {
9
- return _scrollableParent.default;
10
- }
11
- });
12
-
13
- var _scrollableParent = _interopRequireDefault(require("./scrollable-parent"));
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _browser = _interopRequireDefault(require("../../../../../__internal__/utils/helpers/browser"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- /**
13
- * @method
14
- * @param {Object} element
15
- * @return {Object}
16
- */
17
- const ScrollablePartent = {
18
- searchForScrollableParent(element) {
19
- if (!element) {
20
- return null;
21
- }
22
-
23
- const style = _browser.default.getWindow().getComputedStyle(element);
24
-
25
- const isElementScrollable = style && style.position !== "absolute" && /(auto|scroll)/.test(style.overflow + style.overflowY + style.overflowX);
26
-
27
- if (isElementScrollable) {
28
- return element;
29
- }
30
-
31
- return this.searchForScrollableParent(element.parentElement);
32
- }
33
-
34
- };
35
- var _default = ScrollablePartent;
36
- exports.default = _default;